From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A205A04C9; Tue, 11 Aug 2020 10:10:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 123391C0C1; Tue, 11 Aug 2020 10:10:09 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id B1E721C0CC for ; Tue, 11 Aug 2020 10:10:06 +0200 (CEST) IronPort-SDR: ONZohin9hM4WOCT7uXXc4qrH+yyntsjh5AWOBMaBn8ryExU2kgpJvJGnrXvLfQV2/Hdfg3NvLP h+pnAVguPxKQ== X-IronPort-AV: E=McAfee;i="6000,8403,9709"; a="133226912" X-IronPort-AV: E=Sophos;i="5.75,460,1589266800"; d="scan'208";a="133226912" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2020 01:10:06 -0700 IronPort-SDR: kGoG/uq6kW6z8/NnSObaHjtHySDmrzi3t/6vvo5ThUOYJkheQ9Y7kbmSbHL4SM/CCa4Sb6FnrJ DK+VuiBVbAmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,460,1589266800"; d="scan'208";a="308335405" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.134]) by orsmga002.jf.intel.com with ESMTP; 11 Aug 2020 01:10:04 -0700 From: SteveX Yang To: jingjing.wu@intel.com, beilei.xing@intel.com, dev@dpdk.org Cc: qiming.yang@intel.com, SteveX Yang Date: Tue, 11 Aug 2020 07:59:10 +0000 Message-Id: <20200811075910.20954-8-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200811075910.20954-1-stevex.yang@intel.com> References: <20200811075910.20954-1-stevex.yang@intel.com> Subject: [dpdk-dev] [PATCH 7/7] net/iavf: fix port close X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Port reset will call iavf_dev_uninit() to release resources. It wants to call iavf_dev_close() to release resources. So there will be a call conflict if calling iavf_dev_reset() and iavf_dev_close() at the same time. This patch added adapter->closed flag in iavf_dev_close() to control the status of close. Fixes: 83fe5e80692a ("net/iavf: move device state flag") Signed-off-by: SteveX Yang --- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_ethdev.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 9be8a2381..06cbe6089 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -161,6 +161,7 @@ struct iavf_adapter { bool tx_vec_allowed; const uint32_t *ptype_tbl; bool stopped; + bool closed; uint16_t fdir_ref_cnt; }; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index f16aff531..b58e57b07 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1367,6 +1367,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) hw->back = IAVF_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private); adapter->eth_dev = eth_dev; adapter->stopped = 1; + adapter->closed = 0; if (iavf_init_vf(eth_dev) != 0) { PMD_INIT_LOG(ERR, "Init vf failed"); @@ -1423,6 +1424,9 @@ iavf_dev_close(struct rte_eth_dev *dev) struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); + if (adapter->closed == 1) + return; + iavf_dev_stop(dev); iavf_flow_flush(dev, NULL); iavf_flow_uninit(adapter); @@ -1434,6 +1438,8 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_intr_callback_unregister(intr_handle, iavf_dev_interrupt_handler, dev); iavf_disable_irq0(hw); + + adapter->closed = 1; } static int -- 2.17.1