RE: [PATCH bpf v3 2/9] xsk: introduce helper to determine rxq->frag_size
From: Loktionov, Aleksandr <hidden>
Date: 2026-02-17 15:11:24
Also in:
bpf, imx, intel-wired-lan, linux-kselftest, lkml
quoted hunk ↗ jump to hunk
-----Original Message----- From: Zaremba, Larysa <redacted> Sent: Tuesday, February 17, 2026 2:25 PM To: bpf@vger.kernel.org Cc: Zaremba, Larysa <redacted>; Claudiu Manoil [off-list ref]; Vladimir Oltean [off-list ref]; Wei Fang [off-list ref]; Clark Wang [off-list ref]; Andrew Lunn [off-list ref]; David S. Miller [off-list ref]; Eric Dumazet [off-list ref]; Jakub Kicinski [off-list ref]; Paolo Abeni [off-list ref]; Nguyen, Anthony L [off-list ref]; Kitszel, Przemyslaw [off-list ref]; Alexei Starovoitov [off-list ref]; Daniel Borkmann [off-list ref]; Jesper Dangaard Brouer [off-list ref]; John Fastabend [off-list ref]; Stanislav Fomichev [off-list ref]; Andrii Nakryiko [off-list ref]; Martin KaFai Lau [off-list ref]; Eduard Zingerman [off-list ref]; Song Liu [off-list ref]; Yonghong Song [off-list ref]; KP Singh [off-list ref]; Hao Luo [off-list ref]; Jiri Olsa [off-list ref]; Simon Horman [off-list ref]; Shuah Khan [off-list ref]; Lobakin, Aleksander [off-list ref]; Fijalkowski, Maciej [off-list ref]; Bastien Curutchet (eBPF Foundation) [off-list ref]; Vyavahare, Tushar [off-list ref]; Jason Xing [off-list ref]; Ricardo B. Marlière [off-list ref]; Eelco Chaudron [off-list ref]; Lorenzo Bianconi [off-list ref]; Toke Hoiland-Jorgensen [off-list ref]; imx@lists.linux.dev; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; intel-wired- lan@lists.osuosl.org; linux-kselftest@vger.kernel.org; Loktionov, Aleksandr [off-list ref]; Dragos Tatulea [off-list ref] Subject: [PATCH bpf v3 2/9] xsk: introduce helper to determine rxq-quoted
frag_sizerxq->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 <redacted> --- 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(structxsk_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 u32xsk_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 <redacted>