From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id E84DB1B3FD for ; Wed, 28 Nov 2018 10:14:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2018 01:14:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,290,1539673200"; d="scan'208";a="116457265" Received: from dpdk-server.sh.intel.com ([10.67.110.151]) by fmsmga001.fm.intel.com with ESMTP; 28 Nov 2018 01:14:58 -0800 From: Zhirun Yan To: dev@dpdk.org, qi.z.zhang@intel.com Cc: haiyue.wang@intel.com, Zhirun Yan Date: Wed, 28 Nov 2018 16:52:31 +0000 Message-Id: <20181128165231.78807-1-zhirun.yan@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v1] net/i40e: fix PF 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: , X-List-Received-Date: Wed, 28 Nov 2018 09:15:00 -0000 Before this patch, the function i40e_dev_close wants to call i40e_dev_stop() to release res, but it will never call it. Fixes: 4861cde4611601ccc9 ("i40e: new poll mode driver") Signed-off-by: Zhirun Yan --- drivers/net/i40e/i40e_ethdev.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7030eb1fa..bc5e45095 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2391,15 +2391,11 @@ static void i40e_dev_stop(struct rte_eth_dev *dev) { struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); - struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_vsi *main_vsi = pf->main_vsi; struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; int i; - if (hw->adapter_stopped == 1) - return; - if (dev->data->dev_conf.intr_conf.rxq == 0) { rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev); rte_intr_enable(intr_handle); @@ -2442,8 +2438,6 @@ i40e_dev_stop(struct rte_eth_dev *dev) /* reset hierarchy commit */ pf->tm_conf.committed = false; - - hw->adapter_stopped = 1; } static void @@ -2460,7 +2454,10 @@ i40e_dev_close(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); - i40e_dev_stop(dev); + if (dev->data->dev_started != 0) { + dev->data->dev_started = 0; + i40e_dev_stop(dev); + } /* Remove all mirror rules */ while ((p_mirror = TAILQ_FIRST(&pf->mirror_list))) { @@ -2523,6 +2520,8 @@ i40e_dev_close(struct rte_eth_dev *dev) I40E_WRITE_REG(hw, I40E_PFGEN_CTRL, (reg | I40E_PFGEN_CTRL_PFSWR_MASK)); I40E_WRITE_FLUSH(hw); + + hw->adapter_stopped = 1; } /* @@ -2539,8 +2538,6 @@ i40e_dev_reset(struct rte_eth_dev *dev) * To avoid unexpected behavior in VF, currently reset of PF with * SR-IOV activation is not supported. It might be supported later. */ - if (dev->data->sriov.active) - return -ENOTSUP; ret = eth_i40e_dev_uninit(dev); if (ret) -- 2.17.1