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 68838A0093 for ; Tue, 3 May 2022 12:03:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6272142836; Tue, 3 May 2022 12:03:44 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 6762A427EB; Tue, 3 May 2022 12:03:41 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KswWh5PSQzhXWW; Tue, 3 May 2022 18:03:12 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 3 May 2022 18:03:39 +0800 From: "Min Hu (Connor)" To: CC: "Min Hu (Connor)" , , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ivan Ilchenko Subject: [PATCH v3 5/5] ethdev: fix dev state when stop Date: Tue, 3 May 2022 18:02:17 +0800 Message-ID: <20220503100217.46203-6-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220503100217.46203-1-humin29@huawei.com> References: <20220324030036.4761-1-humin29@huawei.com> <20220503100217.46203-1-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Currently, 'dev_started' is always set to be 0 when dev stop, whether it succeeded or failed. This is unreasonable and this patch fixed it. Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int") Cc: stable@dpdk.org Signed-off-by: Min Hu (Connor) --- lib/ethdev/rte_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 29a3d80466..e0011372aa 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1533,8 +1533,9 @@ rte_eth_dev_stop(uint16_t port_id) /* point fast-path functions to dummy ones */ eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id); - dev->data->dev_started = 0; ret = (*dev->dev_ops->dev_stop)(dev); + if (ret == 0) + dev->data->dev_started = 0; rte_ethdev_trace_stop(port_id, ret); return ret; -- 2.33.0