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 11E65A0552; Wed, 1 Jun 2022 05:18:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 044D240A84; Wed, 1 Jun 2022 05:18:14 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 5A25540150 for ; Wed, 1 Jun 2022 05:18:12 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LCZ7c1lcHzQjC5; Wed, 1 Jun 2022 11:17:00 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) 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 11:18:09 +0800 Subject: Re: [PATCH v2] ethdev: fix dev close in secondary process To: Ajit Khaparde CC: dpdk-dev References: <20220527023553.48177-1-humin29@huawei.com> <20220601013057.31782-1-humin29@huawei.com> From: "Min Hu (Connor)" Message-ID: Date: Wed, 1 Jun 2022 11:18:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 Hi, Ajit v3 has been sent, thanks 在 2022/6/1 10:01, Ajit Khaparde 写道: > On Tue, May 31, 2022 at 6:32 PM Min Hu (Connor) wrote: >> >> 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) { > It will be good to add the comment as a part of the code as well. > That way someone in future won't have to look at the commit log to > understand the behavior. > >> + 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 >>