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 2DC14A04C9; Mon, 14 Sep 2020 00:08:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 129BE1C125; Mon, 14 Sep 2020 00:08:11 +0200 (CEST) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id 9A7391DB9 for ; Mon, 14 Sep 2020 00:08:09 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 98E925DD; Sun, 13 Sep 2020 18:08:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 13 Sep 2020 18:08:08 -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=Toz+q5WaYVMN8 MT0flLxr4V+w+QW+RBadHcX1qF5dVM=; b=fvQ8cCJbC1lNlDkuJOvjlxhoEjrGJ BoRVZNnEPc3JGDvxYG7qRsvQfL//XtPrl7QLkdb3cQK7ooYSrbNN+Iw693jsH0la 2IcHoul327YRcQv0hIEh5x7O9Px7Lg/rQUDQ1d2kDouhCU7KYXWF5234YXa16Ovf Mbgeq+9HATjkIBxdLGfSbS48RE0XBXYc890B6xDEiA3nTAsd0Rg0yK6hoGAEG4If dzUQeD53Us6kOcyUSpgA26TtT55v/nA4eJrPBypSEIx8AGeI3hXeilBh/QkJ5jrL ubg5iFYGgMa5k+2N/sVhCX5A383BI6U6Xc4447dYdDTAGhHQ1fL/Amr7A== 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=Toz+q5WaYVMN8MT0flLxr4V+w+QW+RBadHcX1qF5dVM=; b=ZEjyeVqU 1XPu7y5imLV2pKuNCTyCgorv6M1J+44N43y37i1IBBXRXiVM/ZXILDFNF3yoYWus 2qsa1DW9nguLojSgCG+To3k4QHarTD1aiuz2XkKCcLk9UlfuDha5eGQvMYa+jpI2 iYEzY+dH9aB/PPPbA89zhiJH5ZFBH8rTK6cRTrO/jsgtrqYMcCJNMhVXbTxqYz/h mCZxvdbd1KSh1gGb2TpShBLfD7tTBL3xbW6NMBpubm3hnX6IqfWe60153NoUxs5Z Qkg2PFLjfvjglgkdT+wPkH8hiK+/OG6AGbFVlE/oMMN4fQxRx7aehIc2+OSRDl3H 5gKqL8SaShe8Aw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeihedgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedutdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth 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 7BE533064674; Sun, 13 Sep 2020 18:08:07 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Harman Kalra Date: Mon, 14 Sep 2020 00:07:02 +0200 Message-Id: <20200913220711.3768597-12-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 11/20] net/octeontx: 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(). The callback ".dev_close(port)" is called also from the ".remove(device)" operation. Signed-off-by: Thomas Monjalon --- drivers/net/octeontx/octeontx_ethdev.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 946844ca0b..6713c51504 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -509,10 +509,6 @@ octeontx_dev_close(struct rte_eth_dev *dev) rte_free(txq); } - /* Free MAC address table */ - rte_free(dev->data->mac_addrs); - dev->data->mac_addrs = NULL; - octeontx_port_close(nic); dev->tx_pkt_burst = NULL; @@ -1379,6 +1375,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, data->promiscuous = 0; data->all_multicast = 0; data->scattered_rx = 0; + data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; /* Get maximum number of supported MAC entries */ max_entries = octeontx_bgx_port_mac_entries_get(nic->port_id); @@ -1466,10 +1463,9 @@ octeontx_remove(struct rte_vdev_device *dev) for (i = 0; i < OCTEONTX_VDEV_DEFAULT_MAX_NR_PORT; i++) { sprintf(octtx_name, "eth_octeontx_%d", i); - /* reserve an ethdev entry */ eth_dev = rte_eth_dev_allocated(octtx_name); if (eth_dev == NULL) - return -ENODEV; + continue; /* port already released */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { rte_eth_dev_release_port(eth_dev); @@ -1479,9 +1475,8 @@ octeontx_remove(struct rte_vdev_device *dev) nic = octeontx_pmd_priv(eth_dev); rte_event_dev_stop(nic->evdev); PMD_INIT_LOG(INFO, "Closing octeontx device %s", octtx_name); - + octeontx_dev_close(eth_dev); rte_eth_dev_release_port(eth_dev); - rte_event_dev_close(nic->evdev); } if (rte_eal_process_type() != RTE_PROC_PRIMARY) -- 2.28.0