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: <622072b1376dc468eec9f322c909d5b6b9d206c8.1532954671.git.mkubecek@suse.cz>
Date:   Mon, 30 Jul 2018 14:57:34 +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 22/23] netlink: add netlink handler for seee
 (--set-eee)

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

Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
---
 ethtool.c        |  5 +++--
 netlink/extapi.h |  1 +
 netlink/params.c | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/ethtool.c b/ethtool.c
index 9ac7f3c57ecb..bd85b0c50ce2 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -4889,6 +4889,7 @@ static int show_usage(struct cmd_context *ctx);
 #define nl_sring	NULL
 #define nl_spause	NULL
 #define nl_schannels	NULL
+#define nl_seee		NULL
 #endif
 
 static const struct option {
@@ -5061,10 +5062,10 @@ static const struct option {
 	  "		[ length N ]\n" },
 	{ "--show-eee", 1, do_geee, nl_geee,
 	  "Show EEE settings"},
-	{ "--set-eee", 1, do_seee, NULL,
+	{ "--set-eee", 1, do_seee, nl_seee,
 	  "Set EEE settings",
 	  "		[ eee on|off ]\n"
-	  "		[ advertise %x ]\n"
+	  "		[ advertise %x[/%x] | mode on|off ... ]\n"
 	  "		[ tx-lpi on|off ]\n"
 	  "		[ tx-timer %d ]\n"},
 	{ "--set-phy-tunable", 1, do_set_phy_tunable, NULL,
diff --git a/netlink/extapi.h b/netlink/extapi.h
index bc33be82bdd5..80ed4afb5227 100644
--- a/netlink/extapi.h
+++ b/netlink/extapi.h
@@ -28,6 +28,7 @@ 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_seee(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 5e0f0d264187..1cc2ffbc4b27 100644
--- a/netlink/params.c
+++ b/netlink/params.c
@@ -606,3 +606,37 @@ int nl_schannels(struct cmd_context *ctx)
 	return nl_set_param(ctx, "-L", schannels_params, ETHA_PARAMS_CHANNELS,
 			    ETHA_CHANNELS_MAX);
 }
+
+static const struct param_parser seee_params[] = {
+	{
+		.arg		= "advertise",
+		.type		= ETHA_EEE_LINK_MODES,
+		.handler	= nl_parse_bitset,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "tx-lpi",
+		.type		= ETHA_EEE_TX_LPI_ENABLED,
+		.handler	= nl_parse_bool,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "tx-timer",
+		.type		= ETHA_EEE_TX_LPI_TIMER,
+		.handler	= nl_parse_direct_u32,
+		.min_argc	= 1,
+	},
+	{
+		.arg		= "eee",
+		.type		= ETHA_EEE_ENABLED,
+		.handler	= nl_parse_bool,
+		.min_argc	= 1,
+	},
+	{}
+};
+
+int nl_seee(struct cmd_context *ctx)
+{
+	return nl_set_param(ctx, "--set-eee", seee_params, ETHA_PARAMS_EEE,
+			    ETHA_EEE_MAX);
+}
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