Skip to content

Commit 23cfaf6

Browse files
kuba-mooPaolo Abeni
authored andcommitted
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: Ilias Apalodimas <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Acked-by: Jesper Dangaard Brouer <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Shakeel Butt <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent a214724 commit 23cfaf6

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

net/core/page_pool.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,18 @@ static int page_pool_init(struct page_pool *pool,
238238
return 0;
239239
}
240240

241+
static void page_pool_uninit(struct page_pool *pool)
242+
{
243+
ptr_ring_cleanup(&pool->ring, NULL);
244+
245+
if (pool->p.flags & PP_FLAG_DMA_MAP)
246+
put_device(pool->p.dev);
247+
248+
#ifdef CONFIG_PAGE_POOL_STATS
249+
free_percpu(pool->recycle_stats);
250+
#endif
251+
}
252+
241253
/**
242254
* page_pool_create() - create a page pool.
243255
* @params: parameters, see struct page_pool_params
@@ -821,14 +833,7 @@ static void __page_pool_destroy(struct page_pool *pool)
821833
if (pool->disconnect)
822834
pool->disconnect(pool);
823835

824-
ptr_ring_cleanup(&pool->ring, NULL);
825-
826-
if (pool->p.flags & PP_FLAG_DMA_MAP)
827-
put_device(pool->p.dev);
828-
829-
#ifdef CONFIG_PAGE_POOL_STATS
830-
free_percpu(pool->recycle_stats);
831-
#endif
836+
page_pool_uninit(pool);
832837
kfree(pool);
833838
}
834839

0 commit comments

Comments
 (0)