hv_netvsc: support changing TCP hash level
Subsystems (4)
cover hv_netvsc: support changing TCP hash level
From: Haiyang Zhang <[email protected]>
The patch set simplifies the existing hash level switching code for UDP. It also adds the support for changing TCP hash level. So users can switch between L3 an L4 hash levels for TCP and UDP.
Haiyang Zhang (3):
hv_netvsc: Change the hash level variable to bit flags
hv_netvsc: Add ethtool handler to set and get TCP hash levels
hv_netvsc: Update netvsc Document for TCP hash level setting
Documentation/networking/netvsc.txt | 8 ++-- drivers/net/hyperv/hyperv_net.h | 11 ++++- drivers/net/hyperv/netvsc_drv.c | 96 ++++++++++++++++++++++++++++--------- 3 files changed, 86 insertions(+), 29 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/3 hv_netvsc: Change the hash level variable to bit flags
From: Haiyang Zhang <[email protected]>
This simplifies the logic and make it easier to add more options.
--- drivers/net/hyperv/hyperv_net.h | 11 +++++-- drivers/net/hyperv/netvsc_drv.c | 73 ++++++++++++++++++++++++++++------------- 2 files changed, 59 insertions(+), 25 deletions(-)
drivers/net/hyperv/hyperv_net.h +9 -2
@@ -704,6 +704,14 @@ struct netvsc_reconfig {u32 event; }; +/* L4 hash bits for different protocols */ +#define HV_TCP4_L4HASH 1 +#define HV_TCP6_L4HASH 2 +#define HV_UDP4_L4HASH 4 +#define HV_UDP6_L4HASH 8 +#define HV_DEFAULT_L4HASH (HV_TCP4_L4HASH | HV_TCP6_L4HASH | HV_UDP4_L4HASH | \ + HV_UDP6_L4HASH) +/* The context of the netvsc device */ struct net_device_context {/* point back to our device context */
@@ -726,10 +734,9 @@ struct net_device_context {u32 tx_send_table[VRSS_SEND_TAB_SIZE ];/* Ethtool settings */ -bool udp4_l4_hash; -bool udp6_l4_hash;u8 duplex;u32 speed; +u32 l4_hash;/* L4 hash settings */ struct netvsc_ethtool_stats eth_stats;/* State to manage the associated VF interface. */
drivers/net/hyperv/netvsc_drv.c +50 -23
122 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH 2/3 hv_netvsc: Add ethtool handler to set and get TCP hash levels
In reply to Haiyang ZhangFrom: Haiyang Zhang <[email protected]>
The patch supports the options to switch TCP hash level between L3 and L4 by ethtool command. TCP over IPv4 and v6 can be set differently. The default hash level is L4. We currently only allow switching TX hash level from within the guests.
For example, for TCP over IPv4 on eth0:
To include TCP port numbers in hashing:
ethtool -N eth0 rx-flow-hash tcp4 sdfn
To exclude TCP port numbers in hashing:
ethtool -N eth0 rx-flow-hash tcp4 sd
To show TCP hash level:
ethtool -n eth0 rx-flow-hash tcp4
--- drivers/net/hyperv/netvsc_drv.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/net/hyperv/netvsc_drv.c +24 -1
@@ -1264,8 +1264,15 @@ netvsc_get_rss_hash_opts(struct net_device_context *ndc,switch (info->flow_type) {case TCP_V4_FLOW : +if (ndc->l4_hash &HV_TCP4_L4HASH ) + info->data |= l4_flag; + +break ; +case TCP_V6_FLOW : - info->data |= l4_flag; +if (ndc->l4_hash &HV_TCP6_L4HASH ) + info->data |= l4_flag; +break ;case UDP_V4_FLOW :
@@ -1318,6 +1325,14 @@ static int netvsc_set_rss_hash_opts(struct net_device_context *ndc,if (info->data == (RXH_IP_SRC |RXH_IP_DST |RXH_L4_B_0_1 |RXH_L4_B_2_3 )) {switch (info->flow_type) { +case TCP_V4_FLOW : + ndc->l4_hash |=HV_TCP4_L4HASH ; +break ; + +case TCP_V6_FLOW : + ndc->l4_hash |=HV_TCP6_L4HASH ; +break ; +case UDP_V4_FLOW : ndc->l4_hash |=HV_UDP4_L4HASH ;break ;
@@ -1335,6 +1350,14 @@ static int netvsc_set_rss_hash_opts(struct net_device_context *ndc,if (info->data == (RXH_IP_SRC |RXH_IP_DST )) {switch (info->flow_type) { +case TCP_V4_FLOW : + ndc->l4_hash &= ~HV_TCP4_L4HASH ; +break ; + +case TCP_V6_FLOW : + ndc->l4_hash &= ~HV_TCP6_L4HASH ; +break ; +case UDP_V4_FLOW : ndc->l4_hash &= ~HV_UDP4_L4HASH ;break ;
Signature · 1 line
2.14.1
PATCH 3/3 hv_netvsc: Update netvsc Document for TCP hash level setting
In reply to Haiyang ZhangFrom: Haiyang Zhang <[email protected]>
Update Documentation/networking/netvsc.txt for TCP hash level setting and related info.
--- Documentation/networking/netvsc.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/networking/netvsc.txt +4 -4
@@ -19,12 +19,12 @@ Features Receive Side Scaling -------------------- - Hyper-V supports receive side scaling. For TCP, packets are - distributed among available queues based on IP address and port + Hyper-V supports receive side scaling. For TCP & UDP, packets can + be distributed among available queues based on IP address and port number. - For UDP, we can switch UDP hash level between L3 and L4 by ethtool - command. UDP over IPv4 and v6 can be set differently. The default + For TCP & UDP, we can switch hash level between L3 and L4 by ethtool + command. TCP/UDP over IPv4 and v6 can be set differently. The default hash level is L4. We currently only allow switching TX hash level from within the guests.
Signature · 1 line
2.14.1
David Miller
maintainerFrom: Haiyang Zhang <[email protected]>
Date: Fri, 6 Oct 2017 08:33:56 -0700
Quoted 5 lines
From: Haiyang Zhang <[email protected]>
The patch set simplifies the existing hash level switching code for UDP. It also adds the support for changing TCP hash level. So users can switch between L3 an L4 hash levels for TCP and UDP.
Series applied.