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 AF976A0548; Tue, 27 Apr 2021 02:55:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C1C84067E; Tue, 27 Apr 2021 02:55:00 +0200 (CEST) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id 1D5E94003E for ; Tue, 27 Apr 2021 02:54:58 +0200 (CEST) Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FTjt13JWWzlZyd for ; Tue, 27 Apr 2021 08:52:57 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Tue, 27 Apr 2021 08:54:52 +0800 To: Ferruh Yigit , CC: References: <1619090834-14643-1-git-send-email-humin29@huawei.com> <1619090834-14643-2-git-send-email-humin29@huawei.com> <7a033aca-b3d4-fce8-91e0-6b7e6c4a5c7f@intel.com> From: "Min Hu (Connor)" Message-ID: <5a8211f7-edc7-6fcb-d760-fcad56103e0d@huawei.com> Date: Tue, 27 Apr 2021 08:54:52 +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: <7a033aca-b3d4-fce8-91e0-6b7e6c4a5c7f@intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH 1/2] net/tap: fix log loss when state fails to be restored 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 Sender: "dev" 在 2021/4/26 23:30, Ferruh Yigit 写道: > On 4/22/2021 12:27 PM, Min Hu (Connor) wrote: >> From: Chengchang Tang >> >> After restoring the remote states, the return value of ioctl() is not >> checked. Therefore, users cannot know whether the remote state is >> restored successfully. >> >> This patch add log for restoring failure. >> >> Fixes: 4810d3af8343 ("net/tap: restore state of remote device when closing") >> Cc: stable@dpdk.org >> >> Signed-off-by: Chengchang Tang >> Signed-off-by: Min Hu (Connor) >> --- >> drivers/net/tap/rte_eth_tap.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c >> index 68baa18..6007c78 100644 >> --- a/drivers/net/tap/rte_eth_tap.c >> +++ b/drivers/net/tap/rte_eth_tap.c >> @@ -1101,6 +1101,7 @@ tap_dev_close(struct rte_eth_dev *dev) >> struct pmd_internals *internals = dev->data->dev_private; >> struct pmd_process_private *process_private = dev->process_private; >> struct rx_queue *rxq; >> + int ret; >> >> if (rte_eal_process_type() != RTE_PROC_PRIMARY) { >> rte_free(dev->process_private); >> @@ -1133,8 +1134,11 @@ tap_dev_close(struct rte_eth_dev *dev) >> >> if (internals->remote_if_index) { >> /* Restore initial remote state */ >> - ioctl(internals->ioctl_sock, SIOCSIFFLAGS, >> + ret = ioctl(internals->ioctl_sock, SIOCSIFFLAGS, >> &internals->remote_initial_flags); >> + if (ret) >> + TAP_LOG(ERR, "restore remote state failed: %d", ret); >> + > > 'ret' is used only in this scope, can you please move the variable declaration > at the beginning of the this if block? > You can do something like "int ret = ioctl(...." > Hi, fixed in v2, thanks. > >> } >> >> rte_mempool_free(internals->gso_ctx_mp); >> > > . >