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 7D4A048BAB for ; Tue, 25 Nov 2025 16:07:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 74AF7402E1; Tue, 25 Nov 2025 16:07:21 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 66EF3402E1 for ; Tue, 25 Nov 2025 16:07:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764083237; 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; bh=26fMwmJB2ij+DC35bOkJSMFBbCKINFee6s5iXv4swrM=; b=LN6AmYeLmdIvxYWaALcEhrNxnGq+Oto36XNJgEUGeQEd/0tIx4HW+BBHWF7IVkf3RjK2Mg eMU0vjIqKxZMPDLpZvdw+RQ6wp/WiMNcWtbj8+PNuARMRpjNHP4LNHaaGQV7Rts523KqJL 0vCw9k0qt7W2rqhg/94ObuK58oSC0+U= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-45-Ne4lsaF1M_q0BOkgV5obuQ-1; Tue, 25 Nov 2025 10:06:39 -0500 X-MC-Unique: Ne4lsaF1M_q0BOkgV5obuQ-1 X-Mimecast-MFC-AGG-ID: Ne4lsaF1M_q0BOkgV5obuQ_1764083170 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0E6B91800650; Tue, 25 Nov 2025 15:06:10 +0000 (UTC) Received: from rh.redhat.com (unknown [10.42.28.10]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 73A9F3003761; Tue, 25 Nov 2025 15:06:07 +0000 (UTC) From: Kevin Traynor To: Sivaprasad Tummala Cc: Venkat Kumar Ande , Dengdui Huang , Pavan Nikhilesh , Chengwen Feng , dpdk stable Subject: patch 'examples/l3fwd: add Tx burst size configuration option' has been queued to stable release 24.11.4 Date: Tue, 25 Nov 2025 15:05:50 +0000 Message-ID: <20251125150558.232595-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 7AoSbrrIdDTfsw1rpLJIryKXYNDeRNgrAI7Va12u9_E_1764083170 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 24.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 11/28/25. 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/d150d3359e9f7cbd22b2d34c0fdec7b101400e98 Thanks. Kevin --- >From d150d3359e9f7cbd22b2d34c0fdec7b101400e98 Mon Sep 17 00:00:00 2001 From: Sivaprasad Tummala Date: Thu, 6 Nov 2025 14:16:31 +0000 Subject: [PATCH] examples/l3fwd: add Tx burst size configuration option [ upstream commit 79375d1015b308234e8b6955671a296394249f9b ] Previously, the Tx burst size in l3fwd was fixed at 256, which could lead to suboptimal performance in certain scenarios. This patch introduces separate --rx-burst and --tx-burst options to explicitly configure Rx and Tx burst sizes. By default, the Tx burst size now matches the Rx burst size for better efficiency and pipeline balance. Fixes: d5c4897ecfb2 ("examples/l3fwd: add option to set Rx burst size") Signed-off-by: Sivaprasad Tummala Tested-by: Venkat Kumar Ande Tested-by: Dengdui Huang Tested-by: Pavan Nikhilesh Acked-by: Chengwen Feng --- doc/guides/sample_app_ug/l3_forward.rst | 6 ++ examples/l3fwd/l3fwd.h | 10 +--- examples/l3fwd/l3fwd_acl.c | 2 +- examples/l3fwd/l3fwd_common.h | 5 +- examples/l3fwd/l3fwd_em.c | 2 +- examples/l3fwd/l3fwd_fib.c | 2 +- examples/l3fwd/l3fwd_lpm.c | 2 +- examples/l3fwd/main.c | 80 +++++++++++++++---------- 8 files changed, 67 insertions(+), 42 deletions(-) diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index de347eeeb1..aba671d2b7 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -78,4 +78,6 @@ The application has a number of command line options:: [--lookup LOOKUP_METHOD] --config(port,queue,lcore)[,(port,queue,lcore)] + [--rx-burst NPKTS] + [--tx-burst NPKTS] [--eth-dest=X,MM:MM:MM:MM:MM:MM] [--max-pkt-len PKTLEN] @@ -114,4 +116,8 @@ Where, * ``--config (port,queue,lcore)[,(port,queue,lcore)]:`` Determines which queues from which ports are mapped to which cores. +* ``--rx-burst NPKTS:`` Optional, Rx burst size in decimal (default 32). + +* ``--tx-burst NPKTS:`` Optional, Tx burst size in decimal (default 32). + * ``--eth-dest=X,MM:MM:MM:MM:MM:MM:`` Optional, ethernet destination for port X. diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 0cce3406ee..471e3b488f 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -33,8 +33,4 @@ #define VECTOR_SIZE_DEFAULT MAX_PKT_BURST #define VECTOR_TMO_NS_DEFAULT 1E6 /* 1ms */ -/* - * Try to avoid TX buffering if we have at least MAX_TX_BURST packets to send. - */ -#define MAX_TX_BURST (MAX_PKT_BURST / 2) #define NB_SOCKETS 8 @@ -117,5 +113,5 @@ extern struct acl_algorithms acl_alg[]; extern uint32_t max_pkt_len; -extern uint32_t nb_pkt_per_burst; +extern uint32_t rx_burst_size; extern uint32_t mb_mempool_cache_size; @@ -153,6 +149,6 @@ send_single_packet(struct lcore_conf *qconf, /* enough pkts to be sent */ - if (unlikely(len == MAX_PKT_BURST)) { - send_burst(qconf, MAX_PKT_BURST, port); + if (unlikely(len == rx_burst_size)) { + send_burst(qconf, rx_burst_size, port); len = 0; } diff --git a/examples/l3fwd/l3fwd_acl.c b/examples/l3fwd/l3fwd_acl.c index 4fc4b986cc..a1275e18bc 100644 --- a/examples/l3fwd/l3fwd_acl.c +++ b/examples/l3fwd/l3fwd_acl.c @@ -1137,5 +1137,5 @@ acl_main_loop(__rte_unused void *dummy) queueid = qconf->rx_queue_list[i].queue_id; nb_rx = rte_eth_rx_burst(portid, queueid, - pkts_burst, nb_pkt_per_burst); + pkts_burst, rx_burst_size); if (nb_rx > 0) { diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h index d94e5f1357..ccaf0cd402 100644 --- a/examples/l3fwd/l3fwd_common.h +++ b/examples/l3fwd/l3fwd_common.h @@ -26,4 +26,7 @@ #define SENDM_PORT_OVERHEAD(x) (x) +extern uint32_t rx_burst_size; +extern uint32_t tx_burst_size; + /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -72,5 +75,5 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[], * then send them straightway. */ - if (num >= MAX_TX_BURST && len == 0) { + if (num >= tx_burst_size && len == 0) { n = rte_eth_tx_burst(port, qconf->tx_queue_id[port], m, num); if (unlikely(n < num)) { diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index da9c45e3a4..58c54ed77e 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -645,5 +645,5 @@ em_main_loop(__rte_unused void *dummy) queueid = qconf->rx_queue_list[i].queue_id; nb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst, - nb_pkt_per_burst); + rx_burst_size); if (nb_rx == 0) continue; diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c index 82f1739df7..4fc6bf90d5 100644 --- a/examples/l3fwd/l3fwd_fib.c +++ b/examples/l3fwd/l3fwd_fib.c @@ -240,5 +240,5 @@ fib_main_loop(__rte_unused void *dummy) queueid = qconf->rx_queue_list[i].queue_id; nb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst, - nb_pkt_per_burst); + rx_burst_size); if (nb_rx == 0) continue; diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index fec0aeb79c..a71eee69ec 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -206,5 +206,5 @@ lpm_main_loop(__rte_unused void *dummy) queueid = qconf->rx_queue_list[i].queue_id; nb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst, - nb_pkt_per_burst); + rx_burst_size); if (nb_rx == 0) continue; diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index ae3b4f6439..11aed26f94 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -58,6 +58,7 @@ static_assert(MEMPOOL_CACHE_SIZE >= MAX_PKT_BURST, "MAX_PKT_BURST should be at m uint16_t nb_rxd = RX_DESC_DEFAULT; uint16_t nb_txd = TX_DESC_DEFAULT; -uint32_t nb_pkt_per_burst = DEFAULT_PKT_BURST; +uint32_t rx_burst_size = DEFAULT_PKT_BURST; uint32_t mb_mempool_cache_size = MEMPOOL_CACHE_SIZE; +uint32_t tx_burst_size = DEFAULT_PKT_BURST; /**< Ports set in promiscuous mode off by default. */ @@ -401,5 +402,6 @@ print_usage(const char *prgname) " [--rx-queue-size NPKTS]" " [--tx-queue-size NPKTS]" - " [--burst NPKTS]" + " [--rx-burst NPKTS]" + " [--tx-burst NPKTS]" " [--mbcache CACHESZ]" " [--eth-dest=X,MM:MM:MM:MM:MM:MM]" @@ -428,5 +430,7 @@ print_usage(const char *prgname) " --tx-queue-size NPKTS: Tx queue size in decimal\n" " Default: %d\n" - " --burst NPKTS: Burst size in decimal\n" + " --rx-burst NPKTS: RX Burst size in decimal\n" + " Default: %d\n" + " --tx-burst NPKTS: TX Burst size in decimal\n" " Default: %d\n" " --mbcache CACHESZ: Mbuf cache size in decimal\n" @@ -461,6 +465,6 @@ print_usage(const char *prgname) " --rule_ipv6=FILE: Specify the ipv6 rules entries file.\n" " --alg: ACL classify method to use, one of: %s.\n\n", - prgname, RX_DESC_DEFAULT, TX_DESC_DEFAULT, DEFAULT_PKT_BURST, MEMPOOL_CACHE_SIZE, - ACL_LEAD_CHAR, ROUTE_LEAD_CHAR, alg); + prgname, RX_DESC_DEFAULT, TX_DESC_DEFAULT, DEFAULT_PKT_BURST, DEFAULT_PKT_BURST, + MEMPOOL_CACHE_SIZE, ACL_LEAD_CHAR, ROUTE_LEAD_CHAR, alg); } @@ -696,5 +700,5 @@ parse_mbcache_size(const char *optarg) static void -parse_pkt_burst(const char *optarg) +parse_pkt_burst(const char *optarg, bool is_rx_burst, uint32_t *burst_sz) { struct rte_eth_dev_info dev_info; @@ -711,29 +715,36 @@ parse_pkt_burst(const char *optarg) if (pkt_burst > MAX_PKT_BURST) { RTE_LOG(INFO, L3FWD, "User provided burst must be <= %d. Using default value %d\n", - MAX_PKT_BURST, nb_pkt_per_burst); + MAX_PKT_BURST, *burst_sz); return; } else if (pkt_burst > 0) { - nb_pkt_per_burst = (uint32_t)pkt_burst; + *burst_sz = (uint32_t)pkt_burst; return; } - /* If user gives a value of zero, query the PMD for its recommended Rx burst size. */ - ret = rte_eth_dev_info_get(0, &dev_info); - if (ret != 0) - return; - burst_size = dev_info.default_rxportconf.burst_size; - if (burst_size == 0) { - RTE_LOG(INFO, L3FWD, "PMD does not recommend a burst size. Using default value %d. " - "User provided value must be in [1, %d]\n", - nb_pkt_per_burst, MAX_PKT_BURST); - return; - } else if (burst_size > MAX_PKT_BURST) { - RTE_LOG(INFO, L3FWD, "PMD recommended burst size %d exceeds maximum value %d. " - "Using default value %d\n", - burst_size, MAX_PKT_BURST, nb_pkt_per_burst); - return; + if (is_rx_burst) { + /* If user gives a value of zero, query the PMD for its recommended + * Rx burst size. + */ + ret = rte_eth_dev_info_get(0, &dev_info); + if (ret != 0) + return; + burst_size = dev_info.default_rxportconf.burst_size; + if (burst_size == 0) { + RTE_LOG(INFO, L3FWD, "PMD does not recommend a burst size. Using default value %d. " + "User provided value must be in [1, %d]\n", + rx_burst_size, MAX_PKT_BURST); + return; + } else if (burst_size > MAX_PKT_BURST) { + RTE_LOG(INFO, L3FWD, "PMD recommended burst size %d exceeds maximum value %d. " + "Using default value %d\n", + burst_size, MAX_PKT_BURST, rx_burst_size); + return; + } + *burst_sz = burst_size; + RTE_LOG(INFO, L3FWD, "Using PMD-provided RX burst value %d\n", burst_size); + } else { + RTE_LOG(INFO, L3FWD, "User provided TX burst is 0. Using default value %d\n", + *burst_sz); } - nb_pkt_per_burst = burst_size; - RTE_LOG(INFO, L3FWD, "Using PMD-provided burst value %d\n", burst_size); } @@ -769,5 +780,6 @@ static const char short_options[] = #define CMD_LINE_OPT_RULE_IPV6 "rule_ipv6" #define CMD_LINE_OPT_ALG "alg" -#define CMD_LINE_OPT_PKT_BURST "burst" +#define CMD_LINE_OPT_PKT_RX_BURST "rx-burst" +#define CMD_LINE_OPT_PKT_TX_BURST "tx-burst" #define CMD_LINE_OPT_MB_CACHE_SIZE "mbcache" @@ -800,5 +812,6 @@ enum { CMD_LINE_OPT_VECTOR_SIZE_NUM, CMD_LINE_OPT_VECTOR_TMO_NS_NUM, - CMD_LINE_OPT_PKT_BURST_NUM, + CMD_LINE_OPT_PKT_RX_BURST_NUM, + CMD_LINE_OPT_PKT_TX_BURST_NUM, CMD_LINE_OPT_MB_CACHE_SIZE_NUM, }; @@ -828,5 +841,6 @@ static const struct option lgopts[] = { {CMD_LINE_OPT_RULE_IPV6, 1, 0, CMD_LINE_OPT_RULE_IPV6_NUM}, {CMD_LINE_OPT_ALG, 1, 0, CMD_LINE_OPT_ALG_NUM}, - {CMD_LINE_OPT_PKT_BURST, 1, 0, CMD_LINE_OPT_PKT_BURST_NUM}, + {CMD_LINE_OPT_PKT_RX_BURST, 1, 0, CMD_LINE_OPT_PKT_RX_BURST_NUM}, + {CMD_LINE_OPT_PKT_TX_BURST, 1, 0, CMD_LINE_OPT_PKT_TX_BURST_NUM}, {CMD_LINE_OPT_MB_CACHE_SIZE, 1, 0, CMD_LINE_OPT_MB_CACHE_SIZE_NUM}, {NULL, 0, 0, 0} @@ -918,6 +932,10 @@ parse_args(int argc, char **argv) break; - case CMD_LINE_OPT_PKT_BURST_NUM: - parse_pkt_burst(optarg); + case CMD_LINE_OPT_PKT_RX_BURST_NUM: + parse_pkt_burst(optarg, true, &rx_burst_size); + break; + + case CMD_LINE_OPT_PKT_TX_BURST_NUM: + parse_pkt_burst(optarg, false, &tx_burst_size); break; @@ -1655,4 +1673,6 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n"); + RTE_LOG(INFO, L3FWD, "Using Rx burst %u Tx burst %u\n", rx_burst_size, tx_burst_size); + /* Setup function pointers for lookup method. */ setup_l3fwd_lookup_tables(); -- 2.51.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-11-25 15:03:57.886858147 +0000 +++ 0001-examples-l3fwd-add-Tx-burst-size-configuration-optio.patch 2025-11-25 15:03:57.826651313 +0000 @@ -1 +1 @@ -From 79375d1015b308234e8b6955671a296394249f9b Mon Sep 17 00:00:00 2001 +From d150d3359e9f7cbd22b2d34c0fdec7b101400e98 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 79375d1015b308234e8b6955671a296394249f9b ] + @@ -33 +35 @@ -index 9b0d0350aa..c50a421fd0 100644 +index de347eeeb1..aba671d2b7 100644