mbox series

[net-next,v2,0/2] net: core: improvements to device lookup by hardware address.

Message ID 20250210-arm_fix_selftest-v2-0-ba84b5bc58c8@debian.org (mailing list archive)
Headers show
Series net: core: improvements to device lookup by hardware address. | expand

Message

Breno Leitao Feb. 10, 2025, 11:56 a.m. UTC
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,

Comments

Kuniyuki Iwashima Feb. 11, 2025, 1:09 a.m. UTC | #1
From: Breno Leitao <leitao@debian.org>
Date: Mon, 10 Feb 2025 03:56:12 -0800
> The first patch adds a new dev_getbyhwaddr() helper function for

nit: second

> finding devices by hardware address when the RTNL lock is held. This
> prevents PROVE_LOCKING warnings that occurred when RTNL was held but the

Same comment for patch 2, this itself doens't fix the warning.
Also, patch 2 & 3 should be net.git materials ?  Maybe squash
the two and add a Fixes tag then.


> 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

nit: first


> 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.
Breno Leitao Feb. 11, 2025, 11:41 a.m. UTC | #2
On Tue, Feb 11, 2025 at 10:09:27AM +0900, Kuniyuki Iwashima wrote:
> From: Breno Leitao <leitao@debian.org>
> Date: Mon, 10 Feb 2025 03:56:12 -0800
> > The first patch adds a new dev_getbyhwaddr() helper function for
> 
> nit: second
> 
> > finding devices by hardware address when the RTNL lock is held. This
> > prevents PROVE_LOCKING warnings that occurred when RTNL was held but the
> 
> Same comment for patch 2, this itself doens't fix the warning.
> Also, patch 2 & 3 should be net.git materials ?  Maybe squash
> the two and add a Fixes tag then.

I am not sure this should be against net, since the main user of it will
be targeting net-next.

Also, I don't see it as a fix itself, but a new API that users can
leverage once it is landed, thus, focusing on net-next.

Thanks for the review
--breno