diff options
author | Jiri Pirko <jiri@mellanox.com> | 2019-04-25 16:59:52 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-26 08:52:02 +0300 |
commit | ab1d0cc004d706523dcad7cdad97a2b94eecf169 (patch) | |
tree | f1b32f6ef3b79d7fbb86ae8f6bfd08c012f61d0b /drivers/net/netdevsim/netdev.c | |
parent | 514cf64cc5353929fbfb82ed1bda24588acaf96a (diff) | |
download | linux-ab1d0cc004d706523dcad7cdad97a2b94eecf169.tar.xz |
netdevsim: change debugfs tree topology
With the model where dev is represented by devlink and ports are
represented by devlink ports, make debugfs file names independent
on netdev names. Change the topology to the one illustrated
by the following example:
$ ls /sys/kernel/debug/netdevsim/
netdevsim1
$ ls /sys/kernel/debug/netdevsim/netdevsim1/
bpf_bind_accept bpf_bind_verifier_delay bpf_bound_progs ports
$ ls /sys/kernel/debug/netdevsim/netdevsim1/ports/
0 1
$ ls /sys/kernel/debug/netdevsim/netdevsim1/ports/0/
bpf_map_accept bpf_offloaded_id bpf_tc_accept bpf_tc_non_bound_accept bpf_xdpdrv_accept bpf_xdpoffload_accept dev ipsec
$ ls /sys/kernel/debug/netdevsim/netdevsim1/ports/0/dev -l
lrwxrwxrwx 1 root root 0 Apr 13 15:58 /sys/kernel/debug/netdevsim/netdevsim1/ports/0/dev -> ../../../netdevsim1
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
-rw-r--r-- | drivers/net/netdevsim/netdev.c | 15 |
1 files changed, 3 insertions, 12 deletions
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); |