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 E08EB45CD8; Mon, 18 Nov 2024 19:03:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F23E84279D; Mon, 18 Nov 2024 19:03:48 +0100 (CET) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id A4AAC402DF; Mon, 18 Nov 2024 19:03:38 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2107.outbound.protection.outlook.com [104.47.18.107]) by mx-outbound19-89.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 18 Nov 2024 18:03:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fS6J3JO/0/wrT+P4kRJyemccWw5itnsTdjqHPsxpyiyGRPPusNIUNZb0DE7Di9VetH07FO1gl1hkKUznIZ6refzkloQFpS7dc28dMWNzNR7JCfz3HBQ3pIR++Gqtam4rf3gN/RIuLw/BSTdYaDeTDrWVog2oC8PM+6t3aWrHro2nqZwtBYVM0wytUY6VajZdmC6CC/FDlHrSOu01B4t4BiCJxpWvxeBwsSPdUMT/e7t7swV/JBsEerhB89mAbZG/1iUahBk+sgkOPMJY4a/z0xqXRIFyKgRieidlfODd0VaiYUlw8TRljzQ43avfZe8qen9Qq6XpCRi7JbmM0Ho80w== 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=wu6tCEAySnefUlKFYM7fybZY2fEThZB7wftDK4Jpgf8=; b=ZKcow/6VbORYE+KlWE6AXlTwSOp0uKIl9KRam2oJU/1q9zL3AMtyk5NRreHAuDbSjjJZ55LHd9ZX1M0QNiEFqvcBvOyJ3/KONhEpB1DE56ayakTzYV9Ji0m1FKu9wJdzVlf2hUo6y6mWs+Dh+QuhvL/IC6uEZN3zGUe35ij2cGJr/oX1ZnbOSHl7Eqzd46pl3HqrZQ4wAWK82/tl99qsqz7L1K+yoWp+95qjKom6HH7R3+bj2MvSiFjQLP/ewiRPUIdPsCJYcFgkvQzYnH69ap94RFpA3hSrZjUpwVM2GJNKkUV1871V3wABipaA49G8LaYNQUw41TYEgKynMt4T1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=monjalon.net smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wu6tCEAySnefUlKFYM7fybZY2fEThZB7wftDK4Jpgf8=; b=lsLWZRvosFxMPyYuW+Z+Sj6nwnJqYo+bLCiZtIEFNasNg6nGPoJfP5PJIVa8Vf0IWhlsv3vq13Yt4HzxVLNasmA0xheYHIwyMgebBPo57doF9A91ivjOeAWnNIM08RI2C/bkb4jKAihwEw1hfcJzYNT97PnEp+CI18QtDDcMN7c= Received: from AM6P192CA0081.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:8d::22) by DBAP190MB0823.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1a5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Mon, 18 Nov 2024 18:03:33 +0000 Received: from AMS0EPF000001B1.eurprd05.prod.outlook.com (2603:10a6:209:8d:cafe::33) by AM6P192CA0081.outlook.office365.com (2603:10a6:209:8d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23 via Frontend Transport; Mon, 18 Nov 2024 18:03:32 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=k8s-node-23.default.svc.cluster.local; Received: from k8s-node-23.default.svc.cluster.local (178.72.21.4) by AMS0EPF000001B1.mail.protection.outlook.com (10.167.16.165) with Microsoft SMTP Server id 15.20.8158.14 via Frontend Transport; Mon, 18 Nov 2024 18:03:32 +0000 From: Danylo Vodopianov To: thomas@monjalon.net, aman.deep.singh@intel.com, yuying.zhang@intel.com, orika@nvidia.com, mko-plv@napatech.com, ckm@napatech.com, dsosnowski@nvidia.com, sil-plv@napatech.com Cc: getelson@nvidia.com, akozyrev@nvidia.com, dev@dpdk.org, stable@dpdk.org, ferruh.yigit@amd.com Subject: [PATCH v3 2/2] app/testpmd: fix aged flow destroy Date: Mon, 18 Nov 2024 19:03:23 +0100 Message-ID: <20241118180323.2046886-3-dvo-plv@napatech.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241118180323.2046886-1-dvo-plv@napatech.com> References: <20241118112625.1880659-2-dvo-plv@napatech.com> <20241118180323.2046886-1-dvo-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001B1:EE_|DBAP190MB0823:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: d70e9707-cf8f-4885-769e-08dd07fb50bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?s/ZAkxMYnFQQ5KSLC+R3Swik+F2RfRswrZbZL7gc/Vqb0ozY+bXvSDRiyBuz?= =?us-ascii?Q?nX2Rfl1XkFNvzI2u4SjyrJrXf9vRLBVbe95UWzbOsyl/RZemTKo1+WrUfQOO?= =?us-ascii?Q?YqUUuEirX1x337i0RYRI+gyDocqV7XvZFW/I9tIUzPpuAuiBlf8Lukb+YuoZ?= =?us-ascii?Q?tqcIht0FI9ObQbudZmicmHWAzkR3tH0OI2dwXO4/acEbQfZYACFL8OUcu2uj?= =?us-ascii?Q?ye9zvS4Av7PQ2o/EHi27b1h8Yd/RzWucvv7qNZJ1KBhDxG3CbxqcOEGuHE4K?= =?us-ascii?Q?zyZzGxXpY8mmgZYsRQhC63uzaX8clgdg4+78cyD1/WiUWzpJLzNfSc974WHR?= =?us-ascii?Q?ZUgjBf/YV5Mgv3dJGWK0H8CjIvi4jfFKhLBGyVc2yrot0DJPKbxlL6ZmXI6Y?= =?us-ascii?Q?ah3S5vpaqsfxxYoABfK3w+gIK69jELW52itYQ17kHbUfhrfvwJqOFK1WctwG?= =?us-ascii?Q?aFRn69m8rgLjWGUe4CdfrAFgGePfBhoA7Md2gxee2lF7tm/4/OFyJx8KZ07f?= =?us-ascii?Q?KqaWaExKDiobtGY5zfnH90QD6kzKyJrHSg9IjYvpIl+PQPY89+dZWUmKJihT?= =?us-ascii?Q?2bpLp1xYkIUsvYrblaWuc97B8PZfaJP2QpDgII6uUU6GG9xu/6g5tGAl0tvx?= =?us-ascii?Q?xH/PhEjxMYhwx5Q/5Fv36USZCjjM4PCytdD20tEm0RI8scJXu0jTLqWEenx6?= =?us-ascii?Q?wLJ3nNLtF51QAXmGHYPduqbZkVzaw7sEZHLgjY4xa23Gt5oLT7r4qTfKzSkQ?= =?us-ascii?Q?QYbcxmN/gnG7o5nTAG+HqK1xTgOeewsDWbNRpz6/WJcneCwEuY6Tcnh6vpH/?= =?us-ascii?Q?PupmOf/4fKAzSwokG9qwWbLDe5iyveUPlsymnQn79hcDR3b49O8rEnktIhYh?= =?us-ascii?Q?NFYx5Mk+Rvk0WOYagRxPCyZsu+cOg1yYM1/o7q37omgKOef9A70vBEiWKHVb?= =?us-ascii?Q?j+1q9+NUnxHXOT+qEK6hc2HfAk5W+QskVAtYsWnQK+KS8GIbvzrvqzZJl7Eb?= =?us-ascii?Q?if5br5t/RfvOFNhkMbGSBGODJDYIKL6tIGOAZ0cEVSx8H+88XQf9iyUOWbBE?= =?us-ascii?Q?sVQFo6EvBAeQ0zX3kPoH3OOV+6mvkErLJw1uY5JZfhCRRLuwBHodaAeZ/VOd?= =?us-ascii?Q?sPueMVGXHKB+3swXpGTeeTBrgM1xTlLPI88d3su5Dj6MeY6A87cW3FtiGsuB?= =?us-ascii?Q?rYMGz7/6LECD5/YyxDF9n0GMCzlwTQHJwX0Mn9A+WW5jjHSoOZe6KP4l8AR4?= =?us-ascii?Q?xkasGRyMQzNhHLczKJ8mISE9YquQelR/qr9tcalGWiabQ+SngTYjN2ZvA53I?= =?us-ascii?Q?eKwWRWakMPp+aDQraf5fLvqTDR7vAtKrd8dIAQnpkK55CgKjl9wrUxHbx1VP?= =?us-ascii?Q?3B8vu63aQ0PWipUXRQiHhh6HM0L09AMWi6kSqMmLOVI2gAMRuw=3D=3D?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:k8s-node-23.default.svc.cluster.local; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AWfXN5ZR+JYp+4WPtbbMWBD1MbJi6pj+ho8bgIrl75KE7zzLbk2x2QmA62gWkwlh0wyLJEmWumnLFjtkfBRP7POfPZBas7X8wGl36ZWGhQDDqjiEukZIbduN+ySU51qFWIL35ld7QFmyo4S6bZNvnj5mCj/k5Bt2bR1RBWp6f6hhcpRvhBLAmgNKwA1I9hJ1qhYncrHF+G00C3+b8BXmkHcGiaOiCr1stwWRrq0PfgvgetADp4XL9uJeS5r0q54sZN7YxUJCHA6QSX2IqAZy6OYGeuezgyPpq3/+zqsFxJNEGZPt65sxrG9FLAUG97++jtJQ2qlz9Pk4otcyvj+lGp7hiLGCcRDYQBkKx9kj1I1s9TG/h80A1+j9W3qwA9sxB4PizQq8hSLfHuh5QghFovsHNJlEXN7RADjq3HBQq0BuSZ2LMuMa84eoLh8OlGyVspgmUPX0x/fmS367RsQ/TtE+sGztWNobWl+YAQi5VdcBUtGS2z26hw1aIrY6548lskKJ3w6LVSiBQhXN4zyBNoWYLS9vnTHRVz4tjwoYjHjGR7rw4bQMgwcvBLnYbsj/awKDSn6OF0aMAUPcxNB7efZCRElgvqWJqspcNsFVTOcvI/Si32URYOIO0ykRGy5ZE9wplhJBVDew6d5WydBxFPyIiKhup7m7NKR13RB769U= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2024 18:03:32.6848 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d70e9707-cf8f-4885-769e-08dd07fb50bc X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[k8s-node-23.default.svc.cluster.local] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001B1.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0823 X-BESS-ID: 1731953014-304953-13346-35785-2 X-BESS-VER: 2019.1_20241105.1725 X-BESS-Apparent-Source-IP: 104.47.18.107 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobmZoZAVgZQ0Nw0MS3R3CzR3C AxyTDF3CTZIDHZIi05FShmZGmYlKpUGwsAg9mvokEAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260511 [from cloudscan15-33.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 port_flow_destroy() function never assumed that rule array can be freed when it's executing, and port_flow_aged() just violated that assumption. In case of flow async create failure, it tries to do a cleanup, but it wrongly removes a 1st flow (with id 0). pf->id is not set at this moment and it always is 0, thus 1st flow is removed. A local copy of flow->id must be used to call of port_flow_destroy() to avoid access and processing of flow->id after the flow is removed. Fixes: de956d5ecf08 ("app/testpmd: support age shared action context") Cc: stable@dpdk.org Signed-off-by: Danylo Vodopianov --- app/test-pmd/config.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index c831166431..28d45568ac 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -4160,8 +4160,10 @@ port_flow_aged(portid_t port_id, uint8_t destroy) } type = (enum age_action_context_type *)contexts[idx]; switch (*type) { - case ACTION_AGE_CONTEXT_TYPE_FLOW: + case ACTION_AGE_CONTEXT_TYPE_FLOW: { + uint64_t flow_id; ctx.pf = container_of(type, struct port_flow, age_type); + flow_id = ctx.pf->id; printf("%-20s\t%" PRIu64 "\t%" PRIu32 "\t%" PRIu32 "\t%c%c%c\t\n", "Flow", @@ -4172,9 +4174,10 @@ port_flow_aged(portid_t port_id, uint8_t destroy) ctx.pf->rule.attr->egress ? 'e' : '-', ctx.pf->rule.attr->transfer ? 't' : '-'); if (destroy && !port_flow_destroy(port_id, 1, - &ctx.pf->id, false)) + &flow_id, false)) total++; break; + } case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION: ctx.pia = container_of(type, struct port_indirect_action, age_type); -- 2.43.5