devlink: accept "name" command line option instead of "trap"/"group"
Subsystems (2)
PATCH 1/1 devlink: accept "name" command line option instead of "trap"/"group"
From: Jiri Pirko <[email protected]>
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
--- devlink/devlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
devlink/devlink.c +4 -2
@@ -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);
Signature · 1 line
2.41.0
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:
Hello:
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:
Quoted 11 lines · On Thu, 10 Aug 2023 16:01:02 +0200 you wrote:
From: Jiri Pirko <[email protected]>
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.
[...]
Here is the summary with links:
- [iproute2-next] devlink: accept "name" command line option instead of "trap"/"group"
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=27724f3cbb8a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html