]> git.ipfire.org Git - thirdparty/linux.git/commit
xsk: add generic XSk &xdp_buff -> skb conversion
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Wed, 18 Dec 2024 17:44:33 +0000 (18:44 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 Dec 2024 03:51:14 +0000 (19:51 -0800)
commit560d958c6c68fa62ddb4bd6f890c363598d184b0
tree855e778c46a564be4b2e15653a605a947f013927
parent51205f841a495c78aa59d0e41683463dac23eb27
xsk: add generic XSk &xdp_buff -> skb conversion

Same as with converting &xdp_buff to skb on Rx, the code which allocates
a new skb and copies the XSk frame there is identical across the
drivers, so make it generic. This includes copying all the frags if they
are present in the original buff.
System percpu page_pools greatly improve XDP_PASS performance on XSk:
instead of page_alloc() + page_free(), the net core recycles the same
pages, so the only overhead left is memcpy()s. When the Page Pool is
not compiled in, the whole function is a return-NULL (but it always
gets selected when eBPF is enabled).
Note that the passed buff gets freed if the conversion is done w/o any
error, assuming you don't need this buffer after you convert it to an
skb.

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Link: https://patch.msgid.link/20241218174435.1445282-6-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/xdp.h
net/core/xdp.c