ice: Clear default forwarding VSI during VSI release
Subsystems (3)
PATCH 1/1 ice: Clear default forwarding VSI during VSI release
VSI is set as default forwarding one when promisc mode is set for PF interface, when PF is switched to switchdev mode or when VF driver asks to enable allmulticast or promisc mode for the VF interface (when vf-true-promisc-support priv flag is off). The third case is buggy because in that case VSI associated with VF remains as default one after VF removal.
Reproducer:
1. Create VF
echo 1 > sys/class/net/ens7f0/device/sriov_numvfs
2. Enable allmulticast or promisc mode on VF ip link set ens7f0v0 allmulticast on
ip link set ens7f0v0 promisc on
3. Delete VF
echo 0 > sys/class/net/ens7f0/device/sriov_numvfs
4. Try to enable promisc mode on PF
ip link set ens7f0 promisc on
Although it looks that promisc mode on PF is enabled the opposite is true because ice_vsi_sync_fltr() responsible for IFF_PROMISC handling first checks if any other VSI is set as default forwarding one and if so the function does not do anything. At this point it is not possible to enable promisc mode on PF without re-probe device.
To resolve the issue this patch clear default forwarding VSI during ice_vsi_release() when the VSI to be released is the default one.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/ice/ice_lib.c +2 -0
@@ -3147,6 +3147,8 @@ int ice_vsi_release(struct ice_vsi *vsi) } } +if (ice_is_vsi_dflt_vsi (pf->first_sw, vsi)) +ice_clear_dflt_vsi (pf->first_sw);ice_fltr_remove_all (vsi);ice_rm_vsi_lan_cfg (vsi->port_info, vsi->idx); err =ice_rm_vsi_rdma_cfg (vsi->port_info, vsi->idx);
Signature · 1 line
2.34.1
Quoted 40 lines · Ivan Vecera
VSI is set as default forwarding one when promisc mode is set for PF interface, when PF is switched to switchdev mode or when VF driver asks to enable allmulticast or promisc mode for the VF interface (when vf-true-promisc-support priv flag is off). The third case is buggy because in that case VSI associated with VF remains as default one after VF removal.
Reproducer:
1. Create VF
echo 1 > sys/class/net/ens7f0/device/sriov_numvfs
2. Enable allmulticast or promisc mode on VF ip link set ens7f0v0 allmulticast on
ip link set ens7f0v0 promisc on
3. Delete VF
echo 0 > sys/class/net/ens7f0/device/sriov_numvfs
4. Try to enable promisc mode on PF
ip link set ens7f0 promisc onAlthough it looks that promisc mode on PF is enabled the opposite is true because
ice_vsi_sync_fltr()responsible forIFF_PROMISChandling first checks if any other VSI is set as default forwarding one and if so the function does not do anything. At this point it is not possible to enable promisc mode on PF without re-probe device.To resolve the issue this patch clear default forwarding VSI during
ice_vsi_release()when the VSI to be released is the default one.Fixes 01b5e89aab49 ("ice: Add VF promiscuous support")Signed-off-by Ivan Vecera <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/intel/ice/ice_lib.c +0
-0
drivers/net/ethernet/intel/ice/ice_lib.c int ice_vsi_release(struct ice_vsi *vsi) · line 3151
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_lib.c +2
-0@@ -3147,6 +3147,8 @@ int ice_vsi_release(struct ice_vsi *vsi) } } +if (ice_is_vsi_dflt_vsi (pf->first_sw, vsi)) +ice_clear_dflt_vsi (pf->first_sw);
It would probably be good to check ice_clear_dflt_vsi return code.
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_lib.c +0
-0ice_fltr_remove_all (vsi);ice_rm_vsi_lan_cfg (vsi->port_info, vsi->idx); err =ice_rm_vsi_rdma_cfg (vsi->port_info, vsi->idx);
PATCH 1/1 ice: Clear default forwarding VSI during VSI release
Quoted 44 lines · On Wed, 23 Mar 2022 18:39:11 +0100 Marcin Szycik…
Quoted 43 lines · Ivan Vecera
VSI is set as default forwarding one when promisc mode is set for PF interface, when PF is switched to switchdev mode or when VF driver asks to enable allmulticast or promisc mode for the VF interface (when vf-true-promisc-support priv flag is off). The third case is buggy because in that case VSI associated with VF remains as default one after VF removal.
Reproducer:
1. Create VF
echo 1 > sys/class/net/ens7f0/device/sriov_numvfs
2. Enable allmulticast or promisc mode on VF ip link set ens7f0v0 allmulticast on
ip link set ens7f0v0 promisc on
3. Delete VF
echo 0 > sys/class/net/ens7f0/device/sriov_numvfs
4. Try to enable promisc mode on PF
ip link set ens7f0 promisc onAlthough it looks that promisc mode on PF is enabled the opposite is true because
ice_vsi_sync_fltr()responsible forIFF_PROMISChandling first checks if any other VSI is set as default forwarding one and if so the function does not do anything. At this point it is not possible to enable promisc mode on PF without re-probe device.To resolve the issue this patch clear default forwarding VSI during
ice_vsi_release()when the VSI to be released is the default one.Fixes 01b5e89aab49 ("ice: Add VF promiscuous support")Signed-off-by Ivan Vecera <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/intel/ice/ice_lib.c +0
-0@@ -3147,6 +3147,8 @@ int ice_vsi_release(struct ice_vsi *vsi) } }
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_lib.c int ice_vsi_release(struct ice_vsi *vsi) · line 3151
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_lib.c +2
-0+if (ice_is_vsi_dflt_vsi (pf->first_sw, vsi)) +ice_clear_dflt_vsi (pf->first_sw);It would probably be good to check
ice_clear_dflt_vsireturn code.
Check and report potential warning when error occurs? because we are in ice_vsi_release() so any rollback does not make sense.
Ivan
Quoted 47 lines · Ivan Vecera
Quoted 44 lines · On Wed, 23 Mar 2022 18:39:11 +0100 Marcin Szycik…
Quoted 43 lines · Ivan Vecera
VSI is set as default forwarding one when promisc mode is set for PF interface, when PF is switched to switchdev mode or when VF driver asks to enable allmulticast or promisc mode for the VF interface (when vf-true-promisc-support priv flag is off). The third case is buggy because in that case VSI associated with VF remains as default one after VF removal.
Reproducer:
1. Create VF
echo 1 > sys/class/net/ens7f0/device/sriov_numvfs
2. Enable allmulticast or promisc mode on VF ip link set ens7f0v0 allmulticast on
ip link set ens7f0v0 promisc on
3. Delete VF
echo 0 > sys/class/net/ens7f0/device/sriov_numvfs
4. Try to enable promisc mode on PF
ip link set ens7f0 promisc onAlthough it looks that promisc mode on PF is enabled the opposite is true because
ice_vsi_sync_fltr()responsible forIFF_PROMISChandling first checks if any other VSI is set as default forwarding one and if so the function does not do anything. At this point it is not possible to enable promisc mode on PF without re-probe device.To resolve the issue this patch clear default forwarding VSI during
ice_vsi_release()when the VSI to be released is the default one.Fixes 01b5e89aab49 ("ice: Add VF promiscuous support")Signed-off-by Ivan Vecera <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/intel/ice/ice_lib.c +0
-0@@ -3147,6 +3147,8 @@ int ice_vsi_release(struct ice_vsi *vsi) } }
Quoted 7 lines
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_lib.c int ice_vsi_release(struct ice_vsi *vsi) · line 3151
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_lib.c +2
-0+if (ice_is_vsi_dflt_vsi (pf->first_sw, vsi)) +ice_clear_dflt_vsi (pf->first_sw);It would probably be good to check
ice_clear_dflt_vsireturn code.Check and report potential warning when error occurs? because we are in
ice_vsi_release()so any rollback does not make sense.
Right. ice_clear_dflt_vsi already reports errors so it should be good as is. LGTM, thanks!
Quoted 3 lines
Ivan
Maciej Fijalkowski
Reviewed-byQuoted 25 lines · Marcin Szycik
Quoted 22 lines · Ivan Vecera
Quoted 19 lines · On Wed, 23 Mar 2022 18:39:11 +0100 Marcin Szycik…
Quoted 18 lines · Ivan Vecera
VSI is set as default forwarding one when promisc mode is set for PF interface, when PF is switched to switchdev mode or when VF driver asks to enable allmulticast or promisc mode for the VF interface (when vf-true-promisc-support priv flag is off). The third case is buggy because in that case VSI associated with VF remains as default one after VF removal.
Reproducer:
1. Create VF
echo 1 > sys/class/net/ens7f0/device/sriov_numvfs
2. Enable allmulticast or promisc mode on VF ip link set ens7f0v0 allmulticast on
ip link set ens7f0v0 promisc on
3. Delete VF
echo 0 > sys/class/net/ens7f0/device/sriov_numvfs
4. Try to enable promisc mode on PF
ip link set ens7f0 promisc on
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Although it looks that promisc mode on PF is enabled the opposite is true because
ice_vsi_sync_fltr()responsible forIFF_PROMISChandling first checks if any other VSI is set as default forwarding one and if so the function does not do anything. At this point it is not possible to enable promisc mode on PF without re-probe device.To resolve the issue this patch clear default forwarding VSI
tiny nit:
s/clear/clears
Also it's more welcome to use imperative mood.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
during
ice_vsi_release()when the VSI to be released is the default one.Fixes 01b5e89aab49 ("ice: Add VF promiscuous support")Signed-off-by Ivan Vecera <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/intel/ice/ice_lib.c +0
-0@@ -3147,6 +3147,8 @@ int ice_vsi_release(struct ice_vsi *vsi) } }
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_lib.c int ice_vsi_release(struct ice_vsi *vsi) · line 3151
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_lib.c +2
-0+if (ice_is_vsi_dflt_vsi (pf->first_sw, vsi)) +ice_clear_dflt_vsi (pf->first_sw);It would probably be good to check
ice_clear_dflt_vsireturn code.Check and report potential warning when error occurs? because we are in
ice_vsi_release()so any rollback does not make sense.
I believe that comment wouldn't hurt that it's ok to ignore the retval, but then again i'm fine with what it is currently :)
Quoted 7 lines
Right.
ice_clear_dflt_vsialready reports errors so it should be good as is. LGTM, thanks!Quoted 3 lines
Ivan
Quoted 40 lines · Ivan Vecera
VSI is set as default forwarding one when promisc mode is set for PF interface, when PF is switched to switchdev mode or when VF driver asks to enable allmulticast or promisc mode for the VF interface (when vf-true-promisc-support priv flag is off). The third case is buggy because in that case VSI associated with VF remains as default one after VF removal.
Reproducer:
1. Create VF
echo 1 > sys/class/net/ens7f0/device/sriov_numvfs
2. Enable allmulticast or promisc mode on VF ip link set ens7f0v0 allmulticast on
ip link set ens7f0v0 promisc on
3. Delete VF
echo 0 > sys/class/net/ens7f0/device/sriov_numvfs
4. Try to enable promisc mode on PF
ip link set ens7f0 promisc onAlthough it looks that promisc mode on PF is enabled the opposite is true because
ice_vsi_sync_fltr()responsible forIFF_PROMISChandling first checks if any other VSI is set as default forwarding one and if so the function does not do anything. At this point it is not possible to enable promisc mode on PF without re-probe device.To resolve the issue this patch clear default forwarding VSI during
ice_vsi_release()when the VSI to be released is the default one.Fixes 01b5e89aab49 ("ice: Add VF promiscuous support")Signed-off-by Ivan Vecera <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/intel/ice/ice_lib.c +0
-0
drivers/net/ethernet/intel/ice/ice_lib.c int ice_vsi_release(struct ice_vsi *vsi) · line 3154
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_lib.c +2
-0@@ -3147,6 +3147,8 @@ int ice_vsi_release(struct ice_vsi *vsi) } } +if (ice_is_vsi_dflt_vsi (pf->first_sw, vsi)) +ice_clear_dflt_vsi (pf->first_sw);ice_fltr_remove_all (vsi);ice_rm_vsi_lan_cfg (vsi->port_info, vsi->idx); err =ice_rm_vsi_rdma_cfg (vsi->port_info, vsi->idx);
Thanks for fixing it.
Quoted 7 lines
Signature · 6 lines
2.34.1 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan at osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan