[v2] net/iavf: fix invalid RSS type

Message ID 20201102020419.149961-1-simei.su@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/iavf: fix invalid RSS type |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Simei Su Nov. 2, 2020, 2:04 a.m. UTC
  When a RSS rule with symmetric hash function, the RSS type shouldn't
carry with SRC/DST_ONLY. This patch adds invalid RSS type check for
the case.

Fixes: 91f27b2e39ab ("net/iavf: refactor RSS")

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/iavf/iavf_hash.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index be821b6..c58566c 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -834,10 +834,22 @@  static struct rss_attr_type rss_attr_to_valid_type[] = {
 };
 
 static bool
-iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
+iavf_any_invalid_rss_type(enum rte_eth_hash_function func,
+			  uint64_t rss_type, uint64_t allow_rss_type)
 {
 	uint32_t i;
 
+	/**
+	 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+	 * hash function.
+	 */
+	if (func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+		if (rss_type & ((VALID_RSS_ATTR &
+		    ~RTE_ETH_RSS_L3_PRE64) |
+		    ~(VALID_RSS_IPV4 | VALID_RSS_IPV6)))
+			return true;
+	}
+
 	/* check invalid combination */
 	for (i = 0; i < RTE_DIM(invalid_rss_comb); i++) {
 		if (__builtin_popcountll(rss_type & invalid_rss_comb[i]) > 1)
@@ -917,7 +929,7 @@  iavf_hash_parse_action(struct iavf_pattern_match_item *match_item,
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
-			if (iavf_any_invalid_rss_type(rss_type,
+			if (iavf_any_invalid_rss_type(rss->func, rss_type,
 					match_item->input_set_mask))
 				return rte_flow_error_set(error, ENOTSUP,
 						RTE_FLOW_ERROR_TYPE_ACTION,