public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters
@ 2018-08-09 18:03 Florian Fainelli
  2018-08-09 18:04 ` [PATCH ethtool v2 1/3] ethtool-copy.h: sync with net-next Florian Fainelli
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Florian Fainelli @ 2018-08-09 18:03 UTC (permalink / raw)
  To: netdev, linville; +Cc: davem, andrew, Florian Fainelli

Hi John,

This patch series syncs up ethtool-copy.h to get the new definitions
required for supporting wake-on-LAN using filters: WAKE_FILTER and
RX_CLS_FLOW_WAKE and then updates the rxclass.c code to allow us to
specify action -2 (RX_CLS_FLOW_WAKE).

Let me know if you would like this to be done differently.

Thanks!

Changes in v2:

- properly put the man page hunk describing action -2 into patch #3

Florian Fainelli (3):
  ethtool-copy.h: sync with net-next
  ethtool: Add support for WAKE_FILTER (WoL using filters)
  ethtool: Add support for action value -2 (wake-up filter)

 ethtool-copy.h | 15 +++++++++++----
 ethtool.8.in   |  4 +++-
 ethtool.c      |  5 +++++
 rxclass.c      |  8 +++++---
 4 files changed, 24 insertions(+), 8 deletions(-)

-- 
2.17.1

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

* [PATCH ethtool v2 1/3] ethtool-copy.h: sync with net-next
  2018-08-09 18:03 [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters Florian Fainelli
@ 2018-08-09 18:04 ` Florian Fainelli
  2018-08-09 18:04 ` [PATCH ethtool v2 2/3] ethtool: Add support for WAKE_FILTER (WoL using filters) Florian Fainelli
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2018-08-09 18:04 UTC (permalink / raw)
  To: netdev, linville; +Cc: davem, andrew, Florian Fainelli

This covers kernel changes up to commit 6cfef793b558:
   ethtool: Add WAKE_FILTER and RX_CLS_FLOW_WAKE

Signed-off-by: Florian Fainelli <f.fainelli@gmail•com>
---
 ethtool-copy.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 8cc61e9ab40b..6bfbb85f9402 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -215,12 +215,16 @@ struct ethtool_value {
 	__u32	data;
 };
 
+#define PFC_STORM_PREVENTION_AUTO	0xffff
+#define PFC_STORM_PREVENTION_DISABLE	0
+
 enum tunable_id {
 	ETHTOOL_ID_UNSPEC,
 	ETHTOOL_RX_COPYBREAK,
 	ETHTOOL_TX_COPYBREAK,
+	ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */
 	/*
-	 * Add your fresh new tubale attribute above and remember to update
+	 * Add your fresh new tunable attribute above and remember to update
 	 * tunable_strings[] in net/core/ethtool.c
 	 */
 	__ETHTOOL_TUNABLE_COUNT,
@@ -864,7 +868,8 @@ struct ethtool_flow_ext {
  *	includes the %FLOW_EXT or %FLOW_MAC_EXT flag
  *	(see &struct ethtool_flow_ext description).
  * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
- *	if packets should be discarded
+ *	if packets should be discarded, or %RX_CLS_FLOW_WAKE if the
+ *	packets should be used for Wake-on-LAN with %WAKE_FILTER
  * @location: Location of rule in the table.  Locations must be
  *	numbered such that a flow matching multiple rules will be
  *	classified according to the first (lowest numbered) rule.
@@ -896,13 +901,13 @@ struct ethtool_rx_flow_spec {
 static __inline__ __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
 {
 	return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
-};
+}
 
 static __inline__ __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
 {
 	return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
 				ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
-};
+}
 
 /**
  * struct ethtool_rxnfc - command to get or set RX flow classification rules
@@ -1628,6 +1633,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) */
@@ -1665,6 +1671,7 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
 #define	RXH_DISCARD	(1 << 31)
 
 #define	RX_CLS_FLOW_DISC	0xffffffffffffffffULL
+#define RX_CLS_FLOW_WAKE	0xfffffffffffffffeULL
 
 /* Special RX classification rule insert location values */
 #define RX_CLS_LOC_SPECIAL	0x80000000	/* flag */
-- 
2.17.1

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

* [PATCH ethtool v2 2/3] ethtool: Add support for WAKE_FILTER (WoL using filters)
  2018-08-09 18:03 [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters Florian Fainelli
  2018-08-09 18:04 ` [PATCH ethtool v2 1/3] ethtool-copy.h: sync with net-next Florian Fainelli
