xsk: add multi-buffer support for sockets sharing umem
authorTirthendu Sarkar <tirthendu.sarkar@intel.com>
Thu, 7 Sep 2023 03:50:32 +0000 (09:20 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Jan 2024 16:16:54 +0000 (17:16 +0100)
commitf302f37f1630fa57d309ee8571031d169784141c
treeb2220bd15688dd93c51ed2d17ec0b9e7e8a56f21
parentbf07fda050c80ee4ad87b3f27607dba8314d26f3
xsk: add multi-buffer support for sockets sharing umem

[ Upstream commit d609f3d228a8efe991f44f11f24146e2a5209755 ]

Userspace applications indicate their multi-buffer capability to xsk
using XSK_USE_SG socket bind flag. For sockets using shared umem the
bind flag may contain XSK_USE_SG only for the first socket. For any
subsequent socket the only option supported is XDP_SHARED_UMEM.

Add option XDP_UMEM_SG_FLAG in umem config flags to store the
multi-buffer handling capability when indicated by XSK_USE_SG option in
bing flag by the first socket. Use this to derive multi-buffer capability
for subsequent sockets in xsk core.

Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
Fixes: 81470b5c3c66 ("xsk: introduce XSK_USE_SG bind flag for xsk socket")
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/r/20230907035032.2627879-1-tirthendu.sarkar@intel.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/xdp_sock.h
net/xdp/xsk.c
net/xdp/xsk_buff_pool.c