IPv6 RXNFC
Subsystems (2)
v2 cover IPv6 RXNFC
This series adds support for steering of IPv6 receive flows.
Changes since v1:
* Fixed and simplified IPv6 address and mask parsing
* Made help text / man page more consistent
* Dropped ethtool-copy.h patch as upstream is now newer
Edward Cree (2):
Add IPv6 support to NFC
Documentation for IPv6 NFC
ethtool.8.in | 29 +++++-- ethtool.c | 25 +++++- rxclass.c | 268 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 298 insertions(+), 24 deletions(-)
PATCH v2 1/2 Add IPv6 support to NFC
--- ethtool.c | 21 +++++ rxclass.c | 267 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 274 insertions(+), 14 deletions(-)
ethtool.c +21 -0
@@ -32,6 +32,7 @@#include <sys/stat.h> #include <stdio.h> #include <stddef.h> +#include <stdbool.h> #include <errno.h> #include <sys/utsname.h> #include <limits.h>
@@ -3540,6 +3541,22 @@ static int do_permaddr(struct cmd_context *ctx)return err; } +static bool flow_type_is_ntuple_supported (__u32 flow_type) +{ +switch (flow_type) { +case TCP_V4_FLOW : +case UDP_V4_FLOW : +case SCTP_V4_FLOW : +case AH_V4_FLOW : +case ESP_V4_FLOW : +case IPV4_USER_FLOW : +case ETHER_FLOW : +return true; +default : +return false; + } +} +static int flow_spec_to_ntuple (struct ethtool_rx_flow_spec *fsp,struct ethtool_rx_ntuple_flow_spec *ntuple) {
@@ -3563,6 +3580,10 @@ static int flow_spec_to_ntuple(struct ethtool_rx_flow_spec *fsp, fsp->m_ext.vlan_etype)return -1 ; +/* IPv6 flow types are not supported by ntuple */ +if (!flow_type_is_ntuple_supported (fsp->flow_type & ~FLOW_EXT )) +return -1 ; +/* Set entire ntuple to ~0 to guarantee all masks are set */ memset (ntuple, ~0 ,sizeof (*ntuple));
rxclass.c +253 -14
347 lines not on this page · raw message
PATCH v2 2/2 Documentation for IPv6 NFC
In reply to Edward CreeLeaves 'src-ip' and 'dst-ip' documented as taking x.x.x.x, because there's more low-level nroff here than I can parse, let alone emit.
--- ethtool.8.in | 29 ++++++++++++++++++++--------- ethtool.c | 4 +++- 2 files changed, 23 insertions(+), 10 deletions(-)
ethtool.8.in +20 -9
@@ -74,7 +74,7 @@ .\" .\" \(*NC - Network Classifier type values .\" -.ds NC \fBether\fP|\fBip4\fP|\fBtcp4\fP|\fBudp4\fP|\fBsctp4\fP|\fBah4\fP|\fBesp4\fP +.ds NC \fBether\fP|\fBip4\fP|\fBtcp4\fP|\fBudp4\fP|\fBsctp4\fP|\fBah4\fP|\fBesp4\fP|\fBip6\fP|\fBtcp6\fP|\fBudp6\fP|\fBah6\fP|\fBesp6\fP|\fBsctp6\fP .. .\" .\" Start URL.
@@ -263,6 +263,7 @@ ethtool \- query or control network driver and hardware settings .RB [ src\-ip \ \*(PA\ [ m \ \*(PA]] .RB [ dst\-ip \ \*(PA\ [ m \ \*(PA]] .BM tos +.BM tclass .BM l4proto .BM src\-port .BM dst\-port
@@ -710,6 +711,12 @@ udp4 UDP over IPv4 sctp4 SCTP over IPv4 ah4 IPSEC AH over IPv4 esp4 IPSEC ESP over IPv4 +ip6 Raw IPv6 +tcp6 TCP over IPv6 +udp6 UDP over IPv6 +sctp6 SCTP over IPv6 +ah6 IPSEC AH over IPv6 +esp6 IPSEC ESP over IPv6 .TE .PP For all fields that allow both a value and a mask to be specified, the
@@ -734,38 +741,42 @@ Valid only for flow-type ether. .TP .BR src\-ip \ \*(PA\ [ m \ \*(PA] Specify the source IP address of the incoming packet to match along with -an optional mask. Valid for all IPv4 based flow-types. +an optional mask. Valid for all IP based flow-types. .TP .BR dst\-ip \ \*(PA\ [ m \ \*(PA] Specify the destination IP address of the incoming packet to match along -with an optional mask. Valid for all IPv4 based flow-types. +with an optional mask. Valid for all IP based flow-types. .TP .BI tos \ N \\fR\ [\\fPm \ N \\fR]\\fP Specify the value of the Type of Service field in the incoming packet to match along with an optional mask. Applies to all IPv4 based flow-types. .TP +.BI tclass \ N \\fR\ [\\fPm \ N \\fR]\\fP +Specify the value of the Traffic Class field in the incoming packet to +match along with an optional mask. Applies to all IPv6 based flow-types. +.TP .BI l4proto \ N \\fR\ [\\fPm \ N \\fR]\\fP Includes the layer 4 protocol number and optional mask. Valid only for -flow-type ip4. +flow-types ip4 and ip6. .TP .BI src\-port \ N \\fR\ [\\fPm \ N \\fR]\\fP Specify the value of the source port field (applicable to TCP/UDP packets) in the incoming packet to match along with an optional mask. Valid for -flow-types ip4, tcp4, udp4, and sctp4. +flow-types ip4, tcp4, udp4, and sctp4 and their IPv6 equivalents. .TP .BI dst\-port \ N \\fR\ [\\fPm \ N \\fR]\\fP Specify the value of the destination port field (applicable to TCP/UDP packets)in the incoming packet to match along with an optional mask. -Valid for flow-types ip4, tcp4, udp4, and sctp4. +Valid for flow-types ip4, tcp4, udp4, and sctp4 and their IPv6 equivalents. .TP .BI spi \ N \\fR\ [\\fPm \ N \\fR]\\fP Specify the value of the security parameter index field (applicable to AH/ESP packets)in the incoming packet to match along with an optional -mask. Valid for flow-types ip4, ah4, and esp4. +mask. Valid for flow-types ip4, ah4, and esp4 and their IPv6 equivalents. .TP .BI l4data \ N \\fR\ [\\fPm \ N \\fR]\\fP Specify the value of the first 4 Bytes of Layer 4 in the incoming packet to -match along with an optional mask. Valid for ip4 flow-type. +match along with an optional mask. Valid for ip4 and ip6 flow-types. .TP .BI vlan\-etype \ N \\fR\ [\\fPm \ N \\fR]\\fP Includes the VLAN tag Ethertype and an optional mask.
@@ -779,7 +790,7 @@ Includes 64-bits of user-specific data and an optional mask. .BR dst-mac \ \*(MA\ [ m \ \*(MA] Includes the destination MAC address, specified as 6 bytes in hexadecimal separated by colons, along with an optional mask. -Valid for all IPv4 based flow-types. +Valid for all IP based flow-types. .TP .BI action \ N Specifies the Rx queue to send packets to, or some other action.
ethtool.c +3 -1
@@ -4158,13 +4158,15 @@ static const struct option {"Configure Rx network flow classification options or rules" ," rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|" "tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... |\n" -" flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4\n" +" flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4|" +"ip6|tcp6|udp6|ah6|esp6|sctp6\n" " [ src %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]\n" " [ dst %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]\n" " [ proto %d [m %x] ]\n" " [ src-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]\n" " [ dst-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]\n" " [ tos %d [m %x] ]\n" +" [ tclass %d [m %x] ]\n" " [ l4proto %d [m %x] ]\n" " [ src-port %d [m %x] ]\n" " [ dst-port %d [m %x] ]\n"
Ping?
Ben Hutchings
AppliedQuoted 6 lines · Edward Cree
This series adds support for steering of IPv6 receive flows.
Changes since v1:
* Fixed and simplified IPv6 address and mask parsing
* Made help text / man page more consistent
* Droppedethtool-copy.hpatch as upstream is now newer
Applied these two, and added the patch below. Thanks for your patience.
Ben.
---
Change IP parameter syntax in documentation to just 'ip-address'
Writing out the IPv4 address syntax repeatedly is not really necessary, and extending it to cover IPv6 addresses will just make the documentation harder to read.
--- ethtool.8.in | 2 +- ethtool.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
ethtool.8.in +1 -1
@@ -54,7 +54,7 @@ .\" .\" \(*PA - IP address .\" -.ds PA \fIx\fP\fB.\fP\fIx\fP\fB.\fP\fIx\fP\fB.\fP\fIx\fP +.ds PA \fIip-address\fP .\" .\" \(*WO - wol flags .\"
ethtool.c +2 -2
@@ -4163,8 +4163,8 @@ static const struct option {" [ src %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]\n" " [ dst %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]\n" " [ proto %d [m %x] ]\n" -" [ src-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]\n" -" [ dst-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]\n" +" [ src-ip IP-ADDRESS [m IP-ADDRESS] ]\n" +" [ dst-ip IP-ADDRESS [m IP-ADDRESS] ]\n" " [ tos %d [m %x] ]\n" " [ tclass %d [m %x] ]\n" " [ l4proto %d [m %x] ]\n"
Signature · 2 lines
Ben Hutchings compatible: Gracefully accepts erroneous data from any source