diff mbox

[2/7] ODP helper: Add IPv6 header and defines. Add & rename IPv4 defines

Message ID 1392639281-2753-3-git-send-email-carl.wallen@linaro.org
State Accepted, archived
Commit 2d4ee4d9276e29a61d7f633e450f54f7741411e5
Headers show

Commit Message

Carl Wallen Feb. 17, 2014, 12:14 p.m. UTC
Add IPv6 header and defines along with some new IPv4 defines
and renames. Update code using updated definitions.

Signed-off-by: Carl Wallen <carl.wallen@linaro.org>
---
 include/helper/odp_ip.h                    | 43 +++++++++++++++++++++++-------
 platform/linux-generic/source/odp_packet.c |  4 +--
 2 files changed, 35 insertions(+), 12 deletions(-)

Comments

Ola Liljedahl Feb. 17, 2014, 1:04 p.m. UTC | #1
How much IP and other higher level definitions should be part of ODP? I
think we are half-way into application territory here and I rather define
these helpers in my application, there is not one universal way of defining
all of these concepts.


On 17 February 2014 13:14, Carl Wallen <carl.wallen@linaro.org> wrote:

> Add IPv6 header and defines along with some new IPv4 defines
> and renames. Update code using updated definitions.
>
> Signed-off-by: Carl Wallen <carl.wallen@linaro.org>
> ---
>  include/helper/odp_ip.h                    | 43
> +++++++++++++++++++++++-------
>  platform/linux-generic/source/odp_packet.c |  4 +--
>  2 files changed, 35 insertions(+), 12 deletions(-)
>
> diff --git a/include/helper/odp_ip.h b/include/helper/odp_ip.h
> index d37daca..a5eccc7 100644
> --- a/include/helper/odp_ip.h
> +++ b/include/helper/odp_ip.h
> @@ -22,12 +22,17 @@ extern "C" {
>  #include <odp_debug.h>
>  #include <odp_byteorder.h>
>
> -#define ODP_IPV4           4  /**< IP version 4 */
> -#define ODP_IPHDR_LEN     20  /**< Min length of IP header (no options) */
> -#define ODP_IPHDR_IHL_MIN  5  /**< Minimum IHL value*/
> +#define ODP_IPV4             4  /**< IP version 4 */
> +#define ODP_IPV4HDR_LEN     20  /**< Min length of IP header (no options)
> */
> +#define ODP_IPV4HDR_IHL_MIN  5  /**< Minimum IHL value*/
>
> -#define ODP_IPHDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
> -#define ODP_IPHDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
> +#define ODP_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
> +#define ODP_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
> +#define ODP_IPV4HDR_FLAGS_DONT_FRAG(frag_offset)  ((frag_offset) & 0x4000)
> +#define ODP_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset)  ((frag_offset) &
> 0x2000)
> +#define ODP_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff)
> +
> +#define ODP_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff)
>
>  typedef struct ODP_PACKED {
>         uint8_t    ver_ihl;
> @@ -42,13 +47,31 @@ typedef struct ODP_PACKED {
>         uint32be_t dst_addr;
>  } odp_ipv4hdr_t;
>
> -ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPHDR_LEN,
> ODP_IPV4HDR_T__SIZE_ERROR);
> +ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN,
> ODP_IPV4HDR_T__SIZE_ERROR);
> +
> +
> +#define ODP_IPV6 6
> +#define ODP_IPV6HDR_LEN 40
> +
> +typedef struct ODP_PACKED {
> +       uint32be_t ver_tc_flow;
> +       uint16be_t payload_len;
> +       uint8_t    next_hdr;
> +       uint8_t    hop_limit;
> +       uint8_t    src_addr[16];
> +       uint8_t    dst_addr[16];
> +} odp_ipv6hdr_t;
>
> -/* IP header protocol ('proto') field values, a selected few  */
> -#define ODP_IPPROTO_ICMP 0x01 /**< Internet Control Message Protocol */
> -#define ODP_IPPROTO_TCP  0x06 /**< Transmission Control Protocol */
> -#define ODP_IPPROTO_UDP  0x11 /**< User Datagram Protocol */
> +ODP_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN,
> ODP_IPV6HDR_T__SIZE_ERROR);
>
> +/* IP protocol values (IPv4:'proto' or IPv6:'next_hdr') */
> +#define ODP_IPPROTO_ICMP 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_SCTP 0x84 /**< Stream Control Transmission Protocol
> (132) */
> +#define ODP_IPPROTO_FRAG 0x2C /**< Fragment (44) */
> +#define ODP_IPPROTO_AH   0x33 /**< Authentication Header (51) */
> +#define ODP_IPPROTO_ESP  0x32 /**< Encapsulating Security Payload (50) */
>
>  #ifdef __cplusplus
>  }
> diff --git a/platform/linux-generic/source/odp_packet.c
> b/platform/linux-generic/source/odp_packet.c
> index 7cd0d71..6b06f76 100644
> --- a/platform/linux-generic/source/odp_packet.c
> +++ b/platform/linux-generic/source/odp_packet.c
> @@ -153,8 +153,8 @@ void odp_packet_parse(odp_packet_t pkt, size_t len,
> size_t l2_offset)
>                 pkt_hdr->proto_flags.ipv4 = 1;
>                 ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt);
>
> -               ihl = ODP_IPHDR_IHL(ip->ver_ihl);
> -               if (odp_unlikely(ihl < ODP_IPHDR_IHL_MIN)) {
> +               ihl = ODP_IPV4HDR_IHL(ip->ver_ihl);
> +               if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) {
>                         pkt_hdr->error_flags.ip_err = 1;
>                         return;
>                 }
> --
> 1.8.5.3
>
> --
> You received this message because you are subscribed to the Google Groups
> "LNG ODP Sub-team - lng-odp@linaro.org" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to lng-odp+unsubscribe@linaro.org.
> To post to this group, send email to lng-odp@linaro.org.
> Visit this group at http://groups.google.com/a/linaro.org/group/lng-odp/.
> To view this discussion on the web visit
> https://groups.google.com/a/linaro.org/d/msgid/lng-odp/1392639281-2753-3-git-send-email-carl.wallen%40linaro.org
> .
> For more options, visit
> https://groups.google.com/a/linaro.org/groups/opt_out.
>
Maxim Uvarov Feb. 17, 2014, 1:11 p.m. UTC | #2
On 02/17/2014 05:04 PM, Ola Liljedahl wrote:
> How much IP and other higher level definitions should be part of ODP? 
> I think we are half-way into application territory here and I rather 
> define these helpers in my application, there is not one universal way 
> of defining all of these concepts.
>
then more layers, then more flows we can define....

