aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/page_pool.c
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <[email protected]>2022-01-03 15:08:07 +0000
committerAlexei Starovoitov <[email protected]>2022-01-06 03:46:32 +0000
commit35b2e549894b7ef0b6e7f3a70c2ab75b767cfce9 (patch)
tree32a1813d431fd1875d576c44eb0f624d05802b5f /net/core/page_pool.c
parentxdp: Allow registering memory model without rxq reference (diff)
downloadkernel-35b2e549894b7ef0b6e7f3a70c2ab75b767cfce9.tar.gz
kernel-35b2e549894b7ef0b6e7f3a70c2ab75b767cfce9.zip
page_pool: Add callback to init pages when they are allocated
Add a new callback function to page_pool that, if set, will be called every time a new page is allocated. This will be used from bpf_test_run() to initialise the page data with the data provided by userspace when running XDP programs with redirect turned on. Signed-off-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: John Fastabend <[email protected]> Acked-by: Jesper Dangaard Brouer <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'net/core/page_pool.c')
-rw-r--r--net/core/page_pool.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 1a6978427d6c..f53786f6666d 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -217,6 +217,8 @@ static void page_pool_set_pp_info(struct page_pool *pool,
{
page->pp = pool;
page->pp_magic |= PP_SIGNATURE;
+ if (pool->p.init_callback)
+ pool->p.init_callback(page, pool->p.init_arg);
}
static void page_pool_clear_pp_info(struct page *page)