[dpdk-dev,5/6] net/enic: fix RSS hash type advertisement

Message ID 20180503193713.20622-5-johndale@cisco.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

John Daley (johndale) May 3, 2018, 7:37 p.m. UTC
From: Hyong Youb Kim <hyonkim@cisco.com>

The NIC can hash these RSS packet types, but they are not advertised
via flow_type_rss_offloads. So add them.
- Part of the IPv4 hash:
  ETH_RSS_FRAG_IPV4
  ETH_RSS_NONFRAG_IPV4_OTHER
- Part of the IPv6 hash:
  ETH_RSS_FRAG_IPV6
  ETH_RSS_NONFRAG_IPV6_OTHER
- Part of the UDP hash:
  ETH_RSS_IPV6_UDP_EX

Also, do not use NIC_CFG_RSS_HASH_TYPE_IPV6_EX and
NIC_CFG_RSS_HASH_TYPE_TCP_IPV6_EX, as they are not needed to enable
RSS over IPv6 with extension headers.

Fixes: c2fec27b5cb0 ("net/enic: allow to change RSS settings")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
Reviewed-by: Aaron Conole <aconole@redhat.com>
---
 drivers/net/enic/enic_main.c | 14 ++++++--------
 drivers/net/enic/enic_res.c  | 26 ++++++++++++++++++--------
 2 files changed, 24 insertions(+), 16 deletions(-)
  

Patch

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index b3b4e9626..2b1c1347c 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1190,7 +1190,8 @@  int enic_set_rss_conf(struct enic *enic, struct rte_eth_rss_conf *rss_conf)
 	    (eth_dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) &&
 	    rss_hf != 0) {
 		rss_enable = 1;
-		if (rss_hf & ETH_RSS_IPV4)
+		if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 |
+			      ETH_RSS_NONFRAG_IPV4_OTHER))
 			rss_hash_type |= NIC_CFG_RSS_HASH_TYPE_IPV4;
 		if (rss_hf & ETH_RSS_NONFRAG_IPV4_TCP)
 			rss_hash_type |= NIC_CFG_RSS_HASH_TYPE_TCP_IPV4;
@@ -1202,18 +1203,15 @@  int enic_set_rss_conf(struct enic *enic, struct rte_eth_rss_conf *rss_conf)
 			 */
 			rss_hash_type |= NIC_CFG_RSS_HASH_TYPE_TCP_IPV4;
 		}
-		if (rss_hf & ETH_RSS_IPV6)
+		if (rss_hf & (ETH_RSS_IPV6 | ETH_RSS_IPV6_EX |
+			      ETH_RSS_FRAG_IPV6 | ETH_RSS_NONFRAG_IPV6_OTHER))
 			rss_hash_type |= NIC_CFG_RSS_HASH_TYPE_IPV6;
-		if (rss_hf & ETH_RSS_NONFRAG_IPV6_TCP)
+		if (rss_hf & (ETH_RSS_NONFRAG_IPV6_TCP | ETH_RSS_IPV6_TCP_EX))
 			rss_hash_type |= NIC_CFG_RSS_HASH_TYPE_TCP_IPV6;
-		if (rss_hf & ETH_RSS_NONFRAG_IPV6_UDP) {
+		if (rss_hf & (ETH_RSS_NONFRAG_IPV6_UDP | ETH_RSS_IPV6_UDP_EX)) {
 			/* Again, 'TCP' is not a typo. */
 			rss_hash_type |= NIC_CFG_RSS_HASH_TYPE_TCP_IPV6;
 		}
-		if (rss_hf & ETH_RSS_IPV6_EX)
-			rss_hash_type |= NIC_CFG_RSS_HASH_TYPE_IPV6_EX;
-		if (rss_hf & ETH_RSS_IPV6_TCP_EX)
-			rss_hash_type |= NIC_CFG_RSS_HASH_TYPE_TCP_IPV6_EX;
 	} else {
 		rss_enable = 0;
 		rss_hf = 0;
diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c
index de17a31d0..bdda2c564 100644
--- a/drivers/net/enic/enic_res.c
+++ b/drivers/net/enic/enic_res.c
@@ -138,20 +138,30 @@  int enic_get_vnic_config(struct enic *enic)
 	enic->hash_key_size = ENIC_RSS_HASH_KEY_SIZE;
 	enic->flow_type_rss_offloads = 0;
 	if (ENIC_SETTING(enic, RSSHASH_IPV4))
-		enic->flow_type_rss_offloads |= ETH_RSS_IPV4;
+		/*
+		 * IPV4 hash type handles both non-frag and frag packet types.
+		 * TCP/UDP is controlled via a separate flag below.
+		 */
+		enic->flow_type_rss_offloads |= ETH_RSS_IPV4 |
+			ETH_RSS_FRAG_IPV4 | ETH_RSS_NONFRAG_IPV4_OTHER;
 	if (ENIC_SETTING(enic, RSSHASH_TCPIPV4))
 		enic->flow_type_rss_offloads |= ETH_RSS_NONFRAG_IPV4_TCP;
 	if (ENIC_SETTING(enic, RSSHASH_IPV6))
-		enic->flow_type_rss_offloads |= ETH_RSS_IPV6;
+		/*
+		 * The VIC adapter can perform RSS on IPv6 packets with and
+		 * without extension headers. An IPv6 "fragment" is an IPv6
+		 * packet with the fragment extension header.
+		 */
+		enic->flow_type_rss_offloads |= ETH_RSS_IPV6 |
+			ETH_RSS_IPV6_EX | ETH_RSS_FRAG_IPV6 |
+			ETH_RSS_NONFRAG_IPV6_OTHER;
 	if (ENIC_SETTING(enic, RSSHASH_TCPIPV6))
-		enic->flow_type_rss_offloads |= ETH_RSS_NONFRAG_IPV6_TCP;
-	if (ENIC_SETTING(enic, RSSHASH_IPV6_EX))
-		enic->flow_type_rss_offloads |= ETH_RSS_IPV6_EX;
-	if (ENIC_SETTING(enic, RSSHASH_TCPIPV6_EX))
-		enic->flow_type_rss_offloads |= ETH_RSS_IPV6_TCP_EX;
+		enic->flow_type_rss_offloads |= ETH_RSS_NONFRAG_IPV6_TCP |
+			ETH_RSS_IPV6_TCP_EX;
 	if (vnic_dev_capable_udp_rss(enic->vdev)) {
 		enic->flow_type_rss_offloads |=
-			ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP;
+			ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP |
+			ETH_RSS_IPV6_UDP_EX;
 	}
 
 	/* Zero offloads if RSS is not enabled */