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 29FF143829 for ; Fri, 8 Mar 2024 15:33:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20CE643382; Fri, 8 Mar 2024 15:33:11 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 9973F40E2D for ; Fri, 8 Mar 2024 15:33:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709908389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oXN6AFzaeq79/hB4DueIQXaFpzgfAGh3swIAplZFa9Y=; b=g9c0utumE2wC86qMTh7P0lgCj9XEFDkpliIICqxUh0D3iGdolyMlK/s58rX60HIyU7U64g g6JXUKz7wOJH/eFJH8Iho4dMF3Kj4aA10Y9H9gi4+1T4Jk3zE/ZBWJgpq6QXxycGDmHQQk Wd+LEvWSWeTHZv/T20YLz7zjcpGz8Qw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-64-CG9PK4oRNriNV6Bsy8tiBw-1; Fri, 08 Mar 2024 09:33:06 -0500 X-MC-Unique: CG9PK4oRNriNV6Bsy8tiBw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BA7D73C025B1; Fri, 8 Mar 2024 14:33:05 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1034537FC; Fri, 8 Mar 2024 14:33:04 +0000 (UTC) From: Kevin Traynor 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 21.11.7 Date: Fri, 8 Mar 2024 14:28:21 +0000 Message-ID: <20240308142824.528417-33-ktraynor@redhat.com> In-Reply-To: <20240308142824.528417-1-ktraynor@redhat.com> References: <20240308142824.528417-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/13/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/dabf41766557e4879080529d179758df2433938a Thanks. Kevin --- >From dabf41766557e4879080529d179758df2433938a 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 [ 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 7776e85d57..2e60e2b813 100644 --- a/.mailmap +++ b/.mailmap @@ -1089,4 +1089,5 @@ Przemyslaw Patynowski Przemyslaw Zegan Pu Xu <583493798@qq.com> +Qian Hao Qian Xu Qiao Liu diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index 99e67ef67b..f16afe8986 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -5,4 +5,5 @@ #include #include +#include #include @@ -427,6 +428,6 @@ int_handler(int sig_num) * 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; @@ -454,7 +455,9 @@ 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 */ @@ -473,4 +476,16 @@ rx_thread(struct rte_ring *ring_out) } +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 @@ -772,6 +787,9 @@ main(int argc, char **argv) } - /* 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) { -- 2.43.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-08 13:47:49.978872229 +0000 +++ 0033-examples-packet_ordering-fix-Rx-with-reorder-mode-di.patch 2024-03-08 13:47:49.042686735 +0000 @@ -1 +1 @@ -From 7ba49dc729937ea97642a615e9b08f33919b94f4 Mon Sep 17 00:00:00 2001 +From dabf41766557e4879080529d179758df2433938a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 7ba49dc729937ea97642a615e9b08f33919b94f4 ] + @@ -25,2 +26,0 @@ -Cc: stable@dpdk.org - @@ -35 +35 @@ -index 1b346f630f..55913d0450 100644 +index 7776e85d57..2e60e2b813 100644 @@ -38 +38 @@ -@@ -1143,4 +1143,5 @@ Przemyslaw Patynowski +@@ -1089,4 +1089,5 @@ Przemyslaw Patynowski @@ -45 +45 @@ -index d2fd6f77e4..f839db9102 100644 +index 99e67ef67b..f16afe8986 100644 @@ -48 +48 @@ -@@ -6,4 +6,5 @@ +@@ -5,4 +5,5 @@ @@ -54 +54 @@ -@@ -428,6 +429,6 @@ int_handler(int sig_num) +@@ -427,6 +428,6 @@ int_handler(int sig_num) @@ -63 +63 @@ -@@ -455,7 +456,9 @@ rx_thread(struct rte_ring *ring_out) +@@ -454,7 +455,9 @@ rx_thread(struct rte_ring *ring_out) @@ -76 +76 @@ -@@ -474,4 +477,16 @@ rx_thread(struct rte_ring *ring_out) +@@ -473,4 +476,16 @@ rx_thread(struct rte_ring *ring_out) @@ -93 +93 @@ -@@ -773,6 +788,9 @@ main(int argc, char **argv) +@@ -772,6 +787,9 @@ main(int argc, char **argv)