lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <163ed9f92a0367fc687625e851aa3db87e2092cf.1532954671.git.mkubecek@suse.cz>
Date:   Mon, 30 Jul 2018 14:57:24 +0200 (CEST)
From:   Michal Kubecek <mkubecek@...e.cz>
To:     netdev@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org,
        "John W. Linville" <linville@...driver.com>
Subject: [RFC PATCH ethtool v2 20/23] netlink: add netlink handler for spause
 (-A)

Implement "ethtool -A <dev>" subcommand using netlink interface command
ETHNL_CMD_SET_PARAMS.

Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
---
 ethtool.c        |  3 ++-
 netlink/extapi.h |  1 +
 netlink/params.c | 28 ++++++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/ethtool.c b/ethtool.c
index 792283c46d35..b6e322af9c8a 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -4887,6 +4887,7 @@ static int show_usage(struct cmd_context *ctx);
 #define nl_gfec		NULL
 #define nl_scoalesce	NULL
 #define nl_sring	NULL
+#define nl_spause	NULL
 #endif
 
 static const struct option {
@@ -4912,7 +4913,7 @@ static const struct option {
 	  "		[ msglvl %d[/%d] | type on|off ... [--] ]\n" },
 	{ "-a|--show-pause", 1, do_gpause, nl_gpause,
 	  "Show pause options" },
-	{ "-A|--pause", 1, do_spause, NULL,
+	{ "-A|--pause", 1, do_spause, nl_spause,
 	  "Set pause options",
 	  "		[ autoneg on|off ]\n"
 	  "		[ rx on|off ]\n"
diff --git a/netlink/extapi.h b/netlink/extapi.h
index d6d01ee9eae3..8cf1d0093aaa 100644
--- a/netlink/extapi.h
+++ b/netlink/extapi.h
@@ -26,6 +26,7 @@ int nl_geee(struct cmd_context *ctx);
 int nl_gfec(struct cmd_context *ctx);
 int nl_scoalesce(struct cmd_context *ctx);
 int nl_sring(struct cmd_context *ctx);
+int nl_spause(struct cmd_context *ctx);
 int nl_monitor(struct cmd_context *ctx);
 
 void monitor_usage();
diff --git a/netlink/params.c b/netlink/params.c
index ee0d5e0c51c6..953678a0b227 100644
--- a/netlink/params.c
+++ b/netlink/params.c
@@ -544,3 +544,31 @@ int nl_sring(struct cmd_context *ctx)
 	return nl_set_param(ctx, "-G", sring_params, ETHA_PARAMS_RING,
 			    ETHA_RING_MAX);
 }
+
+static const struct param_parser spause_params[] = {
+	{
+		.arg		= "autoneg",
+		.type		= ETHA_PAUSE_AUTONEG,
+		.handler	= nl_parse_bool,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "rx",
+		.type		= ETHA_PAUSE_RX,
+		.handler	= nl_parse_bool,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "tx",
+		.type		= ETHA_PAUSE_TX,
+		.handler	= nl_parse_bool,
+		.min_argc	= 1,
+	},
+	{}
+};
+
+int nl_spause(struct cmd_context *ctx)
+{
+	return nl_set_param(ctx, "-A", spause_params, ETHA_PARAMS_PAUSE,
+			    ETHA_PAUSE_MAX);
+}
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