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 5C00A43BBA for ; Thu, 7 Mar 2024 12:20:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5395A410D5; Thu, 7 Mar 2024 12:20:54 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2118.outbound.protection.outlook.com [40.107.244.118]) by mails.dpdk.org (Postfix) with ESMTP id DE2414067E for ; Thu, 7 Mar 2024 12:20:51 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dk95NURP52lFjfj3bNpHJwYaNONr0caH7I5MznHvFtzsbcAWUAxzZlyU8WA2LTd2IHo5ZUSVx953zhQwF3QN3Atj0Qvh0JK2miSTqLlk5RcrHzv8S9pgujQ+TPXHNi6cJdFUDOjei4x+ihSLi8ltQR4/WUaqS9DzqgYUjbXeBANTkEblNM9ud2tFCzDz53Ap85SGNDQSAV1LumYu30825E4o13LaVDbpikqCswrzC5x3QXdn27ZSdyYUNyzoYOHLEheSumEePv0u/kTj5Ad/6X9J45aiR7ml/uAkMBWfxID0ZZYE7NfsTF3nYoWHuYgZuN99+m2BI6h2gEhxUjA8sA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uVXXJXBr+/eybfF1ALoeTYowxdKuMEikmTUxZBnMt3k=; b=eQgORp25V+cgiTx82zwC3z7lnbPR+9d5J8C3QGnSqM0kHtxXEbLOgMX1oZlkF0Q33y4wePLgxkeN5dp71D42JNC2UD4izcIP/veZxUh7voEjGKn69JNPq9katxfdia5MnBvxn94lQkqTkaklcTnHAjNA9HBxxeeCqbGQVHZ/tEM+MgAMlmrbx2xZWNcNG113nVYql0r5KZk+4JGaQeSGzniM37vcdQ2VE6zcHBeOdryPRU+Z1QQ6/nSd1jXUxY+Q6bRyIZ6qAlVOpm7KojVDE20TBCTNVKMsLMFLqBMqmdk8NofPWaTD8QCxeBU6sWqUGH4tNM7NRz4TBg3Bs0NPmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uVXXJXBr+/eybfF1ALoeTYowxdKuMEikmTUxZBnMt3k=; b=jtJDUBObNgubx5LvAX7HXetISiX7c3F7YgphW78ACO7J1CA+7uu3aQdZCrMrZ0QiHJjiR9zi2rbxx5uOGhXOdgn+FIBDGNoJCchouKrBY4fw/zujJLmCkOaVL5323s/1cexto2J3Bm8QqEYFZYtfVVAmtPLKfdPPsP0DjSjNMQ0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by PH7PR13MB5959.namprd13.prod.outlook.com (2603:10b6:510:15d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26; Thu, 7 Mar 2024 11:20:50 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7339.035; Thu, 7 Mar 2024 11:20:50 +0000 From: Chaoyong He To: stable@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He Subject: [PATCH 22.11 v2 6/7] net/nfp: fix device resource freeing Date: Thu, 7 Mar 2024 19:20:22 +0800 Message-Id: <20240307112023.1867765-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240307112023.1867765-1-chaoyong.he@corigine.com> References: <20240307112023.1867765-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR01CA0045.prod.exchangelabs.com (2603:10b6:a03:94::22) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB5959:EE_ X-MS-Office365-Filtering-Correlation-Id: 82ea22c6-9f07-4f72-f513-08dc3e98a4e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OjE2wbyPAfvlOBsxQSToxQ5gj63LyAjr12mAf8dDFdT9Oei71SwqXNRa5Z34nn769s5hZ1sTZYzC6lQnMv8QDFHV3K+XiQ9ngNqpAL7RfD0fiX07D6Rb8mma+w3KQAGUnicfw66BqZ/K3rNbVW3pHbEyzHZI2kQ6a8pTjHUUWPIFpVViFbbGfgYWBhcHLJOPKyFQM05oMmVOY80frCpvVZ5roYLt7yNNBADJNZA1FEjd7lVGsoIJE7V6x13/CVXItbgAOYksSPS3f0A0mvYHDv5HgI3xAlmo+ZlF3eyckiRYlbyOgnP0ACqQ4UwxwOrqoKJjxUbztJG93VRDujOQpwO/iy2UrolfKqTMa47IlXrbFHeFGOB3Ybv2/83WymE0Jao0/8GVNhl+oY8ZI7uCs7UKsqs+QFZVDN1gelN2n/fkke16ac4uR0DxANWLcBhAgsVG8WM2ka/0fZI8YyWjPK3sB8GI9jFz1bo5cztO7oA/Z+SMtWEyxuTseFQDY9YaNAmTDqhy4tP25sDvw2v1PdWizQt4Nn1XZWe+1O6+n3H+2b2dpjBhSieCh2mFG4ICdQ++Q4L0+fD2yeHj68JUW+ibRc50CGkIxmY3BP983YAQT0gxfEcX6yTlcPqCr2n5kENWhkPenRloHw/UA41VVt+6HJWZuL9SPtoGWhaCpB9/5f+Bj+cyCaGClS8MDKphselt4aFldIyKUwhuN4wp6A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?p3WwxePbtyqpiAM6Rn2mEcQQCcFiTcbdeMktbUSLNal7mYkNj9Uhcw4gStAl?= =?us-ascii?Q?hUCjvOylzytNyQk1n6/RYf3HBimeFbk0DovJHt/klzaak1waBU4iI7qBCxTs?= =?us-ascii?Q?mx1IfZOaqKtdqSWiugJ9f6vm78qO6+bUo1vlDC8vwSazNKk+Vt0i1jZWvXx7?= =?us-ascii?Q?zdU/9mVHoqnoHLiSxAzuZ6BpV8yjr5o0Q5BQ59Gk2EFjB9tooPjJOVb+vmUQ?= =?us-ascii?Q?aGWpoAvhxm3GW3L5VbmLA/2FcSSg6fmgEGV7h1hlUvVsquBnbsfES5wiB7zs?= =?us-ascii?Q?7Bgyo3VQYtKJM6oybbb/4ORSP4BCBs3kRjclk58XizyeeACuLit347E5S2y+?= =?us-ascii?Q?4ANTZPhhbCIjgp8BRMxkVx5wvh9ADWFtIESGkYN+Z2FeWpvSNxiDB0fg9c2n?= =?us-ascii?Q?1bGhU/S6TjSvHpo0LrWhuDYGkCVjC7QnbN0LE7v1PSv4dPsNm/9WGS9jkzvm?= =?us-ascii?Q?9ZopIvkJgjgeSe9Sx5mcf4xdF19XrsX9GkeuOW89qke00i93RBjgoUlIEnBN?= =?us-ascii?Q?DIx48zOVhPUXyphjCAiESfTOqjmmPCZHR9X4ah+muNwKFGcbWQBdNzVSgysN?= =?us-ascii?Q?Yhq8xBjlo6FlbMuhPk45n4a9GrECK32PSBod24POy4TShbRXE91mIujJKxwc?= =?us-ascii?Q?6fBP44LgwrIucSTf39SredN/7bH3JynJPO+yW8E6sSw7EeiKY2RVrcV+KTfh?= =?us-ascii?Q?VA3YWBW/SB2hCYGzrdYCKHW1zVJJI5WGDy7zlZJntALrLQMxCA0UvSya2oJw?= =?us-ascii?Q?2VhSI0YAYfYq6J8tSz2S7qJUFa+K6Ln63Tc1WuKCj8t/FMuv7v888n6i0fRF?= =?us-ascii?Q?EG99krblhoosBMJiVTc0we+6UAvAKAiP005VSkYQRZuU9Eet7ct5LR08yi56?= =?us-ascii?Q?UE8V00mwYNE060Es9rboZlCjgLmR5Kbsz5FjK4w76Ljg5UDHbaIEN4OQ3wvF?= =?us-ascii?Q?Ow4nxU7USFstqoGRVO+eueO7eQssbX4C9LyIBXiS8tVNoJ1nrxUiAnmD1hJs?= =?us-ascii?Q?Ai33RKHKGRfq8B9lHhT4KCyCJ7ZSdLoFHPogo9+nN9BTZ1AXoQc2czW6vEQl?= =?us-ascii?Q?eGDtpKrePEeCw5NUGVStCn2fLnu7kIJzGM5M1Ac1lCisK2iK0FVmCeJCCbuZ?= =?us-ascii?Q?F+TwI2TyDbQylhQDCl1NJ/ixszYP5VXceVoX7xSstcbD81NOkLyruOoicMpH?= =?us-ascii?Q?cQJlBD2p8nAzI2CohXDCSTXyDIyp6Xv273yIKcckxwLaH4yvFxkb0fnxn+Re?= =?us-ascii?Q?MI2gz9kbokCow46xqynacDaWcc27pOMmwYVS3p5reGsa3xu6sWmCqpENN1rP?= =?us-ascii?Q?b2GpWOtg8nOpviiKLB4eBix2dMpnn/+qISiZjdVTxn9qAaFddJIea4N8+6ZE?= =?us-ascii?Q?zM7Y4ScvEvHKeSHRzGCMjh4chjAlCT41yTiTP+EbRBvsG0ctn9txlJ3Qjz6m?= =?us-ascii?Q?bQwJQzW2jOStIR4Vdz9vTtSMIEz7vR7U9SGkff0NV4whd6aYTIvkogXPAPKf?= =?us-ascii?Q?SeCHglk8e099NdxCPhaL2UXgkU9PC3xU2wEOrywH2lhbyrpnEBvORSiF4Z0k?= =?us-ascii?Q?28eELTioWeZewbv0KGz1n9BjDCEvBln5hgR3APyAUFfh510j3KDwIOzWJAPK?= =?us-ascii?Q?TQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82ea22c6-9f07-4f72-f513-08dc3e98a4e6 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 11:20:50.4955 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M2DvbqPZ492gg1Numr8CadAN0xKfHVWGXcmVzSlKVzJvx+IE6hs5QUHAHy4xaLF1hTpIcI7ikg51xgmeJtXilmYVGTFrZqKIe7uwBGW7mx8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB5959 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit 09309f87358b3a538af47e31340898a15bb34d85 ] Set the representor array to NULL to avoid that close interface does not free some resource. Representor array points to dev_private which is already freed by 'rte_eth_dev_release_port()', and 'nfp_flower_repr_dev_close()' requires pointers to be NULL to proceed freeing other resources. Fixes: 7c596721ae5f ("net/nfp: fix resource leak for flower firmware") Signed-off-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower_representor.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index ac092c2..4b8b023 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -527,17 +527,30 @@ nfp_flower_repr_tx_burst(void *tx_queue, static int nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev) { + uint16_t index; struct nfp_flower_representor *repr; repr = eth_dev->data->dev_private; rte_ring_free(repr->ring); + if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { + index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id); + repr->app_fw_flower->phy_reprs[index] = NULL; + } else { + index = repr->vf_id; + repr->app_fw_flower->vf_reprs[index] = NULL; + } + return 0; } static int -nfp_flower_pf_repr_uninit(__rte_unused struct rte_eth_dev *eth_dev) +nfp_flower_pf_repr_uninit(struct rte_eth_dev *eth_dev) { + struct nfp_flower_representor *repr = eth_dev->data->dev_private; + + repr->app_fw_flower->pf_repr = NULL; + return 0; } -- 2.39.1