@@ -360,6 +360,8 @@ static int rxflow_str_to_type(const char *str)
flow_type = AH_ESP_V4_FLOW;
else if (!strcmp(str, "sctp4"))
flow_type = SCTP_V4_FLOW;
+ else if (!strcmp(str, "gtp4"))
+ flow_type = GTP_V4_FLOW;
else if (!strcmp(str, "tcp6"))
flow_type = TCP_V6_FLOW;
else if (!strcmp(str, "udp6"))
@@ -370,6 +372,8 @@ static int rxflow_str_to_type(const char *str)
flow_type = SCTP_V6_FLOW;
else if (!strcmp(str, "ether"))
flow_type = ETHER_FLOW;
+ else if (!strcmp(str, "gtp6"))
+ flow_type = GTP_V6_FLOW;
return flow_type;
}
@@ -1010,6 +1014,12 @@ static int parse_rxfhashopts(char *optstr, u32 *data)
case 'n':
*data |= RXH_L4_B_2_3;
break;
+ case 'c':
+ *data |= RXH_GTP_V2_C;
+ break;
+ case 'e':
+ *data |= RXH_GTP_EH;
+ break;
case 'r':
*data |= RXH_DISCARD;
break;
@@ -1042,6 +1052,10 @@ static char *unparse_rxfhashopts(u64 opts)
strcat(buf, "L4 bytes 0 & 1 [TCP/UDP src port]\n");
if (opts & RXH_L4_B_2_3)
strcat(buf, "L4 bytes 2 & 3 [TCP/UDP dst port]\n");
+ if (opts & RXH_GTP_V2_C)
+ strcat(buf, "GTPv2-C Switching Flag [GTP]\n");
+ if (opts & RXH_GTP_EH)
+ strcat(buf, "GTP Extension Header [GTP]\n");
} else {
sprintf(buf, "None");
}
@@ -1559,6 +1573,9 @@ static int dump_rxfhash(int fhash, u64 val)
case SCTP_V4_FLOW:
fprintf(stdout, "SCTP over IPV4 flows");
break;
+ case GTP_V4_FLOW:
+ fprintf(stdout, "GTP over IPV4 flows");
+ break;
case AH_ESP_V4_FLOW:
case AH_V4_FLOW:
case ESP_V4_FLOW:
@@ -1573,6 +1590,9 @@ static int dump_rxfhash(int fhash, u64 val)
case SCTP_V6_FLOW:
fprintf(stdout, "SCTP over IPV6 flows");
break;
+ case GTP_V6_FLOW:
+ fprintf(stdout, "GTP over IPV6 flows");
+ break;
case AH_ESP_V6_FLOW:
case AH_V6_FLOW:
case ESP_V6_FLOW:
@@ -5832,16 +5852,16 @@ static const struct option args[] = {
.opts = "-n|-u|--show-nfc|--show-ntuple",
.func = do_grxclass,
.help = "Show Rx network flow classification options or rules",
- .xhelp = " [ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|"
- "tcp6|udp6|ah6|esp6|sctp6 [context %d] |\n"
+ .xhelp = " [ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|gtp4|"
+ "tcp6|udp6|ah6|esp6|sctp6|gtp6 [context %d] |\n"
" rule %d ]\n"
},
{
.opts = "-N|-U|--config-nfc|--config-ntuple",
.func = do_srxclass,
.help = "Configure Rx network flow classification options or rules",
- .xhelp = " rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|"
- "tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... [context %d] |\n"
+ .xhelp = " rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|gtp4|"
+ "tcp6|udp6|ah6|esp6|sctp6|gtp6 m|v|t|s|d|f|n|r|c|e... [context %d] |\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"
@@ -168,7 +168,7 @@ static struct test_case {
{ 1, "-f devname filename 1 foo" },
{ 1, "-f" },
/* Argument parsing for -N/-U is specialised */
- { 0, "-N devname rx-flow-hash tcp4 mvtsdfn" },
+ { 0, "-N devname rx-flow-hash tcp4 mvtsdfnce" },
{ 0, "--config-ntuple devname rx-flow-hash tcp4 r" },
{ 1, "-U devname rx-flow-hash tcp4" },
{ 1, "--config-nfc devname rx-flow-hash foo" },
@@ -2009,6 +2009,8 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define IPV4_FLOW 0x10 /* hash only */
#define IPV6_FLOW 0x11 /* hash only */
#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
+#define GTP_V4_FLOW 0x13 /* hash only */
+#define GTP_V6_FLOW 0x14 /* hash only */
/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
#define FLOW_EXT 0x80000000
#define FLOW_MAC_EXT 0x40000000
@@ -2023,6 +2025,8 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define RXH_IP_DST (1 << 5)
#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
+#define RXH_GTP_V2_C (1 << 8) /* type gtpv2-c in case of gtp */
+#define RXH_GTP_EH (1 << 9) /* gtp extension header in case of gtp */
#define RXH_DISCARD (1 << 31)
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
GTP Flow hash was added to the ice driver. By executing "ethtool -N <dev> rx-flow-hash gtp4 sd", RSS can include not only the IP's src/dst but also the TEID of GTP packets. Additionally, options [c|e] have been support. These allow specification to include GTPv2-C cases as well as the Extension Header's QFI in the hash computation. Signed-off-by: Takeru Hayasaka <hayatake396@gmail.com> --- This patch is for using GTP flow hashes from ethtool. First, add the parameter to enable RSS. This patch helps bring optimizations to Linux servers connected to mobile networks ethtool.c | 28 ++++++++++++++++++++++++---- test-cmdline.c | 2 +- uapi/linux/ethtool.h | 4 ++++ 3 files changed, 29 insertions(+), 5 deletions(-)