aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-08-24 17:51:04 +0300
committerMatias Elo <matias.elo@nokia.com>2023-10-23 09:25:59 +0300
commit5182ce145834f70501ff707f4790399d8512bb00 (patch)
treeada6f8e5d137e27d3e556e1883426875af441850 /example
parente784307d5c78fd9874f560ddd07ada39ab038909 (diff)
helper: icmp: remove and rename defines
Remove unused ICMP defines and add missing ODPH_ prefix to the remaining ones. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'example')
-rw-r--r--example/generator/odp_generator.c6
-rw-r--r--example/ipsec_crypto/odp_ipsec_stream.c4
-rw-r--r--example/ping/odp_ping.c10
3 files changed, 9 insertions, 11 deletions
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index cefe13683..b1d1f83e2 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -462,7 +462,7 @@ static odp_packet_t setup_icmp_pkt_ref(odp_pool_t pool,
/* icmp */
icmp = (odph_icmphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN);
- icmp->type = ICMP_ECHO;
+ icmp->type = ODPH_ICMP_ECHO;
icmp->code = 0;
icmp->un.echo.id = 0;
icmp->un.echo.sequence = 0;
@@ -813,7 +813,7 @@ static void process_icmp_pkt(int thr, thread_args_t *thr_args,
uint64_t rtt_ms, rtt_us;
odph_icmphdr_t *icmp = (odph_icmphdr_t *)_icmp;
- if (icmp->type == ICMP_ECHOREPLY) {
+ if (icmp->type == ODPH_ICMP_ECHOREPLY) {
thr_args->counters.ctr_icmp_reply_rcv++;
memcpy(&tsend, (uint8_t *)icmp + ODPH_ICMPHDR_LEN,
@@ -826,7 +826,7 @@ static void process_icmp_pkt(int thr, thread_args_t *thr_args,
PRIu64 ".%.03" PRIu64" ms\n", thr,
odp_be_to_cpu_16(icmp->un.echo.sequence),
rtt_ms, rtt_us);
- } else if (icmp->type == ICMP_ECHO) {
+ } else if (icmp->type == ODPH_ICMP_ECHO) {
printf(" [%02i] ICMP Echo Request\n", thr);
}
}
diff --git a/example/ipsec_crypto/odp_ipsec_stream.c b/example/ipsec_crypto/odp_ipsec_stream.c
index 0a0710a13..f8bc64eae 100644
--- a/example/ipsec_crypto/odp_ipsec_stream.c
+++ b/example/ipsec_crypto/odp_ipsec_stream.c
@@ -324,7 +324,7 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
/* ICMP header so we can see it on wireshark */
icmp = (odph_icmphdr_t *)data;
data += sizeof(*icmp);
- icmp->type = ICMP_ECHO;
+ icmp->type = ODPH_ICMP_ECHO;
icmp->code = 0;
icmp->un.echo.id = odp_cpu_to_be_16(0x1234);
icmp->un.echo.sequence = odp_cpu_to_be_16(stream->created);
@@ -583,7 +583,7 @@ clear_packet:
/* Verify ICMP header */
data += sizeof(*icmp);
- if (ICMP_ECHO != icmp->type)
+ if (ODPH_ICMP_ECHO != icmp->type)
return FALSE;
if (0x1234 != odp_be_to_cpu_16(icmp->un.echo.id))
return FALSE;
diff --git a/example/ping/odp_ping.c b/example/ping/odp_ping.c
index 2c7d507f2..dbe453319 100644
--- a/example/ping/odp_ping.c
+++ b/example/ping/odp_ping.c
@@ -1,7 +1,5 @@
-/* Copyright (c) 2019-2023, Nokia
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2019-2023 Nokia
*/
#include <stdio.h>
@@ -560,12 +558,12 @@ static void icmp_reply(test_global_t *global, odp_packet_t pkt)
if (icmp_hdr == NULL || len < 4)
goto error;
- if (icmp_hdr->type != 8 || icmp_hdr->code != 0)
+ if (icmp_hdr->type != ODPH_ICMP_ECHO || icmp_hdr->code != 0)
goto error;
/* Echo reply */
old = *(uint16_t *)(uintptr_t)icmp_hdr;
- icmp_hdr->type = 0;
+ icmp_hdr->type = ODPH_ICMP_ECHOREPLY;
new = *(uint16_t *)(uintptr_t)icmp_hdr;
icmp_hdr->chksum = update_chksum(icmp_hdr->chksum, old, new);