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: <2b2634cb14380ed15e69357bccdcc82ada2df4f0.1532954671.git.mkubecek@suse.cz>
Date:   Mon, 30 Jul 2018 14:57:29 +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 21/23] netlink: add netlink handler for
 schannels (-L)

Implement "ethtool -L <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 | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/ethtool.c b/ethtool.c
index b6e322af9c8a..9ac7f3c57ecb 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -4888,6 +4888,7 @@ static int show_usage(struct cmd_context *ctx);
 #define nl_scoalesce	NULL
 #define nl_sring	NULL
 #define nl_spause	NULL
+#define nl_schannels	NULL
 #endif
 
 static const struct option {
@@ -5041,7 +5042,7 @@ static const struct option {
 	  "		N\n"},
 	{ "-l|--show-channels", 1, do_gchannels, nl_gchannels,
 	  "Query Channels" },
-	{ "-L|--set-channels", 1, do_schannels, NULL,
+	{ "-L|--set-channels", 1, do_schannels, nl_schannels,
 	  "Set Channels",
 	  "               [ rx N ]\n"
 	  "               [ tx N ]\n"
diff --git a/netlink/extapi.h b/netlink/extapi.h
index 8cf1d0093aaa..bc33be82bdd5 100644
--- a/netlink/extapi.h
+++ b/netlink/extapi.h
@@ -27,6 +27,7 @@ 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_schannels(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 953678a0b227..5e0f0d264187 100644
--- a/netlink/params.c
+++ b/netlink/params.c
@@ -572,3 +572,37 @@ int nl_spause(struct cmd_context *ctx)
 	return nl_set_param(ctx, "-A", spause_params, ETHA_PARAMS_PAUSE,
 			    ETHA_PAUSE_MAX);
 }
+
+static const struct param_parser schannels_params[] = {
+	{
+		.arg		= "rx",
+		.type		= ETHA_CHANNELS_RX_COUNT,
+		.handler	= nl_parse_direct_u32,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "tx",
+		.type		= ETHA_CHANNELS_TX_COUNT,
+		.handler	= nl_parse_direct_u32,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "other",
+		.type		= ETHA_CHANNELS_OTHER_COUNT,
+		.handler	= nl_parse_direct_u32,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "combined",
+		.type		= ETHA_CHANNELS_COMBINED_COUNT,
+		.handler	= nl_parse_direct_u32,
+		.min_argc	= 1,
+	},
+	{}
+};
+
+int nl_schannels(struct cmd_context *ctx)
+{
+	return nl_set_param(ctx, "-L", schannels_params, ETHA_PARAMS_CHANNELS,
+			    ETHA_CHANNELS_MAX);
+}
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