Maxim.
>
> On 17 February 2014 13:14, Carl Wallen <carl.wallen@linaro.org 
> <mailto:carl.wallen@linaro.org>> wrote:
>
>     Add IPv6 header and defines along with some new IPv4 defines
>     and renames. Update code using updated definitions.
>
>     Signed-off-by: Carl Wallen <carl.wallen@linaro.org
>     <mailto:carl.wallen@linaro.org>>
>     ---
>      include/helper/odp_ip.h                    | 43
>     +++++++++++++++++++++++-------
>      platform/linux-generic/source/odp_packet.c |  4 +--
>      2 files changed, 35 insertions(+), 12 deletions(-)
>
>     diff --git a/include/helper/odp_ip.h b/include/helper/odp_ip.h
>     index d37daca..a5eccc7 100644
>     --- a/include/helper/odp_ip.h
>     +++ b/include/helper/odp_ip.h
>     @@ -22,12 +22,17 @@ extern "C" {
>      #include <odp_debug.h>
>      #include <odp_byteorder.h>
>
>     -#define ODP_IPV4           4  /**< IP version 4 */
>     -#define ODP_IPHDR_LEN     20  /**< Min length of IP header (no
>     options) */
>     -#define ODP_IPHDR_IHL_MIN  5  /**< Minimum IHL value*/
>     +#define ODP_IPV4             4  /**< IP version 4 */
>     +#define ODP_IPV4HDR_LEN     20  /**< Min length of IP header (no
>     options) */
>     +#define ODP_IPV4HDR_IHL_MIN  5  /**< Minimum IHL value*/
>
>     -#define ODP_IPHDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
>     -#define ODP_IPHDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
>     +#define ODP_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
>     +#define ODP_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
>     +#define ODP_IPV4HDR_FLAGS_DONT_FRAG(frag_offset)  ((frag_offset)
>     & 0x4000)
>     +#define ODP_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset)  ((frag_offset)
>     & 0x2000)
>     +#define ODP_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff)
>     +
>     +#define ODP_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff)
>
>      typedef struct ODP_PACKED {
>             uint8_t    ver_ihl;
>     @@ -42,13 +47,31 @@ typedef struct ODP_PACKED {
>             uint32be_t dst_addr;
>      } odp_ipv4hdr_t;
>
>     -ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPHDR_LEN,
>     ODP_IPV4HDR_T__SIZE_ERROR);
>     +ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN,
>     ODP_IPV4HDR_T__SIZE_ERROR);
>     +
>     +
>     +#define ODP_IPV6 6
>     +#define ODP_IPV6HDR_LEN 40
>     +
>     +typedef struct ODP_PACKED {
>     +       uint32be_t ver_tc_flow;
>     +       uint16be_t payload_len;
>     +       uint8_t    next_hdr;
>     +       uint8_t    hop_limit;
>     +       uint8_t    src_addr[16];
>     +       uint8_t    dst_addr[16];
>     +} odp_ipv6hdr_t;
>
>     -/* IP header protocol ('proto') field values, a selected few  */
>     -#define ODP_IPPROTO_ICMP 0x01 /**< Internet Control Message
>     Protocol */
>     -#define ODP_IPPROTO_TCP  0x06 /**< Transmission Control Protocol */
>     -#define ODP_IPPROTO_UDP  0x11 /**< User Datagram Protocol */
>     +ODP_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN,
>     ODP_IPV6HDR_T__SIZE_ERROR);
>
>     +/* IP protocol values (IPv4:'proto' or IPv6:'next_hdr') */
>     +#define ODP_IPPROTO_ICMP 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_SCTP 0x84 /**< Stream Control Transmission
>     Protocol (132) */
>     +#define ODP_IPPROTO_FRAG 0x2C /**< Fragment (44) */
>     +#define ODP_IPPROTO_AH   0x33 /**< Authentication Header (51) */
>     +#define ODP_IPPROTO_ESP  0x32 /**< Encapsulating Security Payload
>     (50) */
>
>      #ifdef __cplusplus
>      }
>     diff --git a/platform/linux-generic/source/odp_packet.c
>     b/platform/linux-generic/source/odp_packet.c
>     index 7cd0d71..6b06f76 100644
>     --- a/platform/linux-generic/source/odp_packet.c
>     +++ b/platform/linux-generic/source/odp_packet.c
>     @@ -153,8 +153,8 @@ void odp_packet_parse(odp_packet_t pkt, size_t
>     len, size_t l2_offset)
>                     pkt_hdr->proto_flags.ipv4 = 1;
>                     ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt);
>
>     -               ihl = ODP_IPHDR_IHL(ip->ver_ihl);
>     -               if (odp_unlikely(ihl < ODP_IPHDR_IHL_MIN)) {
>     +               ihl = ODP_IPV4HDR_IHL(ip->ver_ihl);
>     +               if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) {
>                             pkt_hdr->error_flags.ip_err = 1;
>                             return;
>                     }
>     --
>     1.8.5.3
>
>     --
>     You received this message because you are subscribed to the Google
>     Groups "LNG ODP Sub-team - lng-odp@linaro.org
>     <mailto:lng-odp@linaro.org>" group.
>     To unsubscribe from this group and stop receiving emails from it,
>     send an email to lng-odp+unsubscribe@linaro.org
>     <mailto:lng-odp%2Bunsubscribe@linaro.org>.
>     To post to this group, send email to lng-odp@linaro.org
>     <mailto:lng-odp@linaro.org>.
>     Visit this group at
>     http://groups.google.com/a/linaro.org/group/lng-odp/.
>     To view this discussion on the web visit
>     https://groups.google.com/a/linaro.org/d/msgid/lng-odp/1392639281-2753-3-git-send-email-carl.wallen%40linaro.org.
>     For more options, visit
>     https://groups.google.com/a/linaro.org/groups/opt_out.
>
>
> -- 
> You received this message because you are subscribed to the Google 
> Groups "LNG ODP Sub-team - lng-odp@linaro.org" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to lng-odp+unsubscribe@linaro.org.
> To post to this group, send email to lng-odp@linaro.org.
> Visit this group at http://groups.google.com/a/linaro.org/group/lng-odp/.
> To view this discussion on the web visit 
> https://groups.google.com/a/linaro.org/d/msgid/lng-odp/CAPiYAf5G6nviU0_DLhB2oAgcuas5YNxHcEbHaa7Cz8Kv-qDETQ%40mail.gmail.com.
> For more options, visit 
> https://groups.google.com/a/linaro.org/groups/opt_out.
Petri Savolainen Feb. 17, 2014, 1:20 p.m. UTC | #3
Hi,

