From patchwork Sun Sep 27 23:42:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 78930 X-Patchwork-Delegate: thomas@monjalon.net 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 477CCA04C0; Mon, 28 Sep 2020 01:44:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DA1791D628; Mon, 28 Sep 2020 01:43:32 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 44EB61D614 for ; Mon, 28 Sep 2020 01:43:23 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id E9BD75C00FB; Sun, 27 Sep 2020 19:43:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 27 Sep 2020 19:43:21 -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=hQyssPcxSGVoH SuaYQGqyaUa8+NAdqETWDqxtoPmCWQ=; b=sc4+XskzO87Atfj2Yshli/kaM1vdi P0YdgJ9fF+FHMQUbcVbgoyqPaZyln+H6PK2QbDebdPBKMbQ3qlG8bqSXy3ByV/f0 2Upo/jt6G6QFqriZLqsD4hOwaERhWk4wF784AK4n0LsvCYakuwui2Ab+WMTRbouQ M1kpG/J2qjvYlVDJ9dXjszFDve/vULye8N5OuF1EzZOYQvtAUGhDgOMtH8R1qiQl 6CK2iz9MeiSKNJETq5/Lg+n9O+kAoLarS6LgnTI38wBNn18oiCx7sKvDEXWMgk4Q N3y2CYdrHeQjB3Qxu9OkULhZomny5Hc8d/qfzlDwOLqOvL/57qfyT904w== 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=hQyssPcxSGVoHSuaYQGqyaUa8+NAdqETWDqxtoPmCWQ=; b=hd3B91z8 KyipwB4vufpVq6tTt/Yepkij1t395PfS0NnENf/V/tidoHE/6pr4Y7sTmPiNkJlY wbveb9AFYnAEgx4y+1mhhwepujuABZ5qkN6m5SgTqH9gdn1e7+/ZKFM7kqPsmzGH n+93OX8ABUqDOrFxtauPoCxqw4jyfde9XX4goPM75Kj2/61QECFwt8uRHIktTeXx mYt+GHaqKDsAT5hlbpctYnABzzWp4CwRMHCz0kQrpAx7neuz6LU1NSY8VkgWGyvF UjiFh8z+/Lo7BnATqIndsoEpmTm8C4ls7qFJSYnvG0SlmEd0SLHidCK/lWRU8xSH q4NzBpcRdH/8QA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehgddvhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 2B8693280060; Sun, 27 Sep 2020 19:43:21 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Somalapuram Amaranath Date: Mon, 28 Sep 2020 01:42:29 +0200 Message-Id: <20200927234249.3198780-6-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 Subject: [dpdk-dev] [PATCH v2 05/25] 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 458d64bcef..2dd64180ad 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -11,7 +11,6 @@ #include "rte_time.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); @@ -409,14 +408,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) { @@ -1968,6 +1959,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; eth_dev->rx_descriptor_status = axgbe_dev_rx_descriptor_status; eth_dev->tx_descriptor_status = axgbe_dev_tx_descriptor_status; @@ -2133,7 +2125,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; @@ -2166,7 +2158,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 = {