Skip to content

Commit b818039

Browse files
Tariq ToukanSaeed Mahameed
authored andcommitted
net/mlx5e: XDP, Replace boolean doorbell indication with segment pointer
Instead of calculating the control segment to be used upon an XDP xmit doorbell, save it in SQ structure. Nullify when no pending doorbell. Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent db02a30 commit b818039

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ struct mlx5e_xdpsq {
413413

414414
/* dirtied @xmit */
415415
u16 pc ____cacheline_aligned_in_smp;
416-
bool doorbell;
416+
struct mlx5_wqe_ctrl_seg *doorbell_cseg;
417417

418418
struct mlx5e_cq cq;
419419

drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,8 @@ bool mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xdp_info *xdpi)
126126
}
127127

128128
if (unlikely(!mlx5e_wqc_has_room_for(wq, sq->cc, sq->pc, 1))) {
129-
if (sq->doorbell) {
130-
/* SQ is full, ring doorbell */
131-
mlx5e_xmit_xdp_doorbell(sq);
132-
sq->doorbell = false;
133-
}
129+
/* SQ is full, ring doorbell */
130+
mlx5e_xmit_xdp_doorbell(sq);
134131
stats->full++;
135132
return false;
136133
}
@@ -158,7 +155,7 @@ bool mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xdp_info *xdpi)
158155
sq->db.xdpi[pi] = *xdpi;
159156
sq->pc++;
160157

161-
sq->doorbell = true;
158+
sq->doorbell_cseg = cseg;
162159

163160
stats->xmit++;
164161
return true;
@@ -309,10 +306,7 @@ void mlx5e_xdp_rx_poll_complete(struct mlx5e_rq *rq)
309306
{
310307
struct mlx5e_xdpsq *xdpsq = &rq->xdpsq;
311308

312-
if (xdpsq->doorbell) {
313-
mlx5e_xmit_xdp_doorbell(xdpsq);
314-
xdpsq->doorbell = false;
315-
}
309+
mlx5e_xmit_xdp_doorbell(xdpsq);
316310

317311
if (xdpsq->redirect_flush) {
318312
xdp_do_flush_map();

drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,10 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
5151

5252
static inline void mlx5e_xmit_xdp_doorbell(struct mlx5e_xdpsq *sq)
5353
{
54-
struct mlx5_wq_cyc *wq = &sq->wq;
55-
struct mlx5e_tx_wqe *wqe;
56-
u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc - 1); /* last pi */
57-
58-
wqe = mlx5_wq_cyc_get_wqe(wq, pi);
59-
60-
mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &wqe->ctrl);
54+
if (sq->doorbell_cseg) {
55+
mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, sq->doorbell_cseg);
56+
sq->doorbell_cseg = NULL;
57+
}
6158
}
6259

6360
#endif

0 commit comments

Comments
 (0)