]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ice: Fix spurious interrupt during removal of trusted VF
authorNorbert Zulinski <norbertx.zulinski@intel.com>
Mon, 10 Oct 2022 14:22:22 +0000 (10:22 -0400)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 9 Nov 2022 21:20:38 +0000 (13:20 -0800)
Previously, during removal of trusted VF when VF is down there was
number of spurious interrupt equal to number of queues on VF.

Add check if VF already has inactive queues. If VF is disabled and
has inactive rx queues then do not disable rx queues.
Add check in ice_vsi_stop_tx_ring if it's VF's vsi and if VF is
disabled.

Fixes: efe41860008e ("ice: Fix memory corruption in VF driver")
Signed-off-by: Norbert Zulinski <norbertx.zulinski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_base.c
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/ice/ice_lib.h
drivers/net/ethernet/intel/ice/ice_vf_lib.c

index 9e36f01dfa4fb70c2d3ec7e3e0876b2bf3deadeb..e864634d66bc6c2862430ef150b14b4ae9601673 100644 (file)
@@ -958,7 +958,7 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
         * associated to the queue to schedule NAPI handler
         */
        q_vector = ring->q_vector;
-       if (q_vector)
+       if (q_vector && !(vsi->vf && ice_is_vf_disabled(vsi->vf)))
                ice_trigger_sw_intr(hw, q_vector);
 
        status = ice_dis_vsi_txq(vsi->port_info, txq_meta->vsi_idx,
index 938ba8c215cb07f85cb5bc840e3950128ab91983..7276badfa19ea5d88d9e0ff02f5dc6348cde0927 100644 (file)
@@ -2239,6 +2239,31 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi)
        return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings, vsi->num_xdp_txq);
 }
 
+/**
+ * ice_vsi_is_rx_queue_active
+ * @vsi: the VSI being configured
+ *
+ * Return true if at least one queue is active.
+ */
+bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi)
+{
+       struct ice_pf *pf = vsi->back;
+       struct ice_hw *hw = &pf->hw;
+       int i;
+
+       ice_for_each_rxq(vsi, i) {
+               u32 rx_reg;
+               int pf_q;
+
+               pf_q = vsi->rxq_map[i];
+               rx_reg = rd32(hw, QRX_CTRL(pf_q));
+               if (rx_reg & QRX_CTRL_QENA_STAT_M)
+                       return true;
+       }
+
+       return false;
+}
+
 /**
  * ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not
  * @vsi: VSI to check whether or not VLAN pruning is enabled.
index ec4bf0c89857c6c1ea7c5a81c135d53b2f065b6b..dcdf69a693e9172688f3a38ffa40263a1b2ea23e 100644 (file)
@@ -129,4 +129,5 @@ u16 ice_vsi_num_non_zero_vlans(struct ice_vsi *vsi);
 bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f);
 void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f);
 void ice_init_feature_support(struct ice_pf *pf);
+bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi);
 #endif /* !_ICE_LIB_H_ */
index 0abeed092de1d21d86432a02b8b9da2cf3a6ccda..1c51778db951ba8516db4b98acf4840da70a6b7c 100644 (file)
@@ -576,7 +576,10 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
                        return -EINVAL;
                }
                ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id);
-               ice_vsi_stop_all_rx_rings(vsi);
+
+               if (ice_vsi_is_rx_queue_active(vsi))
+                       ice_vsi_stop_all_rx_rings(vsi);
+
                dev_dbg(dev, "VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n",
                        vf->vf_id);
                return 0;