[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180717153645.7500-2-f.fainelli@gmail.com>
Date: Tue, 17 Jul 2018 08:36:38 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: netdev@...r.kernel.org
Cc: Florian Fainelli <f.fainelli@...il.com>, linville@...driver.com,
davem@...emloft.net, andrew@...n.ch,
vivien.didelot@...oirfairelinux.com
Subject: [PATCH ethtool] ethtool: Add support for WAKE_FILTER
Allow re-purposing the wol->sopass storage area to specify a bitmask of filters
(programmed previously via ethtool::rxnfc) to be used as wake-up patterns.
Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
---
ethtool-copy.h | 1 +
ethtool.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 8cc61e9ab40b..dbfaca15dca5 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -1628,6 +1628,7 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define WAKE_ARP (1 << 4)
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
+#define WAKE_FILTER (1 << 7)
/* L2-L4 network traffic flow types */
#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
diff --git a/ethtool.c b/ethtool.c
index fb93ae898312..322fc8d98ee5 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -931,6 +931,9 @@ static int parse_wolopts(char *optstr, u32 *data)
case 's':
*data |= WAKE_MAGICSECURE;
break;
+ case 'f':
+ *data |= WAKE_FILTER;
+ break;
case 'd':
*data = 0;
break;
@@ -964,6 +967,8 @@ static char *unparse_wolopts(int wolopts)
*p++ = 'g';
if (wolopts & WAKE_MAGICSECURE)
*p++ = 's';
+ if (wolopts & WAKE_FILTER)
+ *p++ = 'f';
} else {
*p = 'd';
}
@@ -989,6 +994,21 @@ static int dump_wol(struct ethtool_wolinfo *wol)
fprintf(stdout, "\n");
}
+ if (wol->supported & WAKE_FILTER) {
+ int i, j;
+ int delim = 0;
+ fprintf(stdout, " Filter(s) enabled: ");
+ for (i = 0; i < SOPASS_MAX; i++) {
+ for (j = 0; j < 8; j++) {
+ if (wol->sopass[i] & (1 << j)) {
+ fprintf(stdout, "%s%d", delim?",":"", i * 8 + j);
+ delim=1;
+ }
+ }
+ }
+ fprintf(stdout, "\n");
+ }
+
return 0;
}
@@ -2897,6 +2917,16 @@ static int do_sset(struct cmd_context *ctx)
exit_bad_args();
get_mac_addr(argp[i], sopass_wanted);
sopass_change = 1;
+ } else if (!strcmp(argp[i], "filters")) {
+ gwol_changed = 1;
+ i++;
+ if (i >= argc)
+ exit_bad_args();
+ if (parse_hex_u32_bitmap(argp[i],
+ SOPASS_MAX * 8,
+ (unsigned int *)sopass_wanted))
+ exit_bad_args();
+ sopass_change = 1;
} else if (!strcmp(argp[i], "msglvl")) {
i++;
if (i >= argc)
@@ -3112,8 +3142,10 @@ static int do_sset(struct cmd_context *ctx)
if (err < 0) {
if (wol_change)
fprintf(stderr, " not setting wol\n");
- if (sopass_change)
+ if (sopass_change & wol.wolopts & WAKE_MAGICSECURE)
fprintf(stderr, " not setting sopass\n");
+ if (sopass_change & wol.wolopts & WAKE_FILTER)
+ fprintf(stderr, " not setting filters\n");
}
}
@@ -5066,6 +5098,7 @@ static const struct option {
" [ xcvr internal|external ]\n"
" [ wol p|u|m|b|a|g|s|d... ]\n"
" [ sopass %x:%x:%x:%x:%x:%x ]\n"
+ " [ filters %x ]\n"
" [ msglvl %d | msglvl type on|off ... ]\n" },
{ "-a|--show-pause", 1, do_gpause, "Show pause options" },
{ "-A|--pause", 1, do_spause, "Set pause options",
--
2.14.1
Powered by blists - more mailing lists