diff mbox series

[v1,1/1] validation: packet: minimal chksum status test

Message ID 1516114812-5443-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/1] validation: packet: minimal chksum status test | expand

Commit Message

Github ODP bot Jan. 16, 2018, 3 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


There was no references into chksum status functions in validation
test suite. Add minimal test to see at least that functions exist.
Parse function should be updated with a checksum implementation,
before actual checksum checking can be tested.

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

---
/** Email created from pull request 396 (psavol:master-test-chksum-status)
 ** https://github.com/Linaro/odp/pull/396
 ** Patch: https://github.com/Linaro/odp/pull/396.patch
 ** Base sha: 520c170d758f2d37554631bf1467ec50e027cd3e
 ** Merge commit sha: 80f318dcc6f7dbed3d7d5f15f85a4cf525315598
 **/
 test/validation/api/packet/packet.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c
index 75e50d531..78ccbeaef 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -2466,6 +2466,8 @@  void packet_test_parse(void)
 	odp_packet_parse_param_t parse;
 	int ret, num_test_pkt, i;
 	uint32_t len, max_len;
+	odp_packet_chksum_status_t chksum_status;
+	odp_proto_chksums_t all_chksums;
 	int num_pkt = 10;
 	odp_packet_t pkt[num_pkt];
 	uint32_t offset[num_pkt];
@@ -2480,6 +2482,12 @@  void packet_test_parse(void)
 				   sizeof(test_packet_ipv6_udp),
 				   sizeof(test_packet_vlan_ipv6_udp) };
 
+	all_chksums.all_chksum  = 0;
+	all_chksums.chksum.ipv4 = 1;
+	all_chksums.chksum.udp  = 1;
+	all_chksums.chksum.tcp  = 1;
+	all_chksums.chksum.sctp = 1;
+
 	num_test_pkt = sizeof(test_pkt_len) / sizeof(uint32_t);
 	max_len = 0;
 
@@ -2509,11 +2517,16 @@  void packet_test_parse(void)
 		CU_ASSERT(ret == 0);
 
 		offset[i] = 0;
+
+		chksum_status = odp_packet_l3_chksum_status(pkt[i]);
+		CU_ASSERT(chksum_status == ODP_PACKET_CHKSUM_UNKNOWN);
+		chksum_status = odp_packet_l4_chksum_status(pkt[i]);
+		CU_ASSERT(chksum_status == ODP_PACKET_CHKSUM_UNKNOWN);
 	}
 
 	parse.proto = ODP_PROTO_ETH;
 	parse.last_layer = ODP_PROTO_LAYER_ALL;
-	parse.chksums.all_chksum = 0;
+	parse.chksums = all_chksums;
 
 	CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
 	CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1],