]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/mlx5e: Add Ethernet driver debugfs
authorGal Pressman <gal@nvidia.com>
Wed, 3 Aug 2022 08:37:33 +0000 (11:37 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 11 Jan 2023 05:24:40 +0000 (21:24 -0800)
Similar to the mlx5_core debugfs, lay the groundwork for mlx5e debugfs
files under /sys/kernel/debug/mlx5/<pci>/nic/..

Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 2d77fb8a8a015903f5c6c1e5361cc21e52d770bc..7cbd71f0b8ae49553f996f2da75fc22ee478faba 100644 (file)
@@ -968,6 +968,7 @@ struct mlx5e_priv {
        struct mlx5e_scratchpad    scratchpad;
        struct mlx5e_htb          *htb;
        struct mlx5e_mqprio_rl    *mqprio_rl;
+       struct dentry             *dfs_root;
 };
 
 struct mlx5e_rx_handlers {
index cff5f2e29e1e2b347197c23924704299e2720b1d..16c8bbad5b334b2ce8a5d979970fb0643b1ba9a9 100644 (file)
@@ -35,6 +35,7 @@
 #include <net/vxlan.h>
 #include <net/geneve.h>
 #include <linux/bpf.h>
+#include <linux/debugfs.h>
 #include <linux/if_bridge.h>
 #include <linux/filter.h>
 #include <net/page_pool.h>
@@ -5931,6 +5932,9 @@ static int mlx5e_probe(struct auxiliary_device *adev,
        priv->profile = profile;
        priv->ppriv = NULL;
 
+       priv->dfs_root = debugfs_create_dir("nic",
+                                           mlx5_debugfs_get_dev_root(priv->mdev));
+
        err = mlx5e_devlink_port_register(priv);
        if (err) {
                mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err);
@@ -5968,6 +5972,7 @@ err_profile_cleanup:
 err_devlink_cleanup:
        mlx5e_devlink_port_unregister(priv);
 err_destroy_netdev:
+       debugfs_remove_recursive(priv->dfs_root);
        mlx5e_destroy_netdev(priv);
        return err;
 }
@@ -5982,6 +5987,7 @@ static void mlx5e_remove(struct auxiliary_device *adev)
        mlx5e_suspend(adev, state);
        priv->profile->cleanup(priv);
        mlx5e_devlink_port_unregister(priv);
+       debugfs_remove_recursive(priv->dfs_root);
        mlx5e_destroy_netdev(priv);
 }