diff mbox series

[API-NEXT,v3,3/4] validation: packet: add num_pkt parameter to parse_test_alloc

Message ID 1534759208-15203-4-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v3,1/4] api: packet: add parse result call | expand

Commit Message

Github ODP bot Aug. 20, 2018, 10 a.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


It's more robust to use a parameter instead of assuming that
a fixed number of packets are allocated.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 672 (psavol:next-packet-metadata)
 ** https://github.com/Linaro/odp/pull/672
 ** Patch: https://github.com/Linaro/odp/pull/672.patch
 ** Base sha: 2722279b31b075586551801eb2860687ff966ea8
 ** Merge commit sha: e76448d8a8f2575ab3a4c445be84d19f055cbf2d
 **/
 test/validation/api/packet/packet.c | 47 ++++++++++++++---------------
 1 file changed, 23 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c
index fa7ce8b82..280e5c829 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -2561,10 +2561,9 @@  static int packet_parse_suite_term(void)
 }
 
 static void parse_test_alloc(odp_packet_t pkt[], const uint8_t test_packet[],
-			     uint32_t len)
+			     uint32_t len, int num_pkt)
 {
 	int ret, i;
-	int num_pkt = PARSE_TEST_NUM_PKT;
 
 	ret = odp_packet_alloc_multi(parse_test.pool, len, pkt, num_pkt);
 	CU_ASSERT_FATAL(ret == num_pkt);
@@ -2585,7 +2584,7 @@  static void parse_eth_ipv4_udp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_udp,
-			 sizeof(test_packet_ipv4_udp));
+			 sizeof(test_packet_ipv4_udp), num_pkt);
 
 	for (i = 0; i < num_pkt; i++) {
 		chksum_status = odp_packet_l3_chksum_status(pkt[i]);
@@ -2629,7 +2628,7 @@  static void parse_ipv4_udp(void)
 	uint32_t offset[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_udp,
-			 sizeof(test_packet_ipv4_udp));
+			 sizeof(test_packet_ipv4_udp), num_pkt);
 
 	for (i = 0; i < num_pkt; i++)
 		offset[i] = 14;
@@ -2665,7 +2664,7 @@  static void parse_eth_ipv4_tcp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_tcp,
-			 sizeof(test_packet_ipv4_tcp));
+			 sizeof(test_packet_ipv4_tcp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2701,7 +2700,7 @@  static void parse_eth_ipv6_udp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv6_udp,
-			 sizeof(test_packet_ipv6_udp));
+			 sizeof(test_packet_ipv6_udp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2731,7 +2730,7 @@  static void parse_eth_ipv6_tcp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv6_tcp,
-			 sizeof(test_packet_ipv6_tcp));
+			 sizeof(test_packet_ipv6_tcp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_ALL;
@@ -2761,7 +2760,7 @@  static void parse_eth_vlan_ipv4_udp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_vlan_ipv4_udp,
-			 sizeof(test_packet_vlan_ipv4_udp));
+			 sizeof(test_packet_vlan_ipv4_udp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2792,7 +2791,7 @@  static void parse_eth_vlan_ipv6_udp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_vlan_ipv6_udp,
-			 sizeof(test_packet_vlan_ipv6_udp));
+			 sizeof(test_packet_vlan_ipv6_udp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2829,7 +2828,7 @@  static void parse_eth_vlan_qinq_ipv4_udp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_vlan_qinq_ipv4_udp,
-			 sizeof(test_packet_vlan_qinq_ipv4_udp));
+			 sizeof(test_packet_vlan_qinq_ipv4_udp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2861,7 +2860,7 @@  static void parse_eth_arp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_arp,
-			 sizeof(test_packet_arp));
+			 sizeof(test_packet_arp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2893,7 +2892,7 @@  static void parse_eth_ipv4_icmp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_icmp,
-			 sizeof(test_packet_ipv4_icmp));
+			 sizeof(test_packet_ipv4_icmp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2924,7 +2923,7 @@  static void parse_eth_ipv6_icmp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv6_icmp,
-			 sizeof(test_packet_ipv6_icmp));
+			 sizeof(test_packet_ipv6_icmp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2955,7 +2954,7 @@  static void parse_eth_ipv4_sctp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_sctp,
-			 sizeof(test_packet_ipv4_sctp));
+			 sizeof(test_packet_ipv4_sctp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -2986,7 +2985,7 @@  static void parse_eth_ipv4_ipsec_ah(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_ipsec_ah,
-			 sizeof(test_packet_ipv4_ipsec_ah));
+			 sizeof(test_packet_ipv4_ipsec_ah), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3017,7 +3016,7 @@  static void parse_eth_ipv4_ipsec_esp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_ipsec_esp,
-			 sizeof(test_packet_ipv4_ipsec_esp));
+			 sizeof(test_packet_ipv4_ipsec_esp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3048,7 +3047,7 @@  static void parse_eth_ipv6_ipsec_ah(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv6_ipsec_ah,
-			 sizeof(test_packet_ipv6_ipsec_ah));
+			 sizeof(test_packet_ipv6_ipsec_ah), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3085,7 +3084,7 @@  static void parse_eth_ipv6_ipsec_esp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv6_ipsec_esp,
-			 sizeof(test_packet_ipv6_ipsec_esp));
+			 sizeof(test_packet_ipv6_ipsec_esp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3116,7 +3115,7 @@  static void parse_mcast_eth_ipv4_udp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_mcast_eth_ipv4_udp,
-			 sizeof(test_packet_mcast_eth_ipv4_udp));
+			 sizeof(test_packet_mcast_eth_ipv4_udp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3150,7 +3149,7 @@  static void parse_bcast_eth_ipv4_udp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_bcast_eth_ipv4_udp,
-			 sizeof(test_packet_bcast_eth_ipv4_udp));
+			 sizeof(test_packet_bcast_eth_ipv4_udp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3185,7 +3184,7 @@  static void parse_mcast_eth_ipv6_udp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_mcast_eth_ipv6_udp,
-			 sizeof(test_packet_mcast_eth_ipv6_udp));
+			 sizeof(test_packet_mcast_eth_ipv6_udp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3219,7 +3218,7 @@  static void parse_eth_ipv4_udp_first_frag(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_udp_first_frag,
-			 sizeof(test_packet_ipv4_udp_first_frag));
+			 sizeof(test_packet_ipv4_udp_first_frag), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3251,7 +3250,7 @@  static void parse_eth_ipv4_udp_last_frag(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_udp_last_frag,
-			 sizeof(test_packet_ipv4_udp_last_frag));
+			 sizeof(test_packet_ipv4_udp_last_frag), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;
@@ -3283,7 +3282,7 @@  static void parse_eth_ipv4_rr_nop_icmp(void)
 	odp_packet_t pkt[num_pkt];
 
 	parse_test_alloc(pkt, test_packet_ipv4_rr_nop_icmp,
-			 sizeof(test_packet_ipv4_rr_nop_icmp));
+			 sizeof(test_packet_ipv4_rr_nop_icmp), num_pkt);
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_L4;