netdevsim: fix duplicated debugfs directory
authorJakub Kicinski <kuba@kernel.org>
Sat, 26 Sep 2020 01:19:13 +0000 (18:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Sep 2020 21:19:08 +0000 (14:19 -0700)
The "ethtool" debugfs directory holds per-netdev knobs, so move
it from the device instance directory to the port directory.

This fixes the following warning when creating multiple ports:

 debugfs: Directory 'ethtool' with parent 'netdevsim1' already present!

Fixes: ff1f7c17fb20 ("netdevsim: add pause frame stats")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netdevsim/ethtool.c
tools/testing/selftests/drivers/net/netdevsim/ethtool-pause.sh

index 7a4c779b4c895caa8129adbb3ae0422ce8d4bbb5..f1884d90a876f5df697b6e5538a2fceab40b04cc 100644 (file)
@@ -54,7 +54,7 @@ void nsim_ethtool_init(struct netdevsim *ns)
 
        ns->netdev->ethtool_ops = &nsim_ethtool_ops;
 
-       ethtool = debugfs_create_dir("ethtool", ns->nsim_dev->ddir);
+       ethtool = debugfs_create_dir("ethtool", ns->nsim_dev_port->ddir);
 
        dir = debugfs_create_dir("pause", ethtool);
        debugfs_create_bool("report_stats_rx", 0600, dir,
index dd6ad6501c9c1855a299bda658d5ada7b801c286..25c896b9e2eb7b1cf931d2382fb465ff4af5ecca 100755 (executable)
@@ -3,7 +3,7 @@
 
 NSIM_ID=$((RANDOM % 1024))
 NSIM_DEV_SYS=/sys/bus/netdevsim/devices/netdevsim$NSIM_ID
-NSIM_DEV_DFS=/sys/kernel/debug/netdevsim/netdevsim$NSIM_ID
+NSIM_DEV_DFS=/sys/kernel/debug/netdevsim/netdevsim$NSIM_ID/ports/0
 NSIM_NETDEV=
 num_passes=0
 num_errors=0