Skip to content

Commit

Permalink
ice: Fix debugfs with devlink reload
Browse files Browse the repository at this point in the history
During devlink reload it is needed to remove debugfs entries
correlated with only one PF. ice_debugfs_exit() removes all
entries created by ice driver so we can't use it.

Introduce ice_debugfs_pf_deinit() in order to release PF's
debugfs entries. Move ice_debugfs_exit() call to ice_module_exit(),
it makes more sense since ice_debugfs_init() is called in
ice_module_init() and not in ice_probe().

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Wojciech Drewek authored and Tony Nguyen committed Feb 12, 2024
1 parent 41cc4e5 commit 500d0df
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/intel/ice/ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)
}

void ice_debugfs_fwlog_init(struct ice_pf *pf);
void ice_debugfs_pf_deinit(struct ice_pf *pf);
void ice_debugfs_init(void);
void ice_debugfs_exit(void);
void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module);
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,16 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
kfree(fw_modules);
}

/**
* ice_debugfs_pf_deinit - cleanup PF's debugfs
* @pf: pointer to the PF struct
*/
void ice_debugfs_pf_deinit(struct ice_pf *pf)
{
debugfs_remove_recursive(pf->ice_debugfs_pf);
pf->ice_debugfs_pf = NULL;
}

/**
* ice_debugfs_init - create root directory for debugfs entries
*/
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_fwlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ void ice_fwlog_deinit(struct ice_hw *hw)
if (hw->bus.func)
return;

ice_debugfs_pf_deinit(hw->back);

/* make sure FW logging is disabled to not put the FW in a weird state
* for the next driver load
*/
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/intel/ice/ice_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5276,8 +5276,6 @@ static void ice_remove(struct pci_dev *pdev)
msleep(100);
}

ice_debugfs_exit();

if (test_bit(ICE_FLAG_SRIOV_ENA, pf->flags)) {
set_bit(ICE_VF_RESETS_DISABLED, pf->state);
ice_free_vfs(pf);
Expand Down Expand Up @@ -5783,6 +5781,7 @@ module_init(ice_module_init);
static void __exit ice_module_exit(void)
{
pci_unregister_driver(&ice_driver);
ice_debugfs_exit();
destroy_workqueue(ice_wq);
destroy_workqueue(ice_lag_wq);
pr_info("module unloaded\n");
Expand Down

0 comments on commit 500d0df

Please sign in to comment.