From patchwork Thu Apr 22 11:27:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 92015 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 82100A09E4; Thu, 22 Apr 2021 13:27:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86C3641D2B; Thu, 22 Apr 2021 13:27:12 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id 59421406A3 for ; Thu, 22 Apr 2021 13:27:08 +0200 (CEST) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FQw6W4ZtnzPtFw for ; Thu, 22 Apr 2021 19:24:03 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Thu, 22 Apr 2021 19:27:01 +0800 From: "Min Hu (Connor)" To: CC: , Date: Thu, 22 Apr 2021 19:27:13 +0800 Message-ID: <1619090834-14643-2-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1619090834-14643-1-git-send-email-humin29@huawei.com> References: <1619090834-14643-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [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" 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); + } rte_mempool_free(internals->gso_ctx_mp);