patches for DPDK stable branches
 help / color / mirror / Atom feed
* patch 'examples/l3fwd: add Tx burst size configuration option' has been queued to stable release 24.11.4
@ 2025-11-25 15:05 Kevin Traynor
  2025-11-25 15:05 ` patch 'examples/server_node_efd: fix format overflow' " Kevin Traynor
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Kevin Traynor @ 2025-11-25 15:05 UTC (permalink / raw)
  To: Sivaprasad Tummala
  Cc: Venkat Kumar Ande, Dengdui Huang, Pavan Nikhilesh, Chengwen Feng,
	dpdk stable

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 <sivaprasad.tummala@amd.com>
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 <sivaprasad.tummala@amd.com>
Tested-by: Venkat Kumar Ande <venkatkumar.ande@amd.com>
Tested-by: Dengdui Huang <huangdengdui@huawei.com>
Tested-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-26 11:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-25 15:05 patch 'examples/l3fwd: add Tx burst size configuration option' has been queued to stable release 24.11.4 Kevin Traynor
2025-11-25 15:05 ` patch 'examples/server_node_efd: fix format overflow' " Kevin Traynor
2025-11-25 15:05 ` patch 'examples/vdpa: " Kevin Traynor
2025-11-25 15:05 ` patch 'net/mlx5: fix flex flow item header length' " Kevin Traynor
2025-11-25 15:05 ` patch 'doc: add Pollara 400 device in ionic guide' " Kevin Traynor
2025-11-25 15:13   ` Kevin Traynor
2025-11-25 15:26     ` Boyer, Andrew
2025-11-25 15:05 ` patch 'doc: fix note in FreeBSD " Kevin Traynor
2025-11-26 11:08 ` patch 'examples/l3fwd: add Tx burst size configuration option' " Kevin Traynor
2025-11-26 11:19   ` Ande, Venkat Kumar
2025-11-26 11:51     ` Kevin Traynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).