On 17 December 2014 at 12:32, Bill Fischofer <[email protected]> wrote:
> If we do this we really need a documentation note that says:
>
> Note: After doing a head push/pull, applications cannot use routines like
> odp_packet_l3_ptr(), etc., until they make appropriate  calls to
> odp_packet_l3_offset_set(), etc., to reflect the previous operation.
> Otherwise they will receive pointers to incorrect areas of the packet.
And since you set absolute Lx offset values, you need to first read
the different Lx offsets, pull a header and then reset the Lx offsets
(old offset - pull size). Complicated. Will require a lot of
boiler-plate code in the applications and many will get it wrong. Also
doesn't seem very efficient to me.

I think we should look at what the applications does and expects in
different situations and then define the API's that make the
applications simple.

>
> On Wed, Dec 17, 2014 at 3:12 AM, Petri Savolainen
> <[email protected]> wrote:
>>
>> Packet head push/pull calls do not automatically adjust
>> metadata offsets, only data pointer and headroom.
>>
>> Signed-off-by: Petri Savolainen <[email protected]>
>> ---
>>  platform/linux-generic/include/odp_packet_internal.h | 8 --------
>>  1 file changed, 8 deletions(-)
>>
>> diff --git a/platform/linux-generic/include/odp_packet_internal.h
>> b/platform/linux-generic/include/odp_packet_internal.h
>> index a0eff30..18e69b3 100644
>> --- a/platform/linux-generic/include/odp_packet_internal.h
>> +++ b/platform/linux-generic/include/odp_packet_internal.h
>> @@ -192,24 +192,16 @@ static inline void *packet_map(odp_packet_hdr_t
>> *pkt_hdr,
>>                           pkt_hdr->headroom + pkt_hdr->frame_len);
>>  }
>>
>> -#define pull_offset(x, len) (x = x < len ? 0 : x - len)
>> -
>>  static inline void push_head(odp_packet_hdr_t *pkt_hdr, size_t len)
>>  {
>>         pkt_hdr->headroom  -= len;
>>         pkt_hdr->frame_len += len;
>> -       pkt_hdr->l2_offset += len;
>> -       pkt_hdr->l3_offset += len;
>> -       pkt_hdr->l4_offset += len;
>>  }
>>
>>  static inline void pull_head(odp_packet_hdr_t *pkt_hdr, size_t len)
>>  {
>>         pkt_hdr->headroom  += len;
>>         pkt_hdr->frame_len -= len;
>> -       pull_offset(pkt_hdr->l2_offset, len);
>> -       pull_offset(pkt_hdr->l3_offset, len);
>> -       pull_offset(pkt_hdr->l4_offset, len);
>>  }
>>
>>  static inline void push_tail(odp_packet_hdr_t *pkt_hdr, size_t len)
>> --
>> 2.2.0
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> [email protected]
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp
>

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to