From patchwork Thu Sep 19 02:47:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenxu Di X-Patchwork-Id: 59348 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4AF911BEEE; Thu, 19 Sep 2019 05:31:03 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 7C95E1E85D for ; Thu, 19 Sep 2019 05:30:59 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2019 20:30:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,522,1559545200"; d="scan'208";a="202197943" Received: from intel.sh.intel.com ([10.239.255.149]) by fmsmga001.fm.intel.com with ESMTP; 18 Sep 2019 20:30:58 -0700 From: Di ChenxuX To: dev@dpdk.org Cc: qiming.yang@intel.com, Di ChenxuX Date: Thu, 19 Sep 2019 02:47:41 +0000 Message-Id: <20190919024742.8147-5-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190919024742.8147-1-chenxux.di@intel.com> References: <20190827050142.16010-1-chenxux.di@intel.com> <20190919024742.8147-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v4 4/5] net/ice: release port upon 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" Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources for the port can be freed by rte_eth_dev_close(). Signed-off-by: Di ChenxuX --- drivers/net/ice/ice_ethdev.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 63997fdfb..7be454bcc 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -1497,6 +1497,11 @@ ice_dev_init(struct rte_eth_dev *dev) goto err_init_mac; } + /* Pass the information to the rte_eth_dev_close() that it should also + * release the private port resources. + */ + dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; + ret = ice_res_pool_init(&pf->msix_pool, 1, hw->func_caps.common_cap.num_msix_vectors - 1); if (ret) { @@ -1662,6 +1667,9 @@ ice_dev_close(struct rte_eth_dev *dev) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + struct rte_flow *p_flow; /* Since stop will make link down, then the link event will be * triggered, disable the irq firstly to avoid the port_infoe etc @@ -1681,20 +1689,6 @@ ice_dev_close(struct rte_eth_dev *dev) rte_free(hw->port_info); hw->port_info = NULL; ice_shutdown_all_ctrlq(hw); -} - -static int -ice_dev_uninit(struct rte_eth_dev *dev) -{ - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); - struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; - struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); - struct rte_flow *p_flow; - - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; - - ice_dev_close(dev); dev->dev_ops = NULL; dev->rx_pkt_burst = NULL; @@ -1716,6 +1710,12 @@ ice_dev_uninit(struct rte_eth_dev *dev) ice_free_switch_filter_rule(p_flow->rule); rte_free(p_flow); } +} + +static int +ice_dev_uninit(struct rte_eth_dev *dev) +{ + ice_dev_close(dev); return 0; }