diff options
author | Bogdan Pricope <bogdan.pricope@linaro.org> | 2017-11-02 12:25:14 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2017-12-27 21:58:42 +0300 |
commit | e3b53ffa66a3482298a7662c32068218e761f9a6 (patch) | |
tree | 871a1f4018d0094274c69fc0a7670f82161c9d77 /example/generator/odp_generator.c | |
parent | 0951c9e658035be064c50a3793c6d681db92acb3 (diff) |
example: generator: use L3/L4 checksum validation status functions
Update odp_generator example application to use L3/L4 checksum
validation status functions.
Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'example/generator/odp_generator.c')
-rw-r--r-- | example/generator/odp_generator.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index b29ec8786..2a35045e6 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -821,11 +821,11 @@ static int gen_recv_thread(void *arg) odp_packet_t pkts[MAX_RX_BURST], pkt; odp_event_t events[MAX_RX_BURST]; int pkt_cnt, ev_cnt, i; - interface_t *itfs, *itf; + odp_packet_chksum_status_t csum_status; + (void)arg; thr = odp_thread_id(); thr_args = (thread_args_t *)arg; - itfs = thr_args->rx.ifs; printf(" [%02i] created mode: RECEIVE\n", thr); odp_barrier_wait(&barrier); @@ -841,21 +841,14 @@ static int gen_recv_thread(void *arg) continue; for (i = 0, pkt_cnt = 0; i < ev_cnt; i++) { pkt = odp_packet_from_event(events[i]); - itf = &itfs[odp_pktio_index(odp_packet_input(pkt))]; - if (odp_packet_has_ipv4(pkt)) { - if (itf->config.pktin.bit.ipv4_chksum) { - if (odp_packet_has_l3_error(pkt)) - printf("HW detected L3 error\n"); - } - } + csum_status = odp_packet_l3_chksum_status(pkt); + if (csum_status == ODP_PACKET_CHKSUM_BAD) + printf("L3 checksum error detected.\n"); - if (odp_packet_has_udp(pkt)) { - if (itf->config.pktin.bit.udp_chksum) { - if (odp_packet_has_l4_error(pkt)) - printf("HW detected L4 error\n"); - } - } + csum_status = odp_packet_l4_chksum_status(pkt); + if (csum_status == ODP_PACKET_CHKSUM_BAD) + printf("L4 checksum error detected.\n"); /* Drop packets with errors */ if (odp_unlikely(odp_packet_has_error(pkt))) { |