Commit 02b3de80 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Paolo Abeni
Browse files

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: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarJesper Dangaard Brouer <hawk@kernel.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 083772c9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ struct page_pool {
	/* User-facing fields, protected by page_pools_lock */
	struct {
		struct hlist_node list;
		u32 napi_id;
		u32 id;
	} user;
};
+3 −1
Original line number Diff line number Diff line
@@ -37,9 +37,11 @@ int page_pool_list(struct page_pool *pool)
	if (err < 0)
		goto err_unlock;

	if (pool->slow.netdev)
	if (pool->slow.netdev) {
		hlist_add_head(&pool->user.list,
			       &pool->slow.netdev->page_pools);
		pool->user.napi_id = pool->p.napi ? pool->p.napi->napi_id : 0;
	}

	mutex_unlock(&page_pools_lock);
	return 0;