patch 'test: fix segment length in packet generator' has been queued to stable release 20.11.8

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Mar 22 01:41:40 CET 2023


Hi,

FYI, your patch has been queued to stable release 20.11.8

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/23/23. 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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/5e6d899166d0e85d3111f2c51b7c542dc93b1b88

Thanks.

Luca Boccassi

---
>From 5e6d899166d0e85d3111f2c51b7c542dc93b1b88 Mon Sep 17 00:00:00 2001
From: Zhuobin Huang <zobin1999 at gmail.com>
Date: Mon, 6 Mar 2023 14:51:56 +0800
Subject: [PATCH] test: fix segment length in packet generator

[ upstream commit b88b8af25e7cbb267584bd4c36d3615c4b20109f ]

Assign correct data length to each segments according to the given
pkt_len and nb_pkt_segs, instead of using pkt_len as the data_len
of every packet segment.

Fixes: a9c9e9698d5e ("app/test: allow to create packets of different sizes")

Signed-off-by: Zhuobin Huang <zobin1999 at gmail.com>
Reviewed-by: David Marchand <david.marchand at redhat.com>
---
 app/test/packet_burst_generator.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c
index 0fd7290b0e..121eaf4da6 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -262,11 +262,11 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
 		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)
 {
-	int i, nb_pkt = 0;
-	size_t eth_hdr_size;
-
+	const uint8_t pkt_seg_data_len = pkt_len / nb_pkt_segs;
 	struct rte_mbuf *pkt_seg;
 	struct rte_mbuf *pkt;
+	size_t eth_hdr_size;
+	int i, nb_pkt = 0;
 
 	for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
 		pkt = rte_pktmbuf_alloc(mp);
@@ -277,7 +277,7 @@ nomore_mbuf:
 			break;
 		}
 
-		pkt->data_len = pkt_len;
+		pkt->data_len = pkt_seg_data_len;
 		pkt_seg = pkt;
 		for (i = 1; i < nb_pkt_segs; i++) {
 			pkt_seg->next = rte_pktmbuf_alloc(mp);
@@ -287,7 +287,10 @@ nomore_mbuf:
 				goto nomore_mbuf;
 			}
 			pkt_seg = pkt_seg->next;
-			pkt_seg->data_len = pkt_len;
+			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->next = NULL; /* Last segment of packet. */
 
@@ -343,11 +346,11 @@ generate_packet_burst_proto(struct rte_mempool *mp,
 		uint8_t ipv4, uint8_t proto, void *proto_hdr,
 		int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs)
 {
-	int i, nb_pkt = 0;
-	size_t eth_hdr_size;
-
+	const uint8_t pkt_seg_data_len = pkt_len / nb_pkt_segs;
 	struct rte_mbuf *pkt_seg;
 	struct rte_mbuf *pkt;
+	size_t eth_hdr_size;
+	int i, nb_pkt = 0;
 
 	for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
 		pkt = rte_pktmbuf_alloc(mp);
@@ -358,7 +361,7 @@ nomore_mbuf:
 			break;
 		}
 
-		pkt->data_len = pkt_len;
+		pkt->data_len = pkt_seg_data_len;
 		pkt_seg = pkt;
 		for (i = 1; i < nb_pkt_segs; i++) {
 			pkt_seg->next = rte_pktmbuf_alloc(mp);
@@ -368,7 +371,10 @@ nomore_mbuf:
 				goto nomore_mbuf;
 			}
 			pkt_seg = pkt_seg->next;
-			pkt_seg->data_len = pkt_len;
+			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->next = NULL; /* Last segment of packet. */
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-21 21:56:37.217270782 +0000
+++ 0004-test-fix-segment-length-in-packet-generator.patch	2023-03-21 21:56:37.008805712 +0000
@@ -1 +1 @@
-From b88b8af25e7cbb267584bd4c36d3615c4b20109f Mon Sep 17 00:00:00 2001
+From 5e6d899166d0e85d3111f2c51b7c542dc93b1b88 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit b88b8af25e7cbb267584bd4c36d3615c4b20109f ]
+
@@ -15 +16,0 @@
- .mailmap                          |  1 +
@@ -17 +18 @@
- 2 files changed, 17 insertions(+), 10 deletions(-)
+ 1 file changed, 16 insertions(+), 10 deletions(-)
@@ -19,12 +19,0 @@
-diff --git a/.mailmap b/.mailmap
-index 4018f0fc47..6a56239c3a 100644
---- a/.mailmap
-+++ b/.mailmap
-@@ -1584,6 +1584,7 @@ Zhipeng Lu <luzhipeng at cestc.cn>
- Zhirun Yan <zhirun.yan at intel.com>
- Zhiwei He <zhiwei.he at intel.com>
- Zhiyong Yang <zhiyong.yang at intel.com>
-+Zhuobin Huang <zobin1999 at gmail.com>
- Zi Hu <huzilucky at gmail.com>
- Zijie Pan <zijie.pan at 6wind.com>
- Ziyang Xuan <xuanziyang2 at huawei.com>
@@ -32 +21 @@
-index 6b42b9b83b..867a88da00 100644
+index 0fd7290b0e..121eaf4da6 100644
@@ -35 +24 @@
-@@ -263,11 +263,11 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
+@@ -262,11 +262,11 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
@@ -50 +39 @@
-@@ -278,7 +278,7 @@ nomore_mbuf:
+@@ -277,7 +277,7 @@ nomore_mbuf:
@@ -59 +48 @@
-@@ -288,7 +288,10 @@ nomore_mbuf:
+@@ -287,7 +287,10 @@ nomore_mbuf:
@@ -71 +60 @@
-@@ -344,11 +347,11 @@ generate_packet_burst_proto(struct rte_mempool *mp,
+@@ -343,11 +346,11 @@ generate_packet_burst_proto(struct rte_mempool *mp,
@@ -86 +75 @@
-@@ -359,7 +362,7 @@ nomore_mbuf:
+@@ -358,7 +361,7 @@ nomore_mbuf:
@@ -95 +84 @@
-@@ -369,7 +372,10 @@ nomore_mbuf:
+@@ -368,7 +371,10 @@ nomore_mbuf:


More information about the stable mailing list