diff options
author | Bill Fischofer <bill.fischofer@linaro.org> | 2014-12-18 07:38:55 -0600 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2014-12-22 18:14:43 +0300 |
commit | 006e196b9c717ffe73a629f7432e1abf0cc8f909 (patch) | |
tree | 0f70d4ccc36e0dd2dafe9015cd7fee7cb96edd65 /platform/linux-generic | |
parent | 976a53eda87ee385bf8c29f2334c3418c44e853b (diff) |
linux-generic: packet: add ODP_PACKET_OFFSET_INVALID
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic')
-rw-r--r-- | platform/linux-generic/include/api/odp_platform_types.h | 3 | ||||
-rw-r--r-- | platform/linux-generic/include/odp_packet_internal.h | 6 | ||||
-rw-r--r-- | platform/linux-generic/odp_packet.c | 10 |
3 files changed, 15 insertions, 4 deletions
diff --git a/platform/linux-generic/include/api/odp_platform_types.h b/platform/linux-generic/include/api/odp_platform_types.h index 2cfba872..0a002191 100644 --- a/platform/linux-generic/include/api/odp_platform_types.h +++ b/platform/linux-generic/include/api/odp_platform_types.h @@ -47,6 +47,9 @@ typedef odp_buffer_t odp_packet_t; /** Invalid packet */ #define ODP_PACKET_INVALID ODP_BUFFER_INVALID +/** Invalid packet offset */ +#define ODP_PACKET_OFFSET_INVALID (0x0fffffff) + /** ODP packet segment */ typedef odp_buffer_t odp_packet_seg_t; diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 10226a94..6dda251d 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -169,6 +169,12 @@ static inline void packet_init(pool_entry_t *pool, len = sizeof(odp_packet_hdr_t) - start_offset; memset(start, 0, len); + /* Set metadata items that initialize to non-zero values */ + pkt_hdr->l2_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->payload_offset = ODP_PACKET_OFFSET_INVALID; + /* * Packet headroom is set from the pool's headroom * Packet tailroom is rounded up to fill the last diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index e40bdb18..a78b3d1e 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -778,10 +778,10 @@ int _odp_packet_parse(odp_packet_t pkt) pkt_hdr->error_flags.all = 0; pkt_hdr->input_flags.all = 0; pkt_hdr->output_flags.all = 0; - pkt_hdr->l2_offset = 0; - pkt_hdr->l3_offset = 0; - pkt_hdr->l4_offset = 0; - pkt_hdr->payload_offset = 0; + pkt_hdr->l2_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->payload_offset = ODP_PACKET_OFFSET_INVALID; pkt_hdr->vlan_s_tag = 0; pkt_hdr->vlan_c_tag = 0; pkt_hdr->l3_protocol = 0; @@ -863,6 +863,7 @@ int _odp_packet_parse(odp_packet_t pkt) default: pkt_hdr->input_flags.l3 = 0; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; ip_proto = 255; /* Reserved invalid by IANA */ } @@ -894,6 +895,7 @@ int _odp_packet_parse(odp_packet_t pkt) default: pkt_hdr->input_flags.l4 = 0; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; break; } |