RE: [Intel-wired-lan] [PATCH net-next v9 1/7] net: core: Add state tracking for async netdev ops
From: Loktionov, Aleksandr
Date: Mon Mar 16 2026 - 03:27:10 EST
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf
> Of I Viswanath
> Sent: Saturday, March 14, 2026 7:28 PM
> To: stfomichev@xxxxxxxxx; horms@xxxxxxxxxx; edumazet@xxxxxxxxxx;
> pabeni@xxxxxxxxxx; andrew+netdev@xxxxxxx; kuba@xxxxxxxxxx;
> davem@xxxxxxxxxxxxx; eperezma@xxxxxxxxxx; xuanzhuo@xxxxxxxxxxxxxxxxx;
> jasowang@xxxxxxxxxx; mst@xxxxxxxxxx; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; Nguyen, Anthony L
> <anthony.l.nguyen@xxxxxxxxx>; Keller, Jacob E
> <jacob.e.keller@xxxxxxxxx>; ronak.doshi@xxxxxxxxxxxx;
> pcnet32@xxxxxxxxxxxx
> Cc: bcm-kernel-feedback-list@xxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx;
> virtualization@xxxxxxxxxxxxxxx; intel-wired-lan@xxxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; I Viswanath
> <viswanathiyyappan@xxxxxxxxx>
> 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 <viswanathiyyappan@xxxxxxxxx>
> ---
> include/linux/netdevice.h | 29 ++++++++++++++
> net/core/dev.c | 84
> ++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 111 insertions(+), 2 deletions(-)
>
...
> --
> 2.47.3
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>