Skip to contentSkip to conversation

net/mlx5e: XDP, Add support for multi-packet per page

PATCH Applied Tariq Toukan 6 participants 16 messages Apr 3 – Apr 7

Subsystems (7)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

v2 cover net/mlx5e: XDP, Add support for multi-packet per page

Hi,

This series removes the limitation of having one packet per page in XDP mode. This has the following implications:

- XDP in Striding RQ mode can now be used on 64K page systems.

- XDP in Legacy RQ mode was using a single packet per page which on 64K page systems is quite inefficient. The improvement can be observed with an XDP_DROP test when running in Legacy RQ mode on a ARM Neoverse-N1 system with a 64K page size:

  +-----------------------------------------------+
  | MTU  | baseline   | this change | improvement |
  |------+------------+-------------+-------------|
  | 1500 | 15.55 Mpps | 18.99 Mpps  | 22.0 %      |
  | 9000 | 15.53 Mpps | 18.24 Mpps  | 17.5 %      |
  +-----------------------------------------------+

After lifting this limitation, the series switches to using fragments for the side page in non-linear mode. This small improvement is at most visible for XDP_DROP tests with small 64B packets and a large enough MTU for Striding RQ to be in non-linear mode:

+----------------------------------------------------------------------+
| System               | MTU  | baseline   | this change | improvement |
|----------------------+------+------------+-------------+-------------|
| 4K page x86_64 [1]   | 9000 | 26.30 Mpps | 30.45 Mpps  | 15.80 %     |
| 64K page aarch64 [2] | 9000 | 15.27 Mpps | 20.10 Mpps  | 31.62 %     |
+----------------------------------------------------------------------+

This series does not cover the xsk (AF_XDP) paths for 64K page systems.

[1] https://lore.kernel.org/all/[email protected]/

V2:
- Link to V1:
https://lore.kernel.org/all/[email protected]/
- Fixed issue found by AI review [1].

Dragos Tatulea (5):
net/mlx5e: XSK, Increase size for chunk_size param net/mlx5e: XDP, Improve dma address calculation of linear part for
XDP_TX
net/mlx5e: XDP, Remove stride size limitation
net/mlx5e: XDP, Use a single linear page per rq net/mlx5e: XDP, Use page fragments for linear data in multibuf-mode

 drivers/net/ethernet/mellanox/mlx5/core/en.h  | 12 +++-
 .../ethernet/mellanox/mlx5/core/en/params.c   | 11 +---
 .../ethernet/mellanox/mlx5/core/en/params.h   |  2 +-
 .../net/ethernet/mellanox/mlx5/core/en/xdp.c  |  2 +-
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 50 ++++++++++++--
 .../net/ethernet/mellanox/mlx5/core/en_rx.c   | 65 +++++++++++++++----
 6 files changed, 113 insertions(+), 29 deletions(-)

base-commit: 8b0e64d6c9e7feec5ba5643b4fa8b7fd54464778

Signature · 1 line
2.44.0
author maintainer
#1 lore raw

PATCH v2 1/5 net/mlx5e: XSK, Increase size for chunk_size param

From: Dragos Tatulea <[email protected]>

When 64K pages are used, chunk_size can take the 64K value which doesn't fit in u16. This results in overflows that are detected in mlx5e_mpwrq_log_wqe_sz().

Increase the type to u32 to fix this.

---
 drivers/net/ethernet/mellanox/mlx5/core/en/params.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.h +1 -1
index 9b1a2aed17c3..275f9be53a34 100644
@@ -8,7 +8,7 @@
 
 struct mlx5e_xsk_param {
 	u16 headroom;
-	u16 chunk_size;
+	u32 chunk_size;
 	bool unaligned;
 };
 
Signature · 1 line
2.44.0
#2 lore raw

Re: [PATCH net-next V2 1/5] net/mlx5e: XSK, Increase size for chunk_size param

drivers/net/ethernet/mellanox/mlx5/core/en/params.h line 12

Quoted 10 lines · Tariq Toukan

[...]

drivers/net/ethernet/mellanox/mlx5/core/en/params.h +1 -1
@@ -8,7 +8,7 @@
 
 struct mlx5e_xsk_param {
 	u16 headroom;
-	u16 chunk_size;
+	u32 chunk_size;
 	bool unaligned;

Sashiko says [1]:
"""
Is it possible that users will still fail to create XSK pools with 64K chunk sizes because of an existing limit in mlx5e_xsk_is_pool_sane()? [...]
"""
Yes, it is possible. XSK is not yet supported fo 64K pages. This series adds 64K page support only for plain XDP.

[1] https://sashiko.dev/#/patchset/20260403090927.139042-1-tariqt%40nvidia.com?part=1

Thanks,
Dragos

author maintainer
#3 lore raw

PATCH v2 2/5 net/mlx5e: XDP, Improve dma address calculation of linear part for XDP_TX

In reply to Tariq Toukan

From: Dragos Tatulea <[email protected]>

When calculating the dma address of the linear part of an XDP frame, the formula assumes that there is a single XDP buffer per page. Extend the formula to allow multiple XDP buffers per page by calculating the data offset in the page.

This is a preparation for the upcoming removal of a single XDP buffer per page limitation when the formula will no longer be correct.

---
 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +1 -1
index 04e1b5fa4825..d3bab198c99c 100644
@@ -123,7 +123,7 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq,
 	 * mode.
 	 */
 
-	dma_addr = page_pool_get_dma_addr(page) + (xdpf->data - (void *)xdpf);
+	dma_addr = page_pool_get_dma_addr(page) + offset_in_page(xdpf->data);
 	dma_sync_single_for_device(sq->pdev, dma_addr, xdptxd->len, DMA_BIDIRECTIONAL);
 
 	if (xdptxd->has_frags) {
Signature · 1 line
2.44.0
author maintainer
#4 lore raw

PATCH v2 3/5 net/mlx5e: XDP, Remove stride size limitation

In reply to Tariq Toukan

From: Dragos Tatulea <[email protected]>

Currently XDP mode always uses PAGE_SIZE strides. This limitation existed because page fragment counting was not implemented when XDP was added. Furthermore, due to this limitation there were other issues as well on system with larger pages (e.g. 64K):

- XDP for Striding RQ was effectively disabled on such systems.

- Legacy RQ allows the configuration but uses a fixed scheme of one XDP buffer per page which is inefficient.

As fragment counting was added during the driver conversion to page_pool and the support for XDP multi-buffer, it is now possible to remove this stride size limitation. This patch does just that.

Now it is possible to use XDP on systems with higher page sizes (e.g. 64K):

- For Striding RQ, loading the program is no longer blocked. Although a 64K page can fit any packet, MTUs that result in stride > 8K will still make the RQ in non-linear mode. That's because the HW doesn't support a higher than 8K stride.

- For Legacy RQ, the stride size was PAGE_SIZE which was very inefficient. Now the stride size will be calculated relative to MTU. Legacy RQ will always be in linear mode for larger system pages.

This can be observed with an XDP_DROP test [1] when running in Legacy RQ mode on a ARM Neoverse-N1 system with a 64K page size:

  +-----------------------------------------------+
  | MTU  | baseline   | this change | improvement |
  |------+------------+-------------+-------------|
  | 1500 | 15.55 Mpps | 18.99 Mpps  | 22.0 %      |
  | 9000 | 15.53 Mpps | 18.24 Mpps  | 17.5 %      |
  +-----------------------------------------------+

There are performance benefits for Striding RQ mode as well:

- Striding RQ non-linear mode now uses 256B strides, just like non-XDP mode.

- Striding RQ linear mode can now fit a number of XDP buffers per page that is relative to the MTU size. That means that on 4K page systems and a small enough MTU, 2 XDP buffers can fit in one page.

The above benefits for Striding RQ can be observed with an XDP_DROP test [1] when running on a 4K page x86_64 system (Intel Xeon Platinum 8580):

  +-----------------------------------------------+
  | MTU  | baseline   | this change | improvement |
  |------+------------+-------------+-------------|
  | 1000 | 28.36 Mpps | 33.98 Mpps  | 19.82 %     |
  | 9000 | 20.76 Mpps | 26.30 Mpps  | 26.70 %     |
  +-----------------------------------------------+

[1] Test description:
- xdp-bench with XDP_DROP
- RX: single queue
- TX: sends 64B packets to saturate CPU on RX side

---
 drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +2 -9
index 26bb31c56e45..1f4a547917ba 100644
@@ -298,12 +298,9 @@ static u32 mlx5e_rx_get_linear_stride_sz(struct mlx5_core_dev *mdev,
 	 * no_head_tail_room should be set in the case of XDP with Striding RQ
 	 * when SKB is not linear. This is because another page is allocated for the linear part.
 	 */
-	sz = roundup_pow_of_two(mlx5e_rx_get_linear_sz_skb(params, no_head_tail_room));
+	sz = mlx5e_rx_get_linear_sz_skb(params, no_head_tail_room);
 
-	/* XDP in mlx5e doesn't support multiple packets per page.
-	 * Do not assume sz <= PAGE_SIZE if params->xdp_prog is set.
-	 */
-	return params->xdp_prog && sz < PAGE_SIZE ? PAGE_SIZE : sz;
+	return roundup_pow_of_two(sz);
 }
 
 static u8 mlx5e_mpwqe_log_pkts_per_wqe(struct mlx5_core_dev *mdev,
@@ -453,10 +450,6 @@ u8 mlx5e_mpwqe_get_log_stride_size(struct mlx5_core_dev *mdev,
 		return order_base_2(mlx5e_rx_get_linear_stride_sz(mdev, params,
 								  rqo, true));
 
-	/* XDP in mlx5e doesn't support multiple packets per page. */
-	if (params->xdp_prog)
-		return PAGE_SHIFT;
-
 	return MLX5_MPWRQ_DEF_LOG_STRIDE_SZ(mdev);
 }
 
Signature · 1 line
2.44.0
author maintainer
#5 lore raw

PATCH v2 4/5 net/mlx5e: XDP, Use a single linear page per rq

In reply to Tariq Toukan

From: Dragos Tatulea <[email protected]>

Currently in striding rq there is one mlx5e_frag_page member per WQE for the linear page. This linear page is used only in XDP multi-buffer mode. This is wasteful because only one linear page is needed per rq: the page gets refreshed on every packet, regardless of WQE. Furthermore, it is not needed in other modes (non-XDP, XDP single-buffer).

This change moves the linear page into its own structure (struct mlx5_mpw_linear_info) and allocates it only when necessary.

A special structure is created because an upcoming patch will extend this structure to support fragmentation of the linear page.

This patch has no functional changes.

---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  6 ++-
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 37 ++++++++++++++++---
 .../net/ethernet/mellanox/mlx5/core/en_rx.c   | 17 +++++----
 3 files changed, 47 insertions(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +5 -1
index c7ac6ebe8290..592234780f2b 100644
@@ -591,10 +591,13 @@ union mlx5e_alloc_units {
 struct mlx5e_mpw_info {
 	u16 consumed_strides;
 	DECLARE_BITMAP(skip_release_bitmap, MLX5_MPWRQ_MAX_PAGES_PER_WQE);
-	struct mlx5e_frag_page linear_page;
 	union mlx5e_alloc_units alloc_units;
 };
 
+struct mlx5e_mpw_linear_info {
+	struct mlx5e_frag_page frag_page;
+};
+
 #define MLX5E_MAX_RX_FRAGS 4
 
 struct mlx5e_rq;
@@ -689,6 +692,7 @@ struct mlx5e_rq {
 			u8                     umr_wqebbs;
 			u8                     mtts_per_wqe;
 			u8                     umr_mode;
+			struct mlx5e_mpw_linear_info *linear_info;
 			struct mlx5e_shampo_hd *shampo;
 		} mpwqe;
 	};
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +32 -5
index 1238e5356012..aa8359a48b12 100644
@@ -369,6 +369,29 @@ static int mlx5e_rq_alloc_mpwqe_info(struct mlx5e_rq *rq, int node)
 	return 0;
 }
 
+static int mlx5e_rq_alloc_mpwqe_linear_info(struct mlx5e_rq *rq, int node,
+					    struct mlx5e_params *params,
+					    struct mlx5e_rq_opt_param *rqo,
+					    u32 *pool_size)
+{
+	struct mlx5_core_dev *mdev = rq->mdev;
+	struct mlx5e_mpw_linear_info *li;
+
+	if (mlx5e_rx_mpwqe_is_linear_skb(mdev, params, rqo) ||
+	    !params->xdp_prog)
+		return 0;
+
+	li = kvzalloc_node(sizeof(*li), GFP_KERNEL, node);
+	if (!li)
+		return -ENOMEM;
+
+	rq->mpwqe.linear_info = li;
+
+	/* additional page per packet for the linear part */
+	*pool_size *= 2;
+
+	return 0;
+}
 
 static u8 mlx5e_mpwrq_access_mode(enum mlx5e_mpwrq_umr_mode umr_mode)
 {
@@ -915,10 +938,6 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
 			mlx5e_mpwqe_get_log_rq_size(mdev, params, rqo);
 		pool_order = rq->mpwqe.page_shift - PAGE_SHIFT;
 
-		if (!mlx5e_rx_mpwqe_is_linear_skb(mdev, params, rqo) &&
-		    params->xdp_prog)
-			pool_size *= 2; /* additional page per packet for the linear part */
-
 		rq->mpwqe.log_stride_sz =
 				mlx5e_mpwqe_get_log_stride_size(mdev, params,
 								rqo);
@@ -936,10 +955,15 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
 		if (err)
 			goto err_rq_mkey;
 
-		err = mlx5_rq_shampo_alloc(mdev, params, rq_param, rq, node);
+		err = mlx5e_rq_alloc_mpwqe_linear_info(rq, node, params, rqo,
+						       &pool_size);
 		if (err)
 			goto err_free_mpwqe_info;
 
+		err = mlx5_rq_shampo_alloc(mdev, params, rq_param, rq, node);
+		if (err)
+			goto err_free_mpwqe_linear_info;
+
 		break;
 	default: /* MLX5_WQ_TYPE_CYCLIC */
 		err = mlx5_wq_cyc_create(mdev, &rq_param->wq, rqc_wq,
@@ -1054,6 +1078,8 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
 	switch (rq->wq_type) {
 	case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
 		mlx5e_rq_free_shampo(rq);
+err_free_mpwqe_linear_info:
+		kvfree(rq->mpwqe.linear_info);
 err_free_mpwqe_info:
 		kvfree(rq->mpwqe.info);
 err_rq_mkey:
@@ -1081,6 +1107,7 @@ static void mlx5e_free_rq(struct mlx5e_rq *rq)
 	switch (rq->wq_type) {
 	case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
 		mlx5e_rq_free_shampo(rq);
+		kvfree(rq->mpwqe.linear_info);
 		kvfree(rq->mpwqe.info);
 		mlx5_core_destroy_mkey(rq->mdev, be32_to_cpu(rq->mpwqe.umr_mkey_be));
 		mlx5e_free_mpwqe_rq_drop_page(rq);
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +10 -7
index f5c0e2a0ada9..feb042d84b8e 100644
@@ -1869,6 +1869,7 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
 	struct mlx5e_frag_page *frag_page = &wi->alloc_units.frag_pages[page_idx];
 	u16 headlen = min_t(u16, MLX5E_RX_MAX_HEAD, cqe_bcnt);
 	struct mlx5e_frag_page *head_page = frag_page;
+	struct mlx5e_frag_page *linear_page = NULL;
 	struct mlx5e_xdp_buff *mxbuf = &rq->mxbuf;
 	u32 page_size = BIT(rq->mpwqe.page_shift);
 	u32 frag_offset    = head_offset;
@@ -1897,13 +1898,15 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
 	if (prog) {
 		/* area for bpf_xdp_[store|load]_bytes */
 		net_prefetchw(netmem_address(frag_page->netmem) + frag_offset);
+
+		linear_page = &rq->mpwqe.linear_info->frag_page;
 		if (unlikely(mlx5e_page_alloc_fragmented(rq->page_pool,
-							 &wi->linear_page))) {
+							 linear_page))) {
 			rq->stats->buff_alloc_err++;
 			return NULL;
 		}
 
-		va = netmem_address(wi->linear_page.netmem);
+		va = netmem_address(linear_page->netmem);
 		net_prefetchw(va); /* xdp_frame data area */
 		linear_hr = XDP_PACKET_HEADROOM;
 		linear_data_len = 0;
@@ -1966,10 +1969,10 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
 				for (pfp = head_page; pfp < frag_page; pfp++)
 					pfp->frags++;
 
-				wi->linear_page.frags++;
+				linear_page->frags++;
 			}
 			mlx5e_page_release_fragmented(rq->page_pool,
-						      &wi->linear_page);
+						      linear_page);
 			return NULL; /* page/packet was consumed by XDP */
 		}
 
@@ -1988,13 +1991,13 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
 			mxbuf->xdp.data - mxbuf->xdp.data_meta);
 		if (unlikely(!skb)) {
 			mlx5e_page_release_fragmented(rq->page_pool,
-						      &wi->linear_page);
+						      linear_page);
 			return NULL;
 		}
 
 		skb_mark_for_recycle(skb);
-		wi->linear_page.frags++;
-		mlx5e_page_release_fragmented(rq->page_pool, &wi->linear_page);
+		linear_page->frags++;
+		mlx5e_page_release_fragmented(rq->page_pool, linear_page);
 
 		if (xdp_buff_has_frags(&mxbuf->xdp)) {
 			struct mlx5e_frag_page *pagep;
Signature · 1 line
2.44.0
#6 lore raw

Re: [PATCH net-next V2 4/5] net/mlx5e: XDP, Use a single linear page per rq

Quoted 25 lines · Tariq Toukan

From: Dragos Tatulea <[email protected]>

Currently in striding rq there is one mlx5e_frag_page member per WQE for the linear page. This linear page is used only in XDP multi-buffer mode. This is wasteful because only one linear page is needed per rq: the page gets refreshed on every packet, regardless of WQE. Furthermore, it is not needed in other modes (non-XDP, XDP single-buffer).

This change moves the linear page into its own structure (struct mlx5_mpw_linear_info) and allocates it only when necessary.

A special structure is created because an upcoming patch will extend this structure to support fragmentation of the linear page.

This patch has no functional changes.

---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  6 ++-

[...]

drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -0
+static int mlx5e_rq_alloc_mpwqe_linear_info(struct mlx5e_rq *rq, int node,
+					    struct mlx5e_params *params,

drivers/net/ethernet/mellanox/mlx5/core/en_main.c static int mlx5e_rq_alloc_mpwqe_info(struct mlx5e_rq *rq, int node) · line 383

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +10 -0
+					    struct mlx5e_rq_opt_param *rqo,
+					    u32 *pool_size)
+{
+	struct mlx5_core_dev *mdev = rq->mdev;
+	struct mlx5e_mpw_linear_info *li;
+
+	if (mlx5e_rx_mpwqe_is_linear_skb(mdev, params, rqo) ||
+	    !params->xdp_prog)
+		return 0;
+

sashiko says:
"""
Could mlx5e_rx_mpwqe_is_linear_skb() return true here (meaning li is not allocated), but later return false when the rx handlers are being set up?

When mlx5e_open_rq() sets up handlers it passes NULL for rqo to mlx5e_rx_mpwqe_is_linear_skb(). Inside that function, without rqo, the page_shift calculation falls back to the system PAGE_SHIFT rather than rqo->qcfg->rx_page_size. A smaller page_shift could cause the stride check to fail, returning false.
If the allocation evaluates to true (skipping allocation) but the handler setup evaluates to false, the nonlinear handler mlx5e_skb_from_cqe_mpwrq_nonlinear will be used for the queue.
"""

This is by design. HW-GRO is the mode that Sashiko is talking about. In that mode linear_info is not used hence not allocated.

Quoted 12 lines

[...]

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +1 -0
@@ -1869,6 +1869,7 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
 	struct mlx5e_frag_page *frag_page = &wi->alloc_units.frag_pages[page_idx];
 	u16 headlen = min_t(u16, MLX5E_RX_MAX_HEAD, cqe_bcnt);
 	struct mlx5e_frag_page *head_page = frag_page;
+	struct mlx5e_frag_page *linear_page = NULL;
 	struct mlx5e_xdp_buff *mxbuf = &rq->mxbuf;
 	u32 page_size = BIT(rq->mpwqe.page_shift);
 	u32 frag_offset    = head_offset;

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w · line 1902

Quoted 5 lines
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +2 -0
@@ -1897,13 +1898,15 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
 	if (prog) {
 		/* area for bpf_xdp_[store|load]_bytes */
 		net_prefetchw(netmem_address(frag_page->netmem) + frag_offset);
+
+		linear_page = &rq->mpwqe.linear_info->frag_page;

"""
If mlx5e_skb_from_cqe_mpwrq_nonlinear() is invoked but linear_info was skipped during allocation, does this result in a NULL pointer dereference when accessing linear_info->frag_page?
"""

Connected to the statement above. linear_page will always be allocated for this handler.

[1] https://sashiko.dev/#/patchset/20260403090927.139042-1-tariqt%40nvidia.com?part=4

Thanks,
Dragos

maintainer
#7 lore raw

Re: [PATCH net-next V2 4/5] net/mlx5e: XDP, Use a single linear page per rq

Quoted 1 line · On Sun, 5 Apr 2026 08:08:06 +0200 Dragos Tatulea wrote:

sashiko says:

Thanks a lot for reviewing the review! It takes a lot of maintainer time

maintainer
#8 lore raw

Re: [PATCH net-next V2 4/5] net/mlx5e: XDP, Use a single linear page per rq

Quoted 4 lines · Jakub Kicinski
Quoted 1 line · On Sun, 5 Apr 2026 08:08:06 +0200 Dragos Tatulea wrote:

sashiko says:

Thanks a lot for reviewing the review! It takes a lot of maintainer time

Just to add some context: we started running Sashiko internally, so hopefully trivial issues won’t be missed. I don’t know if
you remember our on-list discussion from a few weeks ago, following that discussion right now we have three different internal AI tools reviewing each commit.

At the moment this is still manageable, and I think developers should look over all comments from all tools. In our case that currently means three review outputs per commit. It would also be useful to have some official guidance on what authors are recommended to run before posting, so obvious issues can be caught earlier and less reviewer/maintainer time is spent on them.

For example:

“Before posting, authors could run a recommended baseline of review tools, where available, to catch obvious issues early. During review, tools such as review-prompts and Sashiko may be used to assist the reviewer.”

Mark

maintainer
#9 lore raw

Re: [PATCH net-next V2 4/5] net/mlx5e: XDP, Use a single linear page per rq

Quoted 19 lines · On Mon, 6 Apr 2026 19:31:03 +0300 Mark Bloch wrote:
Quoted 4 lines · Jakub Kicinski
Quoted 1 line · On Sun, 5 Apr 2026 08:08:06 +0200 Dragos Tatulea wrote:

sashiko says:

Thanks a lot for reviewing the review! It takes a lot of maintainer time

Just to add some context: we started running Sashiko internally, so hopefully trivial issues won’t be missed. I don’t know if
you remember our on-list discussion from a few weeks ago, following that discussion right now we have three different internal AI tools reviewing each commit.

At the moment this is still manageable, and I think developers should look over all comments from all tools. In our case that currently means three review outputs per commit. It would also be useful to have some official guidance on what authors are recommended to run before posting, so obvious issues can be caught earlier and less reviewer/maintainer time is spent on them.

Quoted 5 lines

For example:

“Before posting, authors could run a recommended baseline of review tools, where available, to catch obvious issues early. During review, tools such as review-prompts and Sashiko may be used to assist the reviewer.”

Please send patches if you think something should be mentioned somewhere. It'd be awesome if y'all participated more in upstream reviews so that you recommendation could be rooted in what happens on the list not just what happens within nVidia.

maintainer
#10 lore raw

Re: [PATCH net-next V2 4/5] net/mlx5e: XDP, Use a single linear page per rq

Quoted 22 lines · Jakub Kicinski
Quoted 21 lines · On Mon, 6 Apr 2026 19:31:03 +0300 Mark Bloch wrote:
Quoted 4 lines · Jakub Kicinski
Quoted 1 line · On Sun, 5 Apr 2026 08:08:06 +0200 Dragos Tatulea wrote:

sashiko says:

Thanks a lot for reviewing the review! It takes a lot of maintainer time

Just to add some context: we started running Sashiko internally, so hopefully trivial issues won’t be missed. I don’t know if
you remember our on-list discussion from a few weeks ago, following that discussion right now we have three different internal AI tools reviewing each commit.

At the moment this is still manageable, and I think developers should look over all comments from all tools. In our case that currently means three review outputs per commit. It would also be useful to have some official guidance on what authors are recommended to run before posting, so obvious issues can be caught earlier and less reviewer/maintainer time is spent on them.

For example:

Quoted 8 lines
Quoted 3 lines

“Before posting, authors could run a recommended baseline of review tools, where available, to catch obvious issues early. During review, tools such as review-prompts and Sashiko may be used to assist the reviewer.”

Please send patches if you think something should be mentioned somewhere. It'd be awesome if y'all participated more in upstream reviews so that you recommendation could be rooted in what happens on the list not just what happens within nVidia.

Fair point.

I can’t speak for the others, but I’ll try to do more upstream reviews myself. In fact, I already blocked regular time slots each week for that.

Unfortunately, the region I live in has been affected by a certain war situation recently, and that has derailed quite a few plans on my side. Hopefully things will settle down sooner rather than later.

Mark

#11 lore raw

Re: [PATCH net-next V2 4/5] net/mlx5e: XDP, Use a single linear page per rq

In reply to Mark Bloch
Quoted 6 lines · Mark Bloch
Quoted 4 lines · Jakub Kicinski
Quoted 1 line · On Sun, 5 Apr 2026 08:08:06 +0200 Dragos Tatulea wrote:

sashiko says:

Thanks a lot for reviewing the review! It takes a lot of maintainer time

Quoted 9 lines

[...]

For example:

“Before posting, authors could run a recommended baseline of review tools, where available, to catch obvious issues early. During review, tools such as review-prompts and Sashiko may be used to assist the reviewer.”

There is already https://netdev-ai.bots.linux.dev/ai-local.html which I found really helpful.
If this is still the preferred approach, I could draft a patch to add it to Documentation/process/maintainer-netdev.rst

Quoted 1 line

Mark

Thanks
Nicolai

maintainer
#12 lore raw

Re: [PATCH net-next V2 4/5] net/mlx5e: XDP, Use a single linear page per rq

Quoted 10 lines · Nicolai Buchwitz
Quoted 9 lines · Mark Bloch
Quoted 4 lines · Jakub Kicinski
Quoted 1 line · On Sun, 5 Apr 2026 08:08:06 +0200 Dragos Tatulea wrote:

sashiko says:

Thanks a lot for reviewing the review! It takes a lot of maintainer time

[...]

Quoted 8 lines
Quoted 6 lines

For example:

“Before posting, authors could run a recommended baseline of review tools, where available, to catch obvious issues early. During review, tools such as review-prompts and Sashiko may be used to assist the reviewer.”

There is already https://netdev-ai.bots.linux.dev/ai-local.html which I found really helpful.

Yes, I’m aware of that page, and it’s definitely useful.

The reason I brought this up is that recently, with the rise of sashiko usage, Jakub has also started pointing out comments coming from it during review, while sashiko itself is not mentioned anywhere in the official netdev documentation.

Mark

Quoted 6 lines

If this is still the preferred approach, I could draft a patch to add it to Documentation/process/maintainer-netdev.rst

Quoted 1 line

Mark

Thanks
Nicolai

maintainer
#13 lore raw

Re: [PATCH net-next V2 4/5] net/mlx5e: XDP, Use a single linear page per rq

In reply to Nicolai Buchwitz
Quoted 10 lines · On Mon, 06 Apr 2026 21:13:43 +0200 Nicolai Buchwitz wrote:
Quoted 8 lines · Mark Bloch
Quoted 2 lines · Jakub Kicinski

Thanks a lot for reviewing the review! It takes a lot of maintainer time

“Before posting, authors could run a recommended baseline of review tools,
where available, to catch obvious issues early. During review, tools such
as review-prompts and Sashiko may be used to assist the reviewer.”

Quoted 4 lines

There is already https://netdev-ai.bots.linux.dev/ai-local.html which I found really helpful.
If this is still the preferred approach, I could draft a patch to add it to Documentation/process/maintainer-netdev.rst

Right, I'd like to have something similar and a bit of time to drive down the number of false positives from Sashiko. Compared to the NIPA's ai-reviews the Sashiko comments take a lot of time to validate and are often alarmist. The merge window starts next week so I'll have more spare cycles.

Please share if you had success running Sashiko (https://sashiko.dev/)
"locally"!

author maintainer
#14 lore raw

PATCH v2 5/5 net/mlx5e: XDP, Use page fragments for linear data in multibuf-mode

In reply to Tariq Toukan

From: Dragos Tatulea <[email protected]>

Currently in XDP multi-buffer mode for striding rq a whole page is allocated for the linear part of the XDP buffer. This is wasteful, especially on systems with larger page sizes.

This change splits the page into fixed sized fragments. The page is replenished when the maximum number of allowed fragments is reached. When a fragment is not used, it will be simply recycled on next packet. This is great for XDP_DROP as the fragment can be recycled for the next packet. In the most extreme case (XDP_DROP everything), there will be 0 fragments used => only one linear page allocation for the lifetime of the XDP program.

The previous page_pool size increase was too conservative (doubling the size) and now there are much fewer allocations (1/8 for a 4K page). So drop the page_pool size extension altogether when the linear side page is used.

This small improvement is at most visible for XDP_DROP tests with small 64B packets and a large enough MTU for Striding RQ to be in non-linear mode:

+----------------------------------------------------------------------+
| System               | MTU  | baseline   | this change | improvement |
|----------------------+------+------------+-------------+-------------|
| 4K page x86_64 [1]   | 9000 | 26.30 Mpps | 30.45 Mpps  | 15.80 %     |
| 64K page aarch64 [2] | 9000 | 15.27 Mpps | 20.10 Mpps  | 31.62 %     |
+----------------------------------------------------------------------+

[1] Intel Xeon Platinum 8580
[2] ARM Neoverse-N1

---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  6 ++
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 25 ++++++--
 .../net/ethernet/mellanox/mlx5/core/en_rx.c   | 60 +++++++++++++++----
 3 files changed, 74 insertions(+), 17 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +6 -0
index 592234780f2b..2270e2e550dd 100644
@@ -82,6 +82,9 @@ struct page_pool;
 
 #define MLX5E_PAGECNT_BIAS_MAX U16_MAX
 #define MLX5E_RX_MAX_HEAD (256)
+#define MLX5E_XDP_LOG_MAX_LINEAR_SZ \
+	order_base_2(MLX5_SKB_FRAG_SZ(XDP_PACKET_HEADROOM + MLX5E_RX_MAX_HEAD))
+
 #define MLX5E_SHAMPO_LOG_HEADER_ENTRY_SIZE (8)
 #define MLX5E_SHAMPO_WQ_HEADER_PER_PAGE \
 	(PAGE_SIZE >> MLX5E_SHAMPO_LOG_HEADER_ENTRY_SIZE)
@@ -596,6 +599,7 @@ struct mlx5e_mpw_info {
 
 struct mlx5e_mpw_linear_info {
 	struct mlx5e_frag_page frag_page;
+	u16 max_frags;
 };
 
 #define MLX5E_MAX_RX_FRAGS 4
@@ -1081,6 +1085,8 @@ bool mlx5e_reset_rx_moderation(struct dim_cq_moder *cq_moder, u8 cq_period_mode,
 bool mlx5e_reset_rx_channels_moderation(struct mlx5e_channels *chs, u8 cq_period_mode,
 					bool dim_enabled, bool keep_dim_state);
 
+void mlx5e_mpwqe_dealloc_linear_page(struct mlx5e_rq *rq);
+
 struct mlx5e_sq_param;
 int mlx5e_open_xdpsq(struct mlx5e_channel *c, struct mlx5e_params *params,
 		     struct mlx5e_sq_param *param, struct xsk_buff_pool *xsk_pool,
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +19 -6
index aa8359a48b12..4ba198fb9d6c 100644
@@ -371,11 +371,11 @@ static int mlx5e_rq_alloc_mpwqe_info(struct mlx5e_rq *rq, int node)
 
 static int mlx5e_rq_alloc_mpwqe_linear_info(struct mlx5e_rq *rq, int node,
 					    struct mlx5e_params *params,
-					    struct mlx5e_rq_opt_param *rqo,
-					    u32 *pool_size)
+					    struct mlx5e_rq_opt_param *rqo)
 {
 	struct mlx5_core_dev *mdev = rq->mdev;
 	struct mlx5e_mpw_linear_info *li;
+	u32 linear_frag_count;
 
 	if (mlx5e_rx_mpwqe_is_linear_skb(mdev, params, rqo) ||
 	    !params->xdp_prog)
@@ -385,10 +385,22 @@ static int mlx5e_rq_alloc_mpwqe_linear_info(struct mlx5e_rq *rq, int node,
 	if (!li)
 		return -ENOMEM;
 
+	linear_frag_count =
+		BIT(rq->mpwqe.page_shift - MLX5E_XDP_LOG_MAX_LINEAR_SZ);
+	if (linear_frag_count > U16_MAX) {
+		netdev_warn(rq->netdev,
+			    "rq %d: linear_frag_count (%u) larger than expected (%u), page_shift: %u, log_max_linear_sz: %u\n",
+			    rq->ix, linear_frag_count, U16_MAX,
+			    rq->mpwqe.page_shift, MLX5E_XDP_LOG_MAX_LINEAR_SZ);
+		kvfree(li);
+		return -EINVAL;
+	}
+
+	li->max_frags = linear_frag_count;
 	rq->mpwqe.linear_info = li;
 
-	/* additional page per packet for the linear part */
-	*pool_size *= 2;
+	/* Set to max to force allocation on first run. */
+	li->frag_page.frags = li->max_frags;
 
 	return 0;
 }
@@ -955,8 +967,7 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
 		if (err)
 			goto err_rq_mkey;
 
-		err = mlx5e_rq_alloc_mpwqe_linear_info(rq, node, params, rqo,
-						       &pool_size);
+		err = mlx5e_rq_alloc_mpwqe_linear_info(rq, node, params, rqo);
 		if (err)
 			goto err_free_mpwqe_info;
 
@@ -1347,6 +1358,8 @@ void mlx5e_free_rx_descs(struct mlx5e_rq *rq)
 			mlx5_wq_ll_pop(wq, wqe_ix_be,
 				       &wqe->next.next_wqe_index);
 		}
+
+		mlx5e_mpwqe_dealloc_linear_page(rq);
 	} else {
 		struct mlx5_wq_cyc *wq = &rq->wqe.wq;
 		u16 missing = mlx5_wq_cyc_missing(wq);
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +49 -11

102 lines not on this page · raw message

Signature · 1 line
2.44.0
#15 lore raw
In reply to Tariq Toukan
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Fri, 3 Apr 2026 12:09:22 +0300 you wrote:

Hi,

This series removes the limitation of having one packet per page in XDP mode. This has the following implications:

- XDP in Striding RQ mode can now be used on 64K page systems.

[...]

Here is the summary with links:
- [net-next,V2,1/5] net/mlx5e: XSK, Increase size for chunk_size param

    https://git.kernel.org/netdev/net-next/c/1047e14b44ed
  - [net-next,V2,2/5] net/mlx5e: XDP, Improve dma address calculation of linear part for XDP_TX
    https://git.kernel.org/netdev/net-next/c/833e72645aac
  - [net-next,V2,3/5] net/mlx5e: XDP, Remove stride size limitation
    https://git.kernel.org/netdev/net-next/c/2dfaa0238774
  - [net-next,V2,4/5] net/mlx5e: XDP, Use a single linear page per rq
    https://git.kernel.org/netdev/net-next/c/ebd4ad29cc82
  - [net-next,V2,5/5] net/mlx5e: XDP, Use page fragments for linear data in multibuf-mode
    https://git.kernel.org/netdev/net-next/c/25b8c9b6d731

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html