Commit 16394d80 authored by Larysa Zaremba's avatar Larysa Zaremba Committed by Jakub Kicinski
Browse files

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: 24ea5012 ("xsk: support mbuf on ZC RX")
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
Link: https://patch.msgid.link/20260305111253.2317394-3-larysa.zaremba@intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 88b6b7f7
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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)
{