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 F2255A0552; Wed, 1 Jun 2022 03:32:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94B0F40A84; Wed, 1 Jun 2022 03:32:19 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 07C7040150 for ; Wed, 1 Jun 2022 03:32:17 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LCWmr1wZcz1K96r for ; Wed, 1 Jun 2022 09:30:36 +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; Wed, 1 Jun 2022 09:32:15 +0800 From: "Min Hu (Connor)" To: Subject: [PATCH v2] ethdev: fix dev close in secondary process Date: Wed, 1 Jun 2022 09:30:57 +0800 Message-ID: <20220601013057.31782-1-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220527023553.48177-1-humin29@huawei.com> References: <20220527023553.48177-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: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500012.china.huawei.com (7.221.188.12) 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 From: Min Hu Secondary process need to close dev to release process private resources. But secondary process should not be obliged to wait for device stop before closing ethdev. This patch fixed it. Fixes: febc855b358e ("ethdev: forbid closing started device") Cc: stable@dpdk.org Signed-off-by: Min Hu --- v2: * fixed comment. --- 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 09abee6345..f34c6580a4 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1574,7 +1574,8 @@ rte_eth_dev_close(uint16_t port_id) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - if (dev->data->dev_started) { + if (rte_eal_process_type() == RTE_PROC_PRIMARY && + dev->data->dev_started) { RTE_ETHDEV_LOG(ERR, "Cannot close started device (port %u)\n", port_id); return -EINVAL; -- 2.33.0