linux/drivers/net/ethernet/intel/ice
Jacob Keller 19281e8668 ice: use ice_for_each_vf for iteration during removal
When removing VFs, the driver takes a weird approach of assigning
pf->num_alloc_vfs to 0 before iterating over the VFs using a temporary
variable.

This logic has been in the driver for a long time, and seems to have
been carried forward from i40e.

We want to refactor the way VFs are stored, and iterating over the data
structure without the ice_for_each_vf interface impedes this work.

The logic relies on implicitly using the num_alloc_vfs as a sort of
"safe guard" for accessing VF data.

While this sort of guard makes sense for Single Root IOV where all VFs
are added at once, the data structures don't work for VFs which can be
added and removed dynamically. We also have a separate state flag,
ICE_VF_DEINIT_IN_PROGRESS which is a stronger protection against
concurrent removal and access.

Avoid the custom tmp iteration and replace it with the standard
ice_for_each_vf iterator. Delay the assignment of num_alloc_vfs until
after this loop finishes.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2022-03-03 08:46:48 -08:00
..
ice_adminq_cmd.h ice: add TTY for GNSS module for E810T device 2022-03-03 14:11:00 +00:00
ice_arfs.c ice: make use of ice_for_each_* macros 2021-10-15 07:39:03 -07:00
ice_arfs.h ice: use static inline for dummy functions 2021-06-07 08:59:01 -07:00
ice_base.c ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
ice_base.h ice: split ice_ring onto Tx/Rx separate structs 2021-10-15 07:39:02 -07:00
ice_cgu_regs.h ice: ensure the hardware Clock Generation Unit is configured 2021-12-21 09:11:40 -08:00
ice_common.c ice: add TTY for GNSS module for E810T device 2022-03-03 14:11:00 +00:00
ice_common.h ice: add TTY for GNSS module for E810T device 2022-03-03 14:11:00 +00:00
ice_controlq.c ice: Cleanup after ice_status removal 2021-12-14 10:19:13 -08:00
ice_controlq.h ice: add support for sideband messages 2021-06-11 07:38:00 -07:00
ice_dcb_lib.c ice: Add hot path support for 802.1Q and 802.1ad VLAN offloads 2022-02-09 09:24:45 -08:00
ice_dcb_lib.h ice: Add infrastructure for mqprio support via ndo_setup_tc 2021-10-20 15:57:54 -07:00
ice_dcb_nl.c ice: Fix problems with DSCP QoS implementation 2021-12-07 13:21:01 -08:00
ice_dcb_nl.h ice: use static inline for dummy functions 2021-06-07 08:59:01 -07:00
ice_dcb.c ice: Cleanup after ice_status removal 2021-12-14 10:19:13 -08:00
ice_dcb.h ice: Cleanup after ice_status removal 2021-12-14 10:19:13 -08:00
ice_devids.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-10-22 11:41:16 +01:00
ice_devlink.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-12-31 14:35:40 +00:00
ice_devlink.h net/ice: Remove unused enum 2021-11-30 08:02:12 -08:00
ice_eswitch.c ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
ice_eswitch.h ice: improve switchdev's slow-path 2022-01-06 10:15:09 -08:00
ice_ethtool_fdir.c ice: Add flow director support for channel mode 2021-12-30 13:16:07 +00:00
ice_ethtool.c Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 2022-02-10 11:00:13 +00:00
ice_fdir.c ice: Cleanup after ice_status removal 2021-12-14 10:19:13 -08:00
ice_fdir.h ice: Add flow director support for channel mode 2021-12-30 13:16:07 +00:00
ice_flex_pipe.c ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_flex_pipe.h ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_flex_type.h ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_flow.c ice: Add flow director support for channel mode 2021-12-30 13:16:07 +00:00
ice_flow.h ice: Add flow director support for channel mode 2021-12-30 13:16:07 +00:00
ice_fltr.c ice: Use the proto argument for VLAN ops 2022-02-09 09:24:45 -08:00
ice_fltr.h ice: Introduce ice_vlan struct 2022-02-09 09:24:45 -08:00
ice_fw_update.c ice: support immediate firmware activation via devlink reload 2021-12-15 08:40:38 -08:00
ice_fw_update.h ice: support immediate firmware activation via devlink reload 2021-12-15 08:40:38 -08:00
ice_gnss.c ice: add TTY for GNSS module for E810T device 2022-03-03 14:11:00 +00:00
ice_gnss.h ice: add TTY for GNSS module for E810T device 2022-03-03 14:11:00 +00:00
ice_hw_autogen.h ice: support crosstimestamping on E822 devices if supported 2021-12-21 09:11:40 -08:00
ice_idc_int.h ice: Implement iidc operations 2021-05-28 20:11:13 -07:00
ice_idc.c ice: Simplify tracking status of RDMA support 2022-02-14 13:35:12 +00:00
ice_lag.c ice: Fix KASAN error in LAG NETDEV_UNREGISTER handler 2022-02-10 08:47:26 -08:00
ice_lag.h
ice_lan_tx_rx.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-10 17:29:56 -08:00
ice_lib.c ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
ice_lib.h ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
ice_main.c ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
ice_nvm.c net: fixup build after bpf header changes 2022-01-04 12:34:19 +00:00
ice_nvm.h ice: support immediate firmware activation via devlink reload 2021-12-15 08:40:38 -08:00
ice_osdep.h ice: Add new VSI VLAN ops 2022-02-09 09:24:45 -08:00
ice_pf_vsi_vlan_ops.c ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_pf_vsi_vlan_ops.h ice: Add outer_vlan_ops and VSI specific VLAN ops implementations 2022-02-09 09:24:45 -08:00
ice_protocol_type.h ice: Match on all profiles in slow-path 2022-02-18 13:22:06 -08:00
ice_ptp_consts.h ice: ensure the hardware Clock Generation Unit is configured 2021-12-21 09:11:40 -08:00
ice_ptp_hw.c ice: add TTY for GNSS module for E810T device 2022-03-03 14:11:00 +00:00
ice_ptp_hw.h ice: add TTY for GNSS module for E810T device 2022-03-03 14:11:00 +00:00
ice_ptp.c ice: check the return of ice_ptp_gettimex64 2022-02-18 13:28:39 -08:00
ice_ptp.h ice: exit bypass mode once hardware finishes timestamp calibration 2021-12-21 09:11:40 -08:00
ice_repr.c ice: refactor unwind cleanup in eswitch mode 2022-03-03 08:46:47 -08:00
ice_repr.h ice: improve switchdev's slow-path 2022-01-06 10:15:09 -08:00
ice_sbq_cmd.h ice: add support for sideband messages 2021-06-11 07:38:00 -07:00
ice_sched.c ice: Remove unnecessary casts 2021-12-14 10:19:14 -08:00
ice_sched.h ice: Cleanup after ice_status removal 2021-12-14 10:19:13 -08:00
ice_sriov.c ice: Remove enum ice_status 2021-12-14 10:19:13 -08:00
ice_sriov.h ice: Use int for ice_status 2021-12-14 10:19:13 -08:00
ice_switch.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-24 17:54:25 -08:00
ice_switch.h ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_tc_lib.c ice: fix setting l4 port flag when adding filter 2022-02-18 13:28:18 -08:00
ice_tc_lib.h ice: VXLAN and Geneve TC support 2021-10-28 11:00:18 -07:00
ice_trace.h ice: split ice_ring onto Tx/Rx separate structs 2021-10-15 07:39:02 -07:00
ice_txrx_lib.c Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 2022-02-10 11:00:13 +00:00
ice_txrx_lib.h ice: Add hot path support for 802.1Q and 802.1ad VLAN offloads 2022-02-09 09:24:45 -08:00
ice_txrx.c ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
ice_txrx.h Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 2022-02-10 11:00:13 +00:00
ice_type.h ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_vf_vsi_vlan_ops.c ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
ice_vf_vsi_vlan_ops.h ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2 2022-02-09 09:24:45 -08:00
ice_virtchnl_allowlist.c ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2 2022-02-09 09:24:45 -08:00
ice_virtchnl_allowlist.h
ice_virtchnl_fdir.c ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
ice_virtchnl_fdir.h
ice_virtchnl_pf.c ice: use ice_for_each_vf for iteration during removal 2022-03-03 08:46:48 -08:00
ice_virtchnl_pf.h ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2 2022-02-09 09:24:45 -08:00
ice_vlan_mode.c ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_vlan_mode.h ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_vlan.h ice: Use the proto argument for VLAN ops 2022-02-09 09:24:45 -08:00
ice_vsi_vlan_lib.c ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_vsi_vlan_lib.h ice: Add outer_vlan_ops and VSI specific VLAN ops implementations 2022-02-09 09:24:45 -08:00
ice_vsi_vlan_ops.c ice: Add outer_vlan_ops and VSI specific VLAN ops implementations 2022-02-09 09:24:45 -08:00
ice_vsi_vlan_ops.h ice: Support configuring the device to Double VLAN Mode 2022-02-09 09:24:45 -08:00
ice_xsk.c Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 2022-02-10 11:00:13 +00:00
ice_xsk.h ice: xsk: Improve AF_XDP ZC Tx and use batching API 2022-01-27 17:25:33 +01:00
ice.h ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
Makefile ice: add TTY for GNSS module for E810T device 2022-03-03 14:11:00 +00:00