[PATCH] app/testpmd: reduce txonly multi-flow src_port range

Long Li
2026-02-26T19:16:37Z

Reduce the UDP source port OR-mask from 0xC0 to 0xF0, lowering
unique high-byte values from 64 to 16 (16 unique ports per lcore).

Modern SmartNICs rarely need more than 16 queues to saturate RX,
and excessive unique ports can exhaust hardware flow caching,
degrading performance.

Unique source ports by lcore count:
1: 16, 2: 32, 4: 64, 8: 128, 16: 256

Signed-off-by: Long Li <longli@microsoft.com>
---
app/test-pmd/txonly.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index bdcf6ea660..bb97a81402 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -229,12 +229,11 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp,
* packet generator for developer's quick performance
* regression test.
*
- * Only ports in the range 49152 (0xC000) and 65535 (0xFFFF)
- * will be used, with the least significant byte representing
- * the lcore ID. As such, the most significant byte will cycle
- * through 0xC0 and 0xFF.
+ * Generate ports in the IANA ephemeral range (49152+).
+ * The OR-mask (0xF0) produces 16 unique port values
+ * per lcore for good RSS distribution.
*/
- src_port = ((src_var++ | 0xC0) << 8) + rte_lcore_id();
+ src_port = ((src_var++ | 0xF0) << 8) + rte_lcore_id();
udp_hdr->src_port = rte_cpu_to_be_16(src_port);
RTE_PER_LCORE(_src_port_var) = src_var;
}
--
2.43.0