DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] net/bnxt: updates to RSS action support
Date: Mon, 11 Oct 2021 15:50:39 -0700	[thread overview]
Message-ID: <20211011225039.62737-1-ajit.khaparde@broadcom.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4708 bytes --]

Some changes to the RSS action support to return appropriate error.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_filter.h |  2 +-
 drivers/net/bnxt/bnxt_flow.c   | 60 +++++++++++++++++++---------------
 2 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_filter.h b/drivers/net/bnxt/bnxt_filter.h
index 07938534a9..587932c96f 100644
--- a/drivers/net/bnxt/bnxt_filter.h
+++ b/drivers/net/bnxt/bnxt_filter.h
@@ -43,7 +43,7 @@ struct bnxt_filter_info {
 #define HWRM_CFA_EM_FILTER	1
 #define HWRM_CFA_NTUPLE_FILTER	2
 #define HWRM_CFA_TUNNEL_REDIRECT_FILTER	3
-#define HWRM_CFA_CONFIG_VNIC	4
+#define HWRM_CFA_CONFIG		4
 	uint8_t                 filter_type;
 	uint32_t                dst_id;
 
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 7043d44b4d..b2ebb5634e 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -738,6 +738,10 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 	filter->enables = en;
 	filter->valid_flags = valid_flags;
 
+	/* Items parsed but no filter to create in HW. */
+	if (filter->enables == 0 && filter->valid_flags == 0)
+		filter->filter_type = HWRM_CFA_CONFIG;
+
 	return 0;
 }
 
@@ -1127,7 +1131,7 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp,
 	if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT &&
 	    rss->func != RTE_ETH_HASH_FUNCTION_TOEPLITZ) {
 		rte_flow_error_set(error,
-				   EINVAL,
+				   ENOTSUP,
 				   RTE_FLOW_ERROR_TYPE_ACTION,
 				   act,
 				   "Unsupported RSS hash function");
@@ -1136,10 +1140,7 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp,
 	}
 
 	/* key_len should match the hash key supported by hardware */
-	if (rss->queue_num == 0 &&
-	    ((rss->key_len == 0 && rss->key != NULL) ||
-	     (rss->key_len != 0 && rss->key == NULL) ||
-	     (rss->key_len != 0 && rss->key_len != HW_HASH_KEY_SIZE))) {
+	if (rss->key_len != 0 && rss->key_len != HW_HASH_KEY_SIZE) {
 		rte_flow_error_set(error,
 				   EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1156,7 +1157,7 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp,
 	 */
 	if (rss->level > 2) {
 		rte_flow_error_set(error,
-				   EINVAL,
+				   ENOTSUP,
 				   RTE_FLOW_ERROR_TYPE_ACTION,
 				   act,
 				   "Unsupported hash level");
@@ -1187,7 +1188,7 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp,
 	vnic->hash_mode =
 		bnxt_rte_to_hwrm_hash_level(bp, rss->types, rss->level);
 
-	/* Update RETA table only if key_len != 0 */
+	/* Update RSS key only if key_len != 0 */
 	if (rss->key_len != 0)
 		memcpy(vnic->rss_hash_key, rss->key, rss->key_len);
 
@@ -1272,17 +1273,6 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 
 	use_ntuple = bnxt_filter_type_check(pattern, error);
 
-	rc = bnxt_validate_rss_action(actions);
-	if (rc != 0) {
-		rte_flow_error_set(error,
-				   EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ACTION,
-				   act,
-				   "Invalid actions specified with RSS");
-		rc = -rte_errno;
-		goto ret;
-	}
-
 start:
 	switch (act->type) {
 	case RTE_FLOW_ACTION_TYPE_QUEUE:
@@ -1504,6 +1494,17 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 		filter->flow_id = filter1->flow_id;
 		break;
 	case RTE_FLOW_ACTION_TYPE_RSS:
+		rc = bnxt_validate_rss_action(actions);
+		if (rc != 0) {
+			rte_flow_error_set(error,
+					   EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ACTION,
+					   act,
+					   "Invalid actions specified with RSS");
+			rc = -rte_errno;
+			goto ret;
+		}
+
 		rss = (const struct rte_flow_action_rss *)act->conf;
 
 		vnic_id = bnxt_get_vnic(bp, attr->group);
@@ -1511,17 +1512,18 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 		BNXT_VALID_VNIC_OR_RET(bp, vnic_id);
 		vnic = &bp->vnic_info[vnic_id];
 
-		if (filter->enables == 0 && filter->valid_flags == 0) {
+		/*
+		 * For non NS3 cases, rte_flow_items will not be considered
+		 * for RSS updates.
+		 */
+		if (filter->filter_type == HWRM_CFA_CONFIG) {
 			/* RSS config update requested */
 			rc = bnxt_vnic_rss_cfg_update(bp, vnic, act, error);
-			if (rc != 0) {
-				rc = -rte_errno;
-				goto ret;
-			} else {
-				filter->dst_id = vnic->fw_vnic_id;
-				filter->filter_type = HWRM_CFA_CONFIG_VNIC;
-				break;
-			}
+			if (rc != 0)
+				return -rte_errno;
+
+			filter->dst_id = vnic->fw_vnic_id;
+			break;
 		}
 
 		/* Check if requested RSS config matches RSS config of VNIC
@@ -2194,6 +2196,10 @@ _bnxt_flow_destroy(struct bnxt *bp,
 			return ret;
 	}
 
+	/* For config type, there is no filter in HW. Finish cleanup here */
+	if (filter->filter_type == HWRM_CFA_CONFIG)
+		goto done;
+
 	ret = bnxt_match_filter(bp, filter);
 	if (ret == 0)
 		PMD_DRV_LOG(ERR, "Could not find matching flow\n");
-- 
2.30.1 (Apple Git-130)


                 reply	other threads:[~2021-10-11 22:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211011225039.62737-1-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).