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 F25F743D47 for ; Mon, 25 Mar 2024 11:59:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5A824068A; Mon, 25 Mar 2024 11:59:06 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by mails.dpdk.org (Postfix) with ESMTP id DDAD140270; Mon, 25 Mar 2024 11:59:03 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mGGG6xPAVBp4Fq/68Ouyb+TysK9ev77QnvOM3fKlPrVc7wSI5g0byU7IYMF5k3KC0/wfjJftv+n9TwCfiguTevYfSuvSuDg9K8w76N30P5WHKGJ9fmwVVpExr0C/XK5scYMsIkZuWVxC7eNKiXd4sIn9wVYcKXl0s4rN3J+u4bz0b3M7PmtFbREm86LWMQZSOddiiM6fJJO7Sbfd+7isbjHYVFKWNhav2qcJT3sbRToalufcxpr3UoeXx4AHNLowXZsb0dHBSY7zyl8jfvh/mH+0KDQPriDgYslJDOXiXSflN9fnGun1HIF24ELETQQrnklZLn+ZLsS76lJZO/S6AA== 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=eks5dD+3m1fS4BnoRMLRGRFHyVJMR3hmJOQPQy3Lz7s=; b=SozRPVYNiS+b2cpE/HtVReo+5912vMj2C9hLQTVagyltohOcDT9cj7F9EdxPhwKKjSg0aAbBAoZsUQYNzXTfPCd6gvwivDX2CiVZ9wRCK20C9qp7h3rYM6gVdw1seiKdMM5WsNXL0dgnnD6p2UiLSJLcnrBl/iV7EKF39h+dxAdK1HY+QQcWzNvojH5I+LCxyDNNnKC2fFewhFmuZIKtf5ZZSJQoD6FFkyC8PSXwibrkYEnsNtu8UQA/T+3Qvey0e1n/bZ7dFNPJdXS7P0mJ61NYZkPMMastvO6kqiwqqHnIUYZpiGlFfxvUAIm306bSVAT1udbeelXOrGlXdLgQ9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eks5dD+3m1fS4BnoRMLRGRFHyVJMR3hmJOQPQy3Lz7s=; b=ujD1m3+IBocdXrFtLA+AX0xapBjt26a9up9YfMaPwADKDiMhc1jMzTVSwK/bf6ThRIEK0QEmwY3EU7D6c7FaWUF0UyC//COKb/JwbIsx61DCqs4L/ZC2p7NIiquL5Ef4GIJFYKSRMOVQaWsdvvKEiU8i7oRqlYez69XsLYqoLdcHHpgG+BNYRRUs4M7R0pFQxlU1i+K24gQGovHkrnqJ+1EuRDE6V+Py6Fofo/dRHRPixfCBI9BSiJkS5GqRKvwMbpy/mRSiKZhUHBUOreTC69dBJoWuEAbefltsxhe1rKHFTLoyH5u4dZS1MVLL5G+rG2Ay5NHm0S7uLk0PtUAuYQ== Received: from BN7PR06CA0053.namprd06.prod.outlook.com (2603:10b6:408:34::30) by LV2PR12MB5920.namprd12.prod.outlook.com (2603:10b6:408:172::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 10:59:01 +0000 Received: from BN3PEPF0000B073.namprd04.prod.outlook.com (2603:10b6:408:34:cafe::46) by BN7PR06CA0053.outlook.office365.com (2603:10b6:408:34::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Mon, 25 Mar 2024 10:59:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN3PEPF0000B073.mail.protection.outlook.com (10.167.243.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 10:59:01 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 25 Mar 2024 03:58:45 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Mon, 25 Mar 2024 03:58:43 -0700 From: Bing Zhao To: , CC: , , , , Dariusz Sosnowski Subject: [PATCH v2] app/testpmd: fix releasing action handle flush memory Date: Mon, 25 Mar 2024 12:58:26 +0200 Message-ID: <20240325105826.393231-1-bingz@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240319093249.307606-1-bingz@nvidia.com> References: <20240319093249.307606-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B073:EE_|LV2PR12MB5920:EE_ X-MS-Office365-Filtering-Correlation-Id: 34729e0e-e677-4955-0562-08dc4cba944c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m4dqcb5HV9IvHp6WDp88X8sPgWCpaEl8SoEWhV8tEbXn+VKlk88XLjqlhgIsqIDR4UyLVm7EiKAk7iQ1L8mpEplduwiANB4DFQXLio00lSEn0O6XkDbPj3sYAORCcHOOfnMe7jPNuUfOodaOv0GEBezIBRXBwC6J3Nk/2kkDS+jAyEIAp53DXjufXJW6NHNBwur1pwl4ZoOrJvLvZzOy6T94gGWLf68hsVfuEBDYdrjUmdumVuObBz9GoC18Ob13BAY5/xqaFfNqKlCNa4DQtY7oUNHgC7eoQ2DXZjbxu+VU3NCSIZNZFvhmt1vBd5caGpVsumauoeRucobnpH8wPrV27+R7it31rrJQtf6DY+xY0bN4LLNMZvAIRFotKCxiYuNMbcZL9HPrzOndja7sS7dGJzjvDQoUDerx0JxVCtmAjZR2fHAc1QpxFcKaWUIREVZrVbxF/0ImrtBvrIkKRD21AfK19zf/vXQ6ECsNjb8F716MLwxYQvIJODJMMyKGHPQ+HPlqYeeKTjMuYLJjAHppfeuY+CmVxAhp4mZ3lwTFqZX1LiiKcK5e2+QzZA+Y3wUPJNdVFW/svv9+HHrKdR11cAc3O28zRRYtnIRumXajGW05au66Iq7m0oqW3PDAzpsGFJs1CT0O/J+95W4QeI32yBKsTXkqWBpGVpxpzhZ8RdxX7VnB/C54Rk3oAJT4mlh67NQULdQZqmGE+Qq1q/f7KyeEaOgiz0SPJNkYZElERkVC1Q8YMCe4DJ2ljYkH X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(1800799015)(376005)(82310400014)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 10:59:01.3218 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34729e0e-e677-4955-0562-08dc4cba944c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B073.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5920 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 The memory of the indirect action handles should be freed after being destroyed in the flush. The behavior needs to be consistent with the single handle destroy port_action_handle_destroy(). Or else, there would be some memory leak when closing / detaching a port without quitting the application. In the meanwhile, since the action handles are already destroyed, it makes no sense to hold the indirect action software resources anymore. Fixes: f7352c176bbf ("app/testpmd: fix use of indirect action after port close") Cc: dmitry.kozliuk@gmail.com Cc: stable@dpdk.org Signed-off-by: Bing Zhao Reviewed-by: Dariusz Sosnowski --- v2: update the description --- app/test-pmd/config.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ba1007ace6..f62ba90c87 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1918,8 +1918,7 @@ port_action_handle_flush(portid_t port_id) /* Poisoning to make sure PMDs update it in case of error. */ memset(&error, 0x44, sizeof(error)); if (pia->handle != NULL) { - ret = pia->type == - RTE_FLOW_ACTION_TYPE_INDIRECT_LIST ? + ret = pia->type == RTE_FLOW_ACTION_TYPE_INDIRECT_LIST ? rte_flow_action_list_handle_destroy (port_id, pia->list_handle, &error) : rte_flow_action_handle_destroy @@ -1929,11 +1928,9 @@ port_action_handle_flush(portid_t port_id) pia->id); ret = port_flow_complain(&error); } - tmp = &pia->next; - } else { - *tmp = pia->next; - free(pia); } + *tmp = pia->next; + free(pia); } return ret; } -- 2.34.1