From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0056.outbound.protection.outlook.com [104.47.1.56]) by dpdk.org (Postfix) with ESMTP id 431531B4B9 for ; Wed, 26 Sep 2018 20:06:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8ibiXoAMqqQz7yo3IyWS6/nJKTd9FA+tFZ7lOGfvGQk=; b=DwGaFLfNGnjekhQy3VlxEn0/6cut8um9feu3qMvkNrRqFWfRTlvhz1izYCqtvj+tMUmiSmbI4lW+a2fEoL5C9gB3pyZu4uh1uYXvO0JI72lAwB0HkzInheH4DTIdgAdBW1fQOp05UCXqEul042QAXZh2Ju3rWwHPQj4TsE2u8pY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from Tophie.ap.freescale.net (14.142.187.166) by AM6PR04MB4679.eurprd04.prod.outlook.com (2603:10a6:20b:1c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Wed, 26 Sep 2018 18:06:14 +0000 From: Shreyansh Jain To: dev@dpdk.org, ferruh.yigit@intel.com Cc: thomas@monjalon.net, Hemant Agrawal Date: Wed, 26 Sep 2018 23:34:38 +0530 Message-Id: <20180926180440.31726-14-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926180440.31726-1-shreyansh.jain@nxp.com> References: <20180917103631.32304-1-shreyansh.jain@nxp.com> <20180926180440.31726-1-shreyansh.jain@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MA1PR0101CA0014.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::24) To AM6PR04MB4679.eurprd04.prod.outlook.com (2603:10a6:20b:1c::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eabbf104-a946-44f2-911a-08d623dac09a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR04MB4679; X-Microsoft-Exchange-Diagnostics: 1; AM6PR04MB4679; 3:5EDC73IgnkDXLEQCBaHU8uPmiIt7HSQVTSHSM3fravUtOMqSb/m9+LmEUMEhgwkDCP5lIk2MgP4ARDbBvqcFkJkPsvl/QimomViDCtTnHUr123GPoT/Hi8LhuBUa20yK7a857e2V/v+vwgMMTeyMtFgA77IcXvEt7AZGVGk77QtH8kt+Yx+SMwQ0Crc0zXa03Up6tTE9LTHaXepVn1txUrKgdbJ2YloW2RAEc3w5FhmF5WDakVwDBMsyD73RplmE; 25:KtPAPv+ET3Ym8RacJyXKGifT1QSB4H6jvCOEPlIrtcaOwXc96WKxe8tlLbiIwfE1lcOz0Xp3bMTQgkLfd0Bn7ZUncAgb7se/WWy0cnHZZ4jr3SbgxmU6W5CjIH33r2lR1xVBIiHLBLu9eCc36SKw0qo7/87in3jFI8Z1H9FvGMKDOA9Sli4bsuJvvusTv2ZDBp9bta7MuobcAHchG7InHCyBupETPtzo1WrmuyNrBJvJBvBVG7arqvA9QdLYKV62ncuFbGAP0sC5+7AS3BIGZ5LmGHbjBcvFFFZdb92QpWm1uvc7ylXY2eHrAOiE/+mYilZb30Uo415MlAVy/ITHNw==; 31:uZpjmgu4hCb3hUCU4FAgiH8vdp2nN8NXi9jiEGrpQ4+taPvdiRu4u5RIVGU65O9RdagWx2c/Ad9/gK7j2KGxDw+gAcWe+Raez8dI5r3fKk4C+fb76jZLLJ5y26ay+IGp1XbVBxZ3matBvbN6/c3erncy+UvSY2GIcHT0tcx1BRHmNxG3A0LFuxUpdZ4Cbu1I0tE45jchqQMjWN6/CcIgRbS+F7jf1S6oGdnjzlU12Ok= X-MS-TrafficTypeDiagnostic: AM6PR04MB4679: X-Microsoft-Exchange-Diagnostics: 1; AM6PR04MB4679; 20:flZrRw5lGsRh5Ats/zMCpr8WAdkDB9dW1cbCM2qaQKC4EENWxjKf7sdCOsZzplU95kJza6mtHYj/WSZCYyRIFm9fZXrIpxr82VUUe2hRCAIvVI4xYlsFOuUPNAyqJCDUu8y8N1+T3vJtWLGKft31JEKm2N0j0VPmoLMErRZl1oOASL7WXbAXWDgnBLA+uemD/3M+Kt3RUUHz/IujpiQ4/bM5Of9M9H5xeYhAb9Ohmqs2DW9M0FEr4JpSG+G2TThwyt5dZaVrEDZTlm1mc8WGCvuYur/8NaOwK+o0GzzCYhxiYsPSE4l1mXdob6BiZPg7/fQB9bC4LvpClEvtvK042VvrP7yvCL71Myta2WC+dBttwAZEKDhbwSJs6W6no79w5TbE28EaojWbkYqDZctjf7p1rvlWLQ376Q3ZjMn2ovrm6RN4y2XALmXMXsM9myXF8QR23xryx7+Mnj7RWUyRcjhsDmul9aVfbX/VguEXXyL94IUvaxf7FZL6iu8J4dyk; 4:ehFDqBHEaq1TGbpO+QxRqc3NVDfZKfP8Iem7iq97YlXU7wK2rguXOq1QCpouFuf9/11EjzqpMen9BuJgOGX4G36SG3pGDXwp6x0Wkg3zxce7vVS6886Z08TMRINmyNyPOWdsGI/qf3r11w/suAzY/i/VLcrb21pMeyZCzEYs+i8/78mLwC6WqkE/oG0hBK8ZZ9XgfCPDcR33G1x8wqBwL63fddALhiJQEoomAoVdQF+FSyCXj0F+8q47PNOoUQ8vR/cWc8ytgEe5OaUfQFFrbfdMBrQHys7VZ+SRk6D/H3aOwd1NhpwqGETtSFIUbdq4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051); SRVR:AM6PR04MB4679; BCL:0; PCL:0; RULEID:; SRVR:AM6PR04MB4679; X-Forefront-PRVS: 08076ABC99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(136003)(396003)(346002)(366004)(39860400002)(189003)(199004)(11346002)(50226002)(446003)(47776003)(44832011)(956004)(476003)(106356001)(486006)(2616005)(6512007)(66066001)(305945005)(7736002)(6486002)(105586002)(36756003)(86362001)(478600001)(8936002)(16526019)(81166006)(50466002)(186003)(26005)(25786009)(8676002)(55236004)(48376002)(81156014)(4326008)(3846002)(6116002)(1076002)(6666003)(52116002)(34290500001)(5009440100003)(2906002)(16586007)(51416003)(316002)(97736004)(6506007)(76176011)(5660300001)(386003)(68736007)(14444005)(53936002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR04MB4679; H:Tophie.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR04MB4679; 23:Z6mPovXfcLWQZvu4P93uUPcmTC0QKx0IMJpuwsCjS?= =?us-ascii?Q?gyXadLwqTpD1INAnYxnnwuDbIU444viezGXQFziMDCDlwnEPFKys0VIKLG1r?= =?us-ascii?Q?3XnRX4giy0DSUkY9DsYZojnDmjsxPc8V5gQnYq6aDWhzqWy9umLuMbyFuWp0?= =?us-ascii?Q?L/oMndCe0EuQS/hvSX5eK6L20bXkXqssGBZ/Jhs3Jsdu19sjEw3uztskj5ZY?= =?us-ascii?Q?L+S93wj6MWmgPUlAWwdBUhyNRxWqsko4zqU7D/NAxEZ6pKWIE/6+dTPoWv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ZEaIT1lIiwEA2yEGbc5B3298CGZQK5BpfdPGA==; 5:8v9Q/eVml/Mu9sNpWmmGjXYs5TUnIxoM/lJZPPnOMOm62cPFMROiuUXkFn6Tmx3Gk8q9+ROCKpV/2W8kzgQd1L0zi6jDmrElfB/8Sxf8SSoV7p/IGQhmlWM8cbxfnNWeMmrmEQ8QobICLd2JG57ttwcvUI8TT/HRVWgttHb/Ym8=; 7:A1ghXfD2vCdoNcQYcwLHVZRibUVB+m/K/F2ok5bYgZ4o/usmLI0NLkKsYhmyeffm+scZbU3clSwiFK9nHk5j+vP/dBTMG6uI68qEt+lvJLaTBWXVpdzK41xGMhZoDsRdOj9OwO6TNbl6TiUdzo67gvV0GRMSHLg82mGF+bLcU0onJwfpY4IqCjOYaqRMQpijkfYet2FxhuPlymwudslCRPgAFupN7W29zFdS3HZWB8c+2VZW4fQCV0lloUXyjVgM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2018 18:06:14.4295 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eabbf104-a946-44f2-911a-08d623dac09a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4679 Subject: [dpdk-dev] [PATCH v2 13/15] net/dpaa2: enhance the queue memory cleanup routines 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: , X-List-Received-Date: Wed, 26 Sep 2018 18:06:17 -0000 From: Hemant Agrawal Earlier the tx queue data was getting cleaned up in close while rest of the functionality was in un-init. Now a new func is created to free queue memory. Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.c | 56 ++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 642a965b8..68c861b93 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -291,6 +291,35 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) return -1; } +static void +dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev) +{ + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct dpaa2_queue *dpaa2_q; + int i; + + PMD_INIT_FUNC_TRACE(); + + /* Queue allocation base */ + if (priv->rx_vq[0]) { + /* cleaning up queue storage */ + for (i = 0; i < priv->nb_rx_queues; i++) { + dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i]; + if (dpaa2_q->q_storage) + rte_free(dpaa2_q->q_storage); + } + /* cleanup tx queue cscn */ + for (i = 0; i < priv->nb_tx_queues; i++) { + dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i]; + if (!dpaa2_q->cscn) + rte_free(dpaa2_q->cscn); + } + /*free memory for all queues (RX+TX) */ + rte_free(priv->rx_vq[0]); + priv->rx_vq[0] = NULL; + } +} + static int dpaa2_eth_dev_configure(struct rte_eth_dev *dev) { @@ -868,23 +897,13 @@ dpaa2_dev_stop(struct rte_eth_dev *dev) static void dpaa2_dev_close(struct rte_eth_dev *dev) { - struct rte_eth_dev_data *data = dev->data; struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; - int i, ret; + int ret; struct rte_eth_link link; - struct dpaa2_queue *dpaa2_q; PMD_INIT_FUNC_TRACE(); - for (i = 0; i < data->nb_tx_queues; i++) { - dpaa2_q = (struct dpaa2_queue *)data->tx_queues[i]; - if (!dpaa2_q->cscn) { - rte_free(dpaa2_q->cscn); - dpaa2_q->cscn = NULL; - } - } - /* Clean the device first */ ret = dpni_reset(dpni, CMD_PRI_LOW, priv->token); if (ret) { @@ -2027,8 +2046,7 @@ dpaa2_dev_uninit(struct rte_eth_dev *eth_dev) { struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; - int i, ret; - struct dpaa2_queue *dpaa2_q; + int ret; PMD_INIT_FUNC_TRACE(); @@ -2042,17 +2060,7 @@ dpaa2_dev_uninit(struct rte_eth_dev *eth_dev) dpaa2_dev_close(eth_dev); - if (priv->rx_vq[0]) { - /* cleaning up queue storage */ - for (i = 0; i < priv->nb_rx_queues; i++) { - dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i]; - if (dpaa2_q->q_storage) - rte_free(dpaa2_q->q_storage); - } - /*free the all queue memory */ - rte_free(priv->rx_vq[0]); - priv->rx_vq[0] = NULL; - } + dpaa2_free_rx_tx_queues(eth_dev); /* free memory for storing MAC addresses */ if (eth_dev->data->mac_addrs) { -- 2.17.1