mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
xsk: Carry a copy of xdp_zc_max_segs within xsk_buff_pool
This so we avoid dereferencing struct net_device within hot path. Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> Link: https://lore.kernel.org/bpf/20241007122458.282590-5-maciej.fijalkowski@intel.com
This commit is contained in:
parent
bea14124ba
commit
6e12687219
@ -76,6 +76,7 @@ struct xsk_buff_pool {
|
||||
u32 chunk_size;
|
||||
u32 chunk_shift;
|
||||
u32 frame_len;
|
||||
u32 xdp_zc_max_segs;
|
||||
u8 tx_metadata_len; /* inherited from umem */
|
||||
u8 cached_need_wakeup;
|
||||
bool uses_need_wakeup;
|
||||
|
@ -229,6 +229,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
|
||||
goto err_unreg_xsk;
|
||||
}
|
||||
pool->umem->zc = true;
|
||||
pool->xdp_zc_max_segs = netdev->xdp_zc_max_segs;
|
||||
return 0;
|
||||
|
||||
err_unreg_xsk:
|
||||
|
@ -260,7 +260,7 @@ u32 xskq_cons_read_desc_batch(struct xsk_queue *q, struct xsk_buff_pool *pool,
|
||||
nr_frags = 0;
|
||||
} else {
|
||||
nr_frags++;
|
||||
if (nr_frags == pool->netdev->xdp_zc_max_segs) {
|
||||
if (nr_frags == pool->xdp_zc_max_segs) {
|
||||
nr_frags = 0;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user