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 C223643E57 for ; Sat, 13 Apr 2024 14:56:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BCB8D40294; Sat, 13 Apr 2024 14:56:34 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2076.outbound.protection.outlook.com [40.107.236.76]) by mails.dpdk.org (Postfix) with ESMTP id AE77D400D6 for ; Sat, 13 Apr 2024 14:56:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j0KI9MSR5ud0qSgVGwTfz0+YwhgYeODNEqKUm7Cn/dOU33Ym3zZv5yvKKRYVEQualRVI/zhgUBmsd5AAXNcd0nV2CoIDUfZaHxQ3dt6sI0IxdO5gFHRh8J5qzlVaugcd3UynDM8yPnupZdUwLee6lDjiBktV1bUBdNslsvPBIO9gmTAUhTDAKCDNaFbjszk2/9Xhio9X26BcrOoUUf8HfOOYBCgBvjGjxH4OJgSAziCvL6XqCSWLP7+/tfPraBh34cmdPSjjs1C/xttdZ0egYAs5B474t7t2HWb+aOGj3svRSgu8BphppynIoEEFZ1oiTXoWdyAJ0zMULNcUInyxRA== 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=+LI01noUEXPmNg+DbKa/M6TBj1xenP6+CxB72jl0x24=; b=kAokgncCgknpQLoQIdSUapFd/IQBUvPRUsGV+ZXSRob2DDOCsAlCbDpedS9t3/ngx4qxXUQn6c/knYmPmnPMij+JSVxOsxtzdURu7LULNKdRrA3UzYCWgUdwS7x9YzyZNFflr+V0/e0Fcj+gl2Q5+CkASn8A4zBKrL8MpMmo/NS0AUoFlcTsZux5aFlLFNXZEnI4GoSaedUWJkQ99SRSRoUNBNRidL+H6V05CU5Cab3KnQ6LBAmU+WQH63/hmgMZvZCNgaLvCSCCFwxkNi+tR6G6HeBJGC9psWRMFEhcwlqZ/pCiIbXwM/xCD1tB9WGIKp5MQoCmzdVrFtngg5H4Kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=126.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=+LI01noUEXPmNg+DbKa/M6TBj1xenP6+CxB72jl0x24=; b=R9s90cyLcRZWLre4shQJ1c+p0p489/lvvkZvEzNC0Q/8yRSMHsJoWdLI7j9Jb16SbtNnRwiSCTuJaBhBGLZZcnjSAIKYqDcBhk45mrA3Ky6l3TMoQR+9j7W0snoC1m+LuD/ttIQUrGREPYCE4AvuQ6O+XxsCKr8+mYqLs7xK89SjfEZHuykHLtJtSfZ5CMNO09fJGOyqlhiF+BD4PVncVpmnhyrZpKoi+8Afk7JwEEPUqdEzhxEt7VMf9eMRG7c2TSVpkfxZmuc93d2ucl1Arx0VoGeJEba+yO6WXp4h/1yR9IZ/C2ZXE5vUhxlltt6tljFrirYvNwKP92I4tiyRUw== Received: from DM6PR11CA0012.namprd11.prod.outlook.com (2603:10b6:5:190::25) by SA3PR12MB7808.namprd12.prod.outlook.com (2603:10b6:806:31b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Sat, 13 Apr 2024 12:56:31 +0000 Received: from DS3PEPF0000C37A.namprd04.prod.outlook.com (2603:10b6:5:190:cafe::3b) by DM6PR11CA0012.outlook.office365.com (2603:10b6:5:190::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.31 via Frontend Transport; Sat, 13 Apr 2024 12:56:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS3PEPF0000C37A.mail.protection.outlook.com (10.167.23.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Sat, 13 Apr 2024 12:56:29 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sat, 13 Apr 2024 05:56:18 -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; Sat, 13 Apr 2024 05:56:16 -0700 From: Xueming Li To: Qian Hao CC: Volodymyr Fialko , dpdk stable Subject: patch 'examples/packet_ordering: fix Rx with reorder mode disabled' has been queued to stable release 23.11.1 Date: Sat, 13 Apr 2024 20:49:09 +0800 Message-ID: <20240413125005.725659-69-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240413125005.725659-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> <20240413125005.725659-1-xuemingl@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: DS3PEPF0000C37A:EE_|SA3PR12MB7808:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b221881-3581-48f1-fd6d-08dc5bb92371 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PLRpMZE8/fzjlfkgtF1ga75pK5uzRGoDnO9kiqxh+744HXMbbqgmCUJK5RkWaKCMqas3Pto6OhXt5mxFdgiSIp6qsoQRrYudFTkfw7hc6R5BF3i7jYyjK/L8m3irfKOj/3OdN1AM+IjOAxypE0KUC3Wm9ukIoCQzbTQo6zNHKTzGpefrPr0scSUkbKzPVXmyCUWwICq9jJxjKhqfrjSeIwgFSZL5ua0nu9zcuzy6jlEw7ig4pGI0Ll9t2Va7hOv3jzFgJqG7j5PPduXM6BVHHJsYlMNsQVAjhIUCHLVeh3E7nt5jEgLsiwjNRC9p1aL7yi9kiT+WIkm0J4AJQ7UHGaCisSltj8ifw7I7mtIGaDKEnGYjugKSYR+N4UBwSyAK+BCPVpjfDaRBHaWPAhF3KcxT+qjwuVBgXcw6YqfVs6dL4jUX+2ySgaWB+OWODyRp0stOWxslDFaHd3/ciKl0uAMJiv4Qk5r+toapfyEsBsSkXjgjOhF7zlJrgrYp+E2NNS36cpPTXx7ixk7oegW0bcvrnYSjpO39+IZ3qqosXRoG+3O+4yGG8Ip2peLXg5xL4NqVOVDqsWtWyCBAh8ddku4AIrmKv+k+ANxLp7ZsHMoGKGQKRQzKboBTt5HGySvJqqv/8Ape5OX/O07sqakOiA+h195y5QcC4BFaVu5nUomVbX04ZDri8/IIsqqGfUSapmO8TkV9GECDqJs/CRkIz14UsH2DH9pUPBtGpgyqyoYqL2tiNGTKUdCd9JYd7fGp X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(82310400014)(376005)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2024 12:56:29.9799 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b221881-3581-48f1-fd6d-08dc5bb92371 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7808 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 Hi, FYI, your patch has been queued to stable release 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/15/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=10296d5f506e4ad4e5c7bb2c32a1f6369ffdcd9c Thanks. Xueming Li --- >From 10296d5f506e4ad4e5c7bb2c32a1f6369ffdcd9c Mon Sep 17 00:00:00 2001 From: Qian Hao Date: Wed, 13 Dec 2023 19:07:18 +0800 Subject: [PATCH] examples/packet_ordering: fix Rx with reorder mode disabled Cc: Xueming Li [ upstream commit 7ba49dc729937ea97642a615e9b08f33919b94f4 ] The packet_ordering example works in two modes (opt via --disable-reorder): - When reorder is enabled: rx_thread - N*worker_thread - send_thread - When reorder is disabled: rx_thread - N*worker_thread - tx_thread N parallel worker_thread(s) generate out-of-order packets. When reorder is enabled, send_thread uses sequence number generated in rx_thread (L459) to enforce packet ordering. Otherwise rx_thread just sends any packet it receives. rx_thread writes sequence number into a dynamic field, which is only registered by calling rte_reorder_create() (Line 741) when reorder is enabled. However, rx_thread marks sequence number onto each packet no matter whether reorder is enabled, overwriting the leading bytes in packet mbufs when reorder is disabled, resulting in segfaults when PMD tries to DMA packets. `if (!disable_reorder_flag) {...}` is added in rx_thread to fix the bug. The test is inlined by the compiler to prevent any performance loss. Signed-off-by: Qian Hao Acked-by: Volodymyr Fialko --- .mailmap | 1 + examples/packet_ordering/main.c | 32 +++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.mailmap b/.mailmap index 9541b3b02e..daa1f52205 100644 --- a/.mailmap +++ b/.mailmap @@ -1131,6 +1131,7 @@ Przemyslaw Czesnowicz Przemyslaw Patynowski Przemyslaw Zegan Pu Xu <583493798@qq.com> +Qian Hao Qian Xu Qiao Liu Qi Fu diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index d2fd6f77e4..f839db9102 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -427,8 +428,8 @@ int_handler(int sig_num) * The mbufs are then passed to the worker threads via the rx_to_workers * ring. */ -static int -rx_thread(struct rte_ring *ring_out) +static __rte_always_inline int +rx_thread(struct rte_ring *ring_out, bool disable_reorder_flag) { uint32_t seqn = 0; uint16_t i, ret = 0; @@ -454,9 +455,11 @@ rx_thread(struct rte_ring *ring_out) } app_stats.rx.rx_pkts += nb_rx_pkts; - /* mark sequence number */ - for (i = 0; i < nb_rx_pkts; ) - *rte_reorder_seqn(pkts[i++]) = seqn++; + /* mark sequence number if reorder is enabled */ + if (!disable_reorder_flag) { + for (i = 0; i < nb_rx_pkts;) + *rte_reorder_seqn(pkts[i++]) = seqn++; + } /* enqueue to rx_to_workers ring */ ret = rte_ring_enqueue_burst(ring_out, @@ -473,6 +476,18 @@ rx_thread(struct rte_ring *ring_out) return 0; } +static __rte_noinline int +rx_thread_reorder(struct rte_ring *ring_out) +{ + return rx_thread(ring_out, false); +} + +static __rte_noinline int +rx_thread_reorder_disabled(struct rte_ring *ring_out) +{ + return rx_thread(ring_out, true); +} + /** * This thread takes bursts of packets from the rx_to_workers ring and * Changes the input port value to output port value. And feds it to @@ -772,8 +787,11 @@ main(int argc, char **argv) (void *)&send_args, last_lcore_id); } - /* Start rx_thread() on the main core */ - rx_thread(rx_to_workers); + /* Start rx_thread_xxx() on the main core */ + if (disable_reorder) + rx_thread_reorder_disabled(rx_to_workers); + else + rx_thread_reorder(rx_to_workers); RTE_LCORE_FOREACH_WORKER(lcore_id) { if (rte_eal_wait_lcore(lcore_id) < 0) -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-04-13 20:43:07.152866717 +0800 +++ 0069-examples-packet_ordering-fix-Rx-with-reorder-mode-di.patch 2024-04-13 20:43:05.017753905 +0800 @@ -1 +1 @@ -From 7ba49dc729937ea97642a615e9b08f33919b94f4 Mon Sep 17 00:00:00 2001 +From 10296d5f506e4ad4e5c7bb2c32a1f6369ffdcd9c Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 7ba49dc729937ea97642a615e9b08f33919b94f4 ] @@ -25,2 +27,0 @@ -Cc: stable@dpdk.org - @@ -35 +36 @@ -index 1b346f630f..55913d0450 100644 +index 9541b3b02e..daa1f52205 100644 @@ -38 +39 @@ -@@ -1142,6 +1142,7 @@ Przemyslaw Czesnowicz +@@ -1131,6 +1131,7 @@ Przemyslaw Czesnowicz