[v3] net/ice: fix invalid RSS type

Message ID 1594476064-366701-1-git-send-email-simei.su@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [v3] net/ice: fix invalid RSS type |

Checks

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

Commit Message

Simei Su July 11, 2020, 2:01 p.m. UTC
  When a RSS rule with only SRC/DST_ONLY or IPV6 prefix RSS type,
it should return failure. Besides, when a RSS rule with symmetric
hash function, the RSS type shouldn't carry with SRC/DST_ONLY or
IPV6 prefix. This patch adds invalid RSS type check for the two
cases.

Fixes: dfdc589f6ee0 ("net/ice: refactor PF hash flow")

Signed-off-by: Simei Su <simei.su@intel.com>
---

v3:
* Add invalid RSS type check for symmetric case.
* Consider IPV6 prefix.
* Refine commit log.

v2:
* Add specific macro value in check rather than hard code.
---
 drivers/net/ice/ice_hash.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
  

Patch

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index e57feff..01311b4 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -1049,13 +1049,36 @@  struct ice_hash_match_type ice_hash_type_list[] = {
 			combine_type = ETH_RSS_L2_SRC_ONLY |
 					ETH_RSS_L2_DST_ONLY |
 					RTE_ETH_RSS_L3_PRE32    |
+					RTE_ETH_RSS_L3_PRE40	|
 					RTE_ETH_RSS_L3_PRE48    |
+					RTE_ETH_RSS_L3_PRE56	|
 					RTE_ETH_RSS_L3_PRE64    |
+					RTE_ETH_RSS_L3_PRE96	|
 					ETH_RSS_L3_SRC_ONLY |
 					ETH_RSS_L3_DST_ONLY |
 					ETH_RSS_L4_SRC_ONLY |
 					ETH_RSS_L4_DST_ONLY;
 
+			/* Check if only SRC/DST_ONLY or ipv6 prefix exists. */
+			if ((rss_type & ~combine_type) == 0)
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"invalid rss types");
+
+			/**
+			 * Check if SRC/DST_ONLY or ipv6 prefix is set for
+			 * SYMMETRIC_TOEPLITZ hash function.
+			 */
+			if (rss->func ==
+				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+				if (rss_type & combine_type)
+					return rte_flow_error_set(error,
+						ENOTSUP,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						action,
+						"invalid rss types");
+			}
+
 			/* Check if rss types match pattern. */
 			if (rss_type & ~combine_type & ~m->eth_rss_hint) {
 				return rte_flow_error_set(error,