DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [dpdk-dev v1] net/iavf: fix simple xor hash
@ 2020-07-17  4:08 Jeff Guo
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Guo @ 2020-07-17  4:08 UTC (permalink / raw)
  To: qi.z.zhang, beilei.xing, jingjing.wu; +Cc: dev, junfeng.guo, simei.su, jia.guo

Simple xor hash should be global congfigured in VFs.

Fixes: 215a247b5f33 (net/iavf: refactor hash flow)

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
 drivers/net/iavf/iavf_hash.c | 46 +++++++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 967e6b64b..4b69e5c30 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -3803,7 +3803,8 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 }
 
 static int
-iavf_hash_parse_action(const struct rte_flow_action actions[],
+iavf_hash_parse_action(struct iavf_pattern_match_item *pattern_match_item,
+		       const struct rte_flow_action actions[],
 		       uint64_t pattern_hint, void **meta,
 		       struct rte_flow_error *error)
 {
@@ -3826,19 +3827,6 @@ iavf_hash_parse_action(const struct rte_flow_action actions[],
 			rss = action->conf;
 			rss_type = rss->types;
 
-			if (rss->func ==
-			    RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
-				rss_meta->rss_algorithm =
-					VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC;
-			} else if (rss->func ==
-				   RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
-				rss_meta->rss_algorithm =
-					VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC;
-			} else {
-				rss_meta->rss_algorithm =
-					VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
-			}
-
 			if (rss->level)
 				return rte_flow_error_set(error, ENOTSUP,
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
@@ -3854,6 +3842,29 @@ iavf_hash_parse_action(const struct rte_flow_action actions[],
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
 					"a non-NULL RSS queue is not supported");
 
+			/* Check hash function and save it to rss_meta,
+			 * the pattern should be empty for simple_xor.
+			 */
+			if (pattern_match_item->pattern_list !=
+			    iavf_pattern_empty && rss->func ==
+			    RTE_ETH_HASH_FUNCTION_SIMPLE_XOR) {
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"Not supported flow");
+			} else if (rss->func ==
+			    RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
+				rss_meta->rss_algorithm =
+					VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC;
+				break;
+			} else if (rss->func ==
+				   RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+				rss_meta->rss_algorithm =
+					VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC;
+			} else {
+				rss_meta->rss_algorithm =
+					VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+			}
+
 			/**
 			 * Check simultaneous use of SRC_ONLY and DST_ONLY
 			 * of the same level.
@@ -3944,7 +3955,7 @@ iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad,
 	if (ret)
 		goto error;
 
-	ret = iavf_hash_parse_action(actions, phint,
+	ret = iavf_hash_parse_action(pattern_match_item, actions, phint,
 				     (void **)&rss_meta_ptr, error);
 
 error:
@@ -3976,7 +3987,10 @@ iavf_hash_create(__rte_unused struct iavf_adapter *ad,
 		return -ENOMEM;
 	}
 
-	rss_cfg->proto_hdrs = *rss_meta->proto_hdrs;
+	/* Simle_xor is globle configured, no need to set protocol hdrs */
+	if (rss_meta->rss_algorithm != VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC)
+		rss_cfg->proto_hdrs = *rss_meta->proto_hdrs;
+
 	rss_cfg->rss_algorithm = rss_meta->rss_algorithm;
 
 	ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dpdk-dev] [dpdk-dev v1] net/iavf: fix simple xor hash
@ 2020-07-17  5:26 Jeff Guo
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Guo @ 2020-07-17  5:26 UTC (permalink / raw)
  To: qi.z.zhang, beilei.xing, jingjing.wu; +Cc: dev, junfeng.guo, simei.su, jia.guo

Simple xor hash should be global congfigured in VFs.

Fixes: 215a247b5f33 ("net/iavf: refactor hash flow")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
 drivers/net/iavf/iavf_hash.c | 46 +++++++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 967e6b64b..4b69e5c30 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -3803,7 +3803,8 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 }
 
 static int
-iavf_hash_parse_action(const struct rte_flow_action actions[],
+iavf_hash_parse_action(struct iavf_pattern_match_item *pattern_match_item,
+		       const struct rte_flow_action actions[],
 		       uint64_t pattern_hint, void **meta,
 		       struct rte_flow_error *error)
 {
@@ -3826,19 +3827,6 @@ iavf_hash_parse_action(const struct rte_flow_action actions[],
 			rss = action->conf;
 			rss_type = rss->types;
 
-			if (rss->func ==
-			    RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
-				rss_meta->rss_algorithm =
-					VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC;
-			} else if (rss->func ==
-				   RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
-				rss_meta->rss_algorithm =
-					VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC;
-			} else {
-				rss_meta->rss_algorithm =
-					VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
-			}
-
 			if (rss->level)
 				return rte_flow_error_set(error, ENOTSUP,
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
@@ -3854,6 +3842,29 @@ iavf_hash_parse_action(const struct rte_flow_action actions[],
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
 					"a non-NULL RSS queue is not supported");
 
+			/* Check hash function and save it to rss_meta,
+			 * the pattern should be empty for simple_xor.
+			 */
+			if (pattern_match_item->pattern_list !=
+			    iavf_pattern_empty && rss->func ==
+			    RTE_ETH_HASH_FUNCTION_SIMPLE_XOR) {
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"Not supported flow");
+			} else if (rss->func ==
+			    RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
+				rss_meta->rss_algorithm =
+					VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC;
+				break;
+			} else if (rss->func ==
+				   RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+				rss_meta->rss_algorithm =
+					VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC;
+			} else {
+				rss_meta->rss_algorithm =
+					VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+			}
+
 			/**
 			 * Check simultaneous use of SRC_ONLY and DST_ONLY
 			 * of the same level.
@@ -3944,7 +3955,7 @@ iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad,
 	if (ret)
 		goto error;
 
-	ret = iavf_hash_parse_action(actions, phint,
+	ret = iavf_hash_parse_action(pattern_match_item, actions, phint,
 				     (void **)&rss_meta_ptr, error);
 
 error:
@@ -3976,7 +3987,10 @@ iavf_hash_create(__rte_unused struct iavf_adapter *ad,
 		return -ENOMEM;
 	}
 
-	rss_cfg->proto_hdrs = *rss_meta->proto_hdrs;
+	/* Simle_xor is globle configured, no need to set protocol hdrs */
+	if (rss_meta->rss_algorithm != VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC)
+		rss_cfg->proto_hdrs = *rss_meta->proto_hdrs;
+
 	rss_cfg->rss_algorithm = rss_meta->rss_algorithm;
 
 	ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-17  5:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17  4:08 [dpdk-dev] [dpdk-dev v1] net/iavf: fix simple xor hash Jeff Guo
2020-07-17  5:26 Jeff Guo

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git