Skip to content

Commit 16394d8

Browse files
walking-machinekuba-moo
authored andcommitted
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: 24ea501 ("xsk: support mbuf on ZC RX") Reviewed-by: Aleksandr Loktionov <[email protected]> Signed-off-by: Larysa Zaremba <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 88b6b7f commit 16394d8

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)