devlink: Fix monitor command

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: a3c4b484a1 ("add devlink tool")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Ido Schimmel 2019-05-05 17:12:43 +03:00 committed by Stephen Hemminger
parent 09e0528cf9
commit e73306048f
1 changed files with 1 additions and 5 deletions

View File

@ -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 {