That's why it's in the "helper" directory. It's optional API which other 
ODP API's ( == odp.h) does not depend on. Helpers have been added (mainly) 
to ease writing of portable test applications. A serious application would 
not use helpers but implement those things otherwise.

Agree, protocol stacks do not belong into ODP scope (only the bits that are 
commonly HW accelerated, like header error checks).

-Petri  



On Monday, 17 February 2014 15:04:51 UTC+2, Ola Liljedahl wrote:
>
> How much IP and other higher level definitions should be part of ODP? I 
> think we are half-way into application territory here and I rather define 
> these helpers in my application, there is not one universal way of defining 
> all of these concepts.
>
>
> On 17 February 2014 13:14, Carl Wallen <carl....@linaro.org <javascript:>>wrote:
>
>> Add IPv6 header and defines along with some new IPv4 defines
>> and renames. Update code using updated definitions.
>>
>> Signed-off-by: Carl Wallen <carl....@linaro.org <javascript:>>
>> ---
>>  include/helper/odp_ip.h                    | 43 
>> +++++++++++++++++++++++-------
>>  platform/linux-generic/source/odp_packet.c |  4 +--
>>  2 files changed, 35 insertions(+), 12 deletions(-)
>>
>> diff --git a/include/helper/odp_ip.h b/include/helper/odp_ip.h
>> index d37daca..a5eccc7 100644
>> --- a/include/helper/odp_ip.h
>> +++ b/include/helper/odp_ip.h
>> @@ -22,12 +22,17 @@ extern "C" {
>>  #include <odp_debug.h>
>>  #include <odp_byteorder.h>
>>
>> -#define ODP_IPV4           4  /**< IP version 4 */
>> -#define ODP_IPHDR_LEN     20  /**< Min length of IP header (no options) 
>> */
>> -#define ODP_IPHDR_IHL_MIN  5  /**< Minimum IHL value*/
>> +#define ODP_IPV4             4  /**< IP version 4 */
>> +#define ODP_IPV4HDR_LEN     20  /**< Min length of IP header (no 
>> options) */
>> +#define ODP_IPV4HDR_IHL_MIN  5  /**< Minimum IHL value*/
>>
>> -#define ODP_IPHDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
>> -#define ODP_IPHDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
>> +#define ODP_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
>> +#define ODP_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
>> +#define ODP_IPV4HDR_FLAGS_DONT_FRAG(frag_offset)  ((frag_offset) & 
>> 0x4000)
>> +#define ODP_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset)  ((frag_offset) & 
>> 0x2000)
>> +#define ODP_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff)
>> +
>> +#define ODP_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff)
>>
>>  typedef struct ODP_PACKED {
>>         uint8_t    ver_ihl;
>> @@ -42,13 +47,31 @@ typedef struct ODP_PACKED {
>>         uint32be_t dst_addr;
>>  } odp_ipv4hdr_t;
>>
>> -ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPHDR_LEN, 
>> ODP_IPV4HDR_T__SIZE_ERROR);
>> +ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, 
>> ODP_IPV4HDR_T__SIZE_ERROR);
>> +
>> +
>> +#define ODP_IPV6 6
>> +#define ODP_IPV6HDR_LEN 40
>> +
>> +typedef struct ODP_PACKED {
>> +       uint32be_t ver_tc_flow;
>> +       uint16be_t payload_len;
>> +       uint8_t    next_hdr;
>> +       uint8_t    hop_limit;
>> +       uint8_t    src_addr[16];
>> +       uint8_t    dst_addr[16];
>> +} odp_ipv6hdr_t;
>>
>> -/* IP header protocol ('proto') field values, a selected few  */
>> -#define ODP_IPPROTO_ICMP 0x01 /**< Internet Control Message Protocol */
>> -#define ODP_IPPROTO_TCP  0x06 /**< Transmission Control Protocol */
>> -#define ODP_IPPROTO_UDP  0x11 /**< User Datagram Protocol */
>> +ODP_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN, 
>> ODP_IPV6HDR_T__SIZE_ERROR);
>>
>> +/* IP protocol values (IPv4:'proto' or IPv6:'next_hdr') */
>> +#define ODP_IPPROTO_ICMP 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_SCTP 0x84 /**< Stream Control Transmission Protocol 
>> (132) */
>> +#define ODP_IPPROTO_FRAG 0x2C /**< Fragment (44) */
>> +#define ODP_IPPROTO_AH   0x33 /**< Authentication Header (51) */
>> +#define ODP_IPPROTO_ESP  0x32 /**< Encapsulating Security Payload (50) */
>>
>>  #ifdef __cplusplus
>>  }
>> diff --git a/platform/linux-generic/source/odp_packet.c 
>> b/platform/linux-generic/source/odp_packet.c
>> index 7cd0d71..6b06f76 100644
>> --- a/platform/linux-generic/source/odp_packet.c
>> +++ b/platform/linux-generic/source/odp_packet.c
>> @@ -153,8 +153,8 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, 
>> size_t l2_offset)
>>                 pkt_hdr->proto_flags.ipv4 = 1;
>>                 ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt);
>>
>> -               ihl = ODP_IPHDR_IHL(ip->ver_ihl);
>> -               if (odp_unlikely(ihl < ODP_IPHDR_IHL_MIN)) {
>> +               ihl = ODP_IPV4HDR_IHL(ip->ver_ihl);
>> +               if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) {
>>                         pkt_hdr->error_flags.ip_err = 1;
>>                         return;
>>                 }
>> --
>> 1.8.5.3
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "LNG ODP Sub-team - lng...@linaro.org <javascript:>" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to lng-odp+u...@linaro.org <javascript:>.
>> To post to this group, send email to lng...@linaro.org <javascript:>.
>> Visit this group at http://groups.google.com/a/linaro.org/group/lng-odp/.
>> To view this discussion on the web visit 
>> https://groups.google.com/a/linaro.org/d/msgid/lng-odp/1392639281-2753-3-git-send-email-carl.wallen%40linaro.org
>> .
>> For more options, visit 
>> https://groups.google.com/a/linaro.org/groups/opt_out.
>>
>
>
diff mbox

