From d9b868436a6fce8986560178c6d1a78072e21861 Mon Sep 17 00:00:00 2001 From: Andrea Claudi Date: Tue, 10 Mar 2020 13:15:17 +0100 Subject: [PATCH 01/14] nexthop: fix error reporting in filter dump nh_dump_filter is missing a return value check in two cases. Fix this simply adding an assignment to the proper variable. Fixes: 63df8e8543b03 ("Add support for nexthop objects") Signed-off-by: Andrea Claudi Reviewed-by: David Ahern Signed-off-by: Stephen Hemminger --- ip/ipnexthop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c index 9f860c8c..99f89630 100644 --- a/ip/ipnexthop.c +++ b/ip/ipnexthop.c @@ -59,13 +59,13 @@ static int nh_dump_filter(struct nlmsghdr *nlh, int reqlen) } if (filter.groups) { - addattr_l(nlh, reqlen, NHA_GROUPS, NULL, 0); + err = addattr_l(nlh, reqlen, NHA_GROUPS, NULL, 0); if (err) return err; } if (filter.master) { - addattr32(nlh, reqlen, NHA_MASTER, filter.master); + err = addattr32(nlh, reqlen, NHA_MASTER, filter.master); if (err) return err; } From 72cc0bafb9f8af217283f7757397242cb7ca8b2d Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Wed, 11 Mar 2020 16:16:36 +0100 Subject: [PATCH 02/14] iproute2: fix MPLS label parsing The initial value of "label" in parse_mpls() is 0xffffffff. Therefore we should test for this value, and not 0, to detect if a label has been provided. The "!label" test not only fails to detect a missing label parameter, it also prevents the use of the IPv4 explicit NULL label, which actually equals 0. Reproducer: $ ip link add name dm0 type dummy $ tc qdisc add dev dm0 ingress $ tc filter add dev dm0 parent ffff: matchall action mpls push Error: act_mpls: Label is required for MPLS push. We have an error talking to the kernel --> Filter was pushed to the kernel, where it got rejected. $ tc filter add dev dm0 parent ffff: matchall action mpls push label 0 Error: argument "label" is required --> Label 0 was rejected by iproute2. Expected result: $ tc filter add dev dm0 parent ffff: matchall action mpls push Error: argument "label" is required --> Filter was directly rejected by iproute2. $ tc filter add dev dm0 parent ffff: matchall action mpls push label 0 --> Filter is accepted. Signed-off-by: Guillaume Nault Signed-off-by: Stephen Hemminger --- tc/m_mpls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/m_mpls.c b/tc/m_mpls.c index 6f3a39f4..50eba01c 100644 --- a/tc/m_mpls.c +++ b/tc/m_mpls.c @@ -156,7 +156,7 @@ static int parse_mpls(struct action_util *a, int *argc_p, char ***argv_p, } } - if (action == TCA_MPLS_ACT_PUSH && !label) + if (action == TCA_MPLS_ACT_PUSH && label == 0xffffffff) missarg("label"); if (action == TCA_MPLS_ACT_PUSH && proto && From adcab267b862d2ed5d08e2bd9ef99a88d54ec95f Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 20 Mar 2020 11:05:26 -0700 Subject: [PATCH 03/14] uapi: update linux/in.h Signed-off-by: Stephen Hemminger --- include/uapi/linux/in.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h index 83a4c187..ca59dc76 100644 --- a/include/uapi/linux/in.h +++ b/include/uapi/linux/in.h @@ -74,6 +74,8 @@ enum { #define IPPROTO_UDPLITE IPPROTO_UDPLITE IPPROTO_MPLS = 137, /* MPLS in IP (RFC 4023) */ #define IPPROTO_MPLS IPPROTO_MPLS + IPPROTO_ETHERNET = 143, /* Ethernet-within-IPv6 Encapsulation */ +#define IPPROTO_ETHERNET IPPROTO_ETHERNET IPPROTO_RAW = 255, /* Raw IP packets */ #define IPPROTO_RAW IPPROTO_RAW IPPROTO_MPTCP = 262, /* Multipath TCP connection */ From 0641bed8a3c779c37746c4d7be9e01a35e920841 Mon Sep 17 00:00:00 2001 From: Andrea Claudi Date: Fri, 27 Mar 2020 11:45:12 +0100 Subject: [PATCH 04/14] man: bridge.8: fix bridge link show description When multiple bridges are present, 'bridge link show' diplays ports for all bridges. Make this clear in the command description, and point out the user to the ip command to display ports for a specific bridge. Reported-by: Marc Muehlfeld Signed-off-by: Andrea Claudi Signed-off-by: Stephen Hemminger --- man/man8/bridge.8 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index 1804f0b4..b9bd6bc5 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -420,9 +420,12 @@ link setting is configured on the software bridge (default) .BR "\-t" , " \-timestamp" display current time when using monitor option. -.SS bridge link show - list bridge port configuration. +.SS bridge link show - list ports configuration for all bridges. -This command displays the current bridge port configuration and flags. +This command displays port configuration and flags for all bridges. + +To display port configuration and flags for a specific bridge, use the +"ip link show master " command. .SH bridge fdb - forwarding database management From 29981db0e051cd4c53920c89dddcf3d883343a0f Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 30 Mar 2020 08:06:08 -0700 Subject: [PATCH 05/14] v5.6.0 --- include/SNAPSHOT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SNAPSHOT.h b/include/SNAPSHOT.h index c0fa1bb4..0d10a9c2 100644 --- a/include/SNAPSHOT.h +++ b/include/SNAPSHOT.h @@ -1 +1 @@ -static const char SNAPSHOT[] = "200127"; +static const char SNAPSHOT[] = "200330"; From b37a863cb2d09ad0736334bd6606c05b802c85cf Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 4 Apr 2020 18:16:14 +0200 Subject: [PATCH 06/14] devlink: remove custom bool command line options parsing Change the code that is doing custom processing of boolean command line options to use dl_argv_bool(). Extend strtobool() to accept "enable"/"disable" to maintain current behavior. Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 6405d4be..ce6e349e 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -739,9 +739,11 @@ static int strtobool(const char *str, bool *p_val) { bool val; - if (!strcmp(str, "true") || !strcmp(str, "1")) + if (!strcmp(str, "true") || !strcmp(str, "1") || + !strcmp(str, "enable")) val = true; - else if (!strcmp(str, "false") || !strcmp(str, "0")) + else if (!strcmp(str, "false") || !strcmp(str, "0") || + !strcmp(str, "disable")) val = false; else return -EINVAL; @@ -1076,20 +1078,6 @@ static int eswitch_inline_mode_get(const char *typestr, return 0; } -static int dpipe_counters_enable_get(const char *typestr, - bool *counters_enable) -{ - if (strcmp(typestr, "enable") == 0) { - *counters_enable = 1; - } else if (strcmp(typestr, "disable") == 0) { - *counters_enable = 0; - } else { - pr_err("Unknown counter_state \"%s\"\n", typestr); - return -EINVAL; - } - return 0; -} - static int eswitch_encap_mode_get(const char *typestr, bool *p_mode) { if (strcmp(typestr, "enable") == 0) { @@ -1336,14 +1324,8 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required, o_found |= DL_OPT_DPIPE_TABLE_NAME; } else if (dl_argv_match(dl, "counters") && (o_all & DL_OPT_DPIPE_TABLE_COUNTERS)) { - const char *typestr; - dl_arg_inc(dl); - err = dl_argv_str(dl, &typestr); - if (err) - return err; - err = dpipe_counters_enable_get(typestr, - &opts->dpipe_counters_enable); + err = dl_argv_bool(dl, &opts->dpipe_counters_enable); if (err) return err; o_found |= DL_OPT_DPIPE_TABLE_COUNTERS; From 90ce848b05fc1883ddafcf57af4c7fcbafd85833 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 4 Apr 2020 18:16:15 +0200 Subject: [PATCH 07/14] devlink: Fix help and man of "devlink health set" command Fix the help and man page of "devlink health set" command to be aligned with the rest of helps and man pages. Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 4 +++- man/man8/devlink-health.8 | 30 ++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index ce6e349e..6a410810 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -6924,7 +6924,9 @@ static void cmd_health_help(void) pr_err(" devlink health diagnose DEV reporter REPORTER_NAME\n"); pr_err(" devlink health dump show DEV reporter REPORTER_NAME\n"); pr_err(" devlink health dump clear DEV reporter REPORTER_NAME\n"); - pr_err(" devlink health set DEV reporter REPORTER_NAME { grace_period | auto_recover } { msec | boolean }\n"); + pr_err(" devlink health set DEV reporter REPORTER_NAME\n"); + pr_err(" [ grace_period MSEC ]\n"); + pr_err(" [ auto_recover { true | false } ]\n"); } static int cmd_health(struct dl *dl) diff --git a/man/man8/devlink-health.8 b/man/man8/devlink-health.8 index 7ed0ae45..70a86cf0 100644 --- a/man/man8/devlink-health.8 +++ b/man/man8/devlink-health.8 @@ -52,13 +52,13 @@ devlink-health \- devlink health reporting and recovery .RI "" DEV "" .B reporter .RI "" REPORTER "" -.RI " { " -.B grace_period | auto_recover -.RI " } { " -.RI "" msec "" -.RI "|" -.RI "" boolean "" -.RI " } " +.RI "[ " +.BI "grace_period " MSEC " +.RI "]" +.RI "[ " +.BR auto_recover " { " true " | " false " } " +.RI "]" + .ti -8 .B devlink health help @@ -130,15 +130,9 @@ the next "devlink health dump show" command. .I "REPORTER" - specifies the reporter's name registered on the devlink device. -.SS devlink health set - Enable the user to configure: -.PD 0 -1) grace_period [msec] - Time interval between consecutive auto recoveries. -.P -2) auto_recover [true/false] - Indicates whether the devlink should execute automatic recover on error. -.P +.SS devlink health set - Configure health reporter. Please note that this command is not supported on a reporter which doesn't support a recovery method. -.PD .PP .I "DEV" @@ -148,6 +142,14 @@ doesn't support a recovery method. .I "REPORTER" - specifies the reporter's name registered on the devlink device. +.TP +.BI grace_period " MSEC " +Time interval between consecutive auto recoveries. + +.TP +.BR auto_recover " { " true " | " false " } " +Indicates whether the devlink should execute automatic recover on error. + .SH "EXAMPLES" .PP devlink health show From 0b1875cdc69f49184445781a62e0bf603bdfc414 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 4 Apr 2020 18:16:16 +0200 Subject: [PATCH 08/14] devlink: fix encap mode manupulation DEVLINK_ATTR_ESWITCH_ENCAP_MODE netlink attribute carries enum. But the code assumes bool value. Fix this by treating the encap mode in the same way as other eswitch mode attributes, switching from "enable"/"disable" to "basic"/"none", according to the enum. Maintain the backward compatibility to allow user to pass "enable"/"disable" too. Also to be in-sync with the rest of the "mode" commands, rename to "encap-mode". Adjust the help and man page accordingly. Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- bash-completion/devlink | 8 +++---- devlink/devlink.c | 46 ++++++++++++++++++++++++++++++----------- man/man8/devlink-dev.8 | 8 +++---- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/bash-completion/devlink b/bash-completion/devlink index 45ca1fe6..8518e7aa 100644 --- a/bash-completion/devlink +++ b/bash-completion/devlink @@ -105,11 +105,11 @@ _devlink_dev_eswitch_set() local -A settings=( [mode]=notseen [inline-mode]=notseen - [encap]=notseen + [encap-mode]=notseen ) if [[ $cword -eq 5 ]]; then - COMPREPLY=( $( compgen -W "mode inline-mode encap" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "mode inline-mode encap-mode" -- "$cur" ) ) fi # Mark seen settings @@ -132,8 +132,8 @@ _devlink_dev_eswitch_set() "$cur" ) ) return ;; - encap) - COMPREPLY=( $( compgen -W "disable enable" -- "$cur" ) ) + encap-mode) + COMPREPLY=( $( compgen -W "none basic" -- "$cur" ) ) return ;; esac diff --git a/devlink/devlink.c b/devlink/devlink.c index 6a410810..6a24f28f 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -41,6 +41,9 @@ #define ESWITCH_INLINE_MODE_NETWORK "network" #define ESWITCH_INLINE_MODE_TRANSPORT "transport" +#define ESWITCH_ENCAP_MODE_NONE "none" +#define ESWITCH_ENCAP_MODE_BASIC "basic" + #define PARAM_CMODE_RUNTIME_STR "runtime" #define PARAM_CMODE_DRIVERINIT_STR "driverinit" #define PARAM_CMODE_PERMANENT_STR "permanent" @@ -284,7 +287,7 @@ struct dl_opts { enum devlink_eswitch_inline_mode eswitch_inline_mode; const char *dpipe_table_name; bool dpipe_counters_enable; - bool eswitch_encap_mode; + enum devlink_eswitch_encap_mode eswitch_encap_mode; const char *resource_path; uint64_t resource_size; uint32_t resource_id; @@ -1078,12 +1081,19 @@ static int eswitch_inline_mode_get(const char *typestr, return 0; } -static int eswitch_encap_mode_get(const char *typestr, bool *p_mode) +static int +eswitch_encap_mode_get(const char *typestr, + enum devlink_eswitch_encap_mode *p_encap_mode) { - if (strcmp(typestr, "enable") == 0) { - *p_mode = true; - } else if (strcmp(typestr, "disable") == 0) { - *p_mode = false; + /* The initial implementation incorrectly accepted "enable"/"disable". + * Carry it to maintain backward compatibility. + */ + if (strcmp(typestr, "disable") == 0 || + strcmp(typestr, ESWITCH_ENCAP_MODE_NONE) == 0) { + *p_encap_mode = DEVLINK_ESWITCH_ENCAP_MODE_NONE; + } else if (strcmp(typestr, "enable") == 0 || + strcmp(typestr, ESWITCH_ENCAP_MODE_BASIC) == 0) { + *p_encap_mode = DEVLINK_ESWITCH_ENCAP_MODE_BASIC; } else { pr_err("Unknown eswitch encap mode \"%s\"\n", typestr); return -EINVAL; @@ -1329,7 +1339,8 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required, if (err) return err; o_found |= DL_OPT_DPIPE_TABLE_COUNTERS; - } else if (dl_argv_match(dl, "encap") && + } else if ((dl_argv_match(dl, "encap") || /* Original incorrect implementation */ + dl_argv_match(dl, "encap-mode")) && (o_all & DL_OPT_ESWITCH_ENCAP_MODE)) { const char *typestr; @@ -1700,7 +1711,7 @@ static void cmd_dev_help(void) pr_err("Usage: devlink dev show [ DEV ]\n"); pr_err(" devlink dev eswitch set DEV [ mode { legacy | switchdev } ]\n"); pr_err(" [ inline-mode { none | link | network | transport } ]\n"); - pr_err(" [ encap { disable | enable } ]\n"); + pr_err(" [ encap-mode { none | basic } ]\n"); pr_err(" devlink dev eswitch show DEV\n"); pr_err(" devlink dev param set DEV name PARAMETER value VALUE cmode { permanent | driverinit | runtime }\n"); pr_err(" devlink dev param show [DEV name PARAMETER]\n"); @@ -2130,6 +2141,18 @@ static const char *eswitch_inline_mode_name(uint32_t mode) } } +static const char *eswitch_encap_mode_name(uint32_t mode) +{ + switch (mode) { + case DEVLINK_ESWITCH_ENCAP_MODE_NONE: + return ESWITCH_ENCAP_MODE_NONE; + case DEVLINK_ESWITCH_ENCAP_MODE_BASIC: + return ESWITCH_ENCAP_MODE_BASIC; + default: + return ""; + } +} + static void pr_out_eswitch(struct dl *dl, struct nlattr **tb) { __pr_out_handle_start(dl, tb, true, false); @@ -2147,11 +2170,10 @@ static void pr_out_eswitch(struct dl *dl, struct nlattr **tb) tb[DEVLINK_ATTR_ESWITCH_INLINE_MODE]))); } if (tb[DEVLINK_ATTR_ESWITCH_ENCAP_MODE]) { - bool encap_mode = !!mnl_attr_get_u8(tb[DEVLINK_ATTR_ESWITCH_ENCAP_MODE]); - check_indent_newline(dl); - print_string(PRINT_ANY, "encap", "encap %s", - encap_mode ? "enable" : "disable"); + print_string(PRINT_ANY, "encap-mode", "encap-mode %s", + eswitch_encap_mode_name(mnl_attr_get_u8( + tb[DEVLINK_ATTR_ESWITCH_ENCAP_MODE]))); } pr_out_handle_end(dl); diff --git a/man/man8/devlink-dev.8 b/man/man8/devlink-dev.8 index 289935db..ac01bf60 100644 --- a/man/man8/devlink-dev.8 +++ b/man/man8/devlink-dev.8 @@ -35,7 +35,7 @@ devlink-dev \- devlink device configuration .BR inline-mode " { " none " | " link " | " network " | " transport " } " .RI "]" .RI "[ " -.BR encap " { " disable " | " enable " } " +.BR encap-mode " { " none " | " basic " } " .RI "]" .ti -8 @@ -125,13 +125,13 @@ Some HWs need the VF driver to put part of the packet headers on the TX descript - L4 mode .TP -.BR encap " { " disable " | " enable " } " +.BR encap-mode " { " none " | " basic " } " Set eswitch encapsulation support -.I disable +.I none - Disable encapsulation support -.I enable +.I basic - Enable encapsulation support .SS devlink dev param set - set new value to devlink device configuration parameter From 192e7b3ffa1de43dc65b95b8c19a1e73baa251ff Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 4 Apr 2020 18:16:17 +0200 Subject: [PATCH 09/14] devlink: Add alias "counters_enabled" for "counters" option To be consistent with netlink attribute name and also with the "dpipe table show" output, add "counters_enabled" for "counters" in "dpipe table set" command. Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 6a24f28f..476f8df6 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -1332,7 +1332,8 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required, if (err) return err; o_found |= DL_OPT_DPIPE_TABLE_NAME; - } else if (dl_argv_match(dl, "counters") && + } else if ((dl_argv_match(dl, "counters") || + dl_argv_match(dl, "counters_enabled")) && (o_all & DL_OPT_DPIPE_TABLE_COUNTERS)) { dl_arg_inc(dl); err = dl_argv_bool(dl, &opts->dpipe_counters_enable); From 342f462efa9f51966c4e92ad5d3e487680ba16d4 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 4 Apr 2020 18:16:18 +0200 Subject: [PATCH 10/14] devlink: rename dpipe_counters_enable struct field to dpipe_counters_enabled To be consistent with the rest of the code and name of netlink attribute, rename the dpipe_counters_enable struct fielt to dpipe_counters_enabled. Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 476f8df6..02339ec0 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -286,7 +286,7 @@ struct dl_opts { enum devlink_eswitch_mode eswitch_mode; enum devlink_eswitch_inline_mode eswitch_inline_mode; const char *dpipe_table_name; - bool dpipe_counters_enable; + bool dpipe_counters_enabled; enum devlink_eswitch_encap_mode eswitch_encap_mode; const char *resource_path; uint64_t resource_size; @@ -1336,7 +1336,7 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required, dl_argv_match(dl, "counters_enabled")) && (o_all & DL_OPT_DPIPE_TABLE_COUNTERS)) { dl_arg_inc(dl); - err = dl_argv_bool(dl, &opts->dpipe_counters_enable); + err = dl_argv_bool(dl, &opts->dpipe_counters_enabled); if (err) return err; o_found |= DL_OPT_DPIPE_TABLE_COUNTERS; @@ -1592,7 +1592,7 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl) opts->dpipe_table_name); if (opts->present & DL_OPT_DPIPE_TABLE_COUNTERS) mnl_attr_put_u8(nlh, DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED, - opts->dpipe_counters_enable); + opts->dpipe_counters_enabled); if (opts->present & DL_OPT_ESWITCH_ENCAP_MODE) mnl_attr_put_u8(nlh, DEVLINK_ATTR_ESWITCH_ENCAP_MODE, opts->eswitch_encap_mode); From b2522187d85fcf75533bb123c9574df282286db6 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 4 Apr 2020 18:16:19 +0200 Subject: [PATCH 11/14] devlink: Fix help message for dpipe Have one help message for all dpipe commands, as it is done for the rest of the devlink object. Possible and required options to the help. Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 02339ec0..2df7ad47 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -4976,15 +4976,19 @@ static int cmd_dpipe_headers_show(struct dl *dl) return err; } -static void cmd_dpipe_header_help(void) +static void cmd_dpipe_help(void) { - pr_err("Usage: devlink dpipe headers show DEV\n"); + pr_err("Usage: devlink dpipe table show DEV [ name TABLE_NAME ]\n"); + pr_err(" devlink dpipe table set DEV name TABLE_NAME\n"); + pr_err(" [ counters_enabled { true | false } ]\n"); + pr_err(" devlink dpipe table dump DEV name TABLE_NAME\n"); + pr_err(" devlink dpipe header show DEV\n"); } static int cmd_dpipe_header(struct dl *dl) { if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { - cmd_dpipe_header_help(); + cmd_dpipe_help(); return 0; } else if (dl_argv_match(dl, "show")) { dl_arg_inc(dl); @@ -5800,16 +5804,10 @@ out: return err; } -static void cmd_dpipe_table_help(void) -{ - pr_err("Usage: devlink dpipe table [ OBJECT-LIST ]\n" - "where OBJECT-LIST := { show | set | dump }\n"); -} - static int cmd_dpipe_table(struct dl *dl) { if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { - cmd_dpipe_table_help(); + cmd_dpipe_help(); return 0; } else if (dl_argv_match(dl, "show")) { dl_arg_inc(dl); @@ -5825,12 +5823,6 @@ static int cmd_dpipe_table(struct dl *dl) return -ENOENT; } -static void cmd_dpipe_help(void) -{ - pr_err("Usage: devlink dpipe [ OBJECT-LIST ]\n" - "where OBJECT-LIST := { header | table }\n"); -} - static int cmd_dpipe(struct dl *dl) { if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { From 885f4b0d7ad6edcb2c99034abe69c916973185f9 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 4 Apr 2020 18:16:20 +0200 Subject: [PATCH 12/14] devlink: remove "dev" object sub help messages Remove duplicate sub help messages for "dev" object and have them all show help message for "dev". Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 2df7ad47..51be0efa 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -2765,18 +2765,13 @@ static int cmd_dev_show(struct dl *dl) return err; } -static void cmd_dev_reload_help(void) -{ - pr_err("Usage: devlink dev reload DEV [ netns { PID | NAME | ID } ]\n"); -} - static int cmd_dev_reload(struct dl *dl) { struct nlmsghdr *nlh; int err; if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { - cmd_dev_reload_help(); + cmd_dev_help(); return 0; } @@ -2898,11 +2893,6 @@ static int cmd_versions_show_cb(const struct nlmsghdr *nlh, void *data) return MNL_CB_OK; } -static void cmd_dev_info_help(void) -{ - pr_err("Usage: devlink dev info [ DEV ]\n"); -} - static int cmd_dev_info(struct dl *dl) { struct nlmsghdr *nlh; @@ -2910,7 +2900,7 @@ static int cmd_dev_info(struct dl *dl) int err; if (dl_argv_match(dl, "help")) { - cmd_dev_info_help(); + cmd_dev_help(); return 0; } @@ -2931,12 +2921,6 @@ static int cmd_dev_info(struct dl *dl) return err; } -static void cmd_dev_flash_help(void) -{ - pr_err("Usage: devlink dev flash DEV file PATH [ component NAME ]\n"); -} - - struct cmd_dev_flash_status_ctx { struct dl *dl; char *last_msg; @@ -3084,7 +3068,7 @@ static int cmd_dev_flash(struct dl *dl) int err; if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { - cmd_dev_flash_help(); + cmd_dev_help(); return 0; } From e00248d2965fff4ce6424a7c22868a1f8713aa03 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 4 Apr 2020 18:16:21 +0200 Subject: [PATCH 13/14] man: add man page for devlink dpipe Add simple man page for devlink dpipe. Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- man/man8/devlink-dpipe.8 | 99 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 man/man8/devlink-dpipe.8 diff --git a/man/man8/devlink-dpipe.8 b/man/man8/devlink-dpipe.8 new file mode 100644 index 00000000..3a4d2544 --- /dev/null +++ b/man/man8/devlink-dpipe.8 @@ -0,0 +1,99 @@ +.TH DEVLINK\-DPIPE 8 "4 Apr 2020" "iproute2" "Linux" +.SH NAME +devlink-dpipe \- devlink dataplane pipeline visualization +.SH SYNOPSIS +.sp +.ad l +.in +8 +.ti -8 +.B devlink +.RI "[ " OPTIONS " ]" +.B dpipe +.RB "{ " table " | " header " }" +.RI "{ " COMMAND " | " +.BR help " }" +.sp + +.ti -8 +.IR OPTIONS " := { " +\fB\-V\fR[\fIersion\fR] } + +.ti -8 +.BI "devlink dpipe table show " DEV +.RB "[ " name +.IR TABLE_NAME " ]" + +.ti -8 +.BI "devlink dpipe table set " DEV +.BI name " TABLE_NAME " + +.ti -8 +.BI "devlink dpipe table dump " DEV +.BI name " TABLE_NAME " + +.ti -8 +.BI "devlink dpipe header show " DEV + +.ti -8 +.B devlink dpipe help + +.SH "DESCRIPTION" +.SS devlink dpipe table show - display devlink dpipe table attributes + +.TP +.BI name " TABLE_NAME" +Specifies the table to operate on. + +.SS devlink dpipe table set - set devlink dpipe table attributes + +.TP +.BI name " TABLE_NAME" +Specifies the table to operate on. + +.SS devlink dpipe table dump - dump devlink dpipe table entries + +.TP +.BI name " TABLE_NAME" +Specifies the table to operate on. + +.SS devlink dpipe header show - display devlink dpipe header attributes + +.TP +.BI name " TABLE_NAME" +Specifies the table to operate on. + +.SH "EXAMPLES" +.PP +devlink dpipe table show pci/0000:01:00.0 +.RS 4 +Shows all dpipe tables on specified devlink device. +.RE +.PP +devlink dpipe table show pci/0000:01:00.0 name mlxsw_erif +.RS 4 +Shows mlxsw_erif dpipe table on specified devlink device. +.RE +.PP +devlink dpipe table set pci/0000:01:00.0 name mlxsw_erif counters_enabled true +.RS 4 +Turns on the counters on mlxsw_erif table. +.RE +.PP +devlink dpipe table dump pci/0000:01:00.0 name mlxsw_erif +.RS 4 +Dumps content of mlxsw_erif table. +.RE +.PP +devlink dpipe header show pci/0000:01:00.0 +.RS 4 +Shows all dpipe headers on specified devlink device. +.RE + +.SH SEE ALSO +.BR devlink (8), +.BR devlink-dev (8), +.BR devlink-monitor (8), +.br + +.SH AUTHOR +Jiri Pirko From 27136cab54f11c4c90b7aab7641b29c79e533dcf Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 6 Apr 2020 10:07:54 -0700 Subject: [PATCH 14/14] man/tc-actions: fix formatting Fix error from make check. n-old.tmac: : line 86: 'R' is a string (producing the registered sign), not a macro. Error in tc-actions.8 Signed-off-by: Stephen Hemminger --- man/man8/tc-actions.8 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/man/man8/tc-actions.8 b/man/man8/tc-actions.8 index 21795193..6f1c201d 100644 --- a/man/man8/tc-actions.8 +++ b/man/man8/tc-actions.8 @@ -82,8 +82,7 @@ ACTNAME .I HWSTATSSPEC := .BR hw_stats " {" -.IR immediate " | " delayed " | " disabled -.R } +.IR immediate " | " delayed " | " disabled " }" .I ACTDETAIL :=