Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net/mlx5e: Fix the missing WQE count of large striding RQs
@ 2026-12-02 12:14 Tariq Toukan
  2026-12-02 12:18 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Tariq Toukan @ 2026-12-02 12:14 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Willem de Bruijn
  Cc: Dragos Tatulea, Gal Pressman, Leon Romanovsky, linux-rdma,
	Mark Bloch, Saeed Mahameed, Saeed Mahameed, Tariq Toukan,
	Tariq Toukan

mlx5e_post_rx_mpwqes() counts the WQEs to post in a u8, and the RQ
keeps its in-flight UMR counters in u8 fields:

	missing = mlx5_wq_ll_missing(wq) - rq->mpwqe.umr_in_progress;

A striding RQ can have more than 256 WQEs. Its size is set in packets
of up to the MTU, up to 8K of them, and a WQE holds fewer such packets
as the MTU grows: with 4K pages and an MTU of 9000, a WQE holds 16 of
them, so a ring of 8K packets takes 512 WQEs. An XSK RQ can exceed 256
WQEs at any MTU: a WQE holds only 8 or 16 frames of an unaligned UMEM
whose frame size is not a power of two, so a ring of 8K frames takes
up to 1024 WQEs.

The first refill of such an RQ computes 511 missing WQEs, truncates
that to 255 and posts them. From then on, the missing count is 256
plus the WQEs consumed since, which truncates to only the consumed
ones, so each refill tops the RQ up to 255 WQEs again and never above.
The RQ uses at most half of the ring that was configured, and drops
bursts that the full ring would absorb.

Widen the missing count, the loop counter and the UMR counters to u16,
which fits any RQ size. The counters take part of an existing hole, so
struct mlx5e_rq keeps its size. The ICOSQ is already sized for the UMR
WQEs of the whole RQ, so posting them in one refill fits.

Results on ConnectX-7 with an RX ring of 8K packets, at MTU 9000 for
the regular RQ. Before this patch that ring behaves as one of 4K
packets, and the XSK one as one of 2K frames.

                                          Before      After
  Posted WQEs per RQ                         255        511
  Largest UDP burst with no drops
    9000-byte packets                      9,000     19,000
    1500-byte packets                     50,000    100,000
  Longest NAPI period with no drops        20 ms      45 ms
  TCP incast, 200 rounds
    Dropped packets                       22,313          0
    Retransmitted segments                20,515        435
    Rounds over 200 ms                        42          0
    Longest round                         284 ms      53 ms
  XSK RQ, MTU 1500, 3072-byte frames
    Posted WQEs                              255       1023
    Largest UDP burst with no drops        2,000      8,000

The UDP bursts are of a single flow, and the drops are counted by
rx_out_of_buffer. The NAPI period is gro_flush_timeout, with
napi_defer_hard_irqs set, under a 21.7 Gb/s stream of 9000-byte
packets. In the TCP test, 192 connections on one RX queue send 1MB
each at the same time. The XSK frames are of an unaligned UMEM.

Fixes: fd9b4be8002c ("net/mlx5e: RX, Support multiple outstanding UMR posts")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h    | 6 +++---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index a3945195f454..a794c178a571 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -687,9 +687,9 @@ struct mlx5e_rq {
 			u16                    num_strides;
 			u16                    actual_wq_head;
 			u8                     log_stride_sz;
-			u8                     umr_in_progress;
-			u8                     umr_last_bulk;
-			u8                     umr_completed;
+			u16                    umr_in_progress;
+			u16                    umr_last_bulk;
+			u16                    umr_completed;
 			u8                     min_wqe_bulk;
 			u8                     page_shift;
 			u8                     pages_per_wqe;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 1586cb2404c0..63ac293bfceb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -626,7 +626,7 @@ mlx5e_free_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi)
 	}
 }
 
-static void mlx5e_post_rx_mpwqe(struct mlx5e_rq *rq, u8 n)
+static void mlx5e_post_rx_mpwqe(struct mlx5e_rq *rq, u16 n)
 {
 	struct mlx5_wq_ll *wq = &rq->mpwqe.wq;
 
@@ -933,11 +933,11 @@ static void mlx5e_reclaim_mpwqe_pages(struct mlx5e_rq *rq, int head,
 INDIRECT_CALLABLE_SCOPE bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq)
 {
 	struct mlx5_wq_ll *wq = &rq->mpwqe.wq;
-	u8  umr_completed = rq->mpwqe.umr_completed;
+	u16 umr_completed = rq->mpwqe.umr_completed;
 	struct mlx5e_icosq *sq = rq->icosq;
 	bool reclaimed = false;
 	int alloc_err = 0;
-	u8  missing, i;
+	u16 missing, i;
 	u16 head;
 
 	if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))

base-commit: b6c8f45ed340f00bf2004d407cf7316fe3e24c48
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-02 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 12:14 [PATCH net] net/mlx5e: Fix the missing WQE count of large striding RQs Tariq Toukan
2026-12-02 12:18 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox