diff mbox series

[iproute2-master] devlink: Fix monitor command

Message ID 20190505141243.9768-1-idosch@idosch.org
State Accepted
Delegated to: stephen hemminger
Headers show
Series [iproute2-master] devlink: Fix monitor command | expand

Commit Message

Ido Schimmel May 5, 2019, 2:12 p.m. UTC
From: Ido Schimmel <idosch@mellanox.com>

The command is supposed to allow users to filter events related to
certain objects, but returns an error when an object is specified:

# devlink mon dev
Command "dev" not found

Fix this by allowing the command to process the specified objects.

Example:

# devlink/devlink mon dev &
# echo "10 1" > /sys/bus/netdevsim/new_device
[dev,new] netdevsim/netdevsim10

# devlink/devlink mon port &
# echo "11 1" > /sys/bus/netdevsim/new_device
[port,new] netdevsim/netdevsim11/0: type notset flavour physical
[port,new] netdevsim/netdevsim11/0: type eth netdev eth1 flavour physical

# devlink/devlink mon &
# echo "12 1" > /sys/bus/netdevsim/new_device
[dev,new] netdevsim/netdevsim12
[port,new] netdevsim/netdevsim12/0: type notset flavour physical
[port,new] netdevsim/netdevsim12/0: type eth netdev eth2 flavour physical

Fixes: a3c4b484a1ed ("add devlink tool")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 devlink/devlink.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Jiri Pirko May 5, 2019, 4:19 p.m. UTC | #1
Sun, May 05, 2019 at 04:12:43PM CEST, idosch@idosch.org wrote:
>From: Ido Schimmel <idosch@mellanox.com>
>
>The command is supposed to allow users to filter events related to
>certain objects, but returns an error when an object is specified:
>
># devlink mon dev
>Command "dev" not found
>
>Fix this by allowing the command to process the specified objects.
>
>Example:
>
># devlink/devlink mon dev &
># echo "10 1" > /sys/bus/netdevsim/new_device
>[dev,new] netdevsim/netdevsim10
>
># devlink/devlink mon port &
># echo "11 1" > /sys/bus/netdevsim/new_device
>[port,new] netdevsim/netdevsim11/0: type notset flavour physical
>[port,new] netdevsim/netdevsim11/0: type eth netdev eth1 flavour physical
>
># devlink/devlink mon &
># echo "12 1" > /sys/bus/netdevsim/new_device
>[dev,new] netdevsim/netdevsim12
>[port,new] netdevsim/netdevsim12/0: type notset flavour physical
>[port,new] netdevsim/netdevsim12/0: type eth netdev eth2 flavour physical
>
>Fixes: a3c4b484a1ed ("add devlink tool")
>Signed-off-by: Ido Schimmel <idosch@mellanox.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>
Stephen Hemminger May 6, 2019, 3:43 p.m. UTC | #2
On Sun,  5 May 2019 17:12:43 +0300
Ido Schimmel <idosch@idosch.org> wrote:

> From: Ido Schimmel <idosch@mellanox.com>
> 
> The command is supposed to allow users to filter events related to
> certain objects, but returns an error when an object is specified:
> 
> # devlink mon dev
> Command "dev" not found
> 
> Fix this by allowing the command to process the specified objects.
> 
> Example:
> 
> # devlink/devlink mon dev &
> # echo "10 1" > /sys/bus/netdevsim/new_device
> [dev,new] netdevsim/netdevsim10
> 
> # devlink/devlink mon port &
> # echo "11 1" > /sys/bus/netdevsim/new_device
> [port,new] netdevsim/netdevsim11/0: type notset flavour physical
> [port,new] netdevsim/netdevsim11/0: type eth netdev eth1 flavour physical
> 
> # devlink/devlink mon &
> # echo "12 1" > /sys/bus/netdevsim/new_device
> [dev,new] netdevsim/netdevsim12
> [port,new] netdevsim/netdevsim12/0: type notset flavour physical
> [port,new] netdevsim/netdevsim12/0: type eth netdev eth2 flavour physical
> 
> Fixes: a3c4b484a1ed ("add devlink tool")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/devlink/devlink.c b/devlink/devlink.c
index dc6e73fec20c..6a4ce58b9ee9 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3858,12 +3858,8 @@  static int cmd_mon(struct dl *dl)
 	if (dl_argv_match(dl, "help")) {
 		cmd_mon_help();
 		return 0;
-	} else if (dl_no_arg(dl)) {
-		dl_arg_inc(dl);
-		return cmd_mon_show(dl);
 	}
-	pr_err("Command \"%s\" not found\n", dl_argv(dl));
-	return -ENOENT;
+	return cmd_mon_show(dl);
 }
 
 struct dpipe_field {