From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 3CC85A0A0F
	for <public@inbox.dpdk.org>; Sat,  3 Jul 2021 11:57:06 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2D649410EB;
	Sat,  3 Jul 2021 11:57:06 +0200 (CEST)
Received: from localhost.localdomain (unknown [36.28.25.58])
 by mails.dpdk.org (Postfix) with ESMTP id DAE5F4003E;
 Sat,  3 Jul 2021 11:57:03 +0200 (CEST)
Received: by localhost.localdomain (Postfix, from userid 0)
 id 27DCC534CA6; Sat,  3 Jul 2021 05:57:02 -0400 (EDT)
From: Weifeng Li <liweifeng96@126.com>
To: ajit.khaparde@broadcom.com,
	somnath.kotur@broadcom.com
Cc: dev@dpdk.org,
	liweifeng96@126.com,
	stable@dpdk.org
Date: Sat,  3 Jul 2021 05:57:00 -0400
Message-Id: <1625306220-1268-1-git-send-email-liweifeng96@126.com>
X-Mailer: git-send-email 1.8.3.1
Subject: [dpdk-stable] [PATCH] net/bnxt: fix nested lock at bond mode
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Bnxt regist lsc callback (bond_ethdev_lsc_event_callback) when
working at bond mode. This callback will dead lock when lsc
interrupt triggerred.

lsc interrupt ->
bnxt_handle_async_event ->
bnxt_link_update_op ->
bond_ethdev_lsc_event_callback (lsc_lock) ->
bnxt_link_update_op ->
bond_ethdev_lsc_event_callback (lsc_lock dead lock)

Fixes: c2faa1d1969e ("net/bnxt: add support for LSC interrupt event")
Cc: stable@dpdk.org

Signed-off-by: Weifeng Li <liweifeng96@126.com>
---
 drivers/net/bnxt/bnxt_cpr.c    | 2 ++
 drivers/net/bnxt/bnxt_ethdev.c | 5 -----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 2c7fd78..f4c9c72 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -111,6 +111,8 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
 		/* FALLTHROUGH */
 		bnxt_link_update_op(bp->eth_dev, 0);
+		rte_eth_dev_callback_process(bp->eth_dev,
+			RTE_ETH_EVENT_INTR_LSC, NULL);
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
 		PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 495c6cd..619b7b8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1844,11 +1844,6 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	if (new.link_status != eth_dev->data->dev_link.link_status ||
 	    new.link_speed != eth_dev->data->dev_link.link_speed) {
 		rte_eth_linkstatus_set(eth_dev, &new);
-
-		rte_eth_dev_callback_process(eth_dev,
-					     RTE_ETH_EVENT_INTR_LSC,
-					     NULL);
-
 		bnxt_print_link_info(eth_dev);
 	}
 
-- 
1.8.3.1