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) From patchwork Mon Sep 28 08:57:11 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: 78983 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 57A7BA04C0; Mon, 28 Sep 2020 10:58:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6070C1D685; Mon, 28 Sep 2020 10:57:40 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20043.outbound.protection.outlook.com [40.107.2.43]) by dpdk.org (Postfix) with ESMTP id E76591D5E2 for ; Mon, 28 Sep 2020 10:57:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N8sSxnm6CgFATOWWyZbwnXZWQxPQ30lbbkqMC55tMA0rTGhAH+AyZ9sWfmUEmtas9uRHnHlwS2/8g4mkXHMLRIBZn7ouu+Y6I8gkrChXyGQjqH89l0eDiikyvha9twujNXhAM71uOW8DPg3Ukg6/8p6pP6JKJ+MlKq2FbiGbjK6IB5KnO5EGfJ4dIt8uEO7mGGdSID713dIiRQcb59RHHE5XW4B2+fkuPXxtmOer3KwB+2gL78bgXUCKagmGtY/SYy3mcbQUN+o/13PkbMFCCQCocbfTvj2xwpAZOlm1Z+3Ct9KpqacpfQeV+VZ7ZviraczpFRtWzxaWy9KuC9gBlQ== 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=EPV6bqjVW+r0v1oXy4ZICfppW6oM2WGe5cebFS7xquc=; b=Fd/t0IDDDF/Wh5D3FgBubFdAKfj+xHcC6sygBTlHmrrIbQ7XY5lZv+Nywb1SmAzUMKw70R3JSBCY+A2EuKOcs2DFHW6aB0P4cq/WjNeD1iuJ8yWK5hLhR0CDueyZeGkAEg31AS8rIktiezY0TAkjzuRKVfQ4DW0CcQFDd+zFuKCa0XNrNlxu82yPkG/cPqWsRcAw6lAarE91Nl7nQmW/0bKHvoBmlByl51q1IoGghdKmAo54PJwgOxhSDb0bzLX5R1UT49gR8j++Fc32ANOEtNKdGkE17yh0P/BfB3+/blt3Jm9Icmrj8x3bw/fO3/z/Mnv+chpRUHZcAjsJAI0Fjw== 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=EPV6bqjVW+r0v1oXy4ZICfppW6oM2WGe5cebFS7xquc=; b=KUsWs5oy7GGWX3KCpJT4AcTV+CxHmHyycEsmF+QtJwW9kinxWvPK8xLlQmivKPttHrImcGhmmuA3tcAszNZSjOJqfDEpXmuxf0kjhxPZZDcCTNGatQhbZBjGHhNpOK1wOTWGVG8wnfpdgqIcS3zTH6CcYWc68Mh4rC8Qf/um2Jk= 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:31 +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:31 +0000 From: "Sachin Saxena (OSS)" To: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com Date: Mon, 28 Sep 2020 14:27:11 +0530 Message-Id: <20200928085713.13560-3-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:29 +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: 8f9d5ba8-2e4d-4537-8c6e-08d8638c8873 X-MS-TrafficTypeDiagnostic: VE1PR04MB6542: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wrq39AW6yjrMkVG6gkihmV9XIzR4vmmkNYdLe+mJ+JFF5HgwUOxqSvS97dVm7qWvi402qz01PGZnbfL7LCY5yzQrHZTUnKW7k8wcRd6g9I1ET4KevLID2yaR/0AJ+WRStj8HOFGkV03zERSPi9FROtdicDj66+Bc3KeyP9/RVKKV/Ki1eUH5RkeNIXVdibV4Af3gTqSbTop1bLDY52UXDBaDgQf81xz16FIHI9OQHG959FZ19GC/NjX3WKmne8LOH44V/Pjll5mSi299Ik9VjtVoLZ4EKthFPFPT92BQqwPKS+Ax314tSOf3GHUbhFd2eaGFyNEIvcG2y+tRjoNVrl7LaGQ/ZDitOaMAu0H44AJyEiKvMpU2IEa6yDe8tjg4FETnz3Nczm5Z/qJYKuVcv64bQNHOc9pBKBeTUu2o3NY= 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: tRRrM5A+l9XVkxIWzq8rWOxMHsUa90bJbqhSYgWdfKMqBclhgU/94JOImHF3xc1do4lGAuA6wuuwOlEFs8THgx2hfzKJ5WQMkAVdDKjowlU/CCi0pg2hnBCjeP8B/O14NhX4F3X0e4qK5RAmnOOuab9uLtY3PT2yayMYmmbwwGzOFrDCWvmBJwsdO0PsU6ybgn1Q+edDlc0fyi1m6pfBN9Gqv9eCsRNpsGzBx6uJ2BtpjFLVjRfp4qRWkK9GLTOvxAZ21wKy5rzPi0icR23+wMRh9DNL5aID2GeXsUdGkO0QyqA66ZWnSiHqLHcXstZvtQr03nu89sAJzT7gjVGPMLs3FocgTryLPSJysuK4riEWwpRHXee0wLxt2bIoMvYUaJ88kppsUa5AxXyf6xI31RK5P0NL/fZ3ROyAscty5k5hgg05rsHiK33IPEYvtlDUlT4eZhUF5u0017oHfBYWhV61guK4Dlkk4lamGQ9uBYmTtG3A6zpC0JSxl0nowRgWvfTHQIU5UvAQEwmnGNZNKq6zWJ8j8BF8EAILPCW9GXQjXm3p5msh95Ai7DtYrdEi3VC+bR07/59qWgAbZFLF0ckDQqhZmYwtIyo+e4zRN/eW1g9NuAwKxlLX0yToT2KOErxJVTjWFgCfkt4aj5EK9w== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f9d5ba8-2e4d-4537-8c6e-08d8638c8873 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:31.1039 (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: FYCgZNSkBFUfDGguXFgnQCHdjj2c3iYdiKfXnsWRV2NeKhSZceLOcz9JioYGrsGBFvpU8I5GAlzxWkIWRZxWxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6542 Subject: [dpdk-dev] [PATCH v1 2/4] net/dpaa2: 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/dpaa2/dpaa2_ethdev.c | 86 +++++++++++++------------------- 1 file changed, 35 insertions(+), 51 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index c81e75d53..3b87e8428 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -99,7 +99,6 @@ static const enum rte_filter_op dpaa2_supported_filter_ops[] = { }; static struct rte_dpaa2_driver rte_dpaa2_pmd; -static int dpaa2_dev_uninit(struct rte_eth_dev *eth_dev); static int dpaa2_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); static int dpaa2_dev_set_link_up(struct rte_eth_dev *dev); @@ -1241,7 +1240,7 @@ dpaa2_dev_close(struct rte_eth_dev *dev) { struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private; - int ret; + int i, ret; struct rte_eth_link link; PMD_INIT_FUNC_TRACE(); @@ -1249,8 +1248,12 @@ dpaa2_dev_close(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - dpaa2_flow_clean(dev); + if (!dpni) { + DPAA2_PMD_WARN("Already closed or not started"); + return -1; + } + dpaa2_flow_clean(dev); /* Clean the device first */ ret = dpni_reset(dpni, CMD_PRI_LOW, priv->token); if (ret) { @@ -1261,6 +1264,27 @@ dpaa2_dev_close(struct rte_eth_dev *dev) memset(&link, 0, sizeof(link)); rte_eth_linkstatus_set(dev, &link); + /* Free private queues memory */ + dpaa2_free_rx_tx_queues(dev); + /* Close the device at underlying layer*/ + ret = dpni_close(dpni, CMD_PRI_LOW, priv->token); + if (ret) { + DPAA2_PMD_ERR("Failure closing dpni device with err code %d", + ret); + } + + /* Free the allocated memory for ethernet private data and dpni*/ + priv->hw = NULL; + dev->process_private = NULL; + rte_free(dpni); + + for (i = 0; i < MAX_TCS; i++) + rte_free((void *)(size_t)priv->extract.tc_extract_param[i]); + + if (priv->extract.qos_extract_param) + rte_free((void *)(size_t)priv->extract.qos_extract_param); + + DPAA2_PMD_INFO("%s: netdev deleted", dev->data->name); return 0; } @@ -2712,52 +2736,12 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) RTE_LOG(INFO, PMD, "%s: netdev created\n", eth_dev->data->name); return 0; init_err: - dpaa2_dev_uninit(eth_dev); - return ret; -} - -static int -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 *)eth_dev->process_private; - int i, ret; - - PMD_INIT_FUNC_TRACE(); - - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; - - if (!dpni) { - DPAA2_PMD_WARN("Already closed or not started"); - return -1; - } - + /* With new implementation of .close, port private data + * will also be release by close callback. + */ dpaa2_dev_close(eth_dev); - dpaa2_free_rx_tx_queues(eth_dev); - - /* Close the device at underlying layer*/ - ret = dpni_close(dpni, CMD_PRI_LOW, priv->token); - if (ret) { - DPAA2_PMD_ERR( - "Failure closing dpni device with err code %d", - ret); - } - - /* Free the allocated memory for ethernet private data and dpni*/ - priv->hw = NULL; - eth_dev->process_private = NULL; - rte_free(dpni); - - for (i = 0; i < MAX_TCS; i++) - rte_free((void *)(size_t)priv->extract.tc_extract_param[i]); - - if (priv->extract.qos_extract_param) - rte_free((void *)(size_t)priv->extract.qos_extract_param); - - DPAA2_PMD_INFO("%s: netdev deleted", eth_dev->data->name); - return 0; + return ret; } static int @@ -2826,13 +2810,13 @@ static int rte_dpaa2_remove(struct rte_dpaa2_device *dpaa2_dev) { struct rte_eth_dev *eth_dev; + int ret; eth_dev = dpaa2_dev->eth_dev; - dpaa2_dev_uninit(eth_dev); - - rte_eth_dev_release_port(eth_dev); + dpaa2_dev_close(eth_dev); + ret = rte_eth_dev_release_port(eth_dev); - return 0; + return ret; } static struct rte_dpaa2_driver rte_dpaa2_pmd = { From patchwork Mon Sep 28 08:57:12 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: 78982 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 8DB75A04C0; Mon, 28 Sep 2020 10:58:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D7EC51D67F; Mon, 28 Sep 2020 10:57:38 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20043.outbound.protection.outlook.com [40.107.2.43]) by dpdk.org (Postfix) with ESMTP id 027E31D5E4 for ; Mon, 28 Sep 2020 10:57:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/avN73G7lgqZzNcV5GbIRMuLxw6QL5dEejOW8gWxktfvkJV0vSVXY2pFvLJFovqZp7Y8WRoXfMgKfmjd6FJOH8OioDOpHPNEwFg7fhIKWanSxZezjJWfDjQiArZxZZUWVQfKcWqqTX29G47fmQSDh7nYmMR35IFF0zc+bhPoagucXsW3S+VYx/eKMdaTBe0iFdR7eK5trm7l9vFbKrAh37K2vPzzqDy4sTfU5dX48mxaCBESoaxgLvuQuSvxwmHxR2Z6vN2M8cGBfwBtGEkeDMy01WNL5TkpG7ZnFU7rlzjSBtAsKUsF7UIYZQQ5R5ssbNA6iSwOXTVsPPKlCojmQ== 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=Re8X1VfPsfAHee8YBfmR4y3tYXS+CvLN/EblijQL9Us=; b=DhDugMM+96Y6ow4taWZS6dzYVbszxWA6iGWNYMHrr8j78mtGC2JSNa6VlWf+brI8YTUVDLEcjxX42w5GQOwrr2teYok0Vq/Zu0C6j4uiUWaZKEAtKnSCfo3Sy2hH/pyKS1niXo4k4uMg8qN0nL8TazNYtKofzrAfuQnopds0c2OdV3jG2C7uC5pqaO8TIzwS9Kkb+1If7/nEZDMfb2HCDHwdtd3Weceaoq9+SsRDiQpLoATo03eD9pflpGAVUv5VtWNW1d3nvwC6f/rnVH2JuMPY/p2dz/Clc2M6l4vRDk/yOE4S5xl48DUxB0lfjnIG6rNd3A8mvqY76aEvMeSeXg== 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=Re8X1VfPsfAHee8YBfmR4y3tYXS+CvLN/EblijQL9Us=; b=k0qO1Xj8/JkgaJQmc0huUrJldkgCiDuHpWUayEJvJVtVttz2EnlaP+XPOXHMUjyzhR5XzW4ZbqpbOXF7rSnE8GGr4C7vdCWBlJhDkmIvGQuOr5BLODijPpgjXhbA+V0No7hbBfT160QNAMadKn6GkkqqIJ9OX9f4Mt5AdfqAbPE= 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:32 +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:32 +0000 From: "Sachin Saxena (OSS)" To: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com Date: Mon, 28 Sep 2020 14:27:12 +0530 Message-Id: <20200928085713.13560-4-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:31 +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: 5a20c93c-70ba-405b-377b-08d8638c8962 X-MS-TrafficTypeDiagnostic: VE1PR04MB6542: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ymx3YmyiLT0O7xw4E4o8YCcCmfVJP3JvTV9LChXu8auO7R976+kNKV9RyM8nwaL09CBRpbn+nYg89MU817RfmdqhfQmgs0o/NTMAEGQoj5mbsO2/gbNbZdrgCOn6QjrQHJzqGtOzdW1R4mI7LMBqTV2u6dRaDlHYQ/TW2N2FKrDQXjJZO1IRRtxztu5W9faH+bNKq7IUr+05Bm6Ljot4eHL4r7Vrk6rAh1xkJSZ0U9eFJmF3Q3e/7LXIk6GrnOaoxE7AcZXUUXcWTmmL2dUJIwvyDk5fdrg30/PebM8GwuuWsxAIfrphFCqB0ZZW511ZFh31bjvDBs66iKJOYXAWTMfb12z8xOTmf2qTpJ10Arf69l5dgC9kxyZrMY8QcEaJDn7OQy09pFIS/3oZlxgCvmkKtG5jyRP8oNlGeZbBupg= 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: JEvoZy2xDrnasy1eN6ItSgmrTUs2t1mC7eDy9haZz2z/8p4E8y68IweRyVzLNaMNMd3wcNGBAufAp4GeJKl5fq2LExLyAvvmqKxpv+ouF4KqgaT0LCs1o9T1gBbiygDOC8Ft7aBOyYqUk9jKMSTAaK0K+rojhi0pVhm5yJbgYAnNL5AhCSmJuwoqHO3R99baoRYzOymFH72XIjDMmNpiDBhIYmH6if64Riyfh5ISFcAhYu9MpMaA3wfvm/b9VWXQ8yyoUau4Vw74sYKI3m6Amr9HXu9yVXFhGWSQI4N2lp+3GLs8YFUhihgumeQj/gQO+l4hocig0FHVmHTBOHTsJkiQc37aV2SR4tRqWghL5oviVcZ2hEei6ps1grF7lDhuUI4IeU97DpdSwNO8lEgq2UMpBB1wujwvhnpVEwGUcEqWJrlwC8pLgGz+NclRlsoT+72eFS3S0ZZdzt1FcApHmBdW484Areyq+mBBrZybY+jExeCDnYEbEMrtP7aRReI2cXFFux5V9STn9ZYzq4TS0nid0DSpcAcydNcG77uz/HkXVggzesfr/1k/5z2/40dxIR6bo5es+rtr5Sgax7ISDN0pHNhxa8ZkIYG301mGHrIcuIxsAR14K9SLYMDc8nGZ31VJfOb8csCihqHIQaedbg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a20c93c-70ba-405b-377b-08d8638c8962 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:32.6120 (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: 08rTEgF2bJituY4kj6b3Q4Bmq8UYZm/sQ4FITP9HOtAmYdU/xrk5T9Su5mrHw7ePtUHSZIUlbLgnbOBnNxGItQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6542 Subject: [dpdk-dev] [PATCH v1 3/4] net/pfe: 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/pfe/pfe_ethdev.c | 38 +++++++++++++----------------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c index a7e9d97ba..f0de1c8a2 100644 --- a/drivers/net/pfe/pfe_ethdev.c +++ b/drivers/net/pfe/pfe_ethdev.c @@ -385,22 +385,11 @@ pfe_eth_stop(struct rte_eth_dev *dev/*, int wake*/) dev->tx_pkt_burst = &pfe_dummy_xmit_pkts; } -static void -pfe_eth_exit(struct rte_eth_dev *dev, struct pfe *pfe) -{ - PMD_INIT_FUNC_TRACE(); - - pfe_eth_stop(dev); - /* Close the device file for link status */ - pfe_eth_close_cdev(dev->data->dev_private); - - rte_eth_dev_release_port(dev); - pfe->nb_devs--; -} - static int pfe_eth_close(struct rte_eth_dev *dev) { + PMD_INIT_FUNC_TRACE(); + if (!dev) return -1; @@ -410,7 +399,12 @@ pfe_eth_close(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - pfe_eth_exit(dev, g_pfe); + pfe_eth_stop(dev); + /* Close the device file for link status */ + pfe_eth_close_cdev(dev->data->dev_private); + + munmap(g_pfe->cbus_baseaddr, g_pfe->cbus_size); + g_pfe->nb_devs--; if (g_pfe->nb_devs == 0) { pfe_hif_exit(g_pfe); @@ -1147,6 +1141,7 @@ pmd_pfe_remove(struct rte_vdev_device *vdev) { const char *name; struct rte_eth_dev *eth_dev = NULL; + int ret = 0; name = rte_vdev_device_name(vdev); if (name == NULL) @@ -1158,17 +1153,12 @@ pmd_pfe_remove(struct rte_vdev_device *vdev) return 0; eth_dev = rte_eth_dev_allocated(name); - if (eth_dev != NULL) - pfe_eth_exit(eth_dev, g_pfe); - munmap(g_pfe->cbus_baseaddr, g_pfe->cbus_size); - - if (g_pfe->nb_devs == 0) { - pfe_hif_exit(g_pfe); - pfe_hif_lib_exit(g_pfe); - rte_free(g_pfe); - g_pfe = NULL; + if (eth_dev) { + pfe_eth_close(eth_dev); + ret = rte_eth_dev_release_port(eth_dev); } - return 0; + + return ret; } static From patchwork Mon Sep 28 08:57:13 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: 78984 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 E476CA04C0; Mon, 28 Sep 2020 10:58:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2DBBD1D692; Mon, 28 Sep 2020 10:57:42 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20046.outbound.protection.outlook.com [40.107.2.46]) by dpdk.org (Postfix) with ESMTP id 2D1591D67D for ; Mon, 28 Sep 2020 10:57:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HdGrF8/a/YXD/yJ14kMo1jJ/vDxjGBSZQvaxrSyhei5NiKntKXNb0jcTsUvAMipqpdJ/1WOVexXkurJfM7Euw5rohh2P//bX0bnJbgA7taQ8ffWr/dFF6iNUWuD8/RlzjCXU92ca7TecOaojDmEAIL9gPsN8D6QWLUnM8cKHAA5S/PaZTPyQEayAiztNIEL90Fw18OLVWm4xbDxR54/KU8ZAcYoi6AODQcrAJ6XqziWHrzEn2MWKoekDa8raeaI4YnY9VFPEmMq2RG6DNM3wZE3S5sFpQ5SCL5UB/u2MonVRV0q+R9FQcOMvLEfQVehGFiOztxASpKixD+azSMrX1g== 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=nX7l/90Qw1wdr8CMmY/W5g4DbtQv2cd4t7mwq6KLMf0=; b=fvl4NfN4wVy8L8zzgpjS1EZxOxavkF0s7eBQgqlU0xYC7buV+dsQKoJ/fE4L53Zfao0fKmDwyrd5GAO43P+cd7NqovXNuCIqS7oLevCQiH/y+U92i1Hepz0Nv012jRyRyFan5iOOegJzYDWKa4df++4OIdpMJtzR9eX8y4he4+X3CSjMaxnU7YbhIWAYR507gRUq9aQhC+SMiJRO2nddISvbOD3njZinth9HZi8G7OI/1F9CDRquHl3qa52haWD9CUFa4OyHTR2YeqBo/nqxtmn4XAwtupYciWYMphzqi2ObU/1uFM3Mgz7ZtAFH3Hl8CGQmhJX2Yk85IuFclrRKNQ== 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=nX7l/90Qw1wdr8CMmY/W5g4DbtQv2cd4t7mwq6KLMf0=; b=a57ovHOYXIdfR/Tj2D+zoCVnlW8IZ3OLfuVX61Zf7xG7lDlrPTPqZd0Xf7KR49TfIL+/21v4va0dQAv6owFialbLwISjhE5So+J2PQJb3OAaZ+lOz6PnMp79VTJ3p+Of3P51iZHWFrYTctBZlcP9nhabk5sa9V1rwpg7BeizUKo= 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:34 +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:34 +0000 From: "Sachin Saxena (OSS)" To: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com Date: Mon, 28 Sep 2020 14:27:13 +0530 Message-Id: <20200928085713.13560-5-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:32 +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: 36280e24-ce3c-4426-583f-08d8638c8a48 X-MS-TrafficTypeDiagnostic: VE1PR04MB6542: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5HGvJVp1apRLmU8ETOc4hprm9CLL2MMI8y+ZcKF4UZVujmmbVFnWzaKbUL6NZWTIxEkeTY+/aBOuMNUOiajl6k6D8/ZYNJnEga5U0t+SEH21YKaJXXqpGykXBLavUTgPs52cLUL5GHJ1hb1JhM8VQ4ZfMb+6Ntc8z4Iw1+6LuzVMj4ow0aRjhhLR/gmRnQRSfw7X2WPK8kKIe0h2W1+EXER2PBeFafrzYPtEKYF1bqu69Xe159sQu/QZfpoHCP+kpE3fDFwhgjKCDHdgCZA5UgXZevZW10LmqJHb1uuutjv2k4LqUwAI4iACL9MhYaUAotkNecvqGzQvL7QHHXbKlx5jZh5Q3u78x1D49WFPED0MDElYAsKxAg2gtCbSGvsLbaFfMmn54y1x/+OqH4AuxbHmXzY5aZBRR9vOAQvZmoA= 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: i8THUtxDuCcddNFtuN5TBzaPoEl0jl/8Z7Muih4jgHcvceK8RpT1/xTgTV8CuY06ZlsdXfC2+pQ6I/97xjV0TN8GZhS/s3wDEzFzLACkV3Fn1njC6XGUIVbmaEK5yPIPlDerwTg62/Ow1zOKrJL2lstDmpi3au0kU+MIS2tWokflpasgSKL59+6aUqqT+j8NCtgXhDACtZXJ0oy+5H/s6w4dWtnNEnbWAw2ookj5Lw+na/A31QQp40p7Ya3pti64HJ65vItB7PcRnFM7Iqc0fqak7JBPJ6U+jfasYNoY+wUxqw2kf0DbApGnFx+QsytPrrsqQQu0G/zpyAlco2PIQWQz47OjxP0D/5q2m6c78NUUL2vez63vFTBPkhjjUnDKFTKCHgjGMf4KQUi9DvO7ZTeHx8x/cx3kOoZ3AVGKBGo2l2ZK/Bd5Y9makRBpWVc1NQlxrnyM97UD3BdN+0Rg7+wybOVO8mqDVQQJWpAJSlKnRzaIGQpsfoo3+q/WXisaSNcEPTB1sT+h78M7XXf+49U7I4gLRW8Qv+HHHIsEyaeO64wCRvSbVWsNq3YrYZ8o2AlQMVRXtcwEmn6kwNrHYX51XvFal0J6t4EXRM8rz8Vbd08zYZkJhPK7QgfG5JzqmE/h+XHedWFn+L9PhbkT7A== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36280e24-ce3c-4426-583f-08d8638c8a48 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:34.3871 (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: AQ86827xPdLCKfeAmllOxgvLV2P1GNk2nuo0ApkUXZcYVgVI3IGez3gU9zX0dsg8TlvkI7YB8hH+ocjUo+ysHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6542 Subject: [dpdk-dev] [PATCH v1 4/4] net/enetc: 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/enetc/enetc_ethdev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index d42add3ef..b3dec7e64 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -568,6 +568,9 @@ enetc_dev_close(struct rte_eth_dev *dev) } dev->data->nb_tx_queues = 0; + if (rte_eal_iova_mode() == RTE_IOVA_PA) + dpaax_iova_table_depopulate(); + return 0; } @@ -919,14 +922,11 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } static int -enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused) +enetc_dev_uninit(struct rte_eth_dev *eth_dev) { PMD_INIT_FUNC_TRACE(); - if (rte_eal_iova_mode() == RTE_IOVA_PA) - dpaax_iova_table_depopulate(); - - return 0; + return enetc_dev_close(eth_dev); } static int