From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B84E24590C; Thu, 5 Sep 2024 11:30:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 352BF42E7E; Thu, 5 Sep 2024 11:29:35 +0200 (CEST) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id 394BC42E60 for ; Thu, 5 Sep 2024 11:29:28 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4WzvCK3n6qz1xwyc; Thu, 5 Sep 2024 17:27:25 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id B403B1A0188; Thu, 5 Sep 2024 17:29:26 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 5 Sep 2024 17:29:26 +0800 From: Chengwen Feng To: , , , , Somnath Kotur , Kalesh AP CC: , , Subject: [PATCH v4 3/7] net/bnxt: fix race-condition when report error recovery Date: Thu, 5 Sep 2024 09:25:00 +0000 Message-ID: <20240905092504.10725-4-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240905092504.10725-1-fengchengwen@huawei.com> References: <20230301030610.49468-1-fengchengwen@huawei.com> <20240905092504.10725-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org If set data path functions to dummy functions before reports error recovering event, there maybe a race-condition with data path threads, this patch fixes it by setting data path functions to dummy functions only after reports such event. Fixes: e11052f3a46f ("net/bnxt: support proactive error handling mode") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Acked-by: Konstantin Ananyev Acked-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_cpr.c | 13 +++++++------ drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index a4509abd60..1da0fc62f4 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -189,14 +189,9 @@ void bnxt_handle_async_event(struct bnxt *bp, PMD_DRV_LOG(INFO, "Port conn async event\n"); break; case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: - /* - * Avoid any rx/tx packet processing during firmware reset - * operation. - */ - bnxt_stop_rxtx(bp->eth_dev); - /* Ignore reset notify async events when stopping the port */ if (!bp->eth_dev->data->dev_started) { + bnxt_stop_rxtx(bp->eth_dev); bp->flags |= BNXT_FLAG_FATAL_ERROR; return; } @@ -205,6 +200,12 @@ void bnxt_handle_async_event(struct bnxt *bp, RTE_ETH_EVENT_ERR_RECOVERING, NULL); + /* + * Avoid any rx/tx packet processing during firmware reset + * operation. + */ + bnxt_stop_rxtx(bp->eth_dev); + pthread_mutex_lock(&bp->err_recovery_lock); event_data = data1; /* timestamp_lo/hi values are in units of 100ms */ diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index e63febe782..2813ce5035 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -4738,14 +4738,14 @@ static void bnxt_check_fw_health(void *arg) bp->flags |= BNXT_FLAG_FATAL_ERROR; bp->flags |= BNXT_FLAG_FW_RESET; - bnxt_stop_rxtx(bp->eth_dev); - PMD_DRV_LOG(ERR, "Detected FW dead condition\n"); rte_eth_dev_callback_process(bp->eth_dev, RTE_ETH_EVENT_ERR_RECOVERING, NULL); + bnxt_stop_rxtx(bp->eth_dev); + if (bnxt_is_primary_func(bp)) wait_msec = info->primary_func_wait_period; else -- 2.17.1