From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C521845A67; Mon, 30 Sep 2024 12:32:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9168D406B6; Mon, 30 Sep 2024 12:30:39 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013028.outbound.protection.outlook.com [52.101.67.28]) by mails.dpdk.org (Postfix) with ESMTP id F046A40671 for ; Mon, 30 Sep 2024 12:30:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=whFlXjdVNJpNfY9Sa7cmMeQMKbMr9o+8VWH60utNbtM1FOrXwpoqG+hTQ1peq74ZVdpCM7sUnmGO8kBT+iy/VKxdusvsi4IKyNmRSlATxn9oVGZ70nH/0C/NMogyCumjtrFnYvcSE7mAPqwSDUpB/RgHM1rcBfi76fKUAf5i9T5GzQ/QI1vJdsKKx44y4/7E/mMEAxEPNpqH6vevhJZ2L8klrn2GR6AyKNwafa0TCGuf7DEiDDbfJ+L3O/BAt0IrlOBYjoykku3jtnFsFfWTqU2AIWtU8N+XDkU6t4fTX3ABf5+9e422Hy1UVe6CdxDX0lsuj+f3EonIEUkox3fPlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W3FfC1dGRoFnI4cvG54mhKd2vqaQaW37hPDpvcFGyV8=; b=zWSC5chLPQI3R+JaMH7R0cZAd20EOjCsd6Cp9D6UImJIOKHT1Is8QS6jqiAkgbDFs7g19BPNjXDNJE9JaKpXqY2PlGZj/9kQfVw9RYdL18HhU3mDBpZEfv5dgF2v4mLf5TcExA9gdwyFhvcArlS6C31XEgHrEC8rpRHw3lnZVGs8Laebd4UoIpifN8aRT7HZE9T+4V23VaGJnkPfGHUs20qSWv8IQsb+xWcaPl3lKtrOZ3Jeoj7xRPBejsZd0OSwI+y3m6YGD5SwH6TULxfdSkLEtEF4XwBy9EaLTdIathdlGMJzKWF7+D12SJqRojwWSDRfAZBi5hKD7SURwzEU3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none 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=W3FfC1dGRoFnI4cvG54mhKd2vqaQaW37hPDpvcFGyV8=; b=ZixheuqODSiVfpvtRgujbwaaxgxeHqL6f86Lwr6n81ejayFRxe8iGzgXH7uIwVkopAjwFVpJCYksqXH2+Bnu1AA7+qKiI4w3u797c88kZPje5VtdZvGEO1GFD9lTAHhfTCEqxZ1tIpe2QeBPmPPYkbFardxyrJW6nUJV2fXbmwxvPXMoOZKTt0odXxbLE/JYqbAzwB5+giBjEaFCo+SQZSmi9HteuW1kNvOxx4celHS3tCXJ8UFcZiu2hiEuvb2Sr5euvH3sWxwu4mv0XQNq03EzUiFXhFHxAWBtjvS4V/HwTotZCAQJi1Jg9AbU4EMSFV33dtoHgiNEo1mDfwNg5w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by VE1PR04MB7214.eurprd04.prod.outlook.com (2603:10a6:800:1a6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.17; Mon, 30 Sep 2024 10:30:25 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.8005.026; Mon, 30 Sep 2024 10:30:25 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Gagandeep Singh Subject: [PATCH v3 16/18] net/dpaa: improve the dpaa port cleanup Date: Mon, 30 Sep 2024 15:59:44 +0530 Message-Id: <20240930102946.3236998-17-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240930102946.3236998-1-hemant.agrawal@nxp.com> References: <20240823073240.3708320-1-hemant.agrawal@nxp.com> <20240930102946.3236998-1-hemant.agrawal@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2P153CA0027.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::14) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|VE1PR04MB7214:EE_ X-MS-Office365-Filtering-Correlation-Id: d09db498-46a4-495f-f1a1-08dce13ae596 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GJzT68ZIfHENCCeU4mZQC+flcAuM+h0bzs/ZyGTw/uE9kQjmw7NHMe8pujLI?= =?us-ascii?Q?XJogREij6wHV0ulyg5Vo6Tki41EDIvon3Oe3lVXfXfYA2xSLBHxKkxnllhg5?= =?us-ascii?Q?aSGNj/r9zJ+nEP4ifcqjiNnYdvVdAlHbGcdm6tipZf/90abTmFns+m39taaC?= =?us-ascii?Q?9Bniebt8fmyd8BrnhMeEH0EmJEABDREJNDYr5zIPFmmfTBcER9e/HZqsgJ5S?= =?us-ascii?Q?B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U+actxsZk/7KPM9umwAoZN+?= =?us-ascii?Q?gZRjg97uq8+va46ivKgvsE0L5PpqVDCytoyao276M/QY2jMFZBEe8d3AtD6T?= =?us-ascii?Q?KMQOs94lvJQl6/3imL+0yrp2U85jnwCSBSr3FfA9t8bncngTv2SgrWhZnOem?= =?us-ascii?Q?HRPZvj0tyH2e/GvZBZsLAQfVDPSNK73Q5FeX1yhPOeEhAN2KrbLa+UIAayNE?= =?us-ascii?Q?BYW57F+JctQDgaFjHURSw0ov8Dv0GP1DVI8VL9pvU7hJ2Si5Mc+1vzzFE+6A?= =?us-ascii?Q?D8mshkXXCsPCDywwJkEP0QEg6CGv2XtB0h6AXa8rSEXU88cZ9g=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?e/y7Mf07HLcInKxEueRRiEDbqD+nM0PaXk4E5L2i2IGeiStowGTlCtN7nCQv?= =?us-ascii?Q?kIZlVhlHcxdvgIu7ccIkVWpQ0kXiAA3R9yH9nnojfZ6zT7RkGdC28u3n/T+S?= =?us-ascii?Q?v9ZVZoRA5mMJXC1QhHkBi9AQ5QTDTMJ26JHkWx3xJl6HCJqaW0L4oQpo4nBO?= =?us-ascii?Q?hu267tTaPb4q7BIb/OxTqb5ImXoSNBqwIWm4XJIh8R1ouchz2BE12Fy8Tub5?= =?us-ascii?Q?jI/EjL4lnxyJT9QUcGJXvVr1Hr/WHEXFkiaTbq1Bx4wk2KJ2a5sRHyXnIo4y?= =?us-ascii?Q?RCivBth83+amdGaJZypIcPtovDC/sSWFHm+DdPERmWCqkwSXWhgBUDFzVlq3?= =?us-ascii?Q?/oAn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mDwXFi/9Ueufm6XZHw?= =?us-ascii?Q?VMlb58EH1ozm0D+AXUsfQz35UoPt2fDc0I55MYLdjm45+3deONVyyAhpkY3c?= =?us-ascii?Q?a026j0GivhIKnGKrOQcXsu8dIws4JHKf3aSmITQi6P4mbmfcEvtfLhJRP1d8?= =?us-ascii?Q?6iBdrftp5hUF8jlGOvZxGmAzioWUjEr4PAuWjZM3HwfHhvfzfFw2sYmN0K7P?= =?us-ascii?Q?q0JKzESjNuNPmUT7eMsmVLdi9+yzOJrxFIuQl9BeTym7+eOW1XGwdkGR30dJ?= =?us-ascii?Q?KwUKPY0JXylDKAWyIL2aNddCABLfRQXy8kNz9HIHwsCjqr9nY1L6KJFairDJ?= =?us-ascii?Q?w3T2o1ztEf/X2qIx8D9os2vKL+7feyTrXAE1Nup1GA6qXZGPhqiYX+TQ7C2R?= =?us-ascii?Q?fQ=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d09db498-46a4-495f-f1a1-08dce13ae596 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2024 10:30:25.7722 (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: adrNPNblItsPmPmA1uyq79/BkhRg/Ulq+hTPrznAJGhe6XvQwgr1U042MlN0RRGnjXb959RmMjl5bOOR5wWK8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7214 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Gagandeep Singh During DPAA cleanup in FMCLESS mode, application can see segmentation fault in device close API and in DPAA destructor execution. Segmentation fault in device close is because driver reducing the number of queues initialised during device configuration without releasing the actual queues. And segmentation fault in DPAA destruction is because it is trying to access RTE* devices whose memory has been released in rte_eal_cleanup() call by the application. This patch improves the behavior. Signed-off-by: Gagandeep Singh --- drivers/net/dpaa/dpaa_ethdev.c | 33 +++++++++++---------------------- drivers/net/dpaa/dpaa_flow.c | 5 ++--- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 133fbd5bc9..41ae033c75 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -561,10 +561,10 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) if (dpaa_intf->cgr_rx) { for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) qman_delete_cgr(&dpaa_intf->cgr_rx[loop]); + rte_free(dpaa_intf->cgr_rx); + dpaa_intf->cgr_rx = NULL; } - 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++) @@ -578,6 +578,15 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) rte_free(dpaa_intf->tx_queues); dpaa_intf->tx_queues = NULL; + if (dpaa_intf->port_handle) { + if (dpaa_fm_deconfig(dpaa_intf, fif)) + DPAA_PMD_WARN("DPAA FM " + "deconfig failed\n"); + } + if (fif->num_profiles) { + if (dpaa_port_vsp_cleanup(dpaa_intf, fif)) + DPAA_PMD_WARN("DPAA FM vsp cleanup failed\n"); + } return ret; } @@ -2607,26 +2616,6 @@ static void __attribute__((destructor(102))) dpaa_finish(void) return; if (!(default_q || fmc_q)) { - unsigned int i; - - for (i = 0; i < RTE_MAX_ETHPORTS; i++) { - if (rte_eth_devices[i].dev_ops == &dpaa_devops) { - struct rte_eth_dev *dev = &rte_eth_devices[i]; - struct dpaa_if *dpaa_intf = - dev->data->dev_private; - struct fman_if *fif = - dev->process_private; - if (dpaa_intf->port_handle) - if (dpaa_fm_deconfig(dpaa_intf, fif)) - DPAA_PMD_WARN("DPAA FM " - "deconfig failed"); - if (fif->num_profiles) { - if (dpaa_port_vsp_cleanup(dpaa_intf, - fif)) - DPAA_PMD_WARN("DPAA FM vsp cleanup failed"); - } - } - } if (is_global_init) if (dpaa_fm_term()) DPAA_PMD_WARN("DPAA FM term failed"); diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index b9cd11efa1..c01d8eaca1 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -13,6 +13,7 @@ #include #include #include +#include #define DPAA_MAX_NUM_ETH_DEV 8 @@ -811,8 +812,6 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set) return -1; } - dpaa_intf->nb_rx_queues = dev->data->nb_rx_queues; - /* Open FM Port and set it in port info */ ret = set_fm_port_handle(dpaa_intf, req_dist_set, fif); if (ret) { @@ -821,7 +820,7 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set) } if (fif->num_profiles) { - for (i = 0; i < dpaa_intf->nb_rx_queues; i++) + for (i = 0; i < dev->data->nb_rx_queues; i++) dpaa_intf->rx_queues[i].vsp_id = fm_default_vsp_id(fif); -- 2.25.1