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 32B9EA04C0; Tue, 29 Sep 2020 01:15:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6593D1D72B; Tue, 29 Sep 2020 01:14:49 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 2AA771D725 for ; Tue, 29 Sep 2020 01:14:47 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id A004F5C00E5; Mon, 28 Sep 2020 19:14:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 28 Sep 2020 19:14:45 -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=uYlOQFiNuH3IXA2EZ3xlb72yTgEBf J6adjC0ISDgmZfxJ42C3JhOvLkagEakZbqYATbWZUjM9Jes+R0doFw6ucm5iifKD tWHGbhvKYWl4rnyQISYKa5vEBbW26mrH4qqiHup4/lwzL7MnNKlegBkJcOS8KhIZ 5lowaL0VHgNh+bzM4m7BckgauYTEYw8dLqAg09X7lnait7EXMkbrO41Zbn5UPxiA i+eMrIcVvBq1SpPMG4V6grmkH8g/JAzknmN8eYkVQ6JXcG9FLCTrG6U75q56Xyr7 l2V+r16hHJNau2RHUnlgRQ4iWSlNfmz1wCHPgFhIw3Kbe8mNlaiMynbCg== 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=BtoV2atm CK8F5dp6QPUNq7NzceiZZD7L6GaSh9UouIW9nYAZ/ouzegPqrPVCFg9EYaLOSzOD zW96BTxhHrmC9ylpswDZSAGdUWa0w7ITEcGd/hVv3lbu9O3ge+KkQjlddxZMCkAQ ZYcN3KuiJPhkfNjh9G1ESNxk8MQvy2KLAp/b0zm193pHldkOlz6960EubOjYepXt 9zb9vt0wyxpaJsq9geJIMvTOTIg9Z3E4yV/QANQYTk5xeu7/iu/wy5567HJ+C5F7 xB+wKphbl1a3+HqYHA/hn04xI3R4T0sKQNgM8hAR0j+Z7l9i1aj5Y6mI5QHr//vw LNP6B91MIAv7hA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdejgddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho 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 0D5053064684; Mon, 28 Sep 2020 19:14:43 -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: Tue, 29 Sep 2020 01:14:09 +0200 Message-Id: <20200928231437.414489-2-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 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 01/29] 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