Commit 23cfaf67 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Paolo Abeni

net: page_pool: factor out uninit

We'll soon (next change in the series) need a fuller unwind path
in page_pool_create() so create the inverse of page_pool_init().
Reviewed-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
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>
Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent a2147245
...@@ -238,6 +238,18 @@ static int page_pool_init(struct page_pool *pool, ...@@ -238,6 +238,18 @@ static int page_pool_init(struct page_pool *pool,
return 0; return 0;
} }
static void page_pool_uninit(struct page_pool *pool)
{
ptr_ring_cleanup(&pool->ring, NULL);
if (pool->p.flags & PP_FLAG_DMA_MAP)
put_device(pool->p.dev);
#ifdef CONFIG_PAGE_POOL_STATS
free_percpu(pool->recycle_stats);
#endif
}
/** /**
* page_pool_create() - create a page pool. * page_pool_create() - create a page pool.
* @params: parameters, see struct page_pool_params * @params: parameters, see struct page_pool_params
...@@ -821,14 +833,7 @@ static void __page_pool_destroy(struct page_pool *pool) ...@@ -821,14 +833,7 @@ static void __page_pool_destroy(struct page_pool *pool)
if (pool->disconnect) if (pool->disconnect)
pool->disconnect(pool); pool->disconnect(pool);
ptr_ring_cleanup(&pool->ring, NULL); page_pool_uninit(pool);
if (pool->p.flags & PP_FLAG_DMA_MAP)
put_device(pool->p.dev);
#ifdef CONFIG_PAGE_POOL_STATS
free_percpu(pool->recycle_stats);
#endif
kfree(pool); kfree(pool);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment