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 06207A04C0; Tue, 29 Sep 2020 01:19:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 972E01D901; Tue, 29 Sep 2020 01:15:44 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id AA06D1D923 for ; Tue, 29 Sep 2020 01:15:21 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 521D85C01AC; Mon, 28 Sep 2020 19:15:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 28 Sep 2020 19:15:21 -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=f01XrLr/Rk66z6+bGvtrEm/Hd5cZ7 viMSW23bXy/WtHgk+9/42wJmCGyFTxPt/yAMePpS0ztGHwnPrriQWr2GnGEdPktY 5ouEjQ7/WfQePA5w77Xf8csI4KnBxsAaD00beiO5fgFmdQY+2zej5tyZDYOIB+jT Rv5RGfAhpBfczfY8j37sUqyEq4ff93KllOwr1icaQ13oanKL82hp6foRE9bNbUCZ 6xKx2pDBLd79bfPk0iVSkRuncSrP/gkD/2w2kZypXnKzseJJKoBUGyTcrYTL5bCf zZ9gSuMTH1cUAo4Bm6rZyBgd88bPCbIgXirXsriYVcb3BZw5RWtAQiTSw== 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=YuOtW/w/ nq3njrLfZ2Xhug+bf2okY7VvPyZSUmGb74aC80q6RSO+CfqTBjk0Odi1620Kc4SB ElnlvPgxQR+lshEoxrc34fiJkROM1H45w0WndepFcbD9YVrcMZzccKTAOJZLQgvg WcQxhj6nxOQ9be51stMZ6RWo6RmMgiqav0v+TrZkAS6BDkogzaJJIU0+GqkEXdSV Qt9ppZyp3YRfzIasxN8V2E8/cS6SR4tnn+ge3o5oB3Wh+Jg2Xogyl9M8NTElQVAZ C2ywM+NXVC45IjQjXamJFkrQvlRRShohomuHdVBAXmmdpvSEgq/m8jqNiOgd5d/+ RvFnfCJxRjxADg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdejgddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepudefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 B8D683064682; Mon, 28 Sep 2020 19:15:19 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Harman Kalra Date: Tue, 29 Sep 2020 01:14:22 +0200 Message-Id: <20200928231437.414489-15-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 14/29] 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) -- 2.28.0