net/enic: fix RSS hash type advertisement
authorHyong Youb Kim <hyonkim@cisco.com>
Thu, 3 May 2018 19:37:12 +0000 (12:37 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 May 2018 21:31:50 +0000 (22:31 +0100)
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
drivers/net/enic/enic_res.c

index b3b4e96..2b1c134 100644 (file)
@@ -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;
index de17a31..bdda2c5 100644 (file)
@@ -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 */