The reason is that only application knows what it’s doing to the packet. 
Application is likely to update the offsets anyway after the push/pull 
operation. Implementation would just speculate what is happening to the packet.

-Petri


From: ext Bill Fischofer [mailto:[email protected]]
Sent: Tuesday, December 16, 2014 3:36 PM
To: Savolainen, Petri (NSN - FI/Espoo)
Cc: ext Taras Kondratiuk; [email protected]
Subject: Re: [lng-odp] [PATCHv5 8/9] api: packet: add head/tail room 
manipulation

Taras is just repackaging the v4 patch from December 12th.

We can certainly consider this a trivial bug-fix if needed. However I would 
like to understand what the advantage of not making these adjustments as part 
of these operations since without them after a push_head() operation all off 
the offsets will be incorrect.  Is this some sort of performance concern or is 
there are reason why it's preferable to ask every application take 
responsibility for these adjustments as opposed to letting the implementation 
do them?

I ask this because in SoCs that maintain this sort of meta data in HW would 
need special additional SW to "undo" these adjustments if that's a required 
feature of the ODP API.

On Tue, Dec 16, 2014 at 7:13 AM, Savolainen, Petri (NSN - FI/Espoo) 
<[email protected]<mailto:[email protected]>> wrote:
> diff --git a/platform/linux-generic/include/odp_packet_internal.h
> b/platform/linux-generic/include/odp_packet_internal.h
> index 0b24300..bd5daf0 100644
> --- a/platform/linux-generic/include/odp_packet_internal.h
> +++ b/platform/linux-generic/include/odp_packet_internal.h
> @@ -188,6 +188,39 @@ 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;

"User is responsible to update packet meta-data offsets when needed."

This operation must not modify L2/l3/l4 offsets.


> +}
> +
> +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);

Same thing here.

-Petri


> +}
> +
> +static inline void push_tail(odp_packet_hdr_t *pkt_hdr, size_t len)
> +{
> +     pkt_hdr->tailroom  -= len;
> +     pkt_hdr->frame_len += len;
> +}
> +
> +
> +static inline void pull_tail(odp_packet_hdr_t *pkt_hdr, size_t len)
> +{
> +     pkt_hdr->tailroom  += len;
> +     pkt_hdr->frame_len -= len;
> +}
> +




_______________________________________________
lng-odp mailing list
[email protected]<mailto:[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