From patchwork Sun Sep 27 23:42:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 78936 X-Patchwork-Delegate: thomas@monjalon.net 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 5826EA04C0; Mon, 28 Sep 2020 01:46:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 30DAF1D64F; Mon, 28 Sep 2020 01:43:45 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id A3DB21D62C for ; Mon, 28 Sep 2020 01:43:33 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 5560F5C010B; Sun, 27 Sep 2020 19:43:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 27 Sep 2020 19:43:32 -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=MNEbyL2eSw8B9 KkuJYv8Xgaj6CSdW23VqpkUqTLmxnw=; b=B2YRj5CsmwtIbdsuHRPns8xOsomWk saPiNLpj1lWw+rs+tkpL5mTBfytK+KRFwhufuSlbf2xsHy4EFIHlRUh7jzSWV8xi qHvveHfmOdf0Xdy4ODejuZxmz66BpJV79docLdj7rN2hxjd+MIIxVWjGkm7bf7ZG B9fsLhFxAdsKQD3DCiaIItg1U6flMIiDLaMrnxk5XSoEg7tB1LYbqTRNa/PKaQ9c MrUPL5+OJDRmz09cGAfuCVtt8lc9nqREA6B+59vmFrP0bbIjQKBRlAXP/TL4ikIG SiBnWxtn14ksRIWstK4VBRCzWIxrLnJF5K+48uwtox7pGZZWPvEOqJnCg== 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=MNEbyL2eSw8B9KkuJYv8Xgaj6CSdW23VqpkUqTLmxnw=; b=k/3UYcz6 4vZRQjsgORGhxWmhi+RzAhNz2hPqXGcXOw0yi2A6+UZxHhyrRh56de7dwezcEE+W jsho95ECARg1lZPr6nr5+D8J11H2os13p4cMzMbnWfV5IA0T/4NauA+MSO7ho6S6 AEQK1x7r4YqhqS6dUHPPDcSdXzs4ytI3PLKh3VAGGbx+4jLJXnR+dem+1TzIgGVb p2ftg79prwlDUsksoFbGEyZucd3XiXpuIBIDmphYJLsphlQKDLe4H7mNpLkxrfJ/ +x3fAk0msaRoqU5bAGebx6F6nYYoghcYue/kwhEUBHO274kbWRRA4EMvEwkat6OC qb6pVX9iBbWDTw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehgddvhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepuddtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 9D9D4328005D; Sun, 27 Sep 2020 19:43:31 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Harman Kalra Date: Mon, 28 Sep 2020 01:42:35 +0200 Message-Id: <20200927234249.3198780-12-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 Subject: [dpdk-dev] [PATCH v2 11/25] 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 10eeeac642..48ce3e1621 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; @@ -1378,6 +1374,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); @@ -1465,10 +1462,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); @@ -1478,9 +1474,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)