DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jeff Guo <jia.guo@intel.com>
To: qi.z.zhang@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com
Cc: dev@dpdk.org, junfeng.guo@intel.com, simei.su@intel.com,
	jia.guo@intel.com
Subject: [dpdk-dev] [dpdk-dev v1] net/iavf: fix simple xor hash
Date: Fri, 17 Jul 2020 13:26:52 +0800
Message-ID: <20200717052652.36973-1-jia.guo@intel.com> (raw)

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


             reply	other threads:[~2020-07-17  5:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17  5:26 Jeff Guo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-07-17  4:08 Jeff Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200717052652.36973-1-jia.guo@intel.com \
    --to=jia.guo@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=junfeng.guo@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=simei.su@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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