ethtool: Wake-on-LAN using filters
Subsystems (2)
v2 cover ethtool: Wake-on-LAN using filters
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(-)
Signature · 1 line
2.17.1
PATCH v2 1/3 ethtool-copy.h: sync with net-next
This covers kernel changes up to commit 6cfef793b558:
ethtool: Add WAKE_FILTER and RX_CLS_FLOW_WAKE
--- ethtool-copy.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
ethtool-copy.h +11 -4
@@ -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 */
Signature · 1 line
2.17.1
PATCH v2 2/3 ethtool: Add support for WAKE_FILTER (WoL using filters)
In reply to Florian FainelliAdd 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.
--- ethtool.8.in | 3 ++- ethtool.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)
ethtool.8.in +2 -1
@@ -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}
ethtool.c +5 -0
@@ -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' ; }
Signature · 1 line
2.17.1
PATCH v2 3/3 ethtool: Add support for action value -2 (wake-up filter)
In reply to Florian FainelliAdd 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).
--- ethtool.8.in | 1 + rxclass.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-)
ethtool.8.in +1 -0
@@ -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
rxclass.c +5 -3
@@ -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" );
Signature · 1 line
2.17.1
Quoted 20 lines · Florian Fainelli
Hi John,
This patch series syncs up
ethtool-copy.hto get the new definitions required for supporting wake-on-LAN using filters:WAKE_FILTERandRX_CLS_FLOW_WAKEand then updates therxclass.ccode 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 forWAKE_FILTER(WoL using filters)
ethtool: Add support for action value -2 (wake-up filter)
Quoted 5 lines
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
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.