Skip to content

Commit 67044a8

Browse files
Maxim MikityanskiySaeed Mahameed
authored andcommitted
net/mlx5e: Move TX code into functions to be used by MPWQE
mlx5e_txwqe_complete performs some actions that can be taken to separate functions: 1. Update the flags needed for hardware timestamping. 2. Stop the TX queue if it's full. Take these actions into separate functions to be reused by the MPWQE code in the following commit and to maintain clear responsibilities of functions. Signed-off-by: Maxim Mikityanskiy <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent b39fe61 commit 67044a8

File tree

1 file changed

+17
-6
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+17
-6
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,20 @@ static void mlx5e_sq_calc_wqe_attr(struct sk_buff *skb, const struct mlx5e_tx_at
327327
};
328328
}
329329

330+
static void mlx5e_tx_skb_update_hwts_flags(struct sk_buff *skb)
331+
{
332+
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
333+
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
334+
}
335+
336+
static void mlx5e_tx_check_stop(struct mlx5e_txqsq *sq)
337+
{
338+
if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, sq->stop_room))) {
339+
netif_tx_stop_queue(sq->txq);
340+
sq->stats->stopped++;
341+
}
342+
}
343+
330344
static inline void
331345
mlx5e_txwqe_complete(struct mlx5e_txqsq *sq, struct sk_buff *skb,
332346
const struct mlx5e_tx_attr *attr,
@@ -348,14 +362,11 @@ mlx5e_txwqe_complete(struct mlx5e_txqsq *sq, struct sk_buff *skb,
348362
cseg->opmod_idx_opcode = cpu_to_be32((sq->pc << 8) | attr->opcode);
349363
cseg->qpn_ds = cpu_to_be32((sq->sqn << 8) | wqe_attr->ds_cnt);
350364

351-
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
352-
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
365+
mlx5e_tx_skb_update_hwts_flags(skb);
353366

354367
sq->pc += wi->num_wqebbs;
355-
if (unlikely(!mlx5e_wqc_has_room_for(wq, sq->cc, sq->pc, sq->stop_room))) {
356-
netif_tx_stop_queue(sq->txq);
357-
sq->stats->stopped++;
358-
}
368+
369+
mlx5e_tx_check_stop(sq);
359370

360371
send_doorbell = __netdev_tx_sent_queue(sq->txq, attr->num_bytes, xmit_more);
361372
if (send_doorbell)

0 commit comments

Comments
 (0)