net: protect NAPI enablement with netdev_lock()
authorJakub Kicinski <kuba@kernel.org>
Wed, 15 Jan 2025 03:53:14 +0000 (19:53 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 16 Jan 2025 03:13:34 +0000 (19:13 -0800)
commit413f0271f3966e0c73d4937963f19335af19e628
tree2dbbae26011130382d7864b13982b04d447c5e11
parent1b23cdbd2bbc4b40e21c12ae86c2781e347ff0f8
net: protect NAPI enablement with netdev_lock()

Wrap napi_enable() / napi_disable() with netdev_lock().
Provide the "already locked" flavor of the API.

iavf needs the usual adjustment. A number of drivers call
napi_enable() under a spin lock, so they have to be modified
to take netdev_lock() first, then spin lock then call
napi_enable_locked().

Protecting napi_enable() implies that napi->napi_id is protected
by netdev_lock().

Acked-by: Francois Romieu <romieu@fr.zoreil.com> # via-velocity
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250115035319.559603-7-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/amd/pcnet32.c
drivers/net/ethernet/intel/iavf/iavf_main.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/via/via-velocity.c
include/linux/netdevice.h
net/core/dev.c