From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38584A0613 for ; Wed, 28 Aug 2019 15:43:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3004F1C229; Wed, 28 Aug 2019 15:43:36 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 40EF31C1FF for ; Wed, 28 Aug 2019 15:43:34 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B06E3308FB82; Wed, 28 Aug 2019 13:43:33 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id A55AF196AE; Wed, 28 Aug 2019 13:43:32 +0000 (UTC) From: Kevin Traynor To: Kalesh AP Cc: Somnath Kotur , dpdk stable Date: Wed, 28 Aug 2019 14:42:12 +0100 Message-Id: <20190828134234.20547-36-ktraynor@redhat.com> In-Reply-To: <20190828134234.20547-1-ktraynor@redhat.com> References: <20190828134234.20547-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 28 Aug 2019 13:43:33 +0000 (UTC) Subject: [dpdk-stable] patch 'net/bnxt: fix error handling in port start' has been queued to LTS release 18.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 09/04/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/0a273adbf5694c52c4c2b2babb423e97965052b2 Thanks. Kevin Traynor --- >From 0a273adbf5694c52c4c2b2babb423e97965052b2 Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 18 Jul 2019 09:05:55 +0530 Subject: [PATCH] net/bnxt: fix error handling in port start [ upstream commit 6de4c538b393d5a1414a18b2dfb83293b9c429a1 ] 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") Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur --- 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 94b3f4e41..e701b7b16 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -355,6 +355,7 @@ static int bnxt_init_chip(struct bnxt *bp) 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; } @@ -367,5 +368,6 @@ static int bnxt_init_chip(struct bnxt *bp) 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 " @@ -382,10 +384,12 @@ 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; } @@ -395,5 +399,5 @@ static int bnxt_init_chip(struct bnxt *bp) PMD_DRV_LOG(ERR, "HWRM link config failure rc: %x\n", rc); - goto err_out; + goto err_free; } } @@ -402,7 +406,9 @@ static int bnxt_init_chip(struct bnxt *bp) 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) @@ -630,5 +636,4 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS); } - bp->dev_stopped = 0; rc = bnxt_init_chip(bp); @@ -648,4 +653,5 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) bnxt_enable_int(bp); bp->flags |= BNXT_FLAG_INIT_DONE; + bp->dev_stopped = 0; return 0; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-08-28 14:32:33.952855971 +0100 +++ 0037-net-bnxt-fix-error-handling-in-port-start.patch 2019-08-28 14:32:31.679956513 +0100 @@ -1 +1 @@ -From 6de4c538b393d5a1414a18b2dfb83293b9c429a1 Mon Sep 17 00:00:00 2001 +From 0a273adbf5694c52c4c2b2babb423e97965052b2 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 6de4c538b393d5a1414a18b2dfb83293b9c429a1 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 35e50f1db..39229f150 100644 +index 94b3f4e41..e701b7b16 100644 @@ -29 +30 @@ -@@ -395,6 +395,7 @@ static int bnxt_init_chip(struct bnxt *bp) +@@ -355,6 +355,7 @@ static int bnxt_init_chip(struct bnxt *bp) @@ -39 +40 @@ -@@ -407,5 +408,6 @@ static int bnxt_init_chip(struct bnxt *bp) +@@ -367,5 +368,6 @@ static int bnxt_init_chip(struct bnxt *bp) @@ -47 +48 @@ -@@ -422,10 +424,12 @@ static int bnxt_init_chip(struct bnxt *bp) +@@ -382,10 +384,12 @@ static int bnxt_init_chip(struct bnxt *bp) @@ -62 +63 @@ -@@ -435,5 +439,5 @@ static int bnxt_init_chip(struct bnxt *bp) +@@ -395,5 +399,5 @@ static int bnxt_init_chip(struct bnxt *bp) @@ -69 +70 @@ -@@ -442,7 +446,9 @@ static int bnxt_init_chip(struct bnxt *bp) +@@ -402,7 +406,9 @@ static int bnxt_init_chip(struct bnxt *bp) @@ -81 +82 @@ -@@ -760,5 +766,4 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) +@@ -630,5 +636,4 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) @@ -87 +88 @@ -@@ -782,4 +787,5 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) +@@ -648,4 +653,5 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)