> -----Original Message-----
> From: Zaremba, Larysa <[email protected]>
> Sent: Thursday, February 12, 2026 7:33 PM
> To: [email protected]
> Cc: Zaremba, Larysa <[email protected]>; Claudiu Manoil
> <[email protected]>; Vladimir Oltean <[email protected]>;
> Wei Fang <[email protected]>; Clark Wang <[email protected]>;
> Andrew Lunn <[email protected]>; David S. Miller
> <[email protected]>; Eric Dumazet <[email protected]>; Jakub
> Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Nguyen,
> Anthony L <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; Alexei Starovoitov <[email protected]>;
> Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer
> <[email protected]>; John Fastabend <[email protected]>;
> Stanislav Fomichev <[email protected]>; Andrii Nakryiko
> <[email protected]>; Martin KaFai Lau <[email protected]>; Eduard
> Zingerman <[email protected]>; Song Liu <[email protected]>; Yonghong
> Song <[email protected]>; KP Singh <[email protected]>; Hao
> Luo <[email protected]>; Jiri Olsa <[email protected]>; Simon Horman
> <[email protected]>; Shuah Khan <[email protected]>; Lobakin,
> Aleksander <[email protected]>; Fijalkowski, Maciej
> <[email protected]>; Bastien Curutchet (eBPF Foundation)
> <[email protected]>; Vyavahare, Tushar
> <[email protected]>; Jason Xing <[email protected]>;
> Ricardo B. Marlière <[email protected]>; Eelco Chaudron
> <[email protected]>; Lorenzo Bianconi <[email protected]>; Toke
> Hoiland-Jorgensen <[email protected]>; [email protected];
> [email protected]; [email protected]; intel-wired-
> [email protected]; [email protected]; Loktionov,
> Aleksandr <[email protected]>; Dragos Tatulea
> <[email protected]>
> 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 <[email protected]>
> Signed-off-by: Larysa Zaremba <[email protected]>
> ---
>  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?

> @@ -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


Reply via email to