Skip to content
Snippets Groups Projects
Commit 4144a105 authored by Maciej Fijalkowski's avatar Maciej Fijalkowski Committed by Jakub Kicinski
Browse files

xsk: fix batch alloc API on non-coherent systems


In cases when synchronizing DMA operations is necessary,
xsk_buff_alloc_batch() returns a single buffer instead of the requested
count. This puts the pressure on drivers that use batch API as they have
to check for this corner case on their side and take care of allocations
by themselves, which feels counter productive. Let us improve the core
by looping over xp_alloc() @max times when slow path needs to be taken.

Another issue with current interface, as spotted and fixed by Dries, was
that when driver called xsk_buff_alloc_batch() with @max == 0, for slow
path case it still allocated and returned a single buffer, which should
not happen. By introducing the logic from first paragraph we kill two
birds with one stone and address this problem as well.

Fixes: 47e4075d ("xsk: Batched buffer allocation for the pool")
Reported-and-tested-by: default avatarDries De Winter <ddewinter@synamedia.com>
Co-developed-by: default avatarDries De Winter <ddewinter@synamedia.com>
Signed-off-by: default avatarDries De Winter <ddewinter@synamedia.com>
Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20240911191019.296480-1-maciej.fijalkowski@intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1f2e900a
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment