diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2019-06-18 15:05:37 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-19 11:23:13 -0400 |
commit | e54cfd7e1745e52eb6c67ee9c77aefb8e4666a88 (patch) | |
tree | baf9b88f268bb9c2d947b008f3687b8b073ba6f5 /include/net | |
parent | cbf3351067cea1a58862b2c7667b479a358a2071 (diff) |
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 'include/net')
-rw-r--r-- | include/net/page_pool.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/page_pool.h b/include/net/page_pool.h index e240fac4c5b9..754d980700df 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -111,6 +111,17 @@ struct page_pool *page_pool_create(const struct page_pool_params *params); void page_pool_destroy(struct page_pool *pool); +void __page_pool_free(struct page_pool *pool); +static inline void page_pool_free(struct page_pool *pool) +{ + /* When page_pool isn't compiled-in, net/core/xdp.c doesn't + * allow registering MEM_TYPE_PAGE_POOL, but shield linker. + */ +#ifdef CONFIG_PAGE_POOL + __page_pool_free(pool); +#endif +} + /* Never call this directly, use helpers below */ void __page_pool_put_page(struct page_pool *pool, struct page *page, bool allow_direct); |