Merged. Please ignore first comment due to initially I tried to apply it
to master. Not to api-next.

Maxim.

On 04.04.2017 09:28, Matias Elo wrote:
> Signed-off-by: Matias Elo <[email protected]>
> Reviewed-and-tested-by: Bill Fischofer <[email protected]>
> ---
> V2:
> - Rebase
> 
>  example/generator/odp_generator.c             | 4 ++--
>  example/ipsec/odp_ipsec_stream.c              | 6 +++---
>  helper/include/odp/helper/ip.h                | 3 ++-
>  platform/linux-generic/include/protocols/ip.h | 3 ++-
>  platform/linux-generic/odp_packet.c           | 5 ++++-
>  5 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/example/generator/odp_generator.c 
> b/example/generator/odp_generator.c
> index 95fb543..af4168d 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -318,7 +318,7 @@ static odp_packet_t setup_icmp_pkt_ref(odp_pool_t pool)
>       ip->ttl = 64;
>       ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODPH_ICMPHDR_LEN +
>                                      ODPH_IPV4HDR_LEN);
> -     ip->proto = ODPH_IPPROTO_ICMP;
> +     ip->proto = ODPH_IPPROTO_ICMPv4;
>       ip->id = 0;
>       ip->chksum = 0;
>  
> @@ -632,7 +632,7 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], 
> unsigned len)
>               }
>  
>               /* icmp */
> -             if (ip->proto == ODPH_IPPROTO_ICMP) {
> +             if (ip->proto == ODPH_IPPROTO_ICMPv4) {
>                       icmp = (odph_icmphdr_t *)(buf + offset);
>                       /* echo reply */
>                       if (icmp->type == ICMP_ECHOREPLY) {
> diff --git a/example/ipsec/odp_ipsec_stream.c 
> b/example/ipsec/odp_ipsec_stream.c
> index 428ec04..b9576ae 100644
> --- a/example/ipsec/odp_ipsec_stream.c
> +++ b/example/ipsec/odp_ipsec_stream.c
> @@ -219,7 +219,7 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
>               ip->src_addr = odp_cpu_to_be_32(entry->tun_src_ip);
>               ip->dst_addr = odp_cpu_to_be_32(entry->tun_dst_ip);
>       } else {
> -             ip->proto = ODPH_IPPROTO_ICMP;
> +             ip->proto = ODPH_IPPROTO_ICMPv4;
>               ip->src_addr = odp_cpu_to_be_32(stream->src_ip);
>               ip->dst_addr = odp_cpu_to_be_32(stream->dst_ip);
>       }
> @@ -262,7 +262,7 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
>               inner_ip = (odph_ipv4hdr_t *)data;
>               memset((char *)inner_ip, 0, sizeof(*inner_ip));
>               inner_ip->ver_ihl = 0x45;
> -             inner_ip->proto = ODPH_IPPROTO_ICMP;
> +             inner_ip->proto = ODPH_IPPROTO_ICMPv4;
>               inner_ip->id = odp_cpu_to_be_16(stream->id);
>               inner_ip->ttl = 64;
>               inner_ip->tos = 0;
> @@ -519,7 +519,7 @@ clear_packet:
>               icmp = (odph_icmphdr_t *)(inner_ip + 1);
>               data = (uint8_t *)icmp;
>       } else {
> -             if (ODPH_IPPROTO_ICMP != ip->proto)
> +             if (ODPH_IPPROTO_ICMPv4 != ip->proto)
>                       return FALSE;
>               icmp = (odph_icmphdr_t *)data;
>       }
> diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h
> index ba6e675..91776fa 100644
> --- a/helper/include/odp/helper/ip.h
> +++ b/helper/include/odp/helper/ip.h
> @@ -205,13 +205,14 @@ typedef struct ODP_PACKED {
>   * IP protocol values (IPv4:'proto' or IPv6:'next_hdr')
>   * @{*/
>  #define ODPH_IPPROTO_HOPOPTS 0x00 /**< IPv6 hop-by-hop options */
> -#define ODPH_IPPROTO_ICMP    0x01 /**< Internet Control Message Protocol (1) 
> */
> +#define ODPH_IPPROTO_ICMPv4  0x01 /**< Internet Control Message Protocol (1) 
> */
>  #define ODPH_IPPROTO_TCP     0x06 /**< Transmission Control Protocol (6) */
>  #define ODPH_IPPROTO_UDP     0x11 /**< User Datagram Protocol (17) */
>  #define ODPH_IPPROTO_ROUTE   0x2B /**< IPv6 Routing header (43) */
>  #define ODPH_IPPROTO_FRAG    0x2C /**< IPv6 Fragment (44) */
>  #define ODPH_IPPROTO_AH      0x33 /**< Authentication Header (51) */
>  #define ODPH_IPPROTO_ESP     0x32 /**< Encapsulating Security Payload (50) */
> +#define ODPH_IPPROTO_ICMPv6  0x3A /**< Internet Control Message Protocol 
> (58) */
>  #define ODPH_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */
>  
>  /**@}*/
> diff --git a/platform/linux-generic/include/protocols/ip.h 
> b/platform/linux-generic/include/protocols/ip.h
> index 20041f1..2b34a75 100644
> --- a/platform/linux-generic/include/protocols/ip.h
> +++ b/platform/linux-generic/include/protocols/ip.h
> @@ -157,13 +157,14 @@ typedef struct ODP_PACKED {
>   * IP protocol values (IPv4:'proto' or IPv6:'next_hdr')
>   * @{*/
>  #define _ODP_IPPROTO_HOPOPTS 0x00 /**< IPv6 hop-by-hop options */
> -#define _ODP_IPPROTO_ICMP    0x01 /**< Internet Control Message Protocol (1) 
> */
> +#define _ODP_IPPROTO_ICMPv4  0x01 /**< Internet Control Message Protocol (1) 
> */
>  #define _ODP_IPPROTO_TCP     0x06 /**< Transmission Control Protocol (6) */
>  #define _ODP_IPPROTO_UDP     0x11 /**< User Datagram Protocol (17) */
>  #define _ODP_IPPROTO_ROUTE   0x2B /**< IPv6 Routing header (43) */
>  #define _ODP_IPPROTO_FRAG    0x2C /**< IPv6 Fragment (44) */
>  #define _ODP_IPPROTO_AH      0x33 /**< Authentication Header (51) */
>  #define _ODP_IPPROTO_ESP     0x32 /**< Encapsulating Security Payload (50) */
> +#define _ODP_IPPROTO_ICMPv6  0x3A /**< Internet Control Message Protocol 
> (58) */
>  #define _ODP_IPPROTO_SCTP    0x84 /**< Stream Control Transmission protocol
>                                      (132) */
>  #define _ODP_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */
> diff --git a/platform/linux-generic/odp_packet.c 
> b/platform/linux-generic/odp_packet.c
> index b8aac6b..a75c191 100644
> --- a/platform/linux-generic/odp_packet.c
> +++ b/platform/linux-generic/odp_packet.c
> @@ -2070,7 +2070,10 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
>  
>               /* Parse Layer 4 headers */
>               switch (prs->ip_proto) {
> -             case _ODP_IPPROTO_ICMP:
> +             case _ODP_IPPROTO_ICMPv4:
> +             /* Fall through */
> +
> +             case _ODP_IPPROTO_ICMPv6:
>                       prs->input_flags.icmp = 1;
>                       break;
>  
> 

Reply via email to