[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250207162718.4f26219e@kernel.org>
Date: Fri, 7 Feb 2025 16:27:18 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon Horman
<horms@...nel.org>, linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
kernel-team@...a.com, kuniyu@...zon.com, ushankar@...estorage.com
Subject: Re: [PATCH RFC net-next] net: Add dev_getbyhwaddr_rtnl() helper
On Fri, 07 Feb 2025 04:11:34 -0800 Breno Leitao wrote:
> +static bool dev_comp_addr(struct net_device *dev,
> + unsigned short type,
> + const char *ha)
Weird indentation.
static bool
dev_comp_addr(struct net_device *dev, unsigned short type, const char *ha)
or
static bool dev_comp_addr(struct net_device *dev, unsigned short type,
const char *ha)
> +{
> + if (dev->type == type && !memcmp(dev->dev_addr, ha, dev->addr_len))
> + return true;
> +
> + return false;
return dev->type == type && !memcmp(dev->dev_addr, ha, dev->addr_len);
> +}
> +/**
> + * dev_getbyhwaddr_rtnl - find a device by its hardware address
I guess Eric suggested the _rtnl() suffix, tho it's quite uncommon.
Most function are either function() or function_rcu() in networking.
> + * @net: the applicable net namespace
> + * @type: media type of device
> + * @ha: hardware address
> + *
> + * Similar to dev_getbyhwaddr_rcu(), but, the owner needs to hold
unnecessary , after but
> + * RTNL.
rtnl_lock. RTNL is short for RTNetLink
> + *
document the return value kdoc style:
Return: pointer to the net_device, or NULL if not found
> + */
> +struct net_device *dev_getbyhwaddr_rtnl(struct net *net, unsigned short type,
> + const char *ha)
You missed adding this to a header file?
Powered by blists - more mailing lists