[Intel-wired-lan] [PATCH bpf v3 2/9] xsk: introduce helper to determine rxq->frag_size
Loktionov, Aleksandr
aleksandr.loktionov at intel.com
Tue Feb 17 15:11:16 UTC 2026
> -----Original Message-----
> From: Zaremba, Larysa <larysa.zaremba at intel.com>
> Sent: Tuesday, February 17, 2026 2:25 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 v3 2/9] xsk: introduce helper to determine rxq-
> >frag_size
>
> rxq->frag_size is basically a step between consecutive strictly
> aligned
> frames. In ZC mode, chunk size fits exactly, but if chunks are
> unaligned, there is no safe way to determine accessible space to grow
> tailroom.
>
> Report frag_size to be zero, if chunks are unaligned, chunk_size
> otherwise.
>
> Fixes: 24ea50127ecf ("xsk: support mbuf on ZC RX")
> Signed-off-by: Larysa Zaremba <larysa.zaremba at intel.com>
> ---
> include/net/xdp_sock_drv.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/include/net/xdp_sock_drv.h b/include/net/xdp_sock_drv.h
> index 242e34f771cc..09d972f4bd60 100644
> --- a/include/net/xdp_sock_drv.h
> +++ b/include/net/xdp_sock_drv.h
> @@ -51,6 +51,11 @@ static inline u32 xsk_pool_get_rx_frame_size(struct
> xsk_buff_pool *pool)
> return xsk_pool_get_chunk_size(pool) -
> xsk_pool_get_headroom(pool); }
>
> +static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool
> *pool)
> +{
> + return pool->unaligned ? 0 : xsk_pool_get_chunk_size(pool); }
> +
> static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
> struct xdp_rxq_info *rxq)
> {
> @@ -337,6 +342,11 @@ static inline u32
> xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
> return 0;
> }
>
> +static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool
> *pool)
> +{
> + return 0;
> +}
> +
> static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
> struct xdp_rxq_info *rxq)
> {
> --
> 2.52.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov at intel.com>
More information about the Intel-wired-lan
mailing list