[dpdk-stable] [PATCH 19.11 2/2] net/bnxt: fix lock init and destroy

Somnath Kotur somnath.kotur at broadcom.com
Fri Feb 19 09:15:18 CET 2021


[ upstream commit c9ffd6f88653163d51c497bb56c62ec3276caf3d]

Invoking init/uninit locks in init_resources and uninit_resources
would end up initializing and destroying locks on every port start
stop which is not desired.
Move the 2 routines to dev_init and dev_close respectively as
locks need to be initialized and destroyed only once during the
lifetime of the driver.

Fixes: 1cb3d39a48f7 ("net/bnxt: synchronize between flow related functions")
Cc: stable at dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur at broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e3f243cb86..5f9b912b1c 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4814,10 +4814,6 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev)
 	if (rc)
 		return rc;
 
-	rc = bnxt_init_locks(bp);
-	if (rc)
-		return rc;
-
 	return 0;
 }
 
@@ -4880,6 +4876,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rc)
 		goto error_free;
 
+	rc = bnxt_init_locks(bp);
+	if (rc)
+		goto error_free;
+
 	PMD_DRV_LOG(INFO,
 		    DRV_MODULE_NAME "found at mem %" PRIX64 ", node addr %pM\n",
 		    pci_dev->mem_resource[0].phys_addr,
@@ -4920,7 +4920,6 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 		}
 	}
 
-	bnxt_uninit_locks(bp);
 	rte_free(bp->ptp_cfg);
 	bp->ptp_cfg = NULL;
 	return rc;
@@ -4952,6 +4951,7 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
 	if (eth_dev->data->dev_started)
 		bnxt_dev_close_op(eth_dev);
 	bnxt_hwrm_free_vf_info(bp);
+	bnxt_uninit_locks(bp);
 	eth_dev->dev_ops = NULL;
 	eth_dev->rx_pkt_burst = NULL;
 	eth_dev->tx_pkt_burst = NULL;
-- 
2.28.0.497.g54e85e7



More information about the stable mailing list