diff mbox series

[v1,1/2] test: Make odp_pktio_perf more scalable

Message ID 1506092406-26086-2-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v1,1/2] test: Make odp_pktio_perf more scalable | expand

Commit Message

Github ODP bot Sept. 22, 2017, 3 p.m. UTC
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>


Change-Id: Ic3f4e5871a6fdd3c29bfb27ff0af1dc3b301750c
---
/** 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: c2ed3f71a8d61449c5e35ce201f020a74a8ea244
 ** Merge commit sha: 8f53c33c86e77be34933d9aeeb3ff3793c941b44
 **/
 test/common_plat/performance/odp_pktio_perf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/test/common_plat/performance/odp_pktio_perf.c b/test/common_plat/performance/odp_pktio_perf.c
index a170e1285..210a833fe 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);
@@ -263,9 +261,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;
 	}