aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>2017-08-24 14:51:08 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2017-08-29 00:25:11 +0300
commit7508c5ac906bb7cb1d339b4c5e924f3a18e504ca (patch)
treee1c838b7f579e6c113169d12152b60d820de258a /helper
parent87fbe7fbf2debf8bc44bfffc3d3a2d1827208452 (diff)
helper: chksum: verify odph_ipv4_chksum_x() functions
Fixes: https://bugs.linaro.org/show_bug.cgi?id=2976 Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'helper')
-rw-r--r--helper/test/chksum.c12
1 files changed, 10 insertions, 2 deletions
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