diff mbox series

[API-NEXT,v2,3/15] linux-gen; packet: allow offsets to be set after packet end

Message ID 1519236011-14987-4-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v2,1/15] api: don't create special case for the tunnel-dummy packets | expand

Commit Message

Github ODP bot Feb. 21, 2018, 5:59 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Allow special case of setting offset just after packet end, as it
simplifies handling of packets.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 494 (lumag:ipsec-tfc-imp)
 ** https://github.com/Linaro/odp/pull/494
 ** Patch: https://github.com/Linaro/odp/pull/494.patch
 ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88
 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e
 **/
 platform/linux-generic/odp_packet.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 6fc5f2206..187580085 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1286,7 +1286,7 @@  int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset)
 {
 	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-	if (offset >= pkt_hdr->frame_len)
+	if (offset > pkt_hdr->frame_len)
 		return -1;
 
 	packet_hdr_has_l2_set(pkt_hdr, 1);
@@ -1298,7 +1298,7 @@  int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset)
 {
 	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-	if (offset >= pkt_hdr->frame_len)
+	if (offset > pkt_hdr->frame_len)
 		return -1;
 
 	pkt_hdr->p.l3_offset = offset;
@@ -1309,7 +1309,7 @@  int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset)
 {
 	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-	if (offset >= pkt_hdr->frame_len)
+	if (offset > pkt_hdr->frame_len)
 		return -1;
 
 	pkt_hdr->p.l4_offset = offset;