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 27C02A04C0; Mon, 28 Sep 2020 01:43:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3CB221D5FC; Mon, 28 Sep 2020 01:43:10 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 24EFF1D5FB for ; Mon, 28 Sep 2020 01:43:09 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id CAA9B5C00EB; Sun, 27 Sep 2020 19:43:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 27 Sep 2020 19:43:07 -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=keJvsxTAQUcTl a6n1hp+EfVrFxLNS7Nb98KIMPLk6SM=; b=dRUf5EM0AfXjlcdDYyQIbd9gfQtZq H+tAEK2uxTldo7WQmc8omX7rizWcbDZwS1NC1hGx8BOc5KyDo//HqENsOjIAVyvg iXejQPlvZpkht2Ym1eK8Je/V99VbtFPOJ6DleluK1L+B79lNJOurQPxrvSoXvY0m pPke/VO8fJbGwuwvxONbwNPJjJzE0L0nuv1phQKXvOOkK881EBWk1ysLY+OrAYkC HL1mu7T4PQ7UzefRlII+jQflKmdUZo6DO7irk7HrwNnGHdY4/2vyN4yQsf4Fkx+h dWeg6U1lynleuU+rxmGsno3kbWDJ4ETPlnnCI8TA3QPjuRw8Rih4PVUBQ== 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=keJvsxTAQUcTla6n1hp+EfVrFxLNS7Nb98KIMPLk6SM=; b=YQoFFHZE LnQ34VEh9WRLczUpjXS2UGsDitOy+cQA09sCjGkDF5wEgEpUELs/toZbi84xS6+X 0RdJHwmRyRiLJEs1/lyt0lDtJAdlQ1BP5U4JAoKoFKsfrnMZa4x27lBpxOEni6h0 ettEoJtKoRcjRqq+hv+bI9NRXE6xEtthlmKWc9Eylqhd+Mym/0VVUIOMNG2IxB4b nkTL7S013IIjlZ86USUH9HlKTeoo+hIHQrb07t5pE380vThB0d82a9/x8gg1S1DZ 17UNwbobevb0prSjCrxszMitvCDbEurbUFpXQrOySCAD3U1XVA4VeAhpCySxJkF7 PegaenfF6dhHPA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehgddvhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepudenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho 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 249213280060; Sun, 27 Sep 2020 19:43:06 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Shepard Siegel , Ed Czeck , John Miller , Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K , Martin Spinler Date: Mon, 28 Sep 2020 01:42:25 +0200 Message-Id: <20200927234249.3198780-2-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 01/25] ethdev: reset device and interrupt pointers on release 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 pointers .device and .intr_handle were already reset by the helper rte_eth_dev_pci_generic_remove(). It is now made part of rte_eth_dev_release_port(). It makes rte_eth_dev_pci_release() meaningless, so it is replaced with a call to rte_eth_dev_release_port(). Signed-off-by: Thomas Monjalon Reviewed-by: Ferruh Yigit --- drivers/net/ark/ark_ethdev.c | 2 +- drivers/net/octeontx2/otx2_ethdev.c | 2 +- drivers/net/szedata2/rte_eth_szedata2.c | 6 +++--- lib/librte_ethdev/rte_ethdev.c | 2 ++ lib/librte_ethdev/rte_ethdev_pci.h | 14 ++------------ 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index d472ae5643..e13415e95b 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -105,7 +105,7 @@ eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, ret = eth_ark_dev_init(eth_dev); if (ret) - rte_eth_dev_pci_release(eth_dev); + rte_eth_dev_release_port(eth_dev); return ret; } diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index c06e32f26b..51a6f99877 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -2668,7 +2668,7 @@ nix_remove(struct rte_pci_device *pci_dev) if (rc) return rc; - rte_eth_dev_pci_release(eth_dev); + rte_eth_dev_release_port(eth_dev); } /* Nothing to be done for secondary processes */ diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 30c888cd96..a17c53577c 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1802,7 +1802,7 @@ szedata2_eth_dev_release_interval(struct rte_eth_dev **eth_devs, for (i = from; i < to; i++) { rte_szedata2_eth_dev_uninit(eth_devs[i]); - rte_eth_dev_pci_release(eth_devs[i]); + rte_eth_dev_release_port(eth_devs[i]); } } @@ -1853,7 +1853,7 @@ static int szedata2_eth_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (ret != 0) { PMD_INIT_LOG(ERR, "Failed to init eth_dev for port %u", i); - rte_eth_dev_pci_release(eth_devs[i]); + rte_eth_dev_release_port(eth_devs[i]); szedata2_eth_dev_release_interval(eth_devs, 0, i); rte_free(list_entry); return ret; @@ -1922,7 +1922,7 @@ static int szedata2_eth_pci_remove(struct rte_pci_device *pci_dev) retval = retval ? retval : ret; } - rte_eth_dev_pci_release(eth_dev); + rte_eth_dev_release_port(eth_dev); } return retval; diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index dfe5c1b488..d12d74dd8c 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -555,6 +555,8 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock); eth_dev->state = RTE_ETH_DEV_UNUSED; + eth_dev->device = NULL; + eth_dev->intr_handle = NULL; if (rte_eal_process_type() == RTE_PROC_PRIMARY) { rte_free(eth_dev->data->rx_queues); diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h index 9c483468ba..bf715896ae 100644 --- a/lib/librte_ethdev/rte_ethdev_pci.h +++ b/lib/librte_ethdev/rte_ethdev_pci.h @@ -107,16 +107,6 @@ rte_eth_dev_pci_allocate(struct rte_pci_device *dev, size_t private_data_size) return eth_dev; } -static inline void -rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev) -{ - eth_dev->device = NULL; - eth_dev->intr_handle = NULL; - - /* free ether device */ - rte_eth_dev_release_port(eth_dev); -} - typedef int (*eth_dev_pci_callback_t)(struct rte_eth_dev *eth_dev); /** @@ -138,7 +128,7 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev, RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL); ret = dev_init(eth_dev); if (ret) - rte_eth_dev_pci_release(eth_dev); + rte_eth_dev_release_port(eth_dev); else rte_eth_dev_probing_finish(eth_dev); @@ -167,7 +157,7 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev, return ret; } - rte_eth_dev_pci_release(eth_dev); + rte_eth_dev_release_port(eth_dev); return 0; } -- 2.28.0