[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z4bq2y0fHtAlfBpf@LQ3V64L9R2>
Date: Tue, 14 Jan 2025 14:53:15 -0800
From: Joe Damato <jdamato@...tly.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org
Subject: Re: [PATCH net-next 02/11] net: add helpers for lookup and walking
netdevs under netdev_lock()
On Mon, Jan 13, 2025 at 07:51:08PM -0800, Jakub Kicinski wrote:
> Add helpers for accessing netdevs under netdev_lock().
> There's some careful handling needed to find the device and lock it
> safely, without it getting unregistered, and without taking rtnl_lock
> (the latter being the whole point of the new locking, after all).
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> net/core/dev.h | 16 +++++++
> net/core/dev.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 126 insertions(+)
[...]
> diff --git a/net/core/dev.c b/net/core/dev.c
> index fda4e1039bf0..5c1e71afbe1c 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -783,6 +783,49 @@ struct napi_struct *netdev_napi_by_id(struct net *net, unsigned int napi_id)
> return napi;
> }
[...]
> +
> +struct net_device *
> +netdev_xa_find_lock(struct net *net, struct net_device *dev,
> + unsigned long *index)
Minor nit, the other added helper functions have docs, but (unless I
missed it somewhere) this one doesn't. Maybe worthwhile to add
docs if sending a v2, but probably not worth a re-roll just for
this.
Powered by blists - more mailing lists