From: Hyong Youb Kim Date: Thu, 3 May 2018 19:37:12 +0000 (-0700) Subject: net/enic: fix RSS hash type advertisement X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3656c30e48562431c3018b79b03f195e21a30b13;p=dpdk.git net/enic: fix RSS hash type advertisement 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 Reviewed-by: John Daley Reviewed-by: Aaron Conole --- diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index b3b4e96267..2b1c1347ce 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 de17a31d02..bdda2c5645 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 */