From patchwork Mon Sep 28 08:57:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sachin Saxena (OSS)" X-Patchwork-Id: 78981 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 96321A04C0; Mon, 28 Sep 2020 10:57:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E815D1D5E9; Mon, 28 Sep 2020 10:57:34 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20081.outbound.protection.outlook.com [40.107.2.81]) by dpdk.org (Postfix) with ESMTP id 8B6BF1D5D6 for ; Mon, 28 Sep 2020 10:57:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cdYR7G/wHNQP3/xwftSNScODUQbapxwkyL7yz0kHznCBujR/FSKpaq2GU1VLyqi/DM3iswM0BPAewE6tV7vzeNNW+KwhOLvLPTpIwqCfP1Z2Nuq4bNkcqXvsTQHo/G5EGSYwdsoJOxidbqVdgdPQ6voSZhHw4UUeQN5OCnJQPcnhpvcdppn5Aebaud7zb8qVyY0K2cr9uWchK7o2CxF65ZchCUnWSpO6WYsU2Mc8SY2xQOs9yDNz2omNQkyxLvyUvn/WrSOH1Vs8iQgj/6kEAIDqC+gUa0Sb/Qfj4cywsYm176M23csPmwn/7MCgKUxVhSgtOoVNE2o0n3nBNkXUXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WYcjP7Dxv5NWerAXu8oFV8fiYF1n+DsdGNQZ4Ju/p8o=; b=UI7E2M7ZuUKrzgjYdXPa+mAp+EGRUU9lGeeMU1bIOiQ7/V7jFQl1JQtKAKmf7mc0ZJA67ktS9ZLmwtdayd+nYJuxLdfrB1M5HAEr2R8UX/pCbYr0UeFGSd8+VqpcVnJPtw3FLmzAOHtWWZjC1YdGoeHKf0dCHEEMawZOmq+iHyy8zVXv2E6JTCbrQ/LcCLQwux6TCfwetEBWVTptrj90f0AIWPLFlyB9u+MWJ3CPmOeXZpGCRiyR/xUfO6jgwn2meuTpkZMYJk+MB6MxWeqmsB2gwMEKMfWlXr1y0pGDEb17VNTeJhs2Dt6cuiHFTM7UJvGaJD6EwslwW7RmXw2ITA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WYcjP7Dxv5NWerAXu8oFV8fiYF1n+DsdGNQZ4Ju/p8o=; b=J5OKbU+T2enII0OKPY2wEvsY9vyi2usGspFV0iFGWOSeRwjjX+6ZrnrIudkcEA3cm+uUDE+QS+0aWyoz4ZwkEbTIq2264VqdJH2jzS7Uo+vclOIhzBTQIxN/7pPTB5+JVHgI3nCE/9QElI8vUjIqjnTDRGGzwipe361p0htl3Tc= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5837.eurprd04.prod.outlook.com (2603:10a6:803:ec::28) by VE1PR04MB6542.eurprd04.prod.outlook.com (2603:10a6:803:123::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Mon, 28 Sep 2020 08:57:29 +0000 Received: from VI1PR04MB5837.eurprd04.prod.outlook.com ([fe80::cc01:9fe2:2544:8a4b]) by VI1PR04MB5837.eurprd04.prod.outlook.com ([fe80::cc01:9fe2:2544:8a4b%7]) with mapi id 15.20.3391.030; Mon, 28 Sep 2020 08:57:29 +0000 From: "Sachin Saxena (OSS)" To: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com Date: Mon, 28 Sep 2020 14:27:10 +0530 Message-Id: <20200928085713.13560-2-sachin.saxena@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200928085713.13560-1-sachin.saxena@oss.nxp.com> References: <20200928085713.13560-1-sachin.saxena@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0206.apcprd06.prod.outlook.com (2603:1096:4:68::14) To VI1PR04MB5837.eurprd04.prod.outlook.com (2603:10a6:803:ec::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03161.swis.in-blr01.nxp.com (14.142.151.118) by SG2PR06CA0206.apcprd06.prod.outlook.com (2603:1096:4:68::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3412.20 via Frontend Transport; Mon, 28 Sep 2020 08:57:27 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [14.142.151.118] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a7950d53-4b5d-4937-d2ff-08d8638c8756 X-MS-TrafficTypeDiagnostic: VE1PR04MB6542: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WM3truFE/xT7WQves8V7bKYB9/3SkwaB4rJ9/PUA4krrTa/4c2+UIVkNjhmWNoFbY3ZunK3aNhtUdmp8GN6JP93sYSTwTP3Ktdm54TuWsloNQI2y8CafF/uac+bg7iD0rKQzx/lW2mzsc4rE9hiRnENMErI9l04aUFYcnARBG2QVyTC+YAapWdY8YxhT/7D6gfbG7TEG3oY67NSNcDeMk9cI8zaDwXiqVE2y4+EV1hHUntqetw2FemHOstVKXo4wNyF3PLHUDcrLzxP9duBdOT8cibjI05DCtVBPdtpxbSvgg3shuzV4nOlqEYxF9NbgTWDvj1bi4aKsE9rr4chukIdBNy9UsOycxKaMY/iG6KlVX5hVK0wU7lxlZh/ME/2x+pKyQ31pVYJAJHRTbgr0NPfDWWLIhBX+5yp6qLGvy+U= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5837.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(396003)(39860400002)(346002)(366004)(136003)(6486002)(66946007)(186003)(478600001)(52116002)(5660300002)(16526019)(8676002)(316002)(6506007)(55236004)(83380400001)(8936002)(26005)(1076003)(2906002)(86362001)(1006002)(6666004)(66476007)(66556008)(6512007)(956004)(2616005)(110426005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rAR4Zo8+9r6INYCOYNwaSoT5s/dXs7XMFGFjeSFZ0lY6K8ELtaSxQmj8HIeUC7/A+Tcom++AskkXTLgftyCFMJoT38SEUYAvE+G2cZkbMVq+8iu1EVE67naV77pZfH5cHYNMwfH2cpOlFfwRFoDsQD/Dsj/t1ntXJ5ttHJJ+gDnG//unuMUtrQMOq8H9j006ANfHQhnuuM99BiBNSGI0Jd2gwBfps/LxogI+zDfhA0kMhgU98x4R+l3AKj+yPeox6rbjOKyeC5A2EwTVx6hYjX83sIMDcllHNMuGG/oqQsM1loUE52f4xE6+b9SWjSrQIQRzknf7UwhHf/2sPi/ljY+WL/RkNNMQjGlUr9q6sckThUCnuy+9LKh38JLjMRQSdYBTHOMFJZmSbanqQoXBTdVsUz2GTpJdYc9J6jfgG65CEj4yCvUyitnc/NxxxQk3wrro42a9sf15L7SLd7olWYlOuaLRzFEHjvH2AXlH4spfDZ9dksG3Qrn2z8YoYbNSiseSbqHsGeDnd9b2PBo9aIbR/KcnBy8wqSmlyvWz9IBymR7sTgcyNdkPwIuCknJfHx0Qu/oCkJBtGjeYD92Cr7wdavN6xp3qc3Zj8arIFKLDcMhuo+nqk6BDwwvcChB6KiLd6k382r5yeEfNzxuYKA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7950d53-4b5d-4937-d2ff-08d8638c8756 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5837.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2020 08:57:29.3958 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cwkMSZjM2Fs2MdNqWCws2qmhaSY/3GiW8U/oD7PyMZqsRUfqfsAnr9DYpxuOPvGk7gq9Xffy6veqlVoidHnMbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6542 Subject: [dpdk-dev] [PATCH v1 1/4] net/dpaa: 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: Sachin Saxena With removal of old close behavior, the private port resources must be released in the .dev_close callback. Freeing of port private resources is moved from the ".remove(device)" to the ".dev_close(port)" operation Signed-off-by: Sachin Saxena --- drivers/net/dpaa/dpaa_ethdev.c | 113 ++++++++++++++------------------- 1 file changed, 49 insertions(+), 64 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index c029dd4f3..7e6a954d7 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -376,12 +376,25 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) struct rte_device *rdev = dev->device; struct rte_dpaa_device *dpaa_dev; struct rte_intr_handle *intr_handle; + struct dpaa_if *dpaa_intf = dev->data->dev_private; + int loop; PMD_INIT_FUNC_TRACE(); if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; + if (!dpaa_intf) { + DPAA_PMD_WARN("Already closed or not started"); + return -1; + } + + /* DPAA FM deconfig */ + if (!(default_q || fmc_q)) { + if (dpaa_fm_deconfig(dpaa_intf, dev->process_private)) + DPAA_PMD_WARN("DPAA FM deconfig failed\n"); + } + dpaa_dev = container_of(rdev, struct rte_dpaa_device, device); intr_handle = &dpaa_dev->intr_handle; __fif = container_of(fif, struct __fman_if, __if); @@ -396,6 +409,38 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) (void *)dev); } + /* release configuration memory */ + if (dpaa_intf->fc_conf) + rte_free(dpaa_intf->fc_conf); + + /* Release RX congestion Groups */ + if (dpaa_intf->cgr_rx) { + for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) + qman_delete_cgr(&dpaa_intf->cgr_rx[loop]); + + qman_release_cgrid_range(dpaa_intf->cgr_rx[loop].cgrid, + dpaa_intf->nb_rx_queues); + } + + rte_free(dpaa_intf->cgr_rx); + dpaa_intf->cgr_rx = NULL; + /* Release TX congestion Groups */ + if (dpaa_intf->cgr_tx) { + for (loop = 0; loop < MAX_DPAA_CORES; loop++) + qman_delete_cgr(&dpaa_intf->cgr_tx[loop]); + + qman_release_cgrid_range(dpaa_intf->cgr_tx[loop].cgrid, + MAX_DPAA_CORES); + rte_free(dpaa_intf->cgr_tx); + dpaa_intf->cgr_tx = NULL; + } + + rte_free(dpaa_intf->rx_queues); + dpaa_intf->rx_queues = NULL; + + rte_free(dpaa_intf->tx_queues); + dpaa_intf->tx_queues = NULL; + return 0; } @@ -1980,66 +2025,6 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) return ret; } -static int -dpaa_dev_uninit(struct rte_eth_dev *dev) -{ - struct dpaa_if *dpaa_intf = dev->data->dev_private; - int loop; - - PMD_INIT_FUNC_TRACE(); - - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return -EPERM; - - if (!dpaa_intf) { - DPAA_PMD_WARN("Already closed or not started"); - return -1; - } - - /* DPAA FM deconfig */ - if (!(default_q || fmc_q)) { - if (dpaa_fm_deconfig(dpaa_intf, dev->process_private)) - DPAA_PMD_WARN("DPAA FM deconfig failed\n"); - } - - dpaa_eth_dev_close(dev); - - /* release configuration memory */ - if (dpaa_intf->fc_conf) - rte_free(dpaa_intf->fc_conf); - - /* Release RX congestion Groups */ - if (dpaa_intf->cgr_rx) { - for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) - qman_delete_cgr(&dpaa_intf->cgr_rx[loop]); - - qman_release_cgrid_range(dpaa_intf->cgr_rx[loop].cgrid, - dpaa_intf->nb_rx_queues); - } - - rte_free(dpaa_intf->cgr_rx); - dpaa_intf->cgr_rx = NULL; - - /* Release TX congestion Groups */ - if (dpaa_intf->cgr_tx) { - for (loop = 0; loop < MAX_DPAA_CORES; loop++) - qman_delete_cgr(&dpaa_intf->cgr_tx[loop]); - - qman_release_cgrid_range(dpaa_intf->cgr_tx[loop].cgrid, - MAX_DPAA_CORES); - rte_free(dpaa_intf->cgr_tx); - dpaa_intf->cgr_tx = NULL; - } - - rte_free(dpaa_intf->rx_queues); - dpaa_intf->rx_queues = NULL; - - rte_free(dpaa_intf->tx_queues); - dpaa_intf->tx_queues = NULL; - - return 0; -} - static int rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv, struct rte_dpaa_device *dpaa_dev) @@ -2156,15 +2141,15 @@ static int rte_dpaa_remove(struct rte_dpaa_device *dpaa_dev) { struct rte_eth_dev *eth_dev; + int ret; PMD_INIT_FUNC_TRACE(); eth_dev = dpaa_dev->eth_dev; - dpaa_dev_uninit(eth_dev); - - rte_eth_dev_release_port(eth_dev); + dpaa_eth_dev_close(eth_dev); + ret = rte_eth_dev_release_port(eth_dev); - return 0; + return ret; } static void __attribute__((destructor(102))) dpaa_finish(void)