[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHS8izPYAO5fbQJBrOuGxiybXGwXuPBoqFwznFQeRQ27b+jtQA@mail.gmail.com>
Date: Wed, 25 Oct 2023 11:33:40 -0700
From: Mina Almasry <almasrymina@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, hawk@...nel.org, ilias.apalodimas@...aro.org
Subject: Re: [PATCH net-next 03/15] net: page_pool: factor out uninit
On Tue, Oct 24, 2023 at 9:02 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> 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 <ilias.apalodimas@...aro.org>
Reviewed-by: Mina Almasry <almasrymina@...gle.com>
> 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 08af9de8e8eb..4aed4809b5b4 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -234,6 +234,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
> @@ -817,14 +829,7 @@ static void __page_pool_destroy(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
>
--
Thanks,
Mina
Powered by blists - more mailing lists