Skip to content

Commit 02b3de8

Browse files
kuba-mooPaolo Abeni
authored andcommitted
net: page_pool: stash the NAPI ID for easier access
To avoid any issues with race conditions on accessing napi and having to think about the lifetime of NAPI objects in netlink GET - stash the napi_id to which page pool was linked at creation time. Reviewed-by: Eric Dumazet <[email protected]> Acked-by: Jesper Dangaard Brouer <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 083772c commit 02b3de8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

include/net/page_pool/types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ struct page_pool {
193193
/* User-facing fields, protected by page_pools_lock */
194194
struct {
195195
struct hlist_node list;
196+
u32 napi_id;
196197
u32 id;
197198
} user;
198199
};

net/core/page_pool_user.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ int page_pool_list(struct page_pool *pool)
3737
if (err < 0)
3838
goto err_unlock;
3939

40-
if (pool->slow.netdev)
40+
if (pool->slow.netdev) {
4141
hlist_add_head(&pool->user.list,
4242
&pool->slow.netdev->page_pools);
43+
pool->user.napi_id = pool->p.napi ? pool->p.napi->napi_id : 0;
44+
}
4345

4446
mutex_unlock(&page_pools_lock);
4547
return 0;

0 commit comments

Comments
 (0)