Patch

diff --git a/include/helper/odp_ip.h b/include/helper/odp_ip.h
index d37daca..a5eccc7 100644
--- a/include/helper/odp_ip.h
+++ b/include/helper/odp_ip.h
@@ -22,12 +22,17 @@  extern "C" {
 #include <odp_debug.h>
 #include <odp_byteorder.h>
 
-#define ODP_IPV4           4  /**< IP version 4 */
-#define ODP_IPHDR_LEN     20  /**< Min length of IP header (no options) */
-#define ODP_IPHDR_IHL_MIN  5  /**< Minimum IHL value*/
+#define ODP_IPV4             4  /**< IP version 4 */
+#define ODP_IPV4HDR_LEN     20  /**< Min length of IP header (no options) */
+#define ODP_IPV4HDR_IHL_MIN  5  /**< Minimum IHL value*/
 
-#define ODP_IPHDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
-#define ODP_IPHDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
+#define ODP_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
+#define ODP_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
+#define ODP_IPV4HDR_FLAGS_DONT_FRAG(frag_offset)  ((frag_offset) & 0x4000)
+#define ODP_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset)  ((frag_offset) & 0x2000)
+#define ODP_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff)
+
+#define ODP_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff)
 
 typedef struct ODP_PACKED {
 	uint8_t    ver_ihl;
@@ -42,13 +47,31 @@  typedef struct ODP_PACKED {
 	uint32be_t dst_addr;
 } odp_ipv4hdr_t;
 
-ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPHDR_LEN, ODP_IPV4HDR_T__SIZE_ERROR);
+ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, ODP_IPV4HDR_T__SIZE_ERROR);
+
+
+#define ODP_IPV6 6
+#define ODP_IPV6HDR_LEN 40
+
+typedef struct ODP_PACKED {
+	uint32be_t ver_tc_flow;
+	uint16be_t payload_len;
+	uint8_t    next_hdr;
+	uint8_t    hop_limit;
+	uint8_t    src_addr[16];
+	uint8_t    dst_addr[16];
+} odp_ipv6hdr_t;
 
-/* IP header protocol ('proto') field values, a selected few  */
-#define ODP_IPPROTO_ICMP 0x01 /**< Internet Control Message Protocol */
-#define ODP_IPPROTO_TCP  0x06 /**< Transmission Control Protocol */
-#define ODP_IPPROTO_UDP  0x11 /**< User Datagram Protocol */
+ODP_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN, ODP_IPV6HDR_T__SIZE_ERROR);
 
+/* IP protocol values (IPv4:'proto' or IPv6:'next_hdr') */
+#define ODP_IPPROTO_ICMP 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_SCTP 0x84 /**< Stream Control Transmission Protocol (132) */
+#define ODP_IPPROTO_FRAG 0x2C /**< Fragment (44) */
+#define ODP_IPPROTO_AH   0x33 /**< Authentication Header (51) */
+#define ODP_IPPROTO_ESP  0x32 /**< Encapsulating Security Payload (50) */
 
 #ifdef __cplusplus
 }
diff --git a/platform/linux-generic/source/odp_packet.c b/platform/linux-generic/source/odp_packet.c
index 7cd0d71..6b06f76 100644
--- a/platform/linux-generic/source/odp_packet.c
+++ b/platform/linux-generic/source/odp_packet.c
@@ -153,8 +153,8 @@  void odp_packet_parse(odp_packet_t pkt, size_t len, size_t l2_offset)
 		pkt_hdr->proto_flags.ipv4 = 1;
 		ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt);
 
-		ihl = ODP_IPHDR_IHL(ip->ver_ihl);
-		if (odp_unlikely(ihl < ODP_IPHDR_IHL_MIN)) {
+		ihl = ODP_IPV4HDR_IHL(ip->ver_ihl);
+		if (odp_unlikely(ihl < ODP_IPV4HDR_IHL_MIN)) {
 			pkt_hdr->error_flags.ip_err = 1;
 			return;
 		}