[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC_iWj+gdrsyumk77mR60o6rw=pUmnXgrkmwJXK_04KPJCMhAw@mail.gmail.com>
Date: Thu, 9 Nov 2023 11:21:32 +0200
From: Ilias Apalodimas <ilias.apalodimas@...aro.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, almasrymina@...gle.com, hawk@...nel.org
Subject: Re: [PATCH net-next 04/15] net: page_pool: id the page pools
On Tue, 24 Oct 2023 at 19:02, Jakub Kicinski <kuba@...nel.org> wrote:
>
> To give ourselves the flexibility of creating netlink commands
> and ability to refer to page pool instances in uAPIs create
> IDs for page pools.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> include/net/page_pool/types.h | 4 ++++
> net/core/Makefile | 2 +-
> net/core/page_pool.c | 21 +++++++++++++++-----
> net/core/page_pool_priv.h | 9 +++++++++
> net/core/page_pool_user.c | 36 +++++++++++++++++++++++++++++++++++
> 5 files changed, 66 insertions(+), 6 deletions(-)
> create mode 100644 net/core/page_pool_priv.h
> create mode 100644 net/core/page_pool_user.c
>
[...]
> +int page_pool_list(struct page_pool *pool)
> +{
> + static u32 id_alloc_next;
> + int err;
> +
> + mutex_lock(&page_pools_lock);
> + err = xa_alloc_cyclic(&page_pools, &pool->user.id, pool, xa_limit_32b,
> + &id_alloc_next, GFP_KERNEL);
> + if (err < 0)
> + goto err_unlock;
A nit really, but get rid of the if/goto and just let this return err; ?
> +
> + mutex_unlock(&page_pools_lock);
> + return 0;
> +
> +err_unlock:
> + mutex_unlock(&page_pools_lock);
> + return err;
> +}
> +
> +void page_pool_unlist(struct page_pool *pool)
> +{
> + mutex_lock(&page_pools_lock);
> + xa_erase(&page_pools, pool->user.id);
> + mutex_unlock(&page_pools_lock);
> +}
> --
> 2.41.0
>
Powered by blists - more mailing lists