]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ice: move ice_deinit_dev() to the end of deinit paths
authorPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Fri, 12 Sep 2025 13:06:26 +0000 (15:06 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 24 Oct 2025 20:27:20 +0000 (13:27 -0700)
ice_deinit_dev() takes care of turning off adminq processing, which is
much needed during driver teardown (remove, reset, error path). Move it
to the very end where applicable.
For example, ice_deinit_hw() called after adminq deinit slows rmmod on
my two-card setup by about 60 seconds.

ice_init_dev() and ice_deinit_dev() scopes were reduced by previous
commits of the series, with a final touch of extracting ice_init_dev_hw()
out now (there is no deinit counterpart).

Note that removed ice_service_task_stop() call from ice_remove() is placed
in the ice_deinit_dev() (and stopping twice makes no sense).

Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/devlink/devlink.c
drivers/net/ethernet/intel/ice/ice.h
drivers/net/ethernet/intel/ice/ice_common.c
drivers/net/ethernet/intel/ice/ice_main.c

index c354a03c950cd98ca66f33fd804fbd92f1546212..938914abbe06675ccc68c7a18a64e63992ac1164 100644 (file)
@@ -1233,6 +1233,7 @@ static int ice_devlink_reinit_up(struct ice_pf *pf)
 {
        struct ice_vsi *vsi = ice_get_main_vsi(pf);
        struct device *dev = ice_pf_to_dev(pf);
+       bool need_dev_deinit = false;
        int err;
 
        err = ice_init_hw(&pf->hw);
@@ -1276,9 +1277,11 @@ err_load:
 unroll_pf_init:
        ice_deinit_pf(pf);
 unroll_dev_init:
-       ice_deinit_dev(pf);
+       need_dev_deinit = true;
 unroll_hw_init:
        ice_deinit_hw(&pf->hw);
+       if (need_dev_deinit)
+               ice_deinit_dev(pf);
        return err;
 }
 
index 9a1abd45733729ea065d204ae5cc5e0f50e64479..9ee596773f34e7afa009827185edf6ece3c95067 100644 (file)
@@ -1033,6 +1033,7 @@ void ice_start_service_task(struct ice_pf *pf);
 int ice_load(struct ice_pf *pf);
 void ice_unload(struct ice_pf *pf);
 void ice_adv_lnk_speed_maps_init(void);
+void ice_init_dev_hw(struct ice_pf *pf);
 int ice_init_dev(struct ice_pf *pf);
 void ice_deinit_dev(struct ice_pf *pf);
 int ice_init_pf(struct ice_pf *pf);
index 2250426ec91b4cdcb47a7eae01d3fc0487f8de79..b097cc8b175cb2476e38791868d2ebb573d430f7 100644 (file)
@@ -1161,6 +1161,9 @@ int ice_init_hw(struct ice_hw *hw)
        status = ice_init_hw_tbls(hw);
        if (status)
                goto err_unroll_fltr_mgmt_struct;
+
+       ice_init_dev_hw(hw->back);
+
        mutex_init(&hw->tnl_lock);
        ice_init_chk_recipe_reuse_support(hw);
 
index 9a817c3c8b99dc3e88e6fd7bb4806c50af7f8b78..a1fe2d363adb0683b49b18c843ae8c15a162d18c 100644 (file)
@@ -4742,9 +4742,8 @@ static void ice_decfg_netdev(struct ice_vsi *vsi)
        vsi->netdev = NULL;
 }
 
-int ice_init_dev(struct ice_pf *pf)
+void ice_init_dev_hw(struct ice_pf *pf)
 {
-       struct device *dev = ice_pf_to_dev(pf);
        struct ice_hw *hw = &pf->hw;
        int err;
 
@@ -4764,6 +4763,12 @@ int ice_init_dev(struct ice_pf *pf)
                 */
                ice_set_safe_mode_caps(hw);
        }
+}
+
+int ice_init_dev(struct ice_pf *pf)
+{
+       struct device *dev = ice_pf_to_dev(pf);
+       int err;
 
        ice_set_pf_caps(pf);
        err = ice_init_interrupt_scheme(pf);
@@ -5220,6 +5225,7 @@ static int
 ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 {
        struct device *dev = &pdev->dev;
+       bool need_dev_deinit = false;
        struct ice_adapter *adapter;
        struct ice_pf *pf;
        struct ice_hw *hw;
@@ -5342,11 +5348,13 @@ unroll_init:
        devl_unlock(priv_to_devlink(pf));
        ice_deinit(pf);
 unroll_dev_init:
-       ice_deinit_dev(pf);
+       need_dev_deinit = true;
 unroll_adapter:
        ice_adapter_put(pdev);
 unroll_hw_init:
        ice_deinit_hw(hw);
+       if (need_dev_deinit)
+               ice_deinit_dev(pf);
        return err;
 }
 
@@ -5441,10 +5449,6 @@ static void ice_remove(struct pci_dev *pdev)
 
        ice_hwmon_exit(pf);
 
-       ice_service_task_stop(pf);
-       ice_aq_cancel_waiting_tasks(pf);
-       set_bit(ICE_DOWN, pf->state);
-
        if (!ice_is_safe_mode(pf))
                ice_remove_arfs(pf);
 
@@ -5456,13 +5460,16 @@ static void ice_remove(struct pci_dev *pdev)
        devl_unlock(priv_to_devlink(pf));
 
        ice_deinit(pf);
-       ice_deinit_dev(pf);
        ice_vsi_release_all(pf);
 
        ice_setup_mc_magic_wake(pf);
        ice_set_wake(pf);
 
        ice_adapter_put(pdev);
+
+       ice_deinit_dev(pf);
+       ice_aq_cancel_waiting_tasks(pf);
+       set_bit(ICE_DOWN, pf->state);
 }
 
 /**