summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarysa Zaremba <larysa.zaremba@intel.com>2026-03-05 12:12:43 +0100
committerSasha Levin <sashal@kernel.org>2026-03-12 07:10:01 -0400
commitff7f356cdbb474ef303f0239c7bb723ccd2f5271 (patch)
treea118fa30c00034651d4f1c3f65cd39481efc0f0b
parent2a9e6ecf0e85840b1e7db73d0279af81ed446dc7 (diff)
downloadlinux-ff7f356cdbb474ef303f0239c7bb723ccd2f5271.tar.gz
linux-ff7f356cdbb474ef303f0239c7bb723ccd2f5271.tar.bz2
linux-ff7f356cdbb474ef303f0239c7bb723ccd2f5271.zip
xsk: introduce helper to determine rxq->frag_size
[ Upstream commit 16394d80539937d348dd3b9ea32415c54e67a81b ] 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") Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> Link: https://patch.msgid.link/20260305111253.2317394-3-larysa.zaremba@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--include/net/xdp_sock_drv.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/net/xdp_sock_drv.h b/include/net/xdp_sock_drv.h
index 99b6c3358e36..33e072768de9 100644
--- a/include/net/xdp_sock_drv.h
+++ b/include/net/xdp_sock_drv.h
@@ -47,6 +47,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)
{
@@ -333,6 +338,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)
{