From patchwork Mon Sep 28 23:14:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 79071 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 A04FCA04C0; Tue, 29 Sep 2020 01:16:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0BD8C1D8E0; Tue, 29 Sep 2020 01:15:08 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 3C63B1D725 for ; Tue, 29 Sep 2020 01:15:02 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D6ABC5C012C; Mon, 28 Sep 2020 19:15:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 28 Sep 2020 19:15:00 -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=uBjmzU/moA8oSMgFybmTzwp62Q+0i 0hYsS22QNC2lGJH5n+9WqAQyOQeyeE3v/jxNyfw1IgwRqelFwiOii5OkZ3io30nQ VT271XXzl55+TFJ9H6b8PFHGTZDB5WSzwgkv7vVV3CfGdLW7dTbS7MzKtypvwnLh pkynteGzIkLGzRPg4b3tRal1a9d178Oais+s8FxQnuDjPrIF2rntGi+u2EHxY8rJ RpgPjQAkb/y6ZD5IJ04Xe85yTqFTB0da+P3IY3e2npKufgJDy1cdDAvi4uab7jGm cR2AmlIV0pZ1fXfLHo8UoOtG8nvY5mAnICzD2QE9C6Ky9Dk0zPlA6cI9w== 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=NVZGEV/C Q0Bzr/vNKCldBuK8GGCQn9xoSmNPNMr68oar/gfluD/kVgm9L4JE04NzW0qtFn8z OEobF40T3OTlhxRxkETrCga8UzU7Pmi0dVCOqYT29nA+fbJMNHgcpdW66mRuswc4 riTsFX9BDDFEVvWNw2GGz976+t3XYHAiOypZoNg3UbdCCaA+na0NBT2T1/ZLHSLY BNR5GkCycd3DUob+S11tdZzkj0N8FL7d7g3U1+UfcfNjX8KTtOUIEE0HrVC5sOEJ B95xbtk8As351wBqZa9wdQefzX58QF4gbKlhRwTxfM39RrloEHbVMeY3L/u8Nh1j 1xQ0WfCmeO3WLg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdejgddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepheenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho 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 053323064610; Mon, 28 Sep 2020 19:14:59 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Somalapuram Amaranath Date: Tue, 29 Sep 2020 01:14:13 +0200 Message-Id: <20200928231437.414489-6-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200928231437.414489-1-thomas@monjalon.net> References: <20200913220711.3768597-1-thomas@monjalon.net> <20200928231437.414489-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 05/29] 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 = {