[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230816234303.3786178-4-kuba@kernel.org>
Date: Wed, 16 Aug 2023 16:42:52 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: netdev@...r.kernel.org
Cc: hawk@...nel.org,
ilias.apalodimas@...aro.org,
aleksander.lobakin@...el.com,
linyunsheng@...wei.com,
almasrymina@...gle.com,
Jakub Kicinski <kuba@...nel.org>
Subject: [RFC net-next 03/13] net: page_pool: factor out uninit
We'll soon need a fuller unwind path in page_pool_create()
so create the inverse of page_pool_init().
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
net/core/page_pool.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 2c14445a353a..8e71e116224d 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -238,6 +238,18 @@ static int page_pool_init(struct page_pool *pool,
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.
* @params: parameters, see struct page_pool_params
@@ -806,14 +818,7 @@ static void page_pool_free(struct page_pool *pool)
if (pool->disconnect)
pool->disconnect(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_uninit(pool);
kfree(pool);
}
--
2.41.0
Powered by blists - more mailing lists