ice: move ice_deinit_dev() to the end of deinit paths

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>
This commit is contained in:
Przemek Kitszel
2025-09-12 15:06:26 +02:00
committed by Tony Nguyen
parent c2fb9398f7
commit 8a37f9e2ff
4 changed files with 23 additions and 9 deletions

View 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 @@ static int ice_devlink_reinit_up(struct ice_pf *pf)
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;
}

View 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);

View 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);

View 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 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
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);
}
/**