DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com
Subject: [dpdk-dev] [PATCH 1/9] net/bnxt: fix error message when VNIC prepare fails
Date: Mon, 31 May 2021 12:56:36 +0530	[thread overview]
Message-ID: <20210531072644.24656-2-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20210531072644.24656-1-kalesh-anakkur.purayil@broadcom.com>

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

The bnxt_vnic_prep() can fail due to multiple reasons.
But when bnxt_vnic_prep() fails, PMD is not returning
the actual error/string to the application.

Fix it by moving the "rte_flow_error_set" to bnxt_vnic_prep()
to set the actual error code.

Fixes: d24610f7bfda ("net/bnxt: allow flow creation when RSS is enabled")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 66 +++++++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 26 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 73fd24c..66012b8 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -919,32 +919,46 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf,
 	return l2_filter;
 }
 
-static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic,
+			  const struct rte_flow_action *act,
+			  struct rte_flow_error *error)
 {
 	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 	uint64_t rx_offloads = dev_conf->rxmode.offloads;
 	int rc;
 
 	if (bp->nr_vnics > bp->max_vnics - 1)
-		return -ENOMEM;
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
+					  NULL,
+					  "Group id is invalid");
 
 	rc = bnxt_vnic_grp_alloc(bp, vnic);
 	if (rc)
-		goto ret;
+		return rte_flow_error_set(error, -rc,
+					  RTE_FLOW_ERROR_TYPE_ACTION,
+					  act,
+					  "Failed to alloc VNIC group");
 
 	rc = bnxt_hwrm_vnic_alloc(bp, vnic);
 	if (rc) {
-		PMD_DRV_LOG(ERR, "HWRM vnic alloc failure rc: %x\n", rc);
+		rte_flow_error_set(error, -rc,
+				   RTE_FLOW_ERROR_TYPE_ACTION,
+				   act,
+				   "Failed to alloc VNIC");
 		goto ret;
 	}
+
 	bp->nr_vnics++;
 
 	/* RSS context is required only when there is more than one RSS ring */
 	if (vnic->rx_queue_cnt > 1) {
 		rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, 0 /* ctx_idx 0 */);
 		if (rc) {
-			PMD_DRV_LOG(ERR,
-				    "HWRM vnic ctx alloc failure: %x\n", rc);
+			rte_flow_error_set(error, -rc,
+					   RTE_FLOW_ERROR_TYPE_ACTION,
+					   act,
+					   "Failed to alloc VNIC context");
 			goto ret;
 		}
 	} else {
@@ -957,10 +971,24 @@ static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 		vnic->vlan_strip = false;
 
 	rc = bnxt_hwrm_vnic_cfg(bp, vnic);
-	if (rc)
+	if (rc) {
+		rte_flow_error_set(error, -rc,
+				   RTE_FLOW_ERROR_TYPE_ACTION,
+				   act,
+				   "Failed to configure VNIC");
 		goto ret;
+	}
 
-	bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
+	rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
+	if (rc) {
+		rte_flow_error_set(error, -rc,
+				   RTE_FLOW_ERROR_TYPE_ACTION,
+				   act,
+				   "Failed to configure VNIC plcmode");
+		goto ret;
+	}
+
+	return 0;
 
 ret:
 	return rc;
@@ -1142,16 +1170,9 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 
 		PMD_DRV_LOG(DEBUG, "VNIC found\n");
 
-		rc = bnxt_vnic_prep(bp, vnic);
-		if (rc)  {
-			rte_flow_error_set(error,
-					   EINVAL,
-					   RTE_FLOW_ERROR_TYPE_ACTION,
-					   act,
-					   "VNIC prep fail");
-			rc = -rte_errno;
+		rc = bnxt_vnic_prep(bp, vnic, act, error);
+		if (rc)
 			goto ret;
-		}
 
 		PMD_DRV_LOG(DEBUG,
 			    "vnic[%d] = %p vnic->fw_grp_ids = %p\n",
@@ -1362,16 +1383,9 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 		vnic->end_grp_id = rss->queue[rss->queue_num - 1];
 		vnic->func_default = 0;	//This is not a default VNIC.
 
-		rc = bnxt_vnic_prep(bp, vnic);
-		if (rc) {
-			rte_flow_error_set(error,
-					   EINVAL,
-					   RTE_FLOW_ERROR_TYPE_ACTION,
-					   act,
-					   "VNIC prep fail");
-			rc = -rte_errno;
+		rc = bnxt_vnic_prep(bp, vnic, act, error);
+		if (rc)
 			goto ret;
-		}
 
 		PMD_DRV_LOG(DEBUG,
 			    "vnic[%d] = %p vnic->fw_grp_ids = %p\n",
-- 
2.10.1


  reply	other threads:[~2021-05-31  7:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31  7:26 [dpdk-dev] [PATCH 0/9] bnxt PMD fixes Kalesh A P
2021-05-31  7:26 ` Kalesh A P [this message]
2021-05-31  7:26 ` [dpdk-dev] [PATCH 2/9] net/bnxt: set flow error when free filter is not available Kalesh A P
2021-05-31  7:26 ` [dpdk-dev] [PATCH 3/9] net/bnxt: remove unnecessary code Kalesh A P
2021-05-31  7:26 ` [dpdk-dev] [PATCH 4/9] net/bnxt: fix error handling when VNIC prepare fails Kalesh A P
2021-05-31  7:26 ` [dpdk-dev] [PATCH 5/9] net/bnxt: set flow error when tunnel redirection free fails Kalesh A P
2021-05-31  7:26 ` [dpdk-dev] [PATCH 6/9] net/bnxt: use common function to destroy VNIC resource Kalesh A P
2021-05-31  7:26 ` [dpdk-dev] [PATCH 7/9] net/bnxt: fix check for PTP support in FW Kalesh A P
2021-05-31  7:26 ` [dpdk-dev] [PATCH 8/9] net/bnxt: improve log message Kalesh A P
2021-05-31  7:26 ` [dpdk-dev] [PATCH 9/9] net/bnxt: remove unnecessary comment Kalesh A P
2021-06-08 23:07 ` [dpdk-dev] [PATCH 0/9] bnxt PMD fixes Ajit Khaparde

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=20210531072644.24656-2-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@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
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).