RE: [Intel-wired-lan] [PATCH iwl-next 3/4] iavf: wait for PF confirmation before removing VLAN filters

From: Romanowski, Rafal

Date: Thu Apr 09 2026 - 06:12:18 EST


> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf Of Petr
> Oros
> Sent: Monday, March 16, 2026 11:42 AM
> To: netdev@xxxxxxxxxxxxxxx
> Cc: Kitszel, Przemyslaw <przemyslaw.kitszel@xxxxxxxxx>; Eric Dumazet
> <edumazet@xxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; Andrew Lunn
> <andrew+netdev@xxxxxxx>; Nguyen, Anthony L <anthony.l.nguyen@xxxxxxxxx>;
> intel-wired-lan@xxxxxxxxxxxxxxxx; Keller, Jacob E <jacob.e.keller@xxxxxxxxx>;
> Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>; David S.
> Miller <davem@xxxxxxxxxxxxx>
> Subject: [Intel-wired-lan] [PATCH iwl-next 3/4] iavf: wait for PF confirmation
> before removing VLAN filters
>
> The VLAN filter DELETE path was asymmetric with the ADD path: ADD waits for
> PF confirmation (ADD -> ADDING -> ACTIVE), but DELETE immediately frees the
> filter struct after sending the DEL message without waiting for the PF response.
>
> This is problematic because:
> - If the PF rejects the DEL, the filter remains in HW but the driver
> has already freed the tracking structure, losing sync.
> - Race conditions between DEL pending and other operations
> (add, reset) cannot be properly resolved if the filter struct
> is already gone.
>
> Add IAVF_VLAN_REMOVING state to make the DELETE path symmetric:
>
> REMOVE -> REMOVING (send DEL) -> PF confirms -> kfree
> -> PF rejects -> ACTIVE
>
> In iavf_del_vlans(), transition filters from REMOVE to REMOVING instead of
> immediately freeing them. The new DEL completion handler in
> iavf_virtchnl_completion() frees filters on success or reverts them to ACTIVE on
> error.
>
> Update iavf_add_vlan() to handle the REMOVING state: if a DEL is pending and
> the user re-adds the same VLAN, queue it for ADD so it gets re-programmed after
> the PF processes the DEL.
>
> The !VLAN_FILTERING_ALLOWED early-exit path still frees filters directly since no
> PF message is sent in that case.
>
> Signed-off-by: Petr Oros <poros@xxxxxxxxxx>
> ---
> drivers/net/ethernet/intel/iavf/iavf.h | 1 +
> drivers/net/ethernet/intel/iavf/iavf_main.c | 9 +++--
> .../net/ethernet/intel/iavf/iavf_virtchnl.c | 37 +++++++++++++------
> 3 files changed, 32 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/iavf/iavf.h
> b/drivers/net/ethernet/intel/iavf/iavf.h
> index 1ad00690622c8e..f9ad814d18b1da 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf.h
> +++ b/drivers/net/ethernet/intel/iavf/iavf.h
> @@ -161,6 +161,7 @@ enum iavf_vlan_state_t {


Tested-by: Rafal Romanowski <rafal.romanowski@xxxxxxxxx>