DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: make txonly mode generate multiple flows
@ 2017-12-15 21:11 Yongseok Koh
  2018-01-12 18:08 ` Thomas Monjalon
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Yongseok Koh @ 2017-12-15 21:11 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, Yongseok Koh

Testpmd can generate multiple flows without taking much cost and this could
be a simple traffic generator for developer's quick tests. IP destination
address is varied.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 app/test-pmd/txonly.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 309c73893..aa4c379c4 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -73,7 +73,7 @@
 #define UDP_DST_PORT 1024
 
 #define IP_SRC_ADDR ((192U << 24) | (168 << 16) | (0 << 8) | 1)
-#define IP_DST_ADDR ((192U << 24) | (168 << 16) | (0 << 8) | 2)
+#define IP_DST_ADDR ((192U << 24) | (168 << 16))
 
 #define IP_DEFTTL  64   /* from RFC 1340. */
 #define IP_VERSION 0x40
@@ -81,6 +81,7 @@
 #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 
 static struct ipv4_hdr  pkt_ip_hdr;  /**< IP header of transmitted packets. */
+static __thread uint8_t ip_var; /**< IP address variation */
 static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */
 
 static void
@@ -187,6 +188,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
 	struct rte_mbuf *pkt_seg;
 	struct rte_mempool *mbp;
 	struct ether_hdr eth_hdr;
+	struct ipv4_hdr *ip_hdr;
 	uint16_t nb_tx;
 	uint16_t nb_pkt;
 	uint16_t vlan_tci, vlan_tci_outer;
@@ -263,6 +265,14 @@ pkt_burst_transmit(struct fwd_stream *fs)
 		copy_buf_to_pkt(&eth_hdr, sizeof(eth_hdr), pkt, 0);
 		copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt,
 				sizeof(struct ether_hdr));
+		ip_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *,
+						 sizeof(struct ether_hdr));
+		/*
+		 * Generate multiple flows by varying IP dest addr.
+		 */
+		ip_hdr->dst_addr =
+			rte_cpu_to_be_32(IP_DST_ADDR | (ip_var++ << 8) |
+					 (rte_lcore_id() + 1));
 		copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt,
 				sizeof(struct ether_hdr) +
 				sizeof(struct ipv4_hdr));
-- 
2.11.0

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

end of thread, other threads:[~2019-03-29 18:44 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-15 21:11 [dpdk-dev] [PATCH] app/testpmd: make txonly mode generate multiple flows Yongseok Koh
2018-01-12 18:08 ` Thomas Monjalon
2018-01-16  2:40 ` Lu, Wenzhuo
2018-01-17 18:04   ` Yongseok Koh
2018-01-17 18:18 ` [dpdk-dev] [PATCH v2] " Yongseok Koh
2018-01-18  1:22   ` Lu, Wenzhuo
2018-01-18 12:21   ` Ananyev, Konstantin
2018-01-19  7:09     ` Yongseok Koh
2018-01-19 11:02       ` Ananyev, Konstantin
2018-01-18 13:55   ` Jerin Jacob
2019-03-28  1:51 ` [dpdk-dev] [PATCH v3] " Yongseok Koh
2019-03-28  1:51   ` Yongseok Koh
2019-03-28 10:24   ` Iremonger, Bernard
2019-03-28 10:24     ` Iremonger, Bernard
2019-03-28 17:33     ` Yongseok Koh
2019-03-28 17:33       ` Yongseok Koh
2019-03-28 17:42       ` Iremonger, Bernard
2019-03-28 17:42         ` Iremonger, Bernard
2019-03-28 18:46 ` [dpdk-dev] [PATCH v4] " Yongseok Koh
2019-03-28 18:46   ` Yongseok Koh
2019-03-29  9:55   ` Iremonger, Bernard
2019-03-29  9:55     ` Iremonger, Bernard
2019-03-29 18:44     ` Ferruh Yigit
2019-03-29 18:44       ` Ferruh Yigit

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).