Skip to content

Commit ca35d60

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 32905f7 commit ca35d60

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
@@ -51,6 +51,11 @@ static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
5151
return xsk_pool_get_chunk_size(pool) - xsk_pool_get_headroom(pool);
5252
}
5353

54+
static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool *pool)
55+
{
56+
return pool->unaligned ? 0 : xsk_pool_get_chunk_size(pool);
57+
}
58+
5459
static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
5560
struct xdp_rxq_info *rxq)
5661
{
@@ -337,6 +342,11 @@ static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
337342
return 0;
338343
}
339344

345+
static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool *pool)
346+
{
347+
return 0;
348+
}
349+
340350
static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
341351
struct xdp_rxq_info *rxq)
342352
{

0 commit comments

Comments
 (0)