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 3DD1B433D8 for ; Mon, 11 Dec 2023 11:22:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3276540ED2; Mon, 11 Dec 2023 11:22:57 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2068.outbound.protection.outlook.com [40.107.102.68]) by mails.dpdk.org (Postfix) with ESMTP id B833B40E0F for ; Mon, 11 Dec 2023 11:22:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jgkFMMk1in9EeT3U+0Hal/GrdqaB/iOPmsWKquSOPYJWL7YmtR42Sln6jszxIFJxRsIMAjXuTUjZgQQlrg4918RBosxVhuIX0S7vu/064sFb14M80aq6+HbemgMptt+gY6V6hCC0MHUquXvNkWWbGT4KwKFBQ3Z9xw3tbUFM0vXKuG/ekzOYWC2q++djm78sam4FLuxRVl+EhvFNhKmuagIOl5cSCIfbm9w1ikDuyY+TAwEprhguSA4LO7k/8U60Ryz09v6+qEBNKzTSXkW4WtSS1xTjHsMVBAwwUrkFrHqGz/iGLhrsHSBMBSAqwg6EcLhl2qpfI2HSEM8b1IRnGg== 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=wgeDj53DIqHEz0pcxgRSLPaQbXBksjoCCVxAI9bHkZw=; b=A1H2pD3aZKPJ7/6qp7uClI+Ykg6NWbobG15jvjCLWf/hFrrbHMSKeCdJiWus7lH6B0YRDvJfv2giUKZJ+RkG5TdWc2GYBiXucqjDXU7xaRuQAJKwa24OJmJBK5qQp1wGtmjcHqGshz5np7wJ2CYZTIhhVwaQDYsMQte3+jdBW9SbM2AEeiBagerykfPD1rog9LLjtG/xmW7if1zkg/APAvbNWHbERVT0QMFmte47OMIHDan9X7OzYwQr1euozmPluQyQdG0zfBQnpR1oTkJ/Z4vx9RoS5gCoToG2cEJqWahx6dVtPE1BRrHZR40MTcaduVFariABY3sr6z73AWV53w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=arm.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=wgeDj53DIqHEz0pcxgRSLPaQbXBksjoCCVxAI9bHkZw=; b=L58wo1ZtHd+3Gc0qnInvIdUx+icJFaZ0qtX/Lx5hB+yBHYFp7g6BKcmlI/JLtg2H3shzAWc+Wlr1xIMAjBGokEEUZJz+ijTlPJ85YJe3vsuIxrZ6WDkbf3KYYF6psfMK+QfF97AKqc6PdUuwiu5gcfaipJBCk9tA6qflH68auLSrn+N++mY4hTOitj3u+yF+aUVlFq3IgejaZPlcEJqjXznbQW37/p5UB+ATnNr2u/w1XGDvO5nYNl/m098MgtIogDH+GqI0du7psXzKyInKdfJAV3GHcamaBQ4Z6S5NwbPZx+cBHv/q5Oielq3uz1oQCdkAoVZI2nKI5apWykG1DQ== Received: from SA9PR13CA0043.namprd13.prod.outlook.com (2603:10b6:806:22::18) by BL3PR12MB6572.namprd12.prod.outlook.com (2603:10b6:208:38f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 10:22:51 +0000 Received: from SN1PEPF0002529D.namprd05.prod.outlook.com (2603:10b6:806:22:cafe::11) by SA9PR13CA0043.outlook.office365.com (2603:10b6:806:22::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.21 via Frontend Transport; Mon, 11 Dec 2023 10:22:51 +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 SN1PEPF0002529D.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.18 via Frontend Transport; Mon, 11 Dec 2023 10:22:51 +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; Mon, 11 Dec 2023 02:22:37 -0800 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.986.41; Mon, 11 Dec 2023 02:22:33 -0800 From: Xueming Li To: Feifei Wang CC: Ruifeng Wang , Matthew Dirba , Cristian Dumitrescu , dpdk stable Subject: patch 'app/pipeline: add sigint handler' has been queued to stable release 22.11.4 Date: Mon, 11 Dec 2023 18:12:16 +0800 Message-ID: <20231211101226.2122-112-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231211101226.2122-1-xuemingl@nvidia.com> References: <20231022142250.10324-1-xuemingl@nvidia.com> <20231211101226.2122-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: SN1PEPF0002529D:EE_|BL3PR12MB6572:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c907a93-c90d-4108-6981-08dbfa332189 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 64R1sU1utamrPEtmkMFIDGkkouuBQntXTCnOtwRTtkbwjcHr+ns7MxW0XDoK0+GPNNoUkwXVf845HBVPBJ7VFDt3RynWvwX406K0Ns65auXnjj3N77BuvF/mDIPfNo0dWPi/bqaPOR7bKrAlHHr6W/WLQ/NNmb04t0iR8ky75CHXf0b6JxXjOm8LyAzlbAJGPG7oqY+xzCEEv4TovrPCLx22TGDGwINZvx1LDMfd8MTeWtCIIxI5+v0LfJwB/3e51fpH7qKMkPKkCr3o4b+y3z3AgDHGKFy/INjACXJLTbFWxYaR2pTK8qlplW1roXiWRXSWPmoXyzYox1hHvPjofNIJiQ4UKprFDR24ivharWDT/Lj0ErNJeu9yWYu2q0i7uDX5hcEv4BMwEoMoMH6oS1vdFsMZ+lEhBbh45Oq4B4KF7E/ZYspd9KkOGc2hVKHCdVQSJZUhIXlxKt1KDSty1/eM0qhc35vgvEsYFA5Ssr+g0PSWRhaIUwHb298keuqV9jWTv3b1ZanXEDBLj43G00Op9xwZ/f36WhUSIylD2FzAtPbqNty270UfZ5+9OF0NuArvVzIx1kStOfy6dNO9/0aC42E+r8BpxX8lokWTEqZoUUiMJcCu48lUJjFkSFFYbXkRsWh7JIdwzqGZA6FLdvrkvebPMG8h5c0e+d9gatIsCOaURgfCvSm3/Ml4EqX+AMpcbwWZOBv5ruNHVCKv8kTsBJ8Fs+bcCGMYY+qsPwoiBH6yLnLt6FjeHd63LFnbYl1vQ/prZKBfapSWQgAfnOuZeMjTt4RjaubMX9ykzVQ= 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)(4636009)(396003)(346002)(376002)(39860400002)(136003)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(82310400011)(46966006)(40470700004)(36840700001)(55016003)(40480700001)(6286002)(1076003)(26005)(426003)(336012)(16526019)(2616005)(40460700003)(82740400003)(36756003)(7636003)(86362001)(356005)(47076005)(83380400001)(5660300002)(53546011)(7696005)(6666004)(36860700001)(316002)(70586007)(70206006)(966005)(8936002)(8676002)(6916009)(54906003)(41300700001)(4001150100001)(4326008)(2906002)(478600001)(30864003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 10:22:51.4580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c907a93-c90d-4108-6981-08dbfa332189 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: SN1PEPF0002529D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6572 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.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/13/23. 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=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=de38896353c37da406d35eebc64baea20f1b5c6e Thanks. Xueming Li --- >From de38896353c37da406d35eebc64baea20f1b5c6e Mon Sep 17 00:00:00 2001 From: Feifei Wang Date: Tue, 12 Sep 2023 14:39:02 +0800 Subject: [PATCH] app/pipeline: add sigint handler Cc: Xueming Li [ upstream commit f6897b23f70b84742129a215ea2be17c8843adb8 ] For test-pipeline, if the main core receive SIGINT signal, it will kill all the threads immediately and not wait other threads to finish their jobs. To fix this, add 'signal_handler' function. Fixes: 48f31ca50cc4 ("app/pipeline: packet framework benchmark") Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang Reviewed-by: Matthew Dirba Acked-by: Cristian Dumitrescu --- .mailmap | 1 + app/test-pipeline/main.c | 14 +++ app/test-pipeline/main.h | 2 + app/test-pipeline/pipeline_acl.c | 6 +- app/test-pipeline/pipeline_hash.c | 110 ++++++++++----------- app/test-pipeline/pipeline_lpm.c | 6 +- app/test-pipeline/pipeline_lpm_ipv6.c | 6 +- app/test-pipeline/pipeline_stub.c | 6 +- app/test-pipeline/runtime.c | 132 ++++++++++++++------------ 9 files changed, 159 insertions(+), 124 deletions(-) diff --git a/.mailmap b/.mailmap index 48267a54f2..9b523c9959 100644 --- a/.mailmap +++ b/.mailmap @@ -865,6 +865,7 @@ Mateusz Rusinski Matias Elo Mats Liljegren Matteo Croce +Matthew Dirba Matthew Hall Matthew Smith Matthew Vick diff --git a/app/test-pipeline/main.c b/app/test-pipeline/main.c index 1e16794183..8633933fd9 100644 --- a/app/test-pipeline/main.c +++ b/app/test-pipeline/main.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,15 @@ #include "main.h" +bool force_quit; + +static void +signal_handler(int signum) +{ + if (signum == SIGINT || signum == SIGTERM) + force_quit = true; +} + int main(int argc, char **argv) { @@ -54,6 +64,10 @@ main(int argc, char **argv) argc -= ret; argv += ret; + force_quit = false; + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + /* Parse application arguments (after the EAL ones) */ ret = app_parse_args(argc, argv); if (ret < 0) { diff --git a/app/test-pipeline/main.h b/app/test-pipeline/main.h index 59dcfddbf4..9df157de22 100644 --- a/app/test-pipeline/main.h +++ b/app/test-pipeline/main.h @@ -60,6 +60,8 @@ struct app_params { extern struct app_params app; +extern bool force_quit; + int app_parse_args(int argc, char **argv); void app_print_usage(void); void app_init(void); diff --git a/app/test-pipeline/pipeline_acl.c b/app/test-pipeline/pipeline_acl.c index 5857bc285f..abde4bf934 100644 --- a/app/test-pipeline/pipeline_acl.c +++ b/app/test-pipeline/pipeline_acl.c @@ -236,14 +236,16 @@ app_main_loop_worker_pipeline_acl(void) { /* Run-time */ #if APP_FLUSH == 0 - for ( ; ; ) + while (!force_quit) rte_pipeline_run(p); #else - for (i = 0; ; i++) { + i = 0; + while (!force_quit) { rte_pipeline_run(p); if ((i & APP_FLUSH) == 0) rte_pipeline_flush(p); + i++; } #endif } diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index 2dd8928d43..cab9c20980 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -366,14 +366,16 @@ app_main_loop_worker_pipeline_hash(void) { /* Run-time */ #if APP_FLUSH == 0 - for ( ; ; ) + while (!force_quit) rte_pipeline_run(p); #else - for (i = 0; ; i++) { + i = 0; + while (!force_quit) { rte_pipeline_run(p); if ((i & APP_FLUSH) == 0) rte_pipeline_flush(p); + i++; } #endif } @@ -411,59 +413,61 @@ app_main_loop_rx_metadata(void) { RTE_LOG(INFO, USER1, "Core %u is doing RX (with meta-data)\n", rte_lcore_id()); - for (i = 0; ; i = ((i + 1) & (app.n_ports - 1))) { - uint16_t n_mbufs; - - n_mbufs = rte_eth_rx_burst( - app.ports[i], - 0, - app.mbuf_rx.array, - app.burst_size_rx_read); - - if (n_mbufs == 0) - continue; - - for (j = 0; j < n_mbufs; j++) { - struct rte_mbuf *m; - uint8_t *m_data, *key; - struct rte_ipv4_hdr *ip_hdr; - struct rte_ipv6_hdr *ipv6_hdr; - uint32_t ip_dst; - uint8_t *ipv6_dst; - uint32_t *signature, *k32; - - m = app.mbuf_rx.array[j]; - m_data = rte_pktmbuf_mtod(m, uint8_t *); - signature = RTE_MBUF_METADATA_UINT32_PTR(m, - APP_METADATA_OFFSET(0)); - key = RTE_MBUF_METADATA_UINT8_PTR(m, - APP_METADATA_OFFSET(32)); - - if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip_hdr = (struct rte_ipv4_hdr *) - &m_data[sizeof(struct rte_ether_hdr)]; - ip_dst = ip_hdr->dst_addr; - - k32 = (uint32_t *) key; - k32[0] = ip_dst & 0xFFFFFF00; - } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { - ipv6_hdr = (struct rte_ipv6_hdr *) - &m_data[sizeof(struct rte_ether_hdr)]; - ipv6_dst = ipv6_hdr->dst_addr; - - memcpy(key, ipv6_dst, 16); - } else + while (!force_quit) { + for (i = 0; i < app.n_ports; i++) { + uint16_t n_mbufs; + + n_mbufs = rte_eth_rx_burst( + app.ports[i], + 0, + app.mbuf_rx.array, + app.burst_size_rx_read); + + if (n_mbufs == 0) continue; - *signature = test_hash(key, NULL, 0, 0); + for (j = 0; j < n_mbufs; j++) { + struct rte_mbuf *m; + uint8_t *m_data, *key; + struct rte_ipv4_hdr *ip_hdr; + struct rte_ipv6_hdr *ipv6_hdr; + uint32_t ip_dst; + uint8_t *ipv6_dst; + uint32_t *signature, *k32; + + m = app.mbuf_rx.array[j]; + m_data = rte_pktmbuf_mtod(m, uint8_t *); + signature = RTE_MBUF_METADATA_UINT32_PTR(m, + APP_METADATA_OFFSET(0)); + key = RTE_MBUF_METADATA_UINT8_PTR(m, + APP_METADATA_OFFSET(32)); + + if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { + ip_hdr = (struct rte_ipv4_hdr *) + &m_data[sizeof(struct rte_ether_hdr)]; + ip_dst = ip_hdr->dst_addr; + + k32 = (uint32_t *) key; + k32[0] = ip_dst & 0xFFFFFF00; + } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { + ipv6_hdr = (struct rte_ipv6_hdr *) + &m_data[sizeof(struct rte_ether_hdr)]; + ipv6_dst = ipv6_hdr->dst_addr; + + memcpy(key, ipv6_dst, 16); + } else + continue; + + *signature = test_hash(key, NULL, 0, 0); + } + + do { + ret = rte_ring_sp_enqueue_bulk( + app.rings_rx[i], + (void **) app.mbuf_rx.array, + n_mbufs, + NULL); + } while (ret == 0 && !force_quit); } - - do { - ret = rte_ring_sp_enqueue_bulk( - app.rings_rx[i], - (void **) app.mbuf_rx.array, - n_mbufs, - NULL); - } while (ret == 0); } } diff --git a/app/test-pipeline/pipeline_lpm.c b/app/test-pipeline/pipeline_lpm.c index 8add5e71b7..e3d4b3fdc5 100644 --- a/app/test-pipeline/pipeline_lpm.c +++ b/app/test-pipeline/pipeline_lpm.c @@ -160,14 +160,16 @@ app_main_loop_worker_pipeline_lpm(void) { /* Run-time */ #if APP_FLUSH == 0 - for ( ; ; ) + while (!force_quit) rte_pipeline_run(p); #else - for (i = 0; ; i++) { + i = 0; + while (!force_quit) { rte_pipeline_run(p); if ((i & APP_FLUSH) == 0) rte_pipeline_flush(p); + i++; } #endif } diff --git a/app/test-pipeline/pipeline_lpm_ipv6.c b/app/test-pipeline/pipeline_lpm_ipv6.c index 26b325180d..f9aca74e4c 100644 --- a/app/test-pipeline/pipeline_lpm_ipv6.c +++ b/app/test-pipeline/pipeline_lpm_ipv6.c @@ -158,14 +158,16 @@ app_main_loop_worker_pipeline_lpm_ipv6(void) { /* Run-time */ #if APP_FLUSH == 0 - for ( ; ; ) + while (!force_quit) rte_pipeline_run(p); #else - for (i = 0; ; i++) { + i = 0; + while (!force_quit) { rte_pipeline_run(p); if ((i & APP_FLUSH) == 0) rte_pipeline_flush(p); + i++; } #endif } diff --git a/app/test-pipeline/pipeline_stub.c b/app/test-pipeline/pipeline_stub.c index b6750d51bf..48a638aad7 100644 --- a/app/test-pipeline/pipeline_stub.c +++ b/app/test-pipeline/pipeline_stub.c @@ -122,14 +122,16 @@ app_main_loop_worker_pipeline_stub(void) { /* Run-time */ #if APP_FLUSH == 0 - for ( ; ; ) + while (!force_quit) rte_pipeline_run(p); #else - for (i = 0; ; i++) { + i = 0; + while (!force_quit) { rte_pipeline_run(p); if ((i & APP_FLUSH) == 0) rte_pipeline_flush(p); + i++; } #endif } diff --git a/app/test-pipeline/runtime.c b/app/test-pipeline/runtime.c index d939a85d7e..752f783370 100644 --- a/app/test-pipeline/runtime.c +++ b/app/test-pipeline/runtime.c @@ -48,24 +48,26 @@ app_main_loop_rx(void) { RTE_LOG(INFO, USER1, "Core %u is doing RX\n", rte_lcore_id()); - for (i = 0; ; i = ((i + 1) & (app.n_ports - 1))) { - uint16_t n_mbufs; - - n_mbufs = rte_eth_rx_burst( - app.ports[i], - 0, - app.mbuf_rx.array, - app.burst_size_rx_read); - - if (n_mbufs == 0) - continue; - - do { - ret = rte_ring_sp_enqueue_bulk( - app.rings_rx[i], - (void **) app.mbuf_rx.array, - n_mbufs, NULL); - } while (ret == 0); + while (!force_quit) { + for (i = 0; i < app.n_ports; i++) { + uint16_t n_mbufs; + + n_mbufs = rte_eth_rx_burst( + app.ports[i], + 0, + app.mbuf_rx.array, + app.burst_size_rx_read); + + if (n_mbufs == 0) + continue; + + do { + ret = rte_ring_sp_enqueue_bulk( + app.rings_rx[i], + (void **) app.mbuf_rx.array, + n_mbufs, NULL); + } while (ret == 0 && !force_quit); + } } } @@ -82,25 +84,27 @@ app_main_loop_worker(void) { if (worker_mbuf == NULL) rte_panic("Worker thread: cannot allocate buffer space\n"); - for (i = 0; ; i = ((i + 1) & (app.n_ports - 1))) { - int ret; - - ret = rte_ring_sc_dequeue_bulk( - app.rings_rx[i], - (void **) worker_mbuf->array, - app.burst_size_worker_read, - NULL); + while (!force_quit) { + for (i = 0; i < app.n_ports; i++) { + int ret; - if (ret == 0) - continue; - - do { - ret = rte_ring_sp_enqueue_bulk( - app.rings_tx[i ^ 1], + ret = rte_ring_sc_dequeue_bulk( + app.rings_rx[i], (void **) worker_mbuf->array, - app.burst_size_worker_write, + app.burst_size_worker_read, NULL); - } while (ret == 0); + + if (ret == 0) + continue; + + do { + ret = rte_ring_sp_enqueue_bulk( + app.rings_tx[i ^ 1], + (void **) worker_mbuf->array, + app.burst_size_worker_write, + NULL); + } while (ret == 0 && !force_quit); + } } } @@ -110,45 +114,47 @@ app_main_loop_tx(void) { RTE_LOG(INFO, USER1, "Core %u is doing TX\n", rte_lcore_id()); - for (i = 0; ; i = ((i + 1) & (app.n_ports - 1))) { - uint16_t n_mbufs, n_pkts; - int ret; + while (!force_quit) { + for (i = 0; i < app.n_ports; i++) { + uint16_t n_mbufs, n_pkts; + int ret; - n_mbufs = app.mbuf_tx[i].n_mbufs; + n_mbufs = app.mbuf_tx[i].n_mbufs; - ret = rte_ring_sc_dequeue_bulk( - app.rings_tx[i], - (void **) &app.mbuf_tx[i].array[n_mbufs], - app.burst_size_tx_read, - NULL); + ret = rte_ring_sc_dequeue_bulk( + app.rings_tx[i], + (void **) &app.mbuf_tx[i].array[n_mbufs], + app.burst_size_tx_read, + NULL); - if (ret == 0) - continue; + if (ret == 0) + continue; - n_mbufs += app.burst_size_tx_read; + n_mbufs += app.burst_size_tx_read; - if (n_mbufs < app.burst_size_tx_write) { - app.mbuf_tx[i].n_mbufs = n_mbufs; - continue; - } + if (n_mbufs < app.burst_size_tx_write) { + app.mbuf_tx[i].n_mbufs = n_mbufs; + continue; + } - n_pkts = rte_eth_tx_burst( - app.ports[i], - 0, - app.mbuf_tx[i].array, - n_mbufs); + n_pkts = rte_eth_tx_burst( + app.ports[i], + 0, + app.mbuf_tx[i].array, + n_mbufs); - if (n_pkts < n_mbufs) { - uint16_t k; + if (n_pkts < n_mbufs) { + uint16_t k; - for (k = n_pkts; k < n_mbufs; k++) { - struct rte_mbuf *pkt_to_free; + for (k = n_pkts; k < n_mbufs; k++) { + struct rte_mbuf *pkt_to_free; - pkt_to_free = app.mbuf_tx[i].array[k]; - rte_pktmbuf_free(pkt_to_free); + pkt_to_free = app.mbuf_tx[i].array[k]; + rte_pktmbuf_free(pkt_to_free); + } } - } - app.mbuf_tx[i].n_mbufs = 0; + app.mbuf_tx[i].n_mbufs = 0; + } } } -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-12-11 17:56:26.668231700 +0800 +++ 0111-app-pipeline-add-sigint-handler.patch 2023-12-11 17:56:23.227652300 +0800 @@ -1 +1 @@ -From f6897b23f70b84742129a215ea2be17c8843adb8 Mon Sep 17 00:00:00 2001 +From de38896353c37da406d35eebc64baea20f1b5c6e Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit f6897b23f70b84742129a215ea2be17c8843adb8 ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org @@ -32 +34 @@ -index 54e3bf7584..49d3616c4c 100644 +index 48267a54f2..9b523c9959 100644 @@ -35 +37 @@ -@@ -899,6 +899,7 @@ Mateusz Rusinski +@@ -865,6 +865,7 @@ Mateusz Rusinski @@ -96 +98 @@ -index 2f04868e3e..9eb4053e23 100644 +index 5857bc285f..abde4bf934 100644 @@ -255 +257 @@ -index 854319174b..8a59bd0042 100644 +index 8add5e71b7..e3d4b3fdc5 100644 @@ -278 +280 @@ -index 18d4f018f1..207ffbeff0 100644 +index 26b325180d..f9aca74e4c 100644