]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xdp: make __xdp_return() MP-agnostic
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Wed, 11 Dec 2024 17:26:40 +0000 (18:26 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 13 Dec 2024 02:22:52 +0000 (18:22 -0800)
commit207ff83cecaeaacf0d47c8ccbe927c8354ac1280
treeb0f5372e5ee3bc6838df803f8c66641034857bab
parent56d95b0adfa224bb1c67733dbcad30dd8debd39e
xdp: make __xdp_return() MP-agnostic

Currently, __xdp_return() takes pointer to the virtual memory to free
a buffer. Apart from that this sometimes provokes redundant
data <--> page conversions, taking data pointer effectively prevents
lots of XDP code to support non-page-backed buffers, as there's no
mapping for the non-host memory (data is always NULL).
Just convert it to always take netmem reference. For
xdp_return_{buff,frame*}(), this chops off one page_address() per each
frag and adds one virt_to_netmem() (same as virt_to_page()) per header
buffer. For __xdp_return() itself, it removes one virt_to_page() for
MEM_TYPE_PAGE_POOL and another one for MEM_TYPE_PAGE_ORDER0, adding
one page_address() for [not really common nowadays]
MEM_TYPE_PAGE_SHARED, but the main effect is that the abovementioned
functions won't die or memleak anymore if the frame has non-host memory
attached and will correctly free those.

Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Link: https://patch.msgid.link/20241211172649.761483-4-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/xdp.h
net/core/filter.c
net/core/xdp.c