diff mbox

Don't reparse on add/rem data for payload changes

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

Commit Message

Bill Fischofer Dec. 16, 2014, 7:32 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

Optimize odp_packet_add/rem_data() by not reparsing unless change is
affecting packet headers.

---
 platform/linux-generic/odp_packet.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 65e6288..ac2708a 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -401,7 +401,8 @@  odp_packet_t odp_packet_add_data(odp_packet_t pkt, uint32_t offset,
 				&new_hdr->buf_hdr.ref_count,
 				odp_atomic_load_u32(
 					&pkt_hdr->buf_hdr.ref_count));
-			_odp_packet_parse(newpkt);
+			if (offset < pkt_hdr->payload_offset)
+				_odp_packet_parse(newpkt);
 			odp_packet_free(pkt);
 		}
 	}
@@ -436,7 +437,8 @@  odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset,
 				&new_hdr->buf_hdr.ref_count,
 				odp_atomic_load_u32(
 					&pkt_hdr->buf_hdr.ref_count));
-			_odp_packet_parse(newpkt);
+			if (offset < pkt_hdr->payload_offset)
+				_odp_packet_parse(newpkt);
 			odp_packet_free(pkt);
 		}
 	}