summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/netdevsim/dev.c10
-rw-r--r--drivers/net/netdevsim/netdev.c15
-rw-r--r--drivers/net/netdevsim/netdevsim.h1
3 files changed, 11 insertions, 15 deletions
diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
index 98a56d8bdcec..14946d162e53 100644
--- a/drivers/net/netdevsim/dev.c
+++ b/drivers/net/netdevsim/dev.c
@@ -27,17 +27,21 @@ static struct dentry *nsim_dev_ddir;
static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
{
- char dev_ddir_name[10];
+ char dev_ddir_name[16];
- sprintf(dev_ddir_name, "%u", nsim_dev->nsim_bus_dev->dev.id);
+ sprintf(dev_ddir_name, DRV_NAME "%u", nsim_dev->nsim_bus_dev->dev.id);
nsim_dev->ddir = debugfs_create_dir(dev_ddir_name, nsim_dev_ddir);
if (IS_ERR_OR_NULL(nsim_dev->ddir))
return PTR_ERR_OR_ZERO(nsim_dev->ddir) ?: -EINVAL;
+ nsim_dev->ports_ddir = debugfs_create_dir("ports", nsim_dev->ddir);
+ if (IS_ERR_OR_NULL(nsim_dev->ports_ddir))
+ return PTR_ERR_OR_ZERO(nsim_dev->ports_ddir) ?: -EINVAL;
return 0;
}
static void nsim_dev_debugfs_exit(struct nsim_dev *nsim_dev)
{
+ debugfs_remove_recursive(nsim_dev->ports_ddir);
debugfs_remove_recursive(nsim_dev->ddir);
}
@@ -273,7 +277,7 @@ void nsim_dev_destroy(struct nsim_dev *nsim_dev)
int nsim_dev_init(void)
{
- nsim_dev_ddir = debugfs_create_dir(DRV_NAME "_dev", NULL);
+ nsim_dev_ddir = debugfs_create_dir(DRV_NAME, NULL);
if (IS_ERR_OR_NULL(nsim_dev_ddir))
return -ENOMEM;
return 0;
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 9b4310e20129..eb823bd0dc39 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -25,8 +25,6 @@
#include "netdevsim.h"
-static struct dentry *nsim_ddir;
-
static int nsim_get_port_parent_id(struct net_device *dev,
struct netdev_phys_item_id *ppid)
{
@@ -42,11 +40,11 @@ static int nsim_init(struct net_device *dev)
char dev_link_name[32];
int err;
- ns->ddir = debugfs_create_dir(netdev_name(dev), nsim_ddir);
+ ns->ddir = debugfs_create_dir("0", ns->nsim_dev->ports_ddir);
if (IS_ERR_OR_NULL(ns->ddir))
return -ENOMEM;
- sprintf(dev_link_name, "../../" DRV_NAME "_dev/%u",
+ sprintf(dev_link_name, "../../../" DRV_NAME "%u",
ns->nsim_dev->nsim_bus_dev->dev.id);
debugfs_create_symlink("dev", ns->ddir, dev_link_name);
@@ -403,13 +401,9 @@ static int __init nsim_module_init(void)
{
int err;
- nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
- if (IS_ERR_OR_NULL(nsim_ddir))
- return -ENOMEM;
-
err = nsim_dev_init();
if (err)
- goto err_debugfs_destroy;
+ return err;
err = nsim_bus_init();
if (err)
@@ -425,8 +419,6 @@ err_bus_exit:
nsim_bus_exit();
err_dev_exit:
nsim_dev_exit();
-err_debugfs_destroy:
- debugfs_remove_recursive(nsim_ddir);
return err;
}
@@ -435,7 +427,6 @@ static void __exit nsim_module_exit(void)
rtnl_link_unregister(&nsim_link_ops);
nsim_bus_exit();
nsim_dev_exit();
- debugfs_remove_recursive(nsim_ddir);
}
module_init(nsim_module_init);
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 17639c7c9032..e951b1ccc3f2 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -134,6 +134,7 @@ struct nsim_dev {
struct nsim_bus_dev *nsim_bus_dev;
struct nsim_fib_data *fib_data;
struct dentry *ddir;
+ struct dentry *ports_ddir;
struct bpf_offload_dev *bpf_dev;
bool bpf_bind_accept;
u32 bpf_bind_verifier_delay;