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 2F3DC43CAD for ; Thu, 14 Mar 2024 01:13:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 250A542E73; Thu, 14 Mar 2024 01:13:13 +0100 (CET) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by mails.dpdk.org (Postfix) with ESMTP id 62DC240297 for ; Thu, 14 Mar 2024 01:13:11 +0100 (CET) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-512f3e75391so449758e87.2 for ; Wed, 13 Mar 2024 17:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710375191; x=1710979991; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5oms8Koo4QYF63v0mYhnYqZmBKNmh7JO/BR0NLFrLc8=; b=Eh9TdY8V6SXXzH4ZA/9jGJDKV0NBLFtadZtLuPZcPWuIocQ0nJbkRLAYOrx7BgDd1V r/EEqLnQhL27pXNZmxeZyQNTIYyShO2a0PaVDOS8FuBMyUmd56794Mqb4jfP2kQ9hphx nwDYLEXMlm4KXvpwOrXRlE4zsgs0GzuwZ7Bd59buO9Zv47cUFT3FHFYwyTAMRQgjtt94 JZXE0t7EuMrXjoHRYcx5PbkUAjSJralciIIH6tzXKPyrsUfRCZpq0XlyZFnA+o0/fAC+ akIZlfwNoFRUH6AQQZC50+DXu7RFEi9TGydq0sYUU3a984f48XAq7wmnjO1xSJ4Hsw3Z oiVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710375191; x=1710979991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5oms8Koo4QYF63v0mYhnYqZmBKNmh7JO/BR0NLFrLc8=; b=EpV7JRN85ZvX0HPMgh9fFDCqrRISx8bZSE0e4Bz1W0l/Luc5QeUjmIM6zW+EF3sKDD MD4sig6ReqtZ19dMPTRhJh82vhZeaU39s0ZKjj4EQE18nB6yvMN0rpjFMxD/SCpY4nrp nO69vMGaqRupBZ12BAc2RbO0YcTsIbORp+S8RZzaLfSzBdi7R6MhBxd9BS2zGYHRLr67 cjFgA47hziSQ2UmVjPocgiQl/xG+jg+s8AfGnMStRGakbxaWQEd8FgSy7kbYPxh/WEEM MjZojkF3X7CazxTLX6B8wTPUoV5sEszdLqztCQY4yPNsofpXdhDVMPCBfIRmnN/XJDH1 IctA== X-Forwarded-Encrypted: i=1; AJvYcCX7QC2C9f3Tc7loOC5EeZT5xJSeTEy3HlsGboPg9scEwhc3ssm2h8+njGDwO0U5XauT56DYBdkQ5RNyqzdqdxE= X-Gm-Message-State: AOJu0YyR+UALfj7Wi7CzpUzfAncujZ8OpA1vM4hBpNrmsMpxJv8zYfWK w60nxjTso46X2x05R0fP/61Fd9NssD9iyn9iqNP9UIKh1B+YBKfqWQNmhoIobpc= X-Google-Smtp-Source: AGHT+IG6kQnaXTCRjL6ZaxALmDvJP7qQVF2EdMyAaf/VjR7WevawgzSX3nCRDZFDgMWkhDGWlzLZNA== X-Received: by 2002:ac2:5b03:0:b0:513:4f60:82c4 with SMTP id v3-20020ac25b03000000b005134f6082c4mr59617lfn.3.1710375190706; Wed, 13 Mar 2024 17:13:10 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id x5-20020ac259c5000000b005116d8eec66sm45793lfn.216.2024.03.13.17.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 17:13:10 -0700 (PDT) From: luca.boccassi@gmail.com 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 22.11.5 Date: Thu, 14 Mar 2024 00:09:56 +0000 Message-Id: <20240314000957.2810803-60-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240314000957.2810803-1-luca.boccassi@gmail.com> References: <20240307013159.1735343-102-luca.boccassi@gmail.com> <20240314000957.2810803-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.5 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/16/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/8b642184a925d5fb98d1f1eed353c1d6d111ecc5 Thanks. Luca Boccassi --- >From 8b642184a925d5fb98d1f1eed353c1d6d111ecc5 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 061ca09b98..23f3d1ddf9 100644 --- a/.mailmap +++ b/.mailmap @@ -1088,6 +1088,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.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-14 00:09:23.383164843 +0000 +++ 0060-examples-packet_ordering-fix-Rx-with-reorder-mode-di.patch 2024-03-14 00:09:20.713617206 +0000 @@ -1 +1 @@ -From 7ba49dc729937ea97642a615e9b08f33919b94f4 Mon Sep 17 00:00:00 2001 +From 8b642184a925d5fb98d1f1eed353c1d6d111ecc5 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 061ca09b98..23f3d1ddf9 100644 @@ -38 +38 @@ -@@ -1142,6 +1142,7 @@ Przemyslaw Czesnowicz +@@ -1088,6 +1088,7 @@ Przemyslaw Czesnowicz