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 51A9541D73; Thu, 2 Mar 2023 13:23:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3C7540E2D; Thu, 2 Mar 2023 13:23:55 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 6C7DA40E09 for ; Thu, 2 Mar 2023 13:23:54 +0100 (CET) Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PS9F33mDmz16Nps; Thu, 2 Mar 2023 20:21:11 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 20:23:50 +0800 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.021; Thu, 2 Mar 2023 13:23:49 +0100 From: Konstantin Ananyev To: Fengchengwen , "thomas@monjalon.net" , "ferruh.yigit@amd.com" , "Ajit Khaparde" , Somnath Kotur , Kalesh AP CC: "dev@dpdk.org" Subject: RE: [PATCH 3/5] net/bnxt: fix race-condition when report error recovery Thread-Topic: [PATCH 3/5] net/bnxt: fix race-condition when report error recovery Thread-Index: AQHZS+uwMOZ1bto6c0a/PotDCQeOPa7na4ug Date: Thu, 2 Mar 2023 12:23:49 +0000 Message-ID: <850a0a000df94dc6846eed6abe7ee1b0@huawei.com> References: <20230301030610.49468-1-fengchengwen@huawei.com> <20230301030610.49468-4-fengchengwen@huawei.com> In-Reply-To: <20230301030610.49468-4-fengchengwen@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected 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. >=20 > Fixes: e11052f3a46f ("net/bnxt: support proactive error handling mode") > Cc: stable@dpdk.org >=20 > Signed-off-by: Chengwen Feng > --- > drivers/net/bnxt/bnxt_cpr.c | 13 +++++++------ > drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- > 2 files changed, 9 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c > index 5bb376d4d5..3950840600 100644 > --- a/drivers/net/bnxt/bnxt_cpr.c > +++ b/drivers/net/bnxt/bnxt_cpr.c > @@ -168,14 +168,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 |=3D BNXT_FLAG_FATAL_ERROR; > return; > } > @@ -184,6 +179,12 @@ void bnxt_handle_async_event(struct bnxt *bp, > RTE_ETH_EVENT_ERR_RECOVERING, > NULL); >=20 > + /* > + * 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 =3D data1; > /* timestamp_lo/hi values are in units of 100ms */ > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethde= v.c > index 753e86b4b2..4083a69d02 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -4562,14 +4562,14 @@ static void bnxt_check_fw_health(void *arg) > bp->flags |=3D BNXT_FLAG_FATAL_ERROR; > bp->flags |=3D BNXT_FLAG_FW_RESET; >=20 > - bnxt_stop_rxtx(bp->eth_dev); > - > PMD_DRV_LOG(ERR, "Detected FW dead condition\n"); >=20 > rte_eth_dev_callback_process(bp->eth_dev, > RTE_ETH_EVENT_ERR_RECOVERING, > NULL); >=20 > + bnxt_stop_rxtx(bp->eth_dev); > + > if (bnxt_is_primary_func(bp)) > wait_msec =3D info->primary_func_wait_period; > else > -- Acked-by: Konstantin Ananyev > 2.17.1