From patchwork Mon Sep 28 23:14:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 79083 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 DD363A04C0; Tue, 29 Sep 2020 01:20:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C6E631D9EF; Tue, 29 Sep 2020 01:15:53 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id E2FA81D96A for ; Tue, 29 Sep 2020 01:15:27 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 8B1315C01AE; Mon, 28 Sep 2020 19:15:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 28 Sep 2020 19:15:26 -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=KWaOnchw8yj9p 8QNci36LxrEBBMSAjGzKCJrg2Op3lo=; b=ndwDs9MN6PjvHd1I6O59QUqZnpwk8 vz4N0hE45F6tnGKg1+OOqaR5Y4CJl55OIw1oFYWpdAAIQAjZqrlw4f1PSBXnJFM5 oiw8Q9Jc38X/Yb/7s2CqRBdv018JkyELQsUIn4yz49OJ7jFVButHz0vGDzlhA54W X7XZUpYyM37XHyg1kS7aYa90/YiLKKw3QnMBibH0dfoNNMPnydLukq4MGDzvUPjj DODJrL0Zix3IuZiXtRzmAnabu4D/OWQWLDlqzvOjQb7wIVSKFgK3VSY0uqI18fcN R+AEI06vvLnTXgcYJ5ag5UmPV0HTMXGjlItFRRzu/OiW13h5neZJH1o8w== 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=KWaOnchw8yj9p8QNci36LxrEBBMSAjGzKCJrg2Op3lo=; b=In87I4rf lePS4VxF2ELC+Dlz/8T+oxSbZkdsn3GZU5b2LPSa9TeedeNPPMs+Gd9/UnDPZiLS jL/fzWH0LtT+z+0moO36uNEVkRAclMESsUlH71lLS9Cwm5Dvybvkk0z0q0tamOxN /NK2jd28wvkT22x2fqcfGlEdcG82M2aP6W1GFJ8O8kV9jvYk/VVAuebTwY3h30gq 1oS4NNgYY32hx1q/+5/zMut3d6q71Szc+YwkFfQyTQGBlmx4gwxot0ks3+scLiIm s1x02N//6I1CTYUEIUmUi/6Dg6Y4lhmZxTzDcyeW8ZuDMfJv3uOh4ILhaha9pjrU 2azAnUbMZjZplg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdejgddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepudeinecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 616DB3064680; Mon, 28 Sep 2020 19:15:25 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, arybchenko@solarflare.com, Rasesh Mody , Shahed Shaikh , Anatoly Burakov Date: Tue, 29 Sep 2020 01:14:25 +0200 Message-Id: <20200928231437.414489-18-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 Subject: [dpdk-dev] [PATCH v3 17/29] net/qede: 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" From: Rasesh Mody Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources for the port can be freed by rte_eth_dev_close(). With this change the private port resources are released in the .dev_close callback. Signed-off-by: Rasesh Mody --- drivers/net/qede/qede_ethdev.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 9535df183f..43fe68c2bf 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1550,6 +1550,10 @@ static int qede_dev_close(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(edev); + /* only close in case of the primary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + /* dev_stop() shall cleanup fp resources in hw but without releasing * dma memories and sw structures so that dev_start() can be called * by the app without reconfiguration. However, in dev_close() we @@ -1587,6 +1591,10 @@ static int qede_dev_close(struct rte_eth_dev *eth_dev) if (ECORE_IS_CMT(edev)) rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev); + eth_dev->dev_ops = NULL; + eth_dev->rx_pkt_burst = NULL; + eth_dev->tx_pkt_burst = NULL; + return 0; } @@ -2703,6 +2711,11 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) adapter->ipgre.enable = false; } + /* Pass the information to the rte_eth_dev_close() that it should also + * release the private port resources. + */ + eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE; + DP_INFO(edev, "MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n", adapter->primary_mac.addr_bytes[0], adapter->primary_mac.addr_bytes[1], @@ -2737,20 +2750,8 @@ static int qede_dev_common_uninit(struct rte_eth_dev *eth_dev) { struct qede_dev *qdev = eth_dev->data->dev_private; struct ecore_dev *edev = &qdev->edev; - PMD_INIT_FUNC_TRACE(edev); - - /* only uninitialize in the primary process */ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; - - /* safe to close dev here */ qede_dev_close(eth_dev); - - eth_dev->dev_ops = NULL; - eth_dev->rx_pkt_burst = NULL; - eth_dev->tx_pkt_burst = NULL; - return 0; }