From: "Ande, Venkat Kumar" <VenkatKumar.Ande@amd.com>
To: "Tummala, Sivaprasad" <Sivaprasad.Tummala@amd.com>,
"david.hunt@intel.com" <david.hunt@intel.com>,
"anatoly.burakov@intel.com" <anatoly.burakov@intel.com>,
"jerinj@marvell.com" <jerinj@marvell.com>,
"radu.nicolau@intel.com" <radu.nicolau@intel.com>,
"gakhil@marvell.com" <gakhil@marvell.com>,
"cristian.dumitrescu@intel.com" <cristian.dumitrescu@intel.com>,
"Yigit, Ferruh" <Ferruh.Yigit@amd.com>,
"konstantin.ananyev@huawei.com" <konstantin.ananyev@huawei.com>,
"mb@smartsharesystems.com" <mb@smartsharesystems.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"haijie1@huawei.com" <haijie1@huawei.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH] examples/l3fwd: adjust Tx burst size based on Rx burst
Date: Wed, 12 Feb 2025 09:46:30 +0000 [thread overview]
Message-ID: <DM4PR12MB5104DB1957A1FCCD736F4A359EFC2@DM4PR12MB5104.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20250212045416.2393001-1-sivaprasad.tummala@amd.com>
[AMD Official Use Only - AMD Internal Distribution Only]
Tested-by: Venkat Kumar Ande <VenkatKumar.Ande@amd.com>
-----Original Message-----
From: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Sent: Wednesday, February 12, 2025 10:24 AM
To: david.hunt@intel.com; anatoly.burakov@intel.com; jerinj@marvell.com; radu.nicolau@intel.com; gakhil@marvell.com; cristian.dumitrescu@intel.com; Yigit, Ferruh <Ferruh.Yigit@amd.com>; konstantin.ananyev@huawei.com; mb@smartsharesystems.com
Cc: dev@dpdk.org; haijie1@huawei.com; stable@dpdk.org
Subject: [PATCH] examples/l3fwd: adjust Tx burst size based on Rx burst
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Previously, the TX burst size was fixed at 256, leading to performance degradation in certain scenarios.
This patch introduces logic to set the TX burst size to match the configured RX burst size (--burst option, default 32, max 512) for better efficiency.
Fixes: d5c4897ecfb2 ("examples/l3fwd: add option to set Rx burst size")
Cc: haijie1@huawei.com
Cc: stable@dpdk.org
Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
examples/l3fwd/l3fwd.h | 6 +++---
examples/l3fwd/l3fwd_common.h | 11 +++++++----
examples/l3fwd/main.c | 2 ++
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 0cce3406ee..9d7c73504b 100644
--- a/examples/l3fwd/l3fwd.h
+++ b/examples/l3fwd/l3fwd.h
@@ -35,7 +35,7 @@
/*
* 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 MAX_TX_BURST (DEFAULT_PKT_BURST / 2)
#define NB_SOCKETS 8
@@ -152,8 +152,8 @@ send_single_packet(struct lcore_conf *qconf,
len++;
/* enough pkts to be sent */
- if (unlikely(len == MAX_PKT_BURST)) {
- send_burst(qconf, MAX_PKT_BURST, port);
+ if (unlikely(len == nb_pkt_per_burst)) {
+ send_burst(qconf, nb_pkt_per_burst, port);
len = 0;
}
diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h index d94e5f1357..6cb7de5144 100644
--- a/examples/l3fwd/l3fwd_common.h
+++ b/examples/l3fwd/l3fwd_common.h
@@ -25,6 +25,9 @@
*/
#define SENDM_PORT_OVERHEAD(x) (x)
+extern uint32_t nb_pkt_per_burst;
+extern uint32_t max_tx_burst;
+
/*
* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2:
* - The IP version number must be 4.
@@ -71,7 +74,7 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[],
* If TX buffer for that queue is empty, and we have enough packets,
* then send them straightway.
*/
- if (num >= MAX_TX_BURST && len == 0) {
+ if (num >= max_tx_burst && len == 0) {
n = rte_eth_tx_burst(port, qconf->tx_queue_id[port], m, num);
if (unlikely(n < num)) {
do {
@@ -86,7 +89,7 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[],
*/
n = len + num;
- n = (n > MAX_PKT_BURST) ? MAX_PKT_BURST - len : num;
+ n = (n > nb_pkt_per_burst) ? nb_pkt_per_burst - len : num;
j = 0;
switch (n % FWDSTEP) {
@@ -112,9 +115,9 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[],
len += n;
/* enough pkts to be sent */
- if (unlikely(len == MAX_PKT_BURST)) {
+ if (unlikely(len == nb_pkt_per_burst)) {
- send_burst(qconf, MAX_PKT_BURST, port);
+ send_burst(qconf, nb_pkt_per_burst, port);
/* copy rest of the packets into the TX buffer. */
len = num - n;
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 994b7dd8e5..4cabd05be2 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -59,6 +59,7 @@ 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 mb_mempool_cache_size = MEMPOOL_CACHE_SIZE;
+uint32_t max_tx_burst = MAX_TX_BURST;
/**< Ports set in promiscuous mode off by default. */ static int promiscuous_on; @@ -733,6 +734,7 @@ parse_pkt_burst(const char *optarg)
return;
}
nb_pkt_per_burst = burst_size;
+ max_tx_burst = burst_size / 2;
RTE_LOG(INFO, L3FWD, "Using PMD-provided burst value %d\n", burst_size); }
--
2.34.1
prev parent reply other threads:[~2025-02-12 9:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 4:54 Sivaprasad Tummala
2025-02-12 9:17 ` Ande, Venkat Kumar
2025-02-12 9:46 ` Ande, Venkat Kumar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM4PR12MB5104DB1957A1FCCD736F4A359EFC2@DM4PR12MB5104.namprd12.prod.outlook.com \
--to=venkatkumar.ande@amd.com \
--cc=Ferruh.Yigit@amd.com \
--cc=Sivaprasad.Tummala@amd.com \
--cc=anatoly.burakov@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=haijie1@huawei.com \
--cc=jerinj@marvell.com \
--cc=konstantin.ananyev@huawei.com \
--cc=mb@smartsharesystems.com \
--cc=radu.nicolau@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).