diff mbox

[1/2] linux-generic: packets: allow offsets to be set to invalid

Message ID 1422020496-4484-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Jan. 23, 2015, 1:41 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/odp_packet.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 257abec..ca1fe63 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -244,7 +244,8 @@  int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset)
 {
 	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
 
-	if (offset >= pkt_hdr->frame_len)
+	if (offset >= pkt_hdr->frame_len &&
+	    offset != ODP_PACKET_OFFSET_INVALID)
 		return -1;
 
 	pkt_hdr->l2_offset = offset;
@@ -266,7 +267,8 @@  int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset)
 {
 	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
 
-	if (offset >= pkt_hdr->frame_len)
+	if (offset >= pkt_hdr->frame_len &&
+	    offset != ODP_PACKET_OFFSET_INVALID)
 		return -1;
 
 	pkt_hdr->l3_offset = offset;
@@ -288,7 +290,8 @@  int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset)
 {
 	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
 
-	if (offset >= pkt_hdr->frame_len)
+	if (offset >= pkt_hdr->frame_len &&
+	    offset != ODP_PACKET_OFFSET_INVALID)
 		return -1;
 
 	pkt_hdr->l4_offset = offset;