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 60356A04C9; Mon, 14 Sep 2020 00:07:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E1C71C012; Mon, 14 Sep 2020 00:07:36 +0200 (CEST) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id 3F9A81C012 for ; Mon, 14 Sep 2020 00:07:34 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id CAB8B5D6; Sun, 13 Sep 2020 18:07:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 13 Sep 2020 18:07:33 -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=K4Xnm/jBXKF0/ w5Uj//drDEKxU3kbryJqjUUaoWApN8=; b=FczgwP5Vp0JxRe38Qqvu41RHFqG2w Eq9MkhpNfp/tgu9Nsv96+gc9dOM22g5CUcVyPoAolaYAsCrWWVWB1cE2tfwYEGi3 AR/9DAh4YvKCROsoAe19RfqNOdvTw01n8SvqXQV0rTQNBXqp8jql5DKhNvu1fyhF aMshqOKPNUP1WUgjwHM5OwywzKFyopO8Yzwl9EXa55Oe9ThrzSR0dYynWpUyq8oj XuuxhEWgS/fXR5qT6Wi/ViaOot9SoRQusF1bDSlezCDCgCbH1uARuipuTy5eYSEk CAWe8TQ71PklnhbAUjcn0EGIFmfffDivxrO56lBCpmEFcMoBgxpRVjXuQ== 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=K4Xnm/jBXKF0/w5Uj//drDEKxU3kbryJqjUUaoWApN8=; b=SKsqDF4p UL0IvupXdsTVzCW6WFMLn6QN7mCEPH17dMsUuwk55qyzl+wBA3qQ7OPN5leZn95Z ygL4Yg8zw9TObq+Ulcj88YgreBpOGZ0/OPR9JqyLW861Omk0y1nFbQq4Gm2v/Fza KYxDcOdKVzBCodIwdFitVhH5DO7tnSXmPFg+IBdZQsAqXXsebRBMI3fpcVnDQPYu xHMkyXddFmaHRokpukv9afiESO9vQ3nYANz77eBlLwIHB5yQMKE67hsODa/V3JME STyQKoMprc+vh32lbVngPv4kWk4Gi5mEm3nM+3K4AcB7EvmtXgeolWBJFrdXj+DQ Apv+HUioOXQOUA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeihedgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 BB2673064688; Sun, 13 Sep 2020 18:07:30 -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, 14 Sep 2020 00:06:52 +0200 Message-Id: <20200913220711.3768597-2-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 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 01/20] 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 --- 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 b32ccd8677..0321ec1264 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 33b72bd4db..7425ee55be 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 7858ad5f11..3617f39ca0 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 a999602fdd..114da807ff 100644 --- a/lib/librte_ethdev/rte_ethdev_pci.h +++ b/lib/librte_ethdev/rte_ethdev_pci.h @@ -134,16 +134,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); /** @@ -165,7 +155,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); @@ -194,7 +184,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