DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
	Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
	stable@dpdk.org, Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [dpdk-dev] [PATCH 01/22] net/bnxt: fix to handle error case during port start
Date: Thu, 18 Jul 2019 09:05:55 +0530	[thread overview]
Message-ID: <20190718033616.37605-2-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20190718033616.37605-1-ajit.khaparde@broadcom.com>

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

1. during port start, if bnxt_init_chip() return error
   bnxt_dev_start_op() invokes bnxt_shutdown_nic() which in turn calls
   bnxt_free_all_hwrm_resources() to free up resources. Hence remove the
   bnxt_free_all_hwrm_resources() from bnxt_init_chip() failure path.
2. fix to check the return value of rte_intr_enable() as this call
   can fail.
3. set bp->dev_stopped to 0 only when port start succeeds.
4. handle failure cases in bnxt_init_chip() routine to do proper
   cleanup and return correct error value.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index cd87d0dbc..7290c4c33 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -394,8 +394,9 @@ static int bnxt_init_chip(struct bnxt *bp)
 					bp->rx_cp_nr_rings);
 			return -ENOTSUP;
 		}
-		if (rte_intr_efd_enable(intr_handle, intr_vector))
-			return -1;
+		rc = rte_intr_efd_enable(intr_handle, intr_vector);
+		if (rc)
+			return rc;
 	}
 
 	if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) {
@@ -406,7 +407,8 @@ static int bnxt_init_chip(struct bnxt *bp)
 		if (intr_handle->intr_vec == NULL) {
 			PMD_DRV_LOG(ERR, "Failed to allocate %d rx_queues"
 				" intr_vec", bp->eth_dev->data->nb_rx_queues);
-			return -ENOMEM;
+			rc = -ENOMEM;
+			goto err_disable;
 		}
 		PMD_DRV_LOG(DEBUG, "intr_handle->intr_vec = %p "
 			"intr_handle->nb_efd = %d intr_handle->max_intr = %d\n",
@@ -421,12 +423,14 @@ static int bnxt_init_chip(struct bnxt *bp)
 	}
 
 	/* enable uio/vfio intr/eventfd mapping */
-	rte_intr_enable(intr_handle);
+	rc = rte_intr_enable(intr_handle);
+	if (rc)
+		goto err_free;
 
 	rc = bnxt_get_hwrm_link_config(bp, &new);
 	if (rc) {
 		PMD_DRV_LOG(ERR, "HWRM Get link config failure rc: %x\n", rc);
-		goto err_out;
+		goto err_free;
 	}
 
 	if (!bp->link_info.link_up) {
@@ -434,16 +438,18 @@ static int bnxt_init_chip(struct bnxt *bp)
 		if (rc) {
 			PMD_DRV_LOG(ERR,
 				"HWRM link config failure rc: %x\n", rc);
-			goto err_out;
+			goto err_free;
 		}
 	}
 	bnxt_print_link_info(bp->eth_dev);
 
 	return 0;
 
+err_free:
+	rte_free(intr_handle->intr_vec);
+err_disable:
+	rte_intr_efd_disable(intr_handle);
 err_out:
-	bnxt_free_all_hwrm_resources(bp);
-
 	/* Some of the error status returned by FW may not be from errno.h */
 	if (rc > 0)
 		rc = -EIO;
@@ -759,7 +765,6 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 			"RxQ cnt %d > CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n",
 			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 	}
-	bp->dev_stopped = 0;
 
 	rc = bnxt_init_chip(bp);
 	if (rc)
@@ -781,6 +786,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
 	bnxt_enable_int(bp);
 	bp->flags |= BNXT_FLAG_INIT_DONE;
+	bp->dev_stopped = 0;
 	return 0;
 
 error:
-- 
2.20.1 (Apple Git-117)


  reply	other threads:[~2019-07-18  3:36 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18  3:35 [dpdk-dev] [PATCH 00/22] bnxt patchset Ajit Khaparde
2019-07-18  3:35 ` Ajit Khaparde [this message]
2019-07-18  3:35 ` [dpdk-dev] [PATCH 02/22] net/bnxt: fix return value check of address mapping Ajit Khaparde
2019-07-18  3:35 ` [dpdk-dev] [PATCH 03/22] net/bnxt: fix failure to add a MAC address Ajit Khaparde
2019-07-18  3:35 ` [dpdk-dev] [PATCH 04/22] net/bnxt: fix an unconditional wait in link update Ajit Khaparde
2019-07-18  3:35 ` [dpdk-dev] [PATCH 05/22] net/bnxt: fix setting primary MAC address Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 06/22] net/bnxt: fix failure path in dev init Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 07/22] net/bnxt: reset filters before registering interrupts Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 08/22] net/bnxt: use correct vnic default completion ring Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 09/22] net/bnxt: use dedicated cpr for async events Ajit Khaparde
2019-07-22 14:57   ` Ferruh Yigit
2019-07-22 15:06     ` Thomas Monjalon
2019-07-22 17:57       ` Lance Richardson
2019-07-22 18:34         ` Ferruh Yigit
2019-07-23  8:04           ` Thomas Monjalon
2019-07-23 10:53             ` Lance Richardson
2019-07-23 21:27           ` Lance Richardson
2019-07-24 16:14   ` [dpdk-dev] [PATCH] " Lance Richardson
2019-07-24 16:32     ` Lance Richardson
2019-07-24 16:49     ` [dpdk-dev] [[PATCH v2]] " Lance Richardson
2019-07-25  9:54       ` Ferruh Yigit
2019-07-18  3:36 ` [dpdk-dev] [PATCH 10/22] net/bnxt: retry irq callback deregistration Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 11/22] net/bnxt: fix error checking of FW commands Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 12/22] net/bnxt: fix to return standard error codes Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 13/22] net/bnxt: fix lock release on getting NVM info Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 14/22] net/bnxt: fix RSS disable issue for thor-based adapters Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 15/22] net/bnxt: use correct RSS table sizes Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 16/22] net/bnxt: fully initialize hwrm msgs for thor RSS cfg Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 17/22] net/bnxt: use correct number of RSS contexts for thor Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 18/22] net/bnxt: pass correct RSS table address " Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 19/22] net/bnxt: avoid overrun in get statistics Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 20/22] net/bnxt: fix MAC/VLAN filter allocation failure Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 21/22] net/bnxt: fix to correctly check result of HWRM command Ajit Khaparde
2019-07-18  3:36 ` [dpdk-dev] [PATCH 22/22] net/bnxt: update HWRM API to version 1.10.0.91 Ajit Khaparde
2019-07-19 12:30 ` [dpdk-dev] [PATCH 00/22] bnxt patchset Ferruh Yigit
2019-07-19 13:22   ` Ajit Kumar Khaparde
2019-07-19 16:59     ` Ferruh Yigit
2019-07-19 21:01 ` Ferruh Yigit

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