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 01810A04D8; Tue, 11 Aug 2020 08:50:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A91D71C0D0; Tue, 11 Aug 2020 08:49:42 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5BD551C0CD for ; Tue, 11 Aug 2020 08:49:41 +0200 (CEST) IronPort-SDR: FtvVC/5yRl78P1AWKZLKOvN5HkARrEAYxqMZNx5Z7qEmRBEw3xaTaLhPNQFopUeYK4PJZ3XRBH Uqg/a/aTnrhA== X-IronPort-AV: E=McAfee;i="6000,8403,9709"; a="171722177" X-IronPort-AV: E=Sophos;i="5.75,460,1589266800"; d="scan'208";a="171722177" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2020 23:49:41 -0700 IronPort-SDR: VSWGZzg5G+wHeME0jj1jZOCBMFa+HM5DIDra2uoO6gb7T1FwVzNzrG8mJKT3KMRRbu1vt9hmY7 NDtiexQj0g6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,460,1589266800"; d="scan'208";a="398445765" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.134]) by fmsmga001.fm.intel.com with ESMTP; 10 Aug 2020 23:49:39 -0700 From: SteveX Yang To: jingjing.wu@intel.com, beilei.xing@intel.com, dev@dpdk.org Cc: "Zhang, RobinX" , SteveX Yang Date: Tue, 11 Aug 2020 06:29:17 +0000 Message-Id: <20200811062917.7007-8-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200811062917.7007-1-stevex.yang@intel.com> References: <20200811062917.7007-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" From: "Zhang, RobinX" 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