All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch iproute2/net-next 0/8] devlink: spring cleanup
@ 2020-04-04 16:16 Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 1/8] devlink: remove custom bool command line options parsing Jiri Pirko
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

This patchset contains couple of small fixes, consistency changes,
help and man adjustments.

Jiri Pirko (8):
  devlink: remove custom bool command line options parsing
  devlink: Fix help and man of "devlink health set" command
  devlink: fix encap mode manupulation
  devlink: Add alias "counters_enabled" for "counters" option
  devlink: rename dpipe_counters_enable struct field to
    dpipe_counters_enabled
  devlink: Fix help message for dpipe
  devlink: remove "dev" object sub help messages
  man: add man page for devlink dpipe

 bash-completion/devlink   |   8 +--
 devlink/devlink.c         | 131 +++++++++++++++++---------------------
 man/man8/devlink-dev.8    |   8 +--
 man/man8/devlink-dpipe.8  | 100 +++++++++++++++++++++++++++++
 man/man8/devlink-health.8 |  30 +++++----
 5 files changed, 181 insertions(+), 96 deletions(-)
 create mode 100644 man/man8/devlink-dpipe.8

-- 
2.21.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [patch iproute2/net-next 1/8] devlink: remove custom bool command line options parsing
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
@ 2020-04-04 16:16 ` Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 2/8] devlink: Fix help and man of "devlink health set" command Jiri Pirko
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

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 <jiri@mellanox.com>
---
 devlink/devlink.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 6434e68593ea..0109d30cba41 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -752,9 +752,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;
@@ -1089,20 +1091,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) {
@@ -1349,14 +1337,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;
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [patch iproute2/net-next 2/8] devlink: Fix help and man of "devlink health set" command
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 1/8] devlink: remove custom bool command line options parsing Jiri Pirko
@ 2020-04-04 16:16 ` Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 3/8] devlink: fix encap mode manupulation Jiri Pirko
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

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 <jiri@mellanox.com>
---
 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 0109d30cba41..559b6cec2fae 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -6901,7 +6901,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 7ed0ae4534dc..70a86cf0acdc 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
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [patch iproute2/net-next 3/8] devlink: fix encap mode manupulation
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 1/8] devlink: remove custom bool command line options parsing Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 2/8] devlink: Fix help and man of "devlink health set" command Jiri Pirko
@ 2020-04-04 16:16 ` Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 4/8] devlink: Add alias "counters_enabled" for "counters" option Jiri Pirko
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

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 <jiri@mellanox.com>
---
 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 45fba75c1539..73d85d5eafb6 100644
--- a/bash-completion/devlink
+++ b/bash-completion/devlink
@@ -100,11 +100,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
@@ -127,8 +127,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 559b6cec2fae..79a1c3829c31 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"
@@ -305,7 +308,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;
@@ -1091,12 +1094,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;
@@ -1342,7 +1352,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;
 
@@ -1678,7 +1689,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");
@@ -2105,6 +2116,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 "<unknown mode>";
+	}
+}
+
 static void pr_out_eswitch(struct dl *dl, struct nlattr **tb)
 {
 	__pr_out_handle_start(dl, tb, true, false);
@@ -2122,11 +2145,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 289935dbcac9..ac01bf603a44 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
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [patch iproute2/net-next 4/8] devlink: Add alias "counters_enabled" for "counters" option
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
                   ` (2 preceding siblings ...)
  2020-04-04 16:16 ` [patch iproute2/net-next 3/8] devlink: fix encap mode manupulation Jiri Pirko
@ 2020-04-04 16:16 ` Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 5/8] devlink: rename dpipe_counters_enable struct field to dpipe_counters_enabled Jiri Pirko
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

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 <jiri@mellanox.com>
---
 devlink/devlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 79a1c3829c31..d40991d52cf6 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1345,7 +1345,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);
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [patch iproute2/net-next 5/8] devlink: rename dpipe_counters_enable struct field to dpipe_counters_enabled
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
                   ` (3 preceding siblings ...)
  2020-04-04 16:16 ` [patch iproute2/net-next 4/8] devlink: Add alias "counters_enabled" for "counters" option Jiri Pirko
@ 2020-04-04 16:16 ` Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 6/8] devlink: Fix help message for dpipe Jiri Pirko
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

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 <jiri@mellanox.com>
---
 devlink/devlink.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index d40991d52cf6..575737fff985 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -307,7 +307,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;
@@ -1349,7 +1349,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;
@@ -1579,7 +1579,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);
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [patch iproute2/net-next 6/8] devlink: Fix help message for dpipe
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
                   ` (4 preceding siblings ...)
  2020-04-04 16:16 ` [patch iproute2/net-next 5/8] devlink: rename dpipe_counters_enable struct field to dpipe_counters_enabled Jiri Pirko
@ 2020-04-04 16:16 ` Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 7/8] devlink: remove "dev" object sub help messages Jiri Pirko
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

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 <jiri@mellanox.com>
---
 devlink/devlink.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 575737fff985..14ea91726892 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -4953,15 +4953,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);
@@ -5777,16 +5781,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);
@@ -5802,12 +5800,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)) {
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [patch iproute2/net-next 7/8] devlink: remove "dev" object sub help messages
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
                   ` (5 preceding siblings ...)
  2020-04-04 16:16 ` [patch iproute2/net-next 6/8] devlink: Fix help message for dpipe Jiri Pirko
@ 2020-04-04 16:16 ` Jiri Pirko
  2020-04-04 16:16 ` [patch iproute2/net-next 8/8] man: add man page for devlink dpipe Jiri Pirko
  2020-04-06  2:21 ` [patch iproute2/net-next 0/8] devlink: spring cleanup Stephen Hemminger
  8 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

Remove duplicate sub help messages for "dev" object and have them all
show help message for "dev".

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 devlink/devlink.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 14ea91726892..efc5591d5ebf 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -2740,18 +2740,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;
 	}
 
@@ -2873,11 +2868,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;
@@ -2885,7 +2875,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;
 	}
 
@@ -2906,12 +2896,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;
@@ -3059,7 +3043,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;
 	}
 
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [patch iproute2/net-next 8/8] man: add man page for devlink dpipe
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
                   ` (6 preceding siblings ...)
  2020-04-04 16:16 ` [patch iproute2/net-next 7/8] devlink: remove "dev" object sub help messages Jiri Pirko
@ 2020-04-04 16:16 ` Jiri Pirko
  2020-04-06 17:30   ` Stephen Hemminger
  2020-04-06  2:21 ` [patch iproute2/net-next 0/8] devlink: spring cleanup Stephen Hemminger
  8 siblings, 1 reply; 13+ messages in thread
From: Jiri Pirko @ 2020-04-04 16:16 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, stephen, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

Add simple man page for devlink dpipe.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 man/man8/devlink-dpipe.8 | 100 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 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 000000000000..00379401208e
--- /dev/null
+++ b/man/man8/devlink-dpipe.8
@@ -0,0 +1,100 @@
+.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
+.R [
+.BI name " TABLE_NAME "
+.R ]
+
+.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 <jiri@mellanox.com>
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [patch iproute2/net-next 0/8] devlink: spring cleanup
  2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
                   ` (7 preceding siblings ...)
  2020-04-04 16:16 ` [patch iproute2/net-next 8/8] man: add man page for devlink dpipe Jiri Pirko
@ 2020-04-06  2:21 ` Stephen Hemminger
  2020-04-06  6:53   ` Jiri Pirko
  8 siblings, 1 reply; 13+ messages in thread
From: Stephen Hemminger @ 2020-04-06  2:21 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, dsahern, mlxsw

On Sat,  4 Apr 2020 18:16:13 +0200
Jiri Pirko <jiri@resnulli.us> wrote:

> From: Jiri Pirko <jiri@mellanox.com>
> 
> This patchset contains couple of small fixes, consistency changes,
> help and man adjustments.
> 
> Jiri Pirko (8):
>   devlink: remove custom bool command line options parsing
>   devlink: Fix help and man of "devlink health set" command
>   devlink: fix encap mode manupulation
>   devlink: Add alias "counters_enabled" for "counters" option
>   devlink: rename dpipe_counters_enable struct field to
>     dpipe_counters_enabled
>   devlink: Fix help message for dpipe
>   devlink: remove "dev" object sub help messages
>   man: add man page for devlink dpipe
> 
>  bash-completion/devlink   |   8 +--
>  devlink/devlink.c         | 131 +++++++++++++++++---------------------
>  man/man8/devlink-dev.8    |   8 +--
>  man/man8/devlink-dpipe.8  | 100 +++++++++++++++++++++++++++++
>  man/man8/devlink-health.8 |  30 +++++----
>  5 files changed, 181 insertions(+), 96 deletions(-)
>  create mode 100644 man/man8/devlink-dpipe.8
> 

Since these all don't depend on new kernel features, let me take
them directly and skip net-next

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch iproute2/net-next 0/8] devlink: spring cleanup
  2020-04-06  2:21 ` [patch iproute2/net-next 0/8] devlink: spring cleanup Stephen Hemminger
@ 2020-04-06  6:53   ` Jiri Pirko
  0 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-06  6:53 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, dsahern, mlxsw

Mon, Apr 06, 2020 at 04:21:09AM CEST, stephen@networkplumber.org wrote:
>On Sat,  4 Apr 2020 18:16:13 +0200
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> From: Jiri Pirko <jiri@mellanox.com>
>> 
>> This patchset contains couple of small fixes, consistency changes,
>> help and man adjustments.
>> 
>> Jiri Pirko (8):
>>   devlink: remove custom bool command line options parsing
>>   devlink: Fix help and man of "devlink health set" command
>>   devlink: fix encap mode manupulation
>>   devlink: Add alias "counters_enabled" for "counters" option
>>   devlink: rename dpipe_counters_enable struct field to
>>     dpipe_counters_enabled
>>   devlink: Fix help message for dpipe
>>   devlink: remove "dev" object sub help messages
>>   man: add man page for devlink dpipe
>> 
>>  bash-completion/devlink   |   8 +--
>>  devlink/devlink.c         | 131 +++++++++++++++++---------------------
>>  man/man8/devlink-dev.8    |   8 +--
>>  man/man8/devlink-dpipe.8  | 100 +++++++++++++++++++++++++++++
>>  man/man8/devlink-health.8 |  30 +++++----
>>  5 files changed, 181 insertions(+), 96 deletions(-)
>>  create mode 100644 man/man8/devlink-dpipe.8
>> 
>
>Since these all don't depend on new kernel features, let me take
>them directly and skip net-next

Okay.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch iproute2/net-next 8/8] man: add man page for devlink dpipe
  2020-04-04 16:16 ` [patch iproute2/net-next 8/8] man: add man page for devlink dpipe Jiri Pirko
@ 2020-04-06 17:30   ` Stephen Hemminger
  2020-04-06 18:06     ` Jiri Pirko
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Hemminger @ 2020-04-06 17:30 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, dsahern, mlxsw

On Sat,  4 Apr 2020 18:16:21 +0200
Jiri Pirko <jiri@resnulli.us> wrote:

> From: Jiri Pirko <jiri@mellanox.com>
> 
> Add simple man page for devlink dpipe.
> 
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  man/man8/devlink-dpipe.8 | 100 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 100 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 000000000000..00379401208e
> --- /dev/null
> +++ b/man/man8/devlink-dpipe.8
> @@ -0,0 +1,100 @@
> +.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
> +.R [
> +.BI name " TABLE_NAME "
> +.R ]

I applied the whole set, but fixed some issues on the man page.
You had some trailing white space, and the .R macro is not the right
way to do this. Make check runs a script from Debian and it spots that.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch iproute2/net-next 8/8] man: add man page for devlink dpipe
  2020-04-06 17:30   ` Stephen Hemminger
@ 2020-04-06 18:06     ` Jiri Pirko
  0 siblings, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2020-04-06 18:06 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, dsahern, mlxsw

Mon, Apr 06, 2020 at 07:30:36PM CEST, stephen@networkplumber.org wrote:
>On Sat,  4 Apr 2020 18:16:21 +0200
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> From: Jiri Pirko <jiri@mellanox.com>
>> 
>> Add simple man page for devlink dpipe.
>> 
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>>  man/man8/devlink-dpipe.8 | 100 +++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 100 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 000000000000..00379401208e
>> --- /dev/null
>> +++ b/man/man8/devlink-dpipe.8
>> @@ -0,0 +1,100 @@
>> +.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
>> +.R [
>> +.BI name " TABLE_NAME "
>> +.R ]
>
>I applied the whole set, but fixed some issues on the man page.
>You had some trailing white space, and the .R macro is not the right
>way to do this. Make check runs a script from Debian and it spots that.

Okay. I'll make sure to run this next time. I had no idea it checkes
man. Thanks!

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-04-06 18:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 16:16 [patch iproute2/net-next 0/8] devlink: spring cleanup Jiri Pirko
2020-04-04 16:16 ` [patch iproute2/net-next 1/8] devlink: remove custom bool command line options parsing Jiri Pirko
2020-04-04 16:16 ` [patch iproute2/net-next 2/8] devlink: Fix help and man of "devlink health set" command Jiri Pirko
2020-04-04 16:16 ` [patch iproute2/net-next 3/8] devlink: fix encap mode manupulation Jiri Pirko
2020-04-04 16:16 ` [patch iproute2/net-next 4/8] devlink: Add alias "counters_enabled" for "counters" option Jiri Pirko
2020-04-04 16:16 ` [patch iproute2/net-next 5/8] devlink: rename dpipe_counters_enable struct field to dpipe_counters_enabled Jiri Pirko
2020-04-04 16:16 ` [patch iproute2/net-next 6/8] devlink: Fix help message for dpipe Jiri Pirko
2020-04-04 16:16 ` [patch iproute2/net-next 7/8] devlink: remove "dev" object sub help messages Jiri Pirko
2020-04-04 16:16 ` [patch iproute2/net-next 8/8] man: add man page for devlink dpipe Jiri Pirko
2020-04-06 17:30   ` Stephen Hemminger
2020-04-06 18:06     ` Jiri Pirko
2020-04-06  2:21 ` [patch iproute2/net-next 0/8] devlink: spring cleanup Stephen Hemminger
2020-04-06  6:53   ` Jiri Pirko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.