diff mbox series

[API-NEXT,v11,4/12] helper: chksum: verify odph_ipv4_chksum_*() functions

Message ID 1505401213-7265-5-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v11,1/12] helper: move include files to helper/include | expand

Commit Message

Github ODP bot Sept. 14, 2017, 3 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 160 (bala-manoharan:api_sched_order_lock)
 ** https://github.com/Linaro/odp/pull/160
 ** Patch: https://github.com/Linaro/odp/pull/160.patch
 ** Base sha: 6b6253c30f88c80bf632436ff06c1b000860a2f1
 ** Merge commit sha: 438a3bab5df9c05dc06f0b4e4b22c0a7db0864fd
 **/
 helper/test/chksum.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/helper/test/chksum.c b/helper/test/chksum.c
index 914eab04a..9eb7ee06b 100644
--- a/helper/test/chksum.c
+++ b/helper/test/chksum.c
@@ -110,9 +110,17 @@  int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED)
 				       ODPH_IPV4HDR_LEN);
 	ip->proto = ODPH_IPPROTO_UDP;
 	ip->id = odp_cpu_to_be_16(1);
-	ip->chksum = 0;
 	odp_packet_has_ipv4_set(test_packet, 1);
-	odph_ipv4_csum_update(test_packet);
+	if (odph_ipv4_csum_update(test_packet) < 0)
+		status = -1;
+
+	if (!odph_ipv4_csum_valid(test_packet))
+		status = -1;
+
+	printf("IP chksum = 0x%x\n", odp_be_to_cpu_16(ip->chksum));
+
+	if (odp_be_to_cpu_16(ip->chksum) != 0x3965)
+		status = -1;
 
 	/* udp */
 	odp_packet_l4_offset_set(test_packet, ODPH_ETHHDR_LEN