On 09/14/2015 11:14 AM, Nicolas Morey-Chaisemartin wrote: > Remove duplicated code and use preexisting metadata copy function > > Signed-off-by: Nicolas Morey-Chaisemartin <[email protected]> > --- > platform/linux-generic/odp_packet.c | 34 ++-------------------------------- > 1 file changed, 2 insertions(+), 32 deletions(-) > > diff --git a/platform/linux-generic/odp_packet.c > b/platform/linux-generic/odp_packet.c > index 5581cc4..3d36b34 100644 > --- a/platform/linux-generic/odp_packet.c > +++ b/platform/linux-generic/odp_packet.c > @@ -427,22 +427,7 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt, > uint32_t offset, > odp_packet_free(newpkt); > newpkt = ODP_PACKET_INVALID; > } else { > - odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt); > - new_hdr->input = pkt_hdr->input; > - new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64; > - if (new_hdr->buf_hdr.uarea_addr != NULL && > - pkt_hdr->buf_hdr.uarea_addr != NULL) > - memcpy(new_hdr->buf_hdr.uarea_addr, > - pkt_hdr->buf_hdr.uarea_addr, > - new_hdr->buf_hdr.uarea_size <= > - pkt_hdr->buf_hdr.uarea_size ? > - new_hdr->buf_hdr.uarea_size : > - pkt_hdr->buf_hdr.uarea_size);
BTW, why do we need to compute the min uarea_size ? The allocated packet comes from the same pool as the old one (in the 2 cases I removed, not the md_copy function), so it should have the same uarea_size, shouldn't it? And on a side note, do we really need both user ptr and user area? If the user really wants a user_ptr, he could just set user_are_size to sizeof(void*) and store it there? _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
