linux/drivers/net/ethernet/intel
Michal Swiatkowski ee7d79433d iavf: allow changing VLAN state without calling PF
First case:
> ip l a l $VF name vlanx type vlan id 100
> ip l d vlanx
> ip l a l $VF name vlanx type vlan id 100

As workqueue can be execute after sometime, there is a window to have
call trace like that:
- iavf_del_vlan
- iavf_add_vlan
- iavf_del_vlans (wq)

It means that our VLAN 100 will change the state from IAVF_VLAN_ACTIVE
to IAVF_VLAN_REMOVE (iavf_del_vlan). After that in iavf_add_vlan state
won't be changed because VLAN 100 is on the filter list. The final
result is that the VLAN 100 filter isn't added in hardware (no
iavf_add_vlans call).

To fix that change the state if the filter wasn't removed yet directly
to active. It is save as IAVF_VLAN_REMOVE means that virtchnl message
wasn't sent yet.

Second case:
> ip l a l $VF name vlanx type vlan id 100
Any type of VF reset ex. change trust
> ip l s $PF vf $VF_NUM trust on
> ip l d vlanx
> ip l a l $VF name vlanx type vlan id 100

In case of reset iavf driver is responsible for readding all filters
that are being used. To do that all VLAN filters state are changed to
IAVF_VLAN_ADD. Here is even longer window for changing VLAN state from
kernel side, as workqueue isn't called immediately. We can have call
trace like that:

- changing to IAVF_VLAN_ADD (after reset)
- iavf_del_vlan (called from kernel ops)
- iavf_del_vlans (wq)

Not exsisitng VLAN filters will be removed from hardware. It isn't a
bug, ice driver will handle it fine. However, we can have call trace
like that:

- changing to IAVF_VLAN_ADD (after reset)
- iavf_del_vlan (called from kernel ops)
- iavf_add_vlan (called from kernel ops)
- iavf_del_vlans (wq)

With fix for previous case we end up with no VLAN filters in hardware.
We have to remove VLAN filters if the state is IAVF_VLAN_ADD and delete
VLAN was called. It is save as IAVF_VLAN_ADD means that virtchnl message
wasn't sent yet.

Fixes: 0c0da0e951 ("iavf: refactor VLAN filter states")
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2025-01-24 10:52:09 -08:00
..
e1000 e1000: Hold RTNL when e1000_down can be called 2024-11-13 10:30:21 -08:00
e1000e Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-11-07 13:44:16 -08:00
fm10k intel/fm10k: Remove unused fm10k_iov_msg_mac_vlan_pf 2025-01-07 18:16:02 -08:00
i40e i40e: add ability to reset VF for Tx and Rx MDD events 2025-01-07 18:16:02 -08:00
iavf iavf: allow changing VLAN state without calling PF 2025-01-24 10:52:09 -08:00
ice ice: remove invalid parameter of equalizer 2025-01-24 10:49:42 -08:00
idpf idpf: add more info during virtchnl transaction timeout/salt mismatch 2025-01-24 10:03:39 -08:00
igb igb: Fix passing 0 to ERR_PTR in igb_run_xdp() 2025-01-07 18:15:54 -08:00
igbvf igbvf: remove unused spinlock 2024-11-13 10:30:21 -08:00
igc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-01-09 16:11:47 -08:00
ixgbe ixgbe: Fix passing 0 to ERR_PTR in ixgbe_run_xdp() 2025-01-07 18:15:57 -08:00
ixgbevf ixgbevf: Fix passing 0 to ERR_PTR in ixgbevf_run_xdp() 2025-01-07 18:15:59 -08:00
libeth module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
libie module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
e100.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
Kconfig ice: use <linux/packing.h> for Tx and Rx queue context data 2024-12-11 20:13:00 -08:00
Makefile net: intel: introduce {, Intel} Ethernet common library 2024-04-24 11:06:25 -07:00