@@ -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);
}
}
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(-)