From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v4 2/3] test: generate larger packet bursts
Date: Sat, 10 Jan 2026 09:22:37 -0800 [thread overview]
Message-ID: <20260110172336.9859-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20260110172336.9859-1-stephen@networkplumber.org>
The packet length in packet burst generator was uint8_t which
limited usefulness for testing larger packet sizes.
The number of packets segments per packet is currently limited
by mbuf nb_segs which is 16 bits. The comment is incorrect.
Change nb_pkt_per_burst to uint16_t since that is the limit
for tx_burst.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/packet_burst_generator.c | 38 +++++++++++++++++--------------
app/test/packet_burst_generator.h | 4 ++--
2 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c
index 4c17737739..548296e33e 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -205,24 +205,23 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr,
return pkt_len;
}
-/*
- * The maximum number of segments per packet is used when creating
- * scattered transmit packets composed of a list of mbufs.
- */
-#define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned char. */
-
int
generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled,
void *ip_hdr, uint8_t ipv4, struct rte_udp_hdr *udp_hdr,
- int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs)
+ uint16_t nb_pkt_per_burst, uint16_t pkt_len, uint16_t nb_pkt_segs)
{
- const uint8_t pkt_seg_data_len = pkt_len / nb_pkt_segs;
+ int i, nb_pkt = 0;
+ size_t eth_hdr_size;
struct rte_mbuf *pkt_seg;
struct rte_mbuf *pkt;
- size_t eth_hdr_size;
- int i, nb_pkt = 0;
+ uint16_t pkt_seg_data_len;
+ uint16_t last_seg_data_len;
+
+ /* Calculate per-segment data length */
+ pkt_seg_data_len = pkt_len / nb_pkt_segs;
+ last_seg_data_len = pkt_seg_data_len + (pkt_len % nb_pkt_segs);
for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
pkt = rte_pktmbuf_alloc(mp);
@@ -243,10 +242,10 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
goto nomore_mbuf;
}
pkt_seg = pkt_seg->next;
- if (i != nb_pkt_segs - 1)
+ if (i != (int)(nb_pkt_segs - 1))
pkt_seg->data_len = pkt_seg_data_len;
else
- pkt_seg->data_len = pkt_seg_data_len + pkt_len % nb_pkt_segs;
+ pkt_seg->data_len = last_seg_data_len;
}
pkt_seg->next = NULL; /* Last segment of packet. */
@@ -300,13 +299,18 @@ generate_packet_burst_proto(struct rte_mempool *mp,
struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr,
uint8_t vlan_enabled, void *ip_hdr,
uint8_t ipv4, uint8_t proto, void *proto_hdr,
- int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs)
+ uint16_t nb_pkt_per_burst, uint16_t pkt_len, uint16_t nb_pkt_segs)
{
- const uint8_t pkt_seg_data_len = pkt_len / nb_pkt_segs;
+ int i, nb_pkt = 0;
+ size_t eth_hdr_size;
struct rte_mbuf *pkt_seg;
struct rte_mbuf *pkt;
- size_t eth_hdr_size;
- int i, nb_pkt = 0;
+ uint16_t pkt_seg_data_len;
+ uint16_t last_seg_data_len;
+
+ /* Calculate per-segment data length */
+ pkt_seg_data_len = pkt_len / nb_pkt_segs;
+ last_seg_data_len = pkt_seg_data_len + (pkt_len % nb_pkt_segs);
for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
pkt = rte_pktmbuf_alloc(mp);
@@ -330,7 +334,7 @@ generate_packet_burst_proto(struct rte_mempool *mp,
if (i != nb_pkt_segs - 1)
pkt_seg->data_len = pkt_seg_data_len;
else
- pkt_seg->data_len = pkt_seg_data_len + pkt_len % nb_pkt_segs;
+ pkt_seg->data_len = last_seg_data_len;
}
pkt_seg->next = NULL; /* Last segment of packet. */
diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h
index cce41bcd0f..bc16764e77 100644
--- a/app/test/packet_burst_generator.h
+++ b/app/test/packet_burst_generator.h
@@ -62,14 +62,14 @@ int
generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled,
void *ip_hdr, uint8_t ipv4, struct rte_udp_hdr *udp_hdr,
- int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs);
+ uint16_t nb_pkt_per_burst, uint16_t pkt_len, uint16_t nb_pkt_segs);
int
generate_packet_burst_proto(struct rte_mempool *mp,
struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr,
uint8_t vlan_enabled, void *ip_hdr,
uint8_t ipv4, uint8_t proto, void *proto_hdr,
- int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs);
+ uint16_t nb_pkt_per_burst, uint16_t pkt_len, uint16_t nb_pkt_segs);
#ifdef __cplusplus
}
--
2.51.0
next prev parent reply other threads:[~2026-01-10 17:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 22:25 [PATCH] test: add a test for null PMD Stephen Hemminger
2026-01-05 14:49 ` Marat Khalili
2026-01-05 17:38 ` Stephen Hemminger
2026-01-06 16:47 ` [PATCH v2 0/2] net/null: add a test Stephen Hemminger
2026-01-06 16:47 ` [PATCH v2 1/2] test: add a test for null PMD Stephen Hemminger
2026-01-06 17:40 ` Marat Khalili
2026-01-06 18:01 ` Stephen Hemminger
2026-01-06 16:47 ` [PATCH v2 2/2] net/null: revise info_get Stephen Hemminger
2026-01-08 20:40 ` [PATCH v3 0/3] test: new test for null PMD Stephen Hemminger
2026-01-08 20:40 ` [PATCH v3 1/3] net/null: cleanup info_get Stephen Hemminger
2026-01-08 20:40 ` [PATCH v3 2/3] test: allow larger packet sizes Stephen Hemminger
2026-01-09 15:00 ` Morten Brørup
2026-01-10 17:21 ` Stephen Hemminger
2026-01-08 20:40 ` [PATCH v3 3/3] test: add a test for null PMD Stephen Hemminger
2026-01-09 1:21 ` Stephen Hemminger
2026-01-10 17:22 ` [PATCH v4 0/3] null pmd minor cleanup and add test Stephen Hemminger
2026-01-10 17:22 ` [PATCH v4 1/3] net/null: cleanup info_get Stephen Hemminger
2026-01-10 17:22 ` Stephen Hemminger [this message]
2026-01-10 17:22 ` [PATCH v4 3/3] test: add a test for null PMD Stephen Hemminger
2026-01-12 0:56 ` [PATCH v4 0/3] null pmd minor cleanup and add test Stephen Hemminger
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=20260110172336.9859-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@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).