@ 2018-08-09 18:04 ` Florian Fainelli
  2018-08-09 18:04 ` [PATCH ethtool v2 3/3] ethtool: Add support for action value -2 (wake-up filter) Florian Fainelli
  2018-08-16 18:32 ` [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters John W. Linville
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2018-08-09 18:04 UTC (permalink / raw)
  To: netdev, linville; +Cc: davem, andrew, Florian Fainelli

Add a new character 'f' which can be used to configure an Ethernet
controller to support Wake-on-LAN using filters programmed with the
ethtool::rxnfc and the special action -2 (wake-up filter). This is
useful in particular in the context of devices that must support wake-up
on more complex patterns such as multicast DNS packets.

Signed-off-by: Florian Fainelli <f.fainelli@gmail•com>
---
 ethtool.8.in | 3 ++-
 ethtool.c    | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ethtool.8.in b/ethtool.8.in
index 0a366aa536ae..3eb9005ada48 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -58,7 +58,7 @@
 .\"
 .\"	\(*WO - wol flags
 .\"
-.ds WO \fBp\fP|\fBu\fP|\fBm\fP|\fBb\fP|\fBa\fP|\fBg\fP|\fBs\fP|\fBd\fP...
+.ds WO \fBp\fP|\fBu\fP|\fBm\fP|\fBb\fP|\fBa\fP|\fBg\fP|\fBs\fP|\fBf|\fBd\fP...
 .\"
 .\"	\(*FL - flow type values
 .\"
@@ -679,6 +679,7 @@ b	Wake on broadcast messages
 a	Wake on ARP
 g	Wake on MagicPacket\[tm]
 s	Enable SecureOn\[tm] password for MagicPacket\[tm]
+f	Wake on filter(s)
 d	T{
 Disable (wake on nothing).  This option clears all previous options.
 T}
diff --git a/ethtool.c b/ethtool.c
index fb93ae898312..aa2bbe9e4c65 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';
 	}
-- 
2.17.1

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

* [PATCH ethtool v2 3/3] ethtool: Add support for action value -2 (wake-up filter)
  2018-08-09 18:03 [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters Florian Fainelli
  2018-08-09 18:04 ` [PATCH ethtool v2 1/3] ethtool-copy.h: sync with net-next Florian Fainelli
  2018-08-09 18:04 ` [PATCH ethtool v2 2/3] ethtool: Add support for WAKE_FILTER (WoL using filters) Florian Fainelli
@ 2018-08-09 18:04 ` Florian Fainelli
  2018-08-16 18:32 ` [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters John W. Linville
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2018-08-09 18:04 UTC (permalink / raw)
  To: netdev, linville; +Cc: davem, andrew, Florian Fainelli

Add the ability to program special filters using ethtool::rxnfc which
are meant to be used for wake-up purposes (in conjuction with
WAKE_FILTER) using the special action value: -2 (RX_CLS_FLOW_WAKE).

Signed-off-by: Florian Fainelli <f.fainelli@gmail•com>
---
 ethtool.8.in | 1 +
 rxclass.c    | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ethtool.8.in b/ethtool.8.in
index 3eb9005ada48..97c7330fd373 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -871,6 +871,7 @@ Specifies the Rx queue to send packets to, or some other action.
 nokeep;
 lB	l.
 -1	Drop the matched flow
+-2	Use the matched flow as a Wake-on-LAN filter
 0 or higher	Rx queue to route the flow
 .TE
 .TP
diff --git a/rxclass.c b/rxclass.c
index 42d122d1ed86..79972651e706 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -251,7 +251,11 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp,
 	if (fsp->flow_type & FLOW_RSS)
 		fprintf(stdout, "\tRSS Context ID: %u\n", rss_context);
 
-	if (fsp->ring_cookie != RX_CLS_FLOW_DISC) {
+	if (fsp->ring_cookie == RX_CLS_FLOW_DISC) {
+		fprintf(stdout, "\tAction: Drop\n");
+	} else if (fsp->ring_cookie == RX_CLS_FLOW_WAKE) {
+		fprintf(stdout, "\tAction: Wake-on-LAN\n");
+	} else {
 		u64 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);
 		u64 queue = ethtool_get_flow_spec_ring(fsp->ring_cookie);
 
@@ -266,8 +270,6 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp,
 		else
 			fprintf(stdout, "\tAction: Direct to queue %llu\n",
 				queue);
-	} else {
-		fprintf(stdout, "\tAction: Drop\n");
 	}
 
 	fprintf(stdout, "\n");
-- 
2.17.1

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

* Re: [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters
  2018-08-09 18:03 [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters Florian Fainelli
                   ` (2 preceding siblings ...)
  2018-08-09 18:04 ` [PATCH ethtool v2 3/3] ethtool: Add support for action value -2 (wake-up filter) Florian Fainelli
@ 2018-08-16 18:32 ` John W. Linville
  3 siblings, 0 replies; 5+ messages in thread
From: John W. Linville @ 2018-08-16 18:32 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, davem, andrew

On Thu, Aug 09, 2018 at 11:03:59AM -0700, Florian Fainelli wrote:
> Hi John,
> 
> This patch series syncs up ethtool-copy.h to get the new definitions
> required for supporting wake-on-LAN using filters: WAKE_FILTER and
> RX_CLS_FLOW_WAKE and then updates the rxclass.c code to allow us to
> specify action -2 (RX_CLS_FLOW_WAKE).
> 
> Let me know if you would like this to be done differently.
> 
> Thanks!
> 
> Changes in v2:
> 
> - properly put the man page hunk describing action -2 into patch #3
> 
> Florian Fainelli (3):
>   ethtool-copy.h: sync with net-next
>   ethtool: Add support for WAKE_FILTER (WoL using filters)
>   ethtool: Add support for action value -2 (wake-up filter)
> 
>  ethtool-copy.h | 15 +++++++++++----
>  ethtool.8.in   |  4 +++-
>  ethtool.c      |  5 +++++
>  rxclass.c      |  8 +++++---
>  4 files changed, 24 insertions(+), 8 deletions(-)

Thanks, Florian -- LGTM!

Patches merged and pushed-out, queued for next release (probably next week)...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver•com			might be all we have.  Be ready.

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

end of thread, other threads:[~2018-08-16 21:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-09 18:03 [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters Florian Fainelli
2018-08-09 18:04 ` [PATCH ethtool v2 1/3] ethtool-copy.h: sync with net-next Florian Fainelli
2018-08-09 18:04 ` [PATCH ethtool v2 2/3] ethtool: Add support for WAKE_FILTER (WoL using filters) Florian Fainelli
2018-08-09 18:04 ` [PATCH ethtool v2 3/3] ethtool: Add support for action value -2 (wake-up filter) Florian Fainelli
2018-08-16 18:32 ` [PATCH ethtool v2 0/3] ethtool: Wake-on-LAN using filters John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox