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 AF801A04C0; Mon, 28 Sep 2020 01:47:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 26D051D65E; Mon, 28 Sep 2020 01:43:48 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 1E5AD1D637 for ; Mon, 28 Sep 2020 01:43:37 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C03525C00FB; Sun, 27 Sep 2020 19:43:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 27 Sep 2020 19:43:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=KWaOnchw8yj9p 8QNci36LxrEBBMSAjGzKCJrg2Op3lo=; b=eEzQXGDLrT1xd1V3zTTDKpaxvo646 4w3XTJP+3kChIv4PttzIxs/4fEy5PStIYzRvfna2/EO3vREEzm5Y3uRB4IehQSUz 9/xnW9tHCb7SOIAyI0D9wl4bHiS7x+MTc7XH2FU9RRufOnendSGScK2/qPP8rhGF E75xuslAmRk7ow+e6yrNeOHF3WYNvgU6z1XMZ/hhHGoF/S2SOwdBBZTTByYdjDny VJck24iM2k7JQ7kDQyVwbD8Negca8XxHaK2nP5EtvLxY30ydxh+SPQpUcUxRVUr3 1fokmNTZhwJCrnpN/xop/rtENx+y2tDuHE5NVvQsnTjbBZvbIaDSEuFsA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=KWaOnchw8yj9p8QNci36LxrEBBMSAjGzKCJrg2Op3lo=; b=CIOcNpO2 PvU1Dn+tjsc4cdljsig2Ck6Pb7JrvaCI3dAyIF2O7iBNU56NajWfZuSArR045isH CX1kyMuYPpLmYZ36uYqXs4FQzDNzAJKr5rDk340Gb80c3ozLIyeV/1SOrzewVXEf zWmJoVaNWyrc4+0IcirzGd5KtLYIZ397KQik+0f94K+F/j8I2CqqqNpyvggORcLR pOFwTjcNqVcDUVhGl9+/cOZtpfD+p4FhHRfG2XilVn5f+y83/wnNihtgoeanPR5m tgUN431/8FOxCCBeN18IvImmM4Y9G+9rCqCCx698CqcvV90V7T7VmIWQbGf0Slhu y/VT39r3VFEgiA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehgddvhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepudegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id BF628328005D; Sun, 27 Sep 2020 19:43:34 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Rasesh Mody , Shahed Shaikh , Anatoly Burakov Date: Mon, 28 Sep 2020 01:42:37 +0200 Message-Id: <20200927234249.3198780-14-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200927234249.3198780-1-thomas@monjalon.net> References: <20200913220711.3768597-1-thomas@monjalon.net> <20200927234249.3198780-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 13/25] net/qede: 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" From: Rasesh Mody Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources for the port can be freed by rte_eth_dev_close(). With this change the private port resources are released in the .dev_close callback. Signed-off-by: Rasesh Mody --- drivers/net/qede/qede_ethdev.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 9535df183f..43fe68c2bf 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1550,6 +1550,10 @@ static int qede_dev_close(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(edev); + /* only close in case of the primary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + /* dev_stop() shall cleanup fp resources in hw but without releasing * dma memories and sw structures so that dev_start() can be called * by the app without reconfiguration. However, in dev_close() we @@ -1587,6 +1591,10 @@ static int qede_dev_close(struct rte_eth_dev *eth_dev) if (ECORE_IS_CMT(edev)) rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev); + eth_dev->dev_ops = NULL; + eth_dev->rx_pkt_burst = NULL; + eth_dev->tx_pkt_burst = NULL; + return 0; } @@ -2703,6 +2711,11 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) adapter->ipgre.enable = false; } + /* Pass the information to the rte_eth_dev_close() that it should also + * release the private port resources. + */ + eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; + DP_INFO(edev, "MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n", adapter->primary_mac.addr_bytes[0], adapter->primary_mac.addr_bytes[1], @@ -2737,20 +2750,8 @@ static int qede_dev_common_uninit(struct rte_eth_dev *eth_dev) { struct qede_dev *qdev = eth_dev->data->dev_private; struct ecore_dev *edev = &qdev->edev; - PMD_INIT_FUNC_TRACE(edev); - - /* only uninitialize in the primary process */ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; - - /* safe to close dev here */ qede_dev_close(eth_dev); - - eth_dev->dev_ops = NULL; - eth_dev->rx_pkt_burst = NULL; - eth_dev->tx_pkt_burst = NULL; - return 0; } -- 2.28.0