From patchwork Sun Sep 13 22:06:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 77556 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3072AA04C9; Mon, 14 Sep 2020 00:08:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 82AE81C0D5; Mon, 14 Sep 2020 00:07:55 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 663541C0D1 for ; Mon, 14 Sep 2020 00:07:53 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 16A255C014E; Sun, 13 Sep 2020 18:07:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 13 Sep 2020 18:07:53 -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=bfhhSVySlPMJf EzfQ/I0W7cQbY7t8ZadgGbhmTmmmtw=; b=vX3gsUntIJrMuk++lt1PGWlD/b6h3 ueXl6sZfLZsAVr6UyY4Dhhcq2zlSAi67zA5OcuzVml03JaX6Z7/Qja744hGFRmCw UUxJV3NVLYfnNngoatQInVAvcO6CIhg5kxA2RTlGWgntKb54rVyXFFfS1KxmbpzC OtZyFbi+q6dDaYkPwjqYpfnx949lvCCIfOdyc1QyKqPB+P/Lpgwr3FwCXZEns7v7 h72cWVFM7g8tW8JO1pVLA7vCFIk/wX4+W5m72T+TK6j43feIp0nB3DsqTW/iE55t duwP0g1BJGiofFuB4DA/mNtXou+3amQd16cJcPIH3kYbQ6sh/a5sCNp5Q== 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=bfhhSVySlPMJfEzfQ/I0W7cQbY7t8ZadgGbhmTmmmtw=; b=teC6LELg vrj3qvmtgPXu8u7ZycUmIMTcZiANr5bEVH9SZNGI7ad1sJbGztmLLxkPvGEaqEJr 7fCBiikODaQEdnT1bsGJ/rbxp6EFIi2PoiEOP3zQHx+Cet7i0PQ/hwAZpGsbZ2na 6BYfCfPq2kmlLwgEhO8St89k5AFzgYcGI7Q0xkwieDJyTY+bg/4kVIvQ4IvbOkdu VDs2M3cfEgkRehPCGydhHAPeSkUvfZcRORzuOpMV6qJwLsdcwpPnCZzbbx5JSHXq Ft+u/z0gcJJzuj1fwCitHbkemhqMiZhXcOSVxp4VDp4awTW9yDWWi/Sazxd7Ku/v 63g/uyRWS0egWQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeihedgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 46D0E306467E; Sun, 13 Sep 2020 18:07:52 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Somalapuram Amaranath Date: Mon, 14 Sep 2020 00:06:56 +0200 Message-Id: <20200913220711.3768597-6-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200913220711.3768597-1-thomas@monjalon.net> References: <20200913220711.3768597-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 05/20] net/axgbe: 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" The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources can be freed by rte_eth_dev_close(). Freeing of private port resources is moved from the ".remove(device)" to the ".dev_close(port)" operation. The ".dev_close" callback is also called as part of the ".remove" one. Signed-off-by: Thomas Monjalon --- drivers/net/axgbe/axgbe_ethdev.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index be6f7cbda6..c5e70ea0a1 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -10,7 +10,6 @@ #include "axgbe_regs.h" static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); -static int eth_axgbe_dev_uninit(struct rte_eth_dev *eth_dev); static int axgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(struct rte_eth_dev *dev); static void axgbe_dev_stop(struct rte_eth_dev *dev); @@ -378,14 +377,6 @@ axgbe_dev_stop(struct rte_eth_dev *dev) rte_bit_relaxed_set32(AXGBE_DOWN, &pdata->dev_state); } -/* Clear all resources like TX/RX queues. */ -static int -axgbe_dev_close(struct rte_eth_dev *dev) -{ - axgbe_dev_clear_queues(dev); - return 0; -} - static int axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev) { @@ -1632,6 +1623,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) int ret; eth_dev->dev_ops = &axgbe_eth_dev_ops; + eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; /* * For secondary processes, we don't initialise any further as primary @@ -1794,7 +1786,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) } static int -eth_axgbe_dev_uninit(struct rte_eth_dev *eth_dev) +axgbe_dev_close(struct rte_eth_dev *eth_dev) { struct rte_pci_device *pci_dev; @@ -1827,7 +1819,7 @@ static int eth_axgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, static int eth_axgbe_pci_remove(struct rte_pci_device *pci_dev) { - return rte_eth_dev_pci_generic_remove(pci_dev, eth_axgbe_dev_uninit); + return rte_eth_dev_pci_generic_remove(pci_dev, axgbe_dev_close); } static struct rte_pci_driver rte_axgbe_pmd = {