summaryrefslogtreecommitdiff
path: root/net/core/page_pool.c
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2019-06-18 16:05:37 +0300
committerDavid S. Miller <davem@davemloft.net>2019-06-19 18:23:13 +0300
commite54cfd7e1745e52eb6c67ee9c77aefb8e4666a88 (patch)
treebaf9b88f268bb9c2d947b008f3687b8b073ba6f5 /net/core/page_pool.c
parentcbf3351067cea1a58862b2c7667b479a358a2071 (diff)
downloadlinux-e54cfd7e1745e52eb6c67ee9c77aefb8e4666a88.tar.xz
page_pool: introduce page_pool_free and use in mlx5
In case driver fails to register the page_pool with XDP return API (via xdp_rxq_info_reg_mem_model()), then the driver can free the page_pool resources more directly than calling page_pool_destroy(), which does a unnecessarily RCU free procedure. This patch is preparing for removing page_pool_destroy(), from driver invocation. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Reviewed-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/page_pool.c')
-rw-r--r--net/core/page_pool.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 205af7bd6d09..41391b5dc14c 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -292,17 +292,24 @@ static void __page_pool_empty_ring(struct page_pool *pool)
}
}
+void __page_pool_free(struct page_pool *pool)
+{
+ WARN(pool->alloc.count, "API usage violation");
+ WARN(!ptr_ring_empty(&pool->ring), "ptr_ring is not empty");
+
+ ptr_ring_cleanup(&pool->ring, NULL);
+ kfree(pool);
+}
+EXPORT_SYMBOL(__page_pool_free);
+
static void __page_pool_destroy_rcu(struct rcu_head *rcu)
{
struct page_pool *pool;
pool = container_of(rcu, struct page_pool, rcu);
- WARN(pool->alloc.count, "API usage violation");
-
__page_pool_empty_ring(pool);
- ptr_ring_cleanup(&pool->ring, NULL);
- kfree(pool);
+ __page_pool_free(pool);
}
/* Cleanup and release resources */