diff options
-rw-r--r-- | example/generator/odp_generator.c | 6 | ||||
-rw-r--r-- | example/ipsec_crypto/odp_ipsec_stream.c | 4 | ||||
-rw-r--r-- | example/ping/odp_ping.c | 10 | ||||
-rw-r--r-- | helper/include/odp/helper/icmp.h | 47 | ||||
-rw-r--r-- | test/validation/api/classification/odp_classification_common.c | 2 | ||||
-rw-r--r-- | test/validation/api/classification/odp_classification_test_pmr.c | 4 |
6 files changed, 14 insertions, 59 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); diff --git a/helper/include/odp/helper/icmp.h b/helper/include/odp/helper/icmp.h index 8f3215428..9dbc02a9f 100644 --- a/helper/include/odp/helper/icmp.h +++ b/helper/include/odp/helper/icmp.h @@ -47,51 +47,8 @@ typedef struct ODP_PACKED { } un; /**< icmp sub header */ } odph_icmphdr_t; -#define ICMP_ECHOREPLY 0 /**< Echo Reply */ -#define ICMP_DEST_UNREACH 3 /**< Destination Unreachable */ -#define ICMP_SOURCE_QUENCH 4 /**< Source Quench */ -#define ICMP_REDIRECT 5 /**< Redirect (change route) */ -#define ICMP_ECHO 8 /**< Echo Request */ -#define ICMP_TIME_EXCEEDED 11 /**< Time Exceeded */ -#define ICMP_PARAMETERPROB 12 /**< Parameter Problem */ -#define ICMP_TIMESTAMP 13 /**< Timestamp Request */ -#define ICMP_TIMESTAMPREPLY 14 /**< Timestamp Reply */ -#define ICMP_INFO_REQUEST 15 /**< Information Request */ -#define ICMP_INFO_REPLY 16 /**< Information Reply */ -#define ICMP_ADDRESS 17 /**< Address Mask Request */ -#define ICMP_ADDRESSREPLY 18 /**< Address Mask Reply */ -#define NR_ICMP_TYPES 18 /**< Number of icmp types */ - -/* Codes for UNREACH. */ -#define ICMP_NET_UNREACH 0 /**< Network Unreachable */ -#define ICMP_HOST_UNREACH 1 /**< Host Unreachable */ -#define ICMP_PROT_UNREACH 2 /**< Protocol Unreachable */ -#define ICMP_PORT_UNREACH 3 /**< Port Unreachable */ -#define ICMP_FRAG_NEEDED 4 /**< Fragmentation Needed/DF set*/ -#define ICMP_SR_FAILED 5 /**< Source Route failed */ -#define ICMP_NET_UNKNOWN 6 /**< Network Unknown */ -#define ICMP_HOST_UNKNOWN 7 /**< Host Unknown */ -#define ICMP_HOST_ISOLATED 8 /**< Host Isolated */ -#define ICMP_NET_ANO 9 /**< ICMP_NET_ANO */ -#define ICMP_HOST_ANO 10 /**< ICMP_HOST_ANO */ -#define ICMP_NET_UNR_TOS 11 /**< ICMP_NET_UNR_TOS */ -#define ICMP_HOST_UNR_TOS 12 /**< ICMP_HOST_UNR_TOS */ -#define ICMP_PKT_FILTERED 13 /**< Packet filtered */ -#define ICMP_PREC_VIOLATION 14 /**< Precedence violation */ -#define ICMP_PREC_CUTOFF 15 /**< Precedence cut off */ -#define NR_ICMP_UNREACH 15 /**< instead of hardcoding - immediate value */ - -/* Codes for REDIRECT. */ -#define ICMP_REDIR_NET 0 /**< Redirect Net */ -#define ICMP_REDIR_HOST 1 /**< Redirect Host */ -#define ICMP_REDIR_NETTOS 2 /**< Redirect Net for TOS */ -#define ICMP_REDIR_HOSTTOS 3 /**< Redirect Host for TOS */ - -/* Codes for TIME_EXCEEDED. */ -#define ICMP_EXC_TTL 0 /**< TTL count exceeded */ -#define ICMP_EXC_FRAGTIME 1 /**< Fragment Reass time - exceeded*/ +#define ODPH_ICMP_ECHOREPLY 0 /**< Echo Reply */ +#define ODPH_ICMP_ECHO 8 /**< Echo Request */ /** @cond _ODP_HIDE_FROM_DOXYGEN_ */ ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN, diff --git a/test/validation/api/classification/odp_classification_common.c b/test/validation/api/classification/odp_classification_common.c index 1172dcc36..1fb4c51b5 100644 --- a/test/validation/api/classification/odp_classification_common.c +++ b/test/validation/api/classification/odp_classification_common.c @@ -465,7 +465,7 @@ odp_packet_t create_packet(cls_packet_info_t pkt_info) igmp->code = 0; igmp->csum = 0; } else if (pkt_info.l4_type == CLS_PKT_L4_ICMP) { - icmp->type = ICMP_ECHO; + icmp->type = ODPH_ICMP_ECHO; icmp->code = 0; icmp->un.echo.id = 0; icmp->un.echo.sequence = 0; diff --git a/test/validation/api/classification/odp_classification_test_pmr.c b/test/validation/api/classification/odp_classification_test_pmr.c index f8a1703dc..b88f7beca 100644 --- a/test/validation/api/classification/odp_classification_test_pmr.c +++ b/test/validation/api/classification/odp_classification_test_pmr.c @@ -1699,7 +1699,7 @@ static void cls_pmr_term_icmp_type(void) odp_pmr_param_t pmr_param; cls_packet_info_t pkt_info; - val = ICMP_ECHO; + val = ODPH_ICMP_ECHO; mask = 0xff; odp_cls_pmr_param_init(&pmr_param); @@ -1720,7 +1720,7 @@ static void cls_pmr_term_icmp_type(void) pkt = create_packet(pkt_info); CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); icmp = (odph_icmphdr_t *)odp_packet_l4_ptr(pkt, NULL); - icmp->type = ICMP_ECHOREPLY; + icmp->type = ODPH_ICMP_ECHOREPLY; test_pmr(&pmr_param, pkt, NO_MATCH); } |