[v6,2/2] test: make odp_pktio_perf more scalable

Message ID 1507644014-13917-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • test: Increase scalability and performance of odp_pktio_perf
Related show

Commit Message

Github ODP bot Oct. 10, 2017, 2 p.m.
From: Ola Liljedahl <ola.liljedahl@arm.com>


Amortise overhead of atomic increment over multiple packets
so to minimise this scalability bottleneck.

Signed-off-by: Ola Liljedahl <ola.liljedahl@arm.com>

Reviewed-by: Brian Brooks <brian.brooks@arm.com>


Jira: ENTNET-487

Change-Id: Idefb23da5d9b9b9c2c82eb46533cdf82dc19442e
---
/** Email created from pull request 188 (WonderfulVoid:master)
 ** https://github.com/Linaro/odp/pull/188
 ** Patch: https://github.com/Linaro/odp/pull/188.patch
 ** Base sha: 3bacbfd55edf76b897a4b2e5c62b59ca6fa95331
 ** Merge commit sha: 63cba8b410fd2e58a1d373bea42a956639022782
 **/
 test/common_plat/performance/odp_pktio_perf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch

diff --git a/test/common_plat/performance/odp_pktio_perf.c b/test/common_plat/performance/odp_pktio_perf.c
index e13a850a3..b749ee9b9 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -167,14 +167,13 @@  static test_globals_t *gbl_args;
 /*
  * Generate a single test packet for transmission.
  */
-static odp_packet_t pktio_create_packet(void)
+static odp_packet_t pktio_create_packet(uint32_t seq)
 {
 	odp_packet_t pkt;
 	odph_ethhdr_t *eth;
 	odph_ipv4hdr_t *ip;
 	odph_udphdr_t *udp;
 	char *buf;
-	uint16_t seq;
 	uint32_t offset;
 	pkt_head_t pkt_hdr;
 	size_t payload_len;
@@ -209,7 +208,6 @@  static odp_packet_t pktio_create_packet(void)
 				       ODPH_IPV4HDR_LEN);
 	ip->ttl = 128;
 	ip->proto = ODPH_IPPROTO_UDP;
-	seq = odp_atomic_fetch_inc_u32(&ip_seq);
 	ip->id = odp_cpu_to_be_16(seq);
 	ip->chksum = 0;
 	odph_ipv4_csum_update(pkt);
@@ -261,9 +259,11 @@  static int pktio_pkt_has_magic(odp_packet_t pkt)
 static int alloc_packets(odp_packet_t *pkt_tbl, int num_pkts)
 {
 	int n;
+	uint16_t seq;
 
+	seq = odp_atomic_fetch_add_u32(&ip_seq, num_pkts);
 	for (n = 0; n < num_pkts; ++n) {
-		pkt_tbl[n] = pktio_create_packet();
+		pkt_tbl[n] = pktio_create_packet(seq + n);
 		if (pkt_tbl[n] == ODP_PACKET_INVALID)
 			break;
 	}