netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] net: core: improvements to device lookup by hardware address.
@ 2025-02-10 11:56 Breno Leitao
  2025-02-10 11:56 ` [PATCH net-next v2 1/2] net: document return value of dev_getbyhwaddr_rcu() Breno Leitao
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Breno Leitao @ 2025-02-10 11:56 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Andrew Lunn
  Cc: linux-kernel, netdev, Breno Leitao, kernel-team, kuniyu, ushankar

The first patch adds a new dev_getbyhwaddr() helper function for
finding devices by hardware address when the RTNL lock is held. This
prevents PROVE_LOCKING warnings that occurred when RTNL was held but the
RCU read lock wasn't. The common address comparison logic is extracted
into dev_comp_addr() to avoid code duplication.

The second patch adds missing documentation for the return value of
dev_getbyhwaddr_rcu(), fixing a warning reported by NIPA. The kdoc
comment now properly specifies that the function returns either a
pointer to net_device or NULL when no matching device is found.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Changes in v2:
- Fixed the documentation (Jakub)
- Renamed the function from dev_getbyhwaddr_rtnl() to dev_getbyhwaddr()
  (Jakub)
- Exported the function in the header (Jakub)
- Link to v1: https://lore.kernel.org/r/20250207-arm_fix_selftest-v1-1-487518d2fd1c@debian.org

---
Breno Leitao (2):
      net: document return value of dev_getbyhwaddr_rcu()
      net: Add dev_getbyhwaddr_rtnl() helper

 include/linux/netdevice.h |  2 ++
 net/core/dev.c            | 38 ++++++++++++++++++++++++++++++++++----
 2 files changed, 36 insertions(+), 4 deletions(-)
---
base-commit: 0d5248724ed8bc68c867c4c65dda625277f68fbc
change-id: 20250207-arm_fix_selftest-ee29dbc33a06

Best regards,
-- 
Breno Leitao <leitao@debian.org>


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [PATCH net-next v2 2/2] net: Add dev_getbyhwaddr_rtnl() helper
@ 2025-02-11 11:49 Iwashima, Kuniyuki
  2025-02-11 13:16 ` Breno Leitao
  0 siblings, 1 reply; 12+ messages in thread
From: Iwashima, Kuniyuki @ 2025-02-11 11:49 UTC (permalink / raw)
  To: Breno Leitao, Uday Shankar
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Andrew Lunn, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, kernel-team@meta.com

From: Breno Leitao <leitao@debian.org>
Date: Tue, 11 Feb 2025 03:36:43 -0800
> > > +struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type,
> > > +                              const char *ha)
> > > +{
> > > +   struct net_device *dev;
> > > +
> > > +   ASSERT_RTNL();
> > > +   for_each_netdev(net, dev)
> > > +           if (dev_comp_addr(dev, type, ha))
> > > +                   return dev;
> > > +
> > > +   return NULL;
> > > +}
> > > +EXPORT_SYMBOL(dev_getbyhwaddr);
> >
> > Commit title should change to reflect the new function name in v2.
> >
> > Separately - how should I combine this with
> > https://lore.kernel.org/netdev/20250205-netconsole-v3-0-132a31f17199@purestorage.com/?
> > I see three options:
> > - combine the two series into one
> 
> I would suggest you combine the two series into one.
> 
> I will send a v3 today adjusting the comments, and you can integrated
> them into your patchset.

I suggest Breno post v3 for net.git with arp fix and then net.git
will be merged to net-next on Thursday, then Uday can respin.

If this is posted to net-next.git, the following arp fix needs to
wait for the next cycle so that net-next.git will be merged to
net.git.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-02-11 13:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 11:56 [PATCH net-next v2 0/2] net: core: improvements to device lookup by hardware address Breno Leitao
2025-02-10 11:56 ` [PATCH net-next v2 1/2] net: document return value of dev_getbyhwaddr_rcu() Breno Leitao
2025-02-11  0:53   ` Kuniyuki Iwashima
2025-02-10 11:56 ` [PATCH net-next v2 2/2] net: Add dev_getbyhwaddr_rtnl() helper Breno Leitao
2025-02-11  1:03   ` Kuniyuki Iwashima
2025-02-11 11:38     ` Breno Leitao
2025-02-11  8:10   ` Uday Shankar
2025-02-11 11:36     ` Breno Leitao
2025-02-11  1:09 ` [PATCH net-next v2 0/2] net: core: improvements to device lookup by hardware address Kuniyuki Iwashima
2025-02-11 11:41   ` Breno Leitao
  -- strict thread matches above, loose matches on Subject: below --
2025-02-11 11:49 [PATCH net-next v2 2/2] net: Add dev_getbyhwaddr_rtnl() helper Iwashima, Kuniyuki
2025-02-11 13:16 ` Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).