Skip to content

Commit ff7f356

Browse files
walking-machineSasha Levin
authored andcommitted
xsk: introduce helper to determine rxq->frag_size
[ Upstream commit 16394d8 ] 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: 24ea501 ("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>
1 parent 2a9e6ec commit ff7f356

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

include/net/xdp_sock_drv.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
4747
return xsk_pool_get_chunk_size(pool) - xsk_pool_get_headroom(pool);
4848
}
4949

50+
static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool *pool)
51+
{
52+
return pool->unaligned ? 0 : xsk_pool_get_chunk_size(pool);
53+
}
54+
5055
static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
5156
struct xdp_rxq_info *rxq)
5257
{
@@ -333,6 +338,11 @@ static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
333338
return 0;
334339
}
335340

341+
static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool *pool)
342+
{
343+
return 0;
344+
}
345+
336346
static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
337347
struct xdp_rxq_info *rxq)
338348
{

0 commit comments

Comments
 (0)