summaryrefslogtreecommitdiff
path: root/net/bpf
diff options
context:
space:
mode:
authorMina Almasry <almasrymina@google.com>2024-06-28 00:32:42 +0000
committerJakub Kicinski <kuba@kernel.org>2024-07-02 18:59:33 -0700
commit4dec64c52e24c2c9a15f81c115f1be5ea35121cb (patch)
treee4c931a880a9dbff96ccc9f2757631f3f0a55cae /net/bpf
parentac26327635d643efe173e7460fa09eb39f0e5c54 (diff)
downloadlwn-4dec64c52e24c2c9a15f81c115f1be5ea35121cb.tar.gz
lwn-4dec64c52e24c2c9a15f81c115f1be5ea35121cb.zip
page_pool: convert to use netmem
Abstract the memory type from the page_pool so we can later add support for new memory types. Convert the page_pool to use the new netmem type abstraction, rather than use struct page directly. As of this patch the netmem type is a no-op abstraction: it's always a struct page underneath. All the page pool internals are converted to use struct netmem instead of struct page, and the page pool now exports 2 APIs: 1. The existing struct page API. 2. The new struct netmem API. Keeping the existing API is transitional; we do not want to refactor all the current drivers using the page pool at once. The netmem abstraction is currently a no-op. The page_pool uses page_to_netmem() to convert allocated pages to netmem, and uses netmem_to_page() to convert the netmem back to pages to pass to mm APIs, Follow up patches to this series add non-paged netmem support to the page_pool. This change is factored out on its own to limit the code churn to this 1 patch, for ease of code review. Signed-off-by: Mina Almasry <almasrymina@google.com> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://patch.msgid.link/20240628003253.1694510-6-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/bpf')
-rw-r--r--net/bpf/test_run.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index a6d7f790cdda..26417ab34ff4 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -127,9 +127,10 @@ struct xdp_test_data {
#define TEST_XDP_FRAME_SIZE (PAGE_SIZE - sizeof(struct xdp_page_head))
#define TEST_XDP_MAX_BATCH 256
-static void xdp_test_run_init_page(struct page *page, void *arg)
+static void xdp_test_run_init_page(netmem_ref netmem, void *arg)
{
- struct xdp_page_head *head = phys_to_virt(page_to_phys(page));
+ struct xdp_page_head *head =
+ phys_to_virt(page_to_phys(netmem_to_page(netmem)));
struct xdp_buff *new_ctx, *orig_ctx;
u32 headroom = XDP_PACKET_HEADROOM;
struct xdp_test_data *xdp = arg;