net/ice: omit IP protocol id from IP/TCP/UDP RSS
PATCH 1/1 net/ice: omit IP protocol id from IP/TCP/UDP RSS
Omit the IP protocol id from the IP/TCP/UDP RSS templates so that the hash computation uses only the source and destination addresses, and ports. Otherwise, the hash input set would contain an extra IP protocol id word at the start, giving RSS hashes that do not match the usual 2-tuple and 4-tuple RSS hash algorithms.
In principle, the IP protocol id could be dropped from the hash config in ice_refine_hash_cfg_l234(). However, it is not obvious which combination of RTE_ETH_RSS_* flags would preserve the id. Therefore, remove the id from the templates completely.
--- drivers/net/ice/ice_hash.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)
drivers/net/ice/ice_hash.c +14 -17
@@ -37,9 +37,6 @@#define ICE_GTPU_EH_DWNLINK 0#define ICE_GTPU_EH_UPLINK 1 -#define ICE_IPV4_PROT BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_PROT) -#define ICE_IPV6_PROT BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_PROT) -#define VALID_RSS_IPV4_L4 (RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ RTE_ETH_RSS_NONFRAG_IPV4_SCTP)
@@ -122,7 +119,7 @@ struct ice_rss_hash_cfg ipv4_tmplt = {struct ice_rss_hash_cfg ipv4_udp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_FLOW_HASH_ETH |ICE_HASH_UDP_IPV4 |ICE_IPV4_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_UDP_IPV4 ,ICE_RSS_OUTER_HEADERS ,0 };
@@ -130,7 +127,7 @@ struct ice_rss_hash_cfg ipv4_udp_tmplt = {struct ice_rss_hash_cfg ipv4_tcp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_FLOW_HASH_ETH |ICE_HASH_TCP_IPV4 |ICE_IPV4_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_TCP_IPV4 ,ICE_RSS_OUTER_HEADERS ,0 };
@@ -138,7 +135,7 @@ struct ice_rss_hash_cfg ipv4_tcp_tmplt = {struct ice_rss_hash_cfg ipv4_sctp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_SCTP , -ICE_FLOW_HASH_ETH |ICE_HASH_SCTP_IPV4 |ICE_IPV4_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_SCTP_IPV4 ,ICE_RSS_OUTER_HEADERS ,0 };
@@ -162,7 +159,7 @@ struct ice_rss_hash_cfg ipv6_frag_tmplt = {struct ice_rss_hash_cfg ipv6_udp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_FLOW_HASH_ETH |ICE_HASH_UDP_IPV6 |ICE_IPV6_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_UDP_IPV6 ,ICE_RSS_OUTER_HEADERS ,0 };
@@ -170,7 +167,7 @@ struct ice_rss_hash_cfg ipv6_udp_tmplt = {struct ice_rss_hash_cfg ipv6_tcp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_FLOW_HASH_ETH |ICE_HASH_TCP_IPV6 |ICE_IPV6_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_TCP_IPV6 ,ICE_RSS_OUTER_HEADERS ,0 };
@@ -178,7 +175,7 @@ struct ice_rss_hash_cfg ipv6_tcp_tmplt = {struct ice_rss_hash_cfg ipv6_sctp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_SCTP , -ICE_FLOW_HASH_ETH |ICE_HASH_SCTP_IPV6 |ICE_IPV6_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_SCTP_IPV6 ,ICE_RSS_OUTER_HEADERS ,0 };
@@ -192,7 +189,7 @@ struct ice_rss_hash_cfg outer_ipv4_inner_ipv4_tmplt = {struct ice_rss_hash_cfg outer_ipv4_inner_ipv4_udp_tmplt = {ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_HASH_UDP_IPV4 |ICE_IPV4_PROT , +ICE_HASH_UDP_IPV4 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 ,0 };
@@ -200,7 +197,7 @@ struct ice_rss_hash_cfg outer_ipv4_inner_ipv4_udp_tmplt = {struct ice_rss_hash_cfg outer_ipv4_inner_ipv4_tcp_tmplt = {ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_HASH_TCP_IPV4 |ICE_IPV4_PROT , +ICE_HASH_TCP_IPV4 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 ,0 };
@@ -215,7 +212,7 @@ struct ice_rss_hash_cfg outer_ipv6_inner_ipv4_tmplt = {struct ice_rss_hash_cfg outer_ipv6_inner_ipv4_udp_tmplt = {ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_HASH_UDP_IPV4 |ICE_IPV4_PROT , +ICE_HASH_UDP_IPV4 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 ,0 };
@@ -223,7 +220,7 @@ struct ice_rss_hash_cfg outer_ipv6_inner_ipv4_udp_tmplt = {struct ice_rss_hash_cfg outer_ipv6_inner_ipv4_tcp_tmplt = {ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_HASH_TCP_IPV4 |ICE_IPV4_PROT , +ICE_HASH_TCP_IPV4 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 ,0 };
@@ -238,7 +235,7 @@ struct ice_rss_hash_cfg outer_ipv4_inner_ipv6_tmplt = {struct ice_rss_hash_cfg outer_ipv4_inner_ipv6_udp_tmplt = {ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_HASH_UDP_IPV6 |ICE_IPV6_PROT , +ICE_HASH_UDP_IPV6 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 ,0 };
@@ -246,7 +243,7 @@ struct ice_rss_hash_cfg outer_ipv4_inner_ipv6_udp_tmplt = {struct ice_rss_hash_cfg outer_ipv4_inner_ipv6_tcp_tmplt = {ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_HASH_TCP_IPV6 |ICE_IPV6_PROT , +ICE_HASH_TCP_IPV6 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 ,0 };
@@ -260,7 +257,7 @@ struct ice_rss_hash_cfg outer_ipv6_inner_ipv6_tmplt = {struct ice_rss_hash_cfg outer_ipv6_inner_ipv6_udp_tmplt = {ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_HASH_UDP_IPV6 |ICE_IPV6_PROT , +ICE_HASH_UDP_IPV6 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 ,0 };
@@ -268,7 +265,7 @@ struct ice_rss_hash_cfg outer_ipv6_inner_ipv6_udp_tmplt = {struct ice_rss_hash_cfg outer_ipv6_inner_ipv6_tcp_tmplt = {ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_HASH_TCP_IPV6 |ICE_IPV6_PROT , +ICE_HASH_TCP_IPV6 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 ,0 };
Hi Visa:
This change may potentially disrupt existing usage, particularly for customers who rely on a default 5-tuple hash configuration. These customers require this configuration to distinguish between TCP and UDP traffic with the same IP and port numbers.
The challenge arises from the absence of an available RSS_TYPE that can instruct the PMD on whether a protocol ID should be included in the hash or not. Therefore, we had to make a decision on a default behavior. (It might be worth considering the introduction of a new RSS_TYPE for this purpose, @Ori Kam
To work around this issue, we've introduced a raw packet filter which allow users to select specific fields as hash keys using a mask. If you require further information or have any questions, please don't hesitate to reach out.
Regards
Qi
Quoted 172 lines
-----Original Message-----
From: Visa Hankala <[email protected]>
Sent: Sunday, August 20, 2023 6:51 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [PATCH] net/ice: omit IP protocol id from IP/TCP/UDP RSSOmit the IP protocol id from the IP/TCP/UDP RSS templates so that the hash computation uses only the source and destination addresses, and ports. Otherwise, the hash input set would contain an extra IP protocol id word at the start, giving RSS hashes that do not match the usual 2-tuple and 4-tuple RSS hash algorithms.
In principle, the IP protocol id could be dropped from the hash config in
ice_refine_hash_cfg_l234(). However, it is not obvious which combination of RTE_ETH_RSS_* flags would preserve the id. Therefore, remove the id from the templates completely.Fixes 38d632cbdc88 ("net/ice: refactor PF RSS")Signed-off-by Visa Hankala <[email protected]>--- drivers/net/ice/ice_hash.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)drivers/net/ice/ice_hash.c index renamed from drivers/net/ice/ice_hash.c +0
-0
52646e9408..ab2eab8fdf100644drivers/net/ice/ice_hash.c +0
-3@@ -37,9 +37,6 @@#define ICE_GTPU_EH_DWNLINK 0#define ICE_GTPU_EH_UPLINK 1 -#define ICE_IPV4_PROT BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_PROT) -#define ICE_IPV6_PROT BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_PROT) -#define VALID_RSS_IPV4_L4 (RTE_ETH_RSS_NONFRAG_IPV4_UDP | \drivers/net/ice/ice_hash.c +7
-7RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ RTE_ETH_RSS_NONFRAG_IPV4_SCTP)@@ -122,7 +119,7 @@ struct ice_rss_hash_cfg ipv4_tmplt = { structice_rss_hash_cfg ipv4_udp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_FLOW_HASH_ETH |ICE_HASH_UDP_IPV4 |ICE_IPV4_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_UDP_IPV4 ,ICE_RSS_OUTER_HEADERS ,0 };@@ -130,7 +127,7 @@ struct ice_rss_hash_cfg ipv4_udp_tmplt = { structice_rss_hash_cfg ipv4_tcp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_FLOW_HASH_ETH |ICE_HASH_TCP_IPV4 |ICE_IPV4_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_TCP_IPV4 ,ICE_RSS_OUTER_HEADERS ,0 };@@ -138,7 +135,7 @@ struct ice_rss_hash_cfg ipv4_tcp_tmplt = { structice_rss_hash_cfg ipv4_sctp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_SCTP , -ICE_FLOW_HASH_ETH |ICE_HASH_SCTP_IPV4 |ICE_IPV4_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_SCTP_IPV4 ,ICE_RSS_OUTER_HEADERS ,0 };@@ -162,7 +159,7 @@ struct ice_rss_hash_cfg ipv6_frag_tmplt = { structice_rss_hash_cfg ipv6_udp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_FLOW_HASH_ETH |ICE_HASH_UDP_IPV6 |ICE_IPV6_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_UDP_IPV6 ,ICE_RSS_OUTER_HEADERS ,0 };@@ -170,7 +167,7 @@ struct ice_rss_hash_cfg ipv6_udp_tmplt = { structice_rss_hash_cfg ipv6_tcp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_FLOW_HASH_ETH |ICE_HASH_TCP_IPV6 |ICE_IPV6_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_TCP_IPV6 ,ICE_RSS_OUTER_HEADERS ,0 };@@ -178,7 +175,7 @@ struct ice_rss_hash_cfg ipv6_tcp_tmplt = { structice_rss_hash_cfg ipv6_sctp_tmplt = {ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_SCTP , -ICE_FLOW_HASH_ETH |ICE_HASH_SCTP_IPV6 |ICE_IPV6_PROT , +ICE_FLOW_HASH_ETH |ICE_HASH_SCTP_IPV6 ,ICE_RSS_OUTER_HEADERS ,0 };@@ -192,7 +189,7 @@ struct ice_rss_hash_cfg outer_ipv4_inner_ipv4_tmplt = { struct ice_rss_hash_cfg outer_ipv4_inner_ipv4_udp_tmplt = {ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_HASH_UDP_IPV4 |ICE_IPV4_PROT , +ICE_HASH_UDP_IPV4 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 ,0 };@@ -200,7 +197,7 @@ struct ice_rss_hash_cfg
outer_ipv4_inner_ipv4_udp_tmplt= { structice_rss_hash_cfgouter_ipv4_inner_ipv4_tcp_tmplt= {drivers/net/ice/ice_hash.c +2
-2ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_HASH_TCP_IPV4 |ICE_IPV4_PROT , +ICE_HASH_TCP_IPV4 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 , 0 };@@ -215,7 +212,7 @@ struct ice_rss_hash_cfg outer_ipv6_inner_ipv4_tmplt = { struct ice_rss_hash_cfg outer_ipv6_inner_ipv4_udp_tmplt = {ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_HASH_UDP_IPV4 |ICE_IPV4_PROT , +ICE_HASH_UDP_IPV4 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 ,0 };@@ -223,7 +220,7 @@ struct ice_rss_hash_cfg
outer_ipv6_inner_ipv4_udp_tmplt= { structice_rss_hash_cfgouter_ipv6_inner_ipv4_tcp_tmplt= {drivers/net/ice/ice_hash.c +2
-2ICE_FLOW_SEG_HDR_IPV4 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_HASH_TCP_IPV4 |ICE_IPV4_PROT , +ICE_HASH_TCP_IPV4 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 , 0 };@@ -238,7 +235,7 @@ struct ice_rss_hash_cfg outer_ipv4_inner_ipv6_tmplt = { struct ice_rss_hash_cfg outer_ipv4_inner_ipv6_udp_tmplt = {ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_HASH_UDP_IPV6 |ICE_IPV6_PROT , +ICE_HASH_UDP_IPV6 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 ,0 };@@ -246,7 +243,7 @@ struct ice_rss_hash_cfg
outer_ipv4_inner_ipv6_udp_tmplt= { structice_rss_hash_cfgouter_ipv4_inner_ipv6_tcp_tmplt= {drivers/net/ice/ice_hash.c +2
-2ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_HASH_TCP_IPV6 |ICE_IPV6_PROT , +ICE_HASH_TCP_IPV6 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 , 0 };@@ -260,7 +257,7 @@ struct ice_rss_hash_cfg outer_ipv6_inner_ipv6_tmplt = { struct ice_rss_hash_cfg outer_ipv6_inner_ipv6_udp_tmplt = {ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_UDP , -ICE_HASH_UDP_IPV6 |ICE_IPV6_PROT , +ICE_HASH_UDP_IPV6 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 ,0 };@@ -268,7 +265,7 @@ struct ice_rss_hash_cfg
outer_ipv6_inner_ipv6_udp_tmplt= { structice_rss_hash_cfgouter_ipv6_inner_ipv6_tcp_tmplt= {drivers/net/ice/ice_hash.c +1
-1ICE_FLOW_SEG_HDR_IPV6 |ICE_FLOW_SEG_HDR_IPV_OTHER |ICE_FLOW_SEG_HDR_TCP , -ICE_HASH_TCP_IPV6 |ICE_IPV6_PROT , +ICE_HASH_TCP_IPV6 ,ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 , 0 };