diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2022-01-03 16:08:08 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-01-05 19:46:32 -0800 |
commit | 64693ec7774e471f817a725686d93903e919a2e5 (patch) | |
tree | 6a8bec9a7fbc46ab60d2e3cad7a51892c0e7ad21 /net | |
parent | 35b2e549894b7ef0b6e7f3a70c2ab75b767cfce9 (diff) | |
download | linux-64693ec7774e471f817a725686d93903e919a2e5.tar.bz2 |
page_pool: Store the XDP mem id
Store the XDP mem ID inside the page_pool struct so it can be retrieved
later for use in bpf_prog_run().
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Link: https://lore.kernel.org/bpf/20220103150812.87914-4-toke@redhat.com
Diffstat (limited to 'net')
-rw-r--r-- | net/core/page_pool.c | 4 | ||||
-rw-r--r-- | net/core/xdp.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/net/core/page_pool.c b/net/core/page_pool.c index f53786f6666d..7347d5c7dbe0 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -693,10 +693,12 @@ static void page_pool_release_retry(struct work_struct *wq) schedule_delayed_work(&pool->release_dw, DEFER_TIME); } -void page_pool_use_xdp_mem(struct page_pool *pool, void (*disconnect)(void *)) +void page_pool_use_xdp_mem(struct page_pool *pool, void (*disconnect)(void *), + struct xdp_mem_info *mem) { refcount_inc(&pool->user_cnt); pool->disconnect = disconnect; + pool->xdp_mem_id = mem->id; } void page_pool_destroy(struct page_pool *pool) diff --git a/net/core/xdp.c b/net/core/xdp.c index 58089f6d2c7a..7aba35504986 100644 --- a/net/core/xdp.c +++ b/net/core/xdp.c @@ -320,7 +320,7 @@ static struct xdp_mem_allocator *__xdp_reg_mem_model(struct xdp_mem_info *mem, } if (type == MEM_TYPE_PAGE_POOL) - page_pool_use_xdp_mem(allocator, mem_allocator_disconnect); + page_pool_use_xdp_mem(allocator, mem_allocator_disconnect, mem); mutex_unlock(&mem_id_lock); |