Subject: Re: [PATCH net 4/5] net/mlx5e: RX, Fix XDP multi-buf frag counting for striding RQ: manual merge

From: Matthieu Baerts <[email-masked]>
Date: Mon, 9 Mar 2026 13:52:11 +0100

Hi Tariq, Dragos,

+cc: linux-next

On 05/03/2026 15:26, Tariq Toukan wrote:
> From: Dragos Tatulea <[email-masked]>
> 
> XDP multi-buf programs can modify the layout of the XDP buffer when the
> program calls bpf_xdp_pull_data() or bpf_xdp_adjust_tail(). The
> referenced commit in the fixes tag corrected the assumption in the mlx5
> driver that the XDP buffer layout doesn't change during a program
> execution. However, this fix introduced another issue: the dropped
> fragments still need to be counted on the driver side to avoid page
> fragment reference counting issues.

FYI, we got a small conflict when merging 'net' in 'net-next' in the
MPTCP tree due to this patch applied in 'net':

  db25c42c2e1f ("net/mlx5e: RX, Fix XDP multi-buf frag counting for striding RQ")

and this one from 'net-next':

  dff1c3164a69 ("net/mlx5e: SHAMPO, Always calculate page size")

----- Generic Message -----
The best is to avoid conflicts between 'net' and 'net-next' trees but if
they cannot be avoided when preparing patches, a note about how to fix
them is much appreciated.

The conflict has been resolved on our side [1] and the resolution we
suggest is attached to this email. Please report any issues linked to
this conflict resolution as it might be used by others. If you worked on
the mentioned patches, don't hesitate to ACK this conflict resolution.
---------------------------

Rerere cache is available in [2].

[1] https://github.com/multipath-tcp/mptcp_net-next/commit/9cbb5f8a4a18
[2] https://github.com/multipath-tcp/mptcp-upstream-rr-cache/commit/0bbafdd

(...)

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> index efcfcddab376..40e53a612989 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

(...)

> @@ -1975,13 +1974,12 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
>  			return NULL; /* page/packet was consumed by XDP */
>  		}
>  
> -		nr_frags_free = old_nr_frags - sinfo->nr_frags;
> -		if (unlikely(nr_frags_free)) {
> -			frag_page -= nr_frags_free;
> +		new_nr_frags = sinfo->nr_frags;
> +		nr_frags_free = old_nr_frags - new_nr_frags;
> +		if (unlikely(nr_frags_free))
>  			truesize -= (nr_frags_free - 1) * PAGE_SIZE +

The conflict is in the context: this line above has been modified on
'net-next' (s/PAGE_SIZE/page_size/), while the ones above it have been
modified on 'net'.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.

---
diff --cc drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 8fb57a4f36dd,268e20884757..f5c0e2a0ada9
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@@ -1977,13 -1971,12 +1973,12 @@@ mlx5e_skb_from_cqe_mpwrq_nonlinear(stru
  			return NULL; /* page/packet was consumed by XDP */
  		}
  
- 		nr_frags_free = old_nr_frags - sinfo->nr_frags;
- 		if (unlikely(nr_frags_free)) {
- 			frag_page -= nr_frags_free;
+ 		new_nr_frags = sinfo->nr_frags;
+ 		nr_frags_free = old_nr_frags - new_nr_frags;
+ 		if (unlikely(nr_frags_free))
 -			truesize -= (nr_frags_free - 1) * PAGE_SIZE +
 +			truesize -= (nr_frags_free - 1) * page_size +
  				ALIGN(pg_consumed_bytes,
  				      BIT(rq->mpwqe.log_stride_sz));
- 		}
  
  		len = mxbuf->xdp.data_end - mxbuf->xdp.data;