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 3AAABA0613 for ; Tue, 27 Aug 2019 08:24:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 27A611BF42; Tue, 27 Aug 2019 08:24:52 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 600531BF37 for ; Tue, 27 Aug 2019 08:24:50 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Aug 2019 23:24:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,436,1559545200"; d="scan'208";a="180118061" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.5]) by fmsmga008.fm.intel.com with ESMTP; 26 Aug 2019 23:24:47 -0700 Date: Tue, 27 Aug 2019 14:23:17 +0800 From: Ye Xiaolong To: chenxux.di@intel.com Cc: dev@dpdk.org, Wenzhuo Lu , Beilei Xing , Qi Zhang , Yang Qiming Message-ID: <20190827062317.GB111534@intel.com> References: <20190827050142.16010-1-chenxux.di@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190827050142.16010-1-chenxux.di@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] drivers/net: 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" Hi, chenxu On 08/27, chenxux.di@intel.com wrote: >From: Di ChenxuX > >Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private >resources for the port can be freed by rte_eth_dev_close(). >This patch cover all the intel drivers > Just setting RTE_ETH_DEV_CLOSE_REMOVE in probe stage is not enough, you can see the advice in http://git.dpdk.org/dpdk/commit/?id=23ea57a2a "When enabling RTE_ETH_DEV_CLOSE_REMOVE, the PMD must free all its private resources for the port in its dev_close function, it's advised to call the dev_close function in the remove function in order to support removing a device without closing its ports". You can refer to other PMD which has finished this transition, like 696202ca5396 ("net/mvpp2: remove resources when port is closed") Also, I'd suggest to split it to several patches, one patch for one PMD. Thanks, Xiaolong >Signed-off-by: Di ChenxuX >--- > drivers/net/e1000/igb_ethdev.c | 5 +++++ > drivers/net/fm10k/fm10k_ethdev.c | 5 +++++ > drivers/net/i40e/i40e_ethdev.c | 5 +++++ > drivers/net/ice/ice_ethdev.c | 5 +++++ > drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++++ > 5 files changed, 25 insertions(+) > >diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c >index fec2b4289..fe785d1d7 100644 >--- a/drivers/net/e1000/igb_ethdev.c >+++ b/drivers/net/e1000/igb_ethdev.c >@@ -843,6 +843,11 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) > rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, > ð_dev->data->mac_addrs[0]); > >+ /* 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; >+ > /* initialize the vfta */ > memset(shadow_vfta, 0, sizeof(*shadow_vfta)); > >diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c >index db4d72129..b5a427c7b 100644 >--- a/drivers/net/fm10k/fm10k_ethdev.c >+++ b/drivers/net/fm10k/fm10k_ethdev.c >@@ -3103,6 +3103,11 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) > &dev->data->mac_addrs[0]); > } > >+ /* 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; >+ > /* Reset the hw statistics */ > fm10k_stats_reset(dev); > >diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c >index 4e40b7ab5..a0536f14c 100644 >--- a/drivers/net/i40e/i40e_ethdev.c >+++ b/drivers/net/i40e/i40e_ethdev.c >@@ -1520,6 +1520,11 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) > rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, > &dev->data->mac_addrs[0]); > >+ /* 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; >+ > /* Init dcb to sw mode by default */ > ret = i40e_dcb_init_configure(dev, TRUE); > if (ret != I40E_SUCCESS) { >diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c >index 44a14cb8a..476c768ee 100644 >--- a/drivers/net/ice/ice_ethdev.c >+++ b/drivers/net/ice/ice_ethdev.c >@@ -1488,6 +1488,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) { >diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c >index 03fc1f717..3e2b537ec 100644 >--- a/drivers/net/ixgbe/ixgbe_ethdev.c >+++ b/drivers/net/ixgbe/ixgbe_ethdev.c >@@ -1245,6 +1245,11 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) > return -ENOMEM; > } > >+ /* 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; >+ > /* initialize the vfta */ > memset(shadow_vfta, 0, sizeof(*shadow_vfta)); > >-- >2.17.1 >