]> git.ipfire.org Git - thirdparty/linux.git/commit
xdp: add generic xdp_build_skb_from_buff()
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Wed, 18 Dec 2024 17:44:31 +0000 (18:44 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 Dec 2024 03:51:14 +0000 (19:51 -0800)
commit539c1fba1ac77184215d892eda0857f5687b7366
treec46d5ec839e98f8a9fd34d797b3c4e76bfbd3944
parent68ddc8ae17685a8c4ac78260bde8fe4a79511aef
xdp: add generic xdp_build_skb_from_buff()

The code which builds an skb from an &xdp_buff keeps multiplying itself
around the drivers with almost no changes. Let's try to stop that by
adding a generic function.
Unlike __xdp_build_skb_from_frame(), always allocate an skbuff head
using napi_build_skb() and make use of the available xdp_rxq pointer to
assign the Rx queue index. In case of PP-backed buffer, mark the skb to
be recycled, as every PP user's been switched to recycle skbs.

Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Link: https://patch.msgid.link/20241218174435.1445282-4-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/xdp.h
net/core/xdp.c