On 03/18/16 14:39, Zoltan Kiss wrote:
Ping, added Bill
ping for what? There are comments to rename functions.
Maxim.
On 11/03/16 07:03, Zoltan Kiss wrote:
Ping
On 03/03/16 03:05, Zoltan Kiss wrote:
The L2 offset functions should consider the L2 flag: return negative
answer if there isn't any, and implicitly set it when offset is set.
E.g. user created packets don't have L2 headers immediately.
Signed-off-by: Zoltan Kiss <zoltan.k...@linaro.org>
---
platform/linux-generic/include/odp_packet_internal.h | 5 +++++
platform/linux-generic/odp_packet.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/platform/linux-generic/include/odp_packet_internal.h
b/platform/linux-generic/include/odp_packet_internal.h
index d9fe544..1dc875e 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -263,6 +263,11 @@ static inline int
odp_packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr)
return pkt_hdr->input_flags.l2;
}
+static inline void odp_packet_hdr_has_l2_set(odp_packet_hdr_t
*pkt_hdr, int val)
+{
+ pkt_hdr->input_flags.l2 = val;
+}
+
static inline int odp_packet_hdr_has_eth(odp_packet_hdr_t *pkt_hdr)
{
return pkt_hdr->input_flags.eth;
diff --git a/platform/linux-generic/odp_packet.c
b/platform/linux-generic/odp_packet.c
index db85b5e..94d7f85 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -353,12 +353,16 @@ uint32_t odp_packet_user_area_size(odp_packet_t
pkt)
void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len)
{
odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+ if (!odp_packet_hdr_has_l2(pkt_hdr))
+ return NULL;
return packet_map(pkt_hdr, pkt_hdr->l2_offset, len);
}
uint32_t odp_packet_l2_offset(odp_packet_t pkt)
{
odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+ if (!odp_packet_hdr_has_l2(pkt_hdr))
+ return ODP_PACKET_OFFSET_INVALID;
return pkt_hdr->l2_offset;
}
@@ -369,6 +373,7 @@ int odp_packet_l2_offset_set(odp_packet_t pkt,
uint32_t offset)
if (offset >= pkt_hdr->frame_len)
return -1;
+ odp_packet_hdr_has_l2_set(pkt_hdr, 1);
pkt_hdr->l2_offset = offset;
return 0;
}
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp