Skip to content

Commit c4c24fc

Browse files
Jianbo LiuSaeed Mahameed
authored andcommitted
net/mlx5e: Move Ethernet driver debugfs to profile init callback
As priv->dfs_root is cleared, and therefore missed, when change eswitch mode, move the creation of the root debugfs to the init callback of mlx5e_nic_profile and mlx5e_uplink_rep_profile, and the destruction to the cleanup callback for symmeter. Fixes: 288eca6 ("net/mlx5e: Add Ethernet driver debugfs") Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent bdf2747 commit c4c24fc

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5261,12 +5261,16 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
52615261

52625262
mlx5e_timestamp_init(priv);
52635263

5264+
priv->dfs_root = debugfs_create_dir("nic",
5265+
mlx5_debugfs_get_dev_root(mdev));
5266+
52645267
fs = mlx5e_fs_init(priv->profile, mdev,
52655268
!test_bit(MLX5E_STATE_DESTROYING, &priv->state),
52665269
priv->dfs_root);
52675270
if (!fs) {
52685271
err = -ENOMEM;
52695272
mlx5_core_err(mdev, "FS initialization failed, %d\n", err);
5273+
debugfs_remove_recursive(priv->dfs_root);
52705274
return err;
52715275
}
52725276
priv->fs = fs;
@@ -5287,6 +5291,7 @@ static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)
52875291
mlx5e_health_destroy_reporters(priv);
52885292
mlx5e_ktls_cleanup(priv);
52895293
mlx5e_fs_cleanup(priv->fs);
5294+
debugfs_remove_recursive(priv->dfs_root);
52905295
priv->fs = NULL;
52915296
}
52925297

@@ -6011,9 +6016,6 @@ static int mlx5e_probe(struct auxiliary_device *adev,
60116016
priv->profile = profile;
60126017
priv->ppriv = NULL;
60136018

6014-
priv->dfs_root = debugfs_create_dir("nic",
6015-
mlx5_debugfs_get_dev_root(priv->mdev));
6016-
60176019
err = profile->init(mdev, netdev);
60186020
if (err) {
60196021
mlx5_core_err(mdev, "mlx5e_nic_profile init failed, %d\n", err);
@@ -6042,7 +6044,6 @@ static int mlx5e_probe(struct auxiliary_device *adev,
60426044
err_profile_cleanup:
60436045
profile->cleanup(priv);
60446046
err_destroy_netdev:
6045-
debugfs_remove_recursive(priv->dfs_root);
60466047
mlx5e_destroy_netdev(priv);
60476048
err_devlink_port_unregister:
60486049
mlx5e_devlink_port_unregister(mlx5e_dev);
@@ -6062,7 +6063,6 @@ static void mlx5e_remove(struct auxiliary_device *adev)
60626063
unregister_netdev(priv->netdev);
60636064
mlx5e_suspend(adev, state);
60646065
priv->profile->cleanup(priv);
6065-
debugfs_remove_recursive(priv->dfs_root);
60666066
mlx5e_destroy_netdev(priv);
60676067
mlx5e_devlink_port_unregister(mlx5e_dev);
60686068
mlx5e_destroy_devlink(mlx5e_dev);

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* SOFTWARE.
3131
*/
3232

33+
#include <linux/debugfs.h>
3334
#include <linux/mlx5/fs.h>
3435
#include <net/switchdev.h>
3536
#include <net/pkt_cls.h>
@@ -812,11 +813,15 @@ static int mlx5e_init_ul_rep(struct mlx5_core_dev *mdev,
812813
{
813814
struct mlx5e_priv *priv = netdev_priv(netdev);
814815

816+
priv->dfs_root = debugfs_create_dir("nic",
817+
mlx5_debugfs_get_dev_root(mdev));
818+
815819
priv->fs = mlx5e_fs_init(priv->profile, mdev,
816820
!test_bit(MLX5E_STATE_DESTROYING, &priv->state),
817821
priv->dfs_root);
818822
if (!priv->fs) {
819823
netdev_err(priv->netdev, "FS allocation failed\n");
824+
debugfs_remove_recursive(priv->dfs_root);
820825
return -ENOMEM;
821826
}
822827

@@ -829,6 +834,7 @@ static int mlx5e_init_ul_rep(struct mlx5_core_dev *mdev,
829834
static void mlx5e_cleanup_rep(struct mlx5e_priv *priv)
830835
{
831836
mlx5e_fs_cleanup(priv->fs);
837+
debugfs_remove_recursive(priv->dfs_root);
832838
priv->fs = NULL;
833839
}
834840

0 commit comments

Comments
 (0)