[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230810140102.1604684-1-jiri@resnulli.us>
Date: Thu, 10 Aug 2023 16:01:02 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: stephen@...workplumber.org,
dsahern@...il.com,
idosch@...dia.com
Subject: [patch iproute2-next] devlink: accept "name" command line option instead of "trap"/"group"
From: Jiri Pirko <jiri@...dia.com>
It is common for all iproute2 apps to have command line option
names matching with show command outputs. However, that is not true
in case of trap and trap group devlink objects.
Correct would be to have "trap" and "group" in the outputs, but that is
not possible to change now. Instead of that, accept "name" instead of
"trap" and "group" options.
Examples:
$ devlink trap show netdevsim/netdevsim1
netdevsim/netdevsim1:
name source_mac_is_multicast type drop generic true action drop group l2_drops
name vlan_tag_mismatch type drop generic true action drop group l2_drops
name ingress_vlan_filter type drop generic true action drop group l2_drops
name ingress_spanning_tree_filter type drop generic true action drop group l2_drops
name port_list_is_empty type drop generic true action drop group l2_drops
name port_loopback_filter type drop generic true action drop group l2_drops
name fid_miss type exception generic false action trap group l2_drops
name blackhole_route type drop generic true action drop group l3_drops
name ttl_value_is_too_small type exception generic true action trap group l3_exceptions
name tail_drop type drop generic true action drop group buffer_drops
name ingress_flow_action_drop type drop generic true action drop group acl_drops
name egress_flow_action_drop type drop generic true action drop group acl_drops
name igmp_query type control generic true action mirror group mc_snooping
name igmp_v1_report type control generic true action trap group mc_snooping
$ devlink trap show netdevsim/netdevsim1 trap source_mac_is_multicast
netdevsim/netdevsim1:
name source_mac_is_multicast type drop generic true action drop group l2_drops
$ devlink trap show netdevsim/netdevsim1 name source_mac_is_multicast
netdevsim/netdevsim1:
name source_mac_is_multicast type drop generic true action drop group l2_drops
$ devlink trap group
netdevsim/netdevsim1:
name l2_drops generic true
name l3_drops generic true policer 1
name l3_exceptions generic true policer 1
name buffer_drops generic true policer 2
name acl_drops generic true policer 3
name mc_snooping generic true policer 3
$ devlink trap group show netdevsim/netdevsim1 group l2_drops
netdevsim/netdevsim1:
name l2_drops generic true
$ devlink trap group show netdevsim/netdevsim1 name l2_drops
name l2_drops generic true
Signed-off-by: Jiri Pirko <jiri@...dia.com>
---
devlink/devlink.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 26513142f900..fe69f53cd2e1 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -2018,14 +2018,16 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
if (err)
return err;
o_found |= DL_OPT_HEALTH_REPORTER_AUTO_DUMP;
- } else if (dl_argv_match(dl, "trap") &&
+ } else if ((dl_argv_match(dl, "trap") ||
+ dl_argv_match(dl, "name")) &&
(o_all & DL_OPT_TRAP_NAME)) {
dl_arg_inc(dl);
err = dl_argv_str(dl, &opts->trap_name);
if (err)
return err;
o_found |= DL_OPT_TRAP_NAME;
- } else if (dl_argv_match(dl, "group") &&
+ } else if ((dl_argv_match(dl, "group") ||
+ dl_argv_match(dl, "name")) &&
(o_all & DL_OPT_TRAP_GROUP_NAME)) {
dl_arg_inc(dl);
err = dl_argv_str(dl, &opts->trap_group_name);
--
2.41.0
Powered by blists - more mailing lists