[Intel-wired-lan] [PATCH bpf v2 6/9] i40e: use xdp.frame_sz as XDP RxQ info frag_size

Larysa Zaremba larysa.zaremba at intel.com
Fri Feb 13 08:58:44 UTC 2026


On Fri, Feb 13, 2026 at 05:04:03AM +0100, Loktionov, Aleksandr wrote:
> 
> 
> > -----Original Message-----
> > From: Zaremba, Larysa <larysa.zaremba at intel.com>
> > Sent: Thursday, February 12, 2026 7:33 PM
> > To: bpf at vger.kernel.org
> > Cc: Zaremba, Larysa <larysa.zaremba at intel.com>; Claudiu Manoil
> > <claudiu.manoil at nxp.com>; Vladimir Oltean <vladimir.oltean at nxp.com>;
> > Wei Fang <wei.fang at nxp.com>; Clark Wang <xiaoning.wang at nxp.com>;
> > Andrew Lunn <andrew+netdev at lunn.ch>; David S. Miller
> > <davem at davemloft.net>; Eric Dumazet <edumazet at google.com>; Jakub
> > Kicinski <kuba at kernel.org>; Paolo Abeni <pabeni at redhat.com>; Nguyen,
> > Anthony L <anthony.l.nguyen at intel.com>; Kitszel, Przemyslaw
> > <przemyslaw.kitszel at intel.com>; Alexei Starovoitov <ast at kernel.org>;
> > Daniel Borkmann <daniel at iogearbox.net>; Jesper Dangaard Brouer
> > <hawk at kernel.org>; John Fastabend <john.fastabend at gmail.com>;
> > Stanislav Fomichev <sdf at fomichev.me>; Andrii Nakryiko
> > <andrii at kernel.org>; Martin KaFai Lau <martin.lau at linux.dev>; Eduard
> > Zingerman <eddyz87 at gmail.com>; Song Liu <song at kernel.org>; Yonghong
> > Song <yonghong.song at linux.dev>; KP Singh <kpsingh at kernel.org>; Hao
> > Luo <haoluo at google.com>; Jiri Olsa <jolsa at kernel.org>; Simon Horman
> > <horms at kernel.org>; Shuah Khan <shuah at kernel.org>; Lobakin,
> > Aleksander <aleksander.lobakin at intel.com>; Fijalkowski, Maciej
> > <maciej.fijalkowski at intel.com>; Bastien Curutchet (eBPF Foundation)
> > <bastien.curutchet at bootlin.com>; Vyavahare, Tushar
> > <tushar.vyavahare at intel.com>; Jason Xing <kernelxing at tencent.com>;
> > Ricardo B. Marlière <rbm at suse.com>; Eelco Chaudron
> > <echaudro at redhat.com>; Lorenzo Bianconi <lorenzo at kernel.org>; Toke
> > Hoiland-Jorgensen <toke at redhat.com>; imx at lists.linux.dev;
> > netdev at vger.kernel.org; linux-kernel at vger.kernel.org; intel-wired-
> > lan at lists.osuosl.org; linux-kselftest at vger.kernel.org; Loktionov,
> > Aleksandr <aleksandr.loktionov at intel.com>; Dragos Tatulea
> > <dtatulea at nvidia.com>
> > Subject: [PATCH bpf v2 6/9] i40e: use xdp.frame_sz as XDP RxQ info
> > frag_size
> > 
> > The only user of frag_size field in XDP RxQ info is
> > bpf_xdp_frags_increase_tail(). It clearly expects whole buffer size
> > instead of DMA write size. Different assumptions in i40e driver
> > configuration lead to negative tailroom.
> > 
> > Set frag_size to the same value as frame_sz in shared pages mode,
> > use new helper to set frag_size when AF_XDP ZC is active.
> > 
> > Fixes: a045d2f2d03d ("i40e: set xdp_rxq_info::frag_size")
> > Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov at intel.com>
> > Signed-off-by: Larysa Zaremba <larysa.zaremba at intel.com>
> > ---
> >  drivers/net/ethernet/intel/i40e/i40e_main.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > index eaa5b65e6daf..f91157774f1d 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > @@ -3563,6 +3563,7 @@ static int i40e_configure_rx_ring(struct
> > i40e_ring *ring)
> >  	u16 pf_q = vsi->base_queue + ring->queue_index;
> >  	struct i40e_hw *hw = &vsi->back->hw;
> >  	struct i40e_hmc_obj_rxq rx_ctx;
> > +	u32 xdp_frame_sz = 0;
> >  	int err = 0;
> >  	bool ok;
> > 
> https://elixir.bootlin.com/linux/v6.19-rc5/source/drivers/net/ethernet/intel/i40e/i40e_main.c#L3577
> All VSIs except main will be skipped, so xdp_init_buff() will be called with the default xdp_frame_sz = 0;
> Is it ok?

Sorry, you forgot to remove your Reviewed-by(s), patch changed too much.
You are right, xdp_frame_sz should be (i40e_rx_pg_size(ring) / 2) for non-main 
VSIs. I assumed that they do not need xdp_buff, but it is unescapable in non-XDP 
Rx processing after XDP mbuf introduction.

> 
> > @@ -3579,11 +3580,12 @@ static int i40e_configure_rx_ring(struct
> > i40e_ring *ring)
> > 
> >  	ring->xsk_pool = i40e_xsk_pool(ring);
> >  	if (ring->xsk_pool) {
> > +		xdp_frame_sz = xsk_pool_get_rx_frag_step(ring-
> > >xsk_pool);
> >  		ring->rx_buf_len = xsk_pool_get_rx_frame_size(ring-
> > >xsk_pool);
> >  		err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
> >  					 ring->queue_index,
> >  					 ring->q_vector->napi.napi_id,
> > -					 ring->rx_buf_len);
> > +					 xdp_frame_sz);
> >  		if (err)
> >  			return err;
> >  		err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
> > @@ -3596,10 +3598,11 @@ static int i40e_configure_rx_ring(struct
> > i40e_ring *ring)
> >  			 ring->queue_index);
> > 
> >  	} else {
> > +		xdp_frame_sz = i40e_rx_pg_size(ring) / 2;
> >  		err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
> >  					 ring->queue_index,
> >  					 ring->q_vector->napi.napi_id,
> > -					 ring->rx_buf_len);
> > +					 xdp_frame_sz);
> >  		if (err)
> >  			return err;
> >  		err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
> > @@ -3610,7 +3613,7 @@ static int i40e_configure_rx_ring(struct
> > i40e_ring *ring)
> >  	}
> > 
> >  skip:
> > -	xdp_init_buff(&ring->xdp, i40e_rx_pg_size(ring) / 2, &ring-
> > >xdp_rxq);
> > +	xdp_init_buff(&ring->xdp, xdp_frame_sz, &ring->xdp_rxq);
> > 
> >  	rx_ctx.dbuff = DIV_ROUND_UP(ring->rx_buf_len,
> >  				    BIT_ULL(I40E_RXQ_CTX_DBUFF_SHIFT));
> > --
> > 2.52.0
> 


More information about the Intel-wired-lan mailing list