]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ice: Fix couple of issues in ice_vsi_release
authorBrett Creeley <brett.creeley@intel.com>
Tue, 16 Apr 2019 17:24:37 +0000 (10:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:10:15 +0000 (09:10 +0200)
[ Upstream commit aa6ccf3f2d7042f94c4e91538956ce7051e7856e ]

Currently the driver is calling ice_napi_del() and then
unregister_netdev(). The call to unregister_netdev() will result in a
call to ice_stop() and then ice_vsi_close(). This is where we call
napi_disable() for all the MSI-X vectors. This flow is reversed so make
the changes to ensure napi_disable() happens prior to napi_del().

Before calling napi_del() and free_netdev() make sure
unregister_netdev() was called. This is done by making sure the
__ICE_DOWN bit is set in the vsi->state for the interested VSI.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ice/ice.h
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/ice/ice_main.c

index 792e6e42030e164dd4800c105792d3e3db1b40d5..754c7080c3fc60e17cf029186eed6ab4ccd636f0 100644 (file)
@@ -451,7 +451,6 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
 int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
 void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);
 void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
-void ice_napi_del(struct ice_vsi *vsi);
 #ifdef CONFIG_DCB
 int ice_pf_ena_all_vsi(struct ice_pf *pf, bool locked);
 void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked);
index fbf1eba0cc2afe5c7038209e40ab01925d8d30b0..f14fa51cc7047c82126353bd7f60b1f5a3687b73 100644 (file)
@@ -2754,19 +2754,14 @@ int ice_vsi_release(struct ice_vsi *vsi)
 
        if (vsi->type == ICE_VSI_VF)
                vf = &pf->vf[vsi->vf_id];
-       /* do not unregister and free netdevs while driver is in the reset
-        * recovery pending state. Since reset/rebuild happens through PF
-        * service task workqueue, its not a good idea to unregister netdev
-        * that is associated to the PF that is running the work queue items
-        * currently. This is done to avoid check_flush_dependency() warning
-        * on this wq
+       /* do not unregister while driver is in the reset recovery pending
+        * state. Since reset/rebuild happens through PF service task workqueue,
+        * it's not a good idea to unregister netdev that is associated to the
+        * PF that is running the work queue items currently. This is done to
+        * avoid check_flush_dependency() warning on this wq
         */
-       if (vsi->netdev && !ice_is_reset_in_progress(pf->state)) {
-               ice_napi_del(vsi);
+       if (vsi->netdev && !ice_is_reset_in_progress(pf->state))
                unregister_netdev(vsi->netdev);
-               free_netdev(vsi->netdev);
-               vsi->netdev = NULL;
-       }
 
        if (test_bit(ICE_FLAG_RSS_ENA, pf->flags))
                ice_rss_clean(vsi);
@@ -2799,6 +2794,13 @@ int ice_vsi_release(struct ice_vsi *vsi)
        ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx);
        ice_vsi_delete(vsi);
        ice_vsi_free_q_vectors(vsi);
+
+       /* make sure unregister_netdev() was called by checking __ICE_DOWN */
+       if (vsi->netdev && test_bit(__ICE_DOWN, vsi->state)) {
+               free_netdev(vsi->netdev);
+               vsi->netdev = NULL;
+       }
+
        ice_vsi_clear_rings(vsi);
 
        ice_vsi_put_qs(vsi);
index 7843abf4d44df59309e9f33a887674a4782ad6bf..dbf3d39ad8b1b01f9262aa8abca115f82863fddf 100644 (file)
@@ -1667,7 +1667,7 @@ skip_req_irq:
  * ice_napi_del - Remove NAPI handler for the VSI
  * @vsi: VSI for which NAPI handler is to be removed
  */
-void ice_napi_del(struct ice_vsi *vsi)
+static void ice_napi_del(struct ice_vsi *vsi)
 {
        int v_idx;