RE: [Intel-wired-lan] [PATCH net-next v9 1/7] net: core: Add state tracking for async netdev ops
From: Loktionov, Aleksandr <hidden>
Date: 2026-03-16 07:26:01
Also in:
intel-wired-lan, lkml, virtualization
-----Original Message----- From: Intel-wired-lan <redacted> On Behalf Of I Viswanath Sent: Saturday, March 14, 2026 7:28 PM To: stfomichev@gmail.com; horms@kernel.org; edumazet@google.com; pabeni@redhat.com; andrew+netdev@lunn.ch; kuba@kernel.org; davem@davemloft.net; eperezma@redhat.com; xuanzhuo@linux.alibaba.com; jasowang@redhat.com; mst@redhat.com; Kitszel, Przemyslaw [off-list ref]; Nguyen, Anthony L [off-list ref]; Keller, Jacob E [off-list ref]; ronak.doshi@broadcom.com; pcnet32@frontier.com Cc: bcm-kernel-feedback-list@broadcom.com; netdev@vger.kernel.org; virtualization@lists.linux.dev; intel-wired-lan@lists.osuosl.org; linux-kernel@vger.kernel.org; I Viswanath [off-list ref] Subject: [Intel-wired-lan] [PATCH net-next v9 1/7] net: core: Add state tracking for async netdev ops Async netdev ops are tricky because of the following problems: 1) Freeing the context associated with async netdev ops might require waiting for completion of the associated work which might require the rtnl lock or the instance lock. However this will deadlock in __dev_close_many as the cleanup is done with those locks already held. 2) We need a way to enable/disable async netdev ops depending on the PM state to allow/prevent hardware access as appropriate. We solve these problems by introducing a state variable to track the current state of netdev. This can take the following values: - ACTIVE (up and normal operation) - DOWN (down) - INACTIVE (in suspend/shutdown) To solve 1, we set the state to down in __dev_close_many. In the associated op handler, we check for the current state and return if the netdev is down. To solve 2, the commit introduces the following functions: - netif_enable_async_ops -> sets state to ACTIVE - netif_disable_async_ops -> sets state to INACTIVE and cancels any pending work as required. The op implementation can use the state information to do the required processing. Signed-off-by: I Viswanath <redacted> --- include/linux/netdevice.h | 29 ++++++++++++++ net/core/dev.c | 84 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 111 insertions(+), 2 deletions(-)
...
-- 2.47.3
Reviewed-by: Aleksandr Loktionov <redacted>