net: add helpers for lookup and walking netdevs under netdev_lock()
authorJakub Kicinski <kuba@kernel.org>
Wed, 15 Jan 2025 03:53:11 +0000 (19:53 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 16 Jan 2025 03:13:33 +0000 (19:13 -0800)
commit2628f4958cd4a8be2f14b611c67ef9766c5ee564
tree004c79cd2cd2ffb9fc1d91f3f98b793ba4f31eb5
parent5fda3f35349b6b7f22f5f5095a3821261d515075
net: add helpers for lookup and walking netdevs under netdev_lock()

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).

Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250115035319.559603-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/dev.c
net/core/dev.h