Once again. There’s no point of implementation speculating what will happen to 
the packet after the pull/push operation. Which L2/L3/L4/… offsets are going to 
be changed and in which direction? Between which headers the application is 
going to add/remove layers? What header are moved?  What happens next in the 
chain? What offsets really need an update? Application has all that knowledge 
and can do only those updates that are needed. We keep it simple – if 
application modifies the packet it is responsible to maintain metadata offsets 
accurate.

-Petri



From: ext Bill Fischofer [mailto:[email protected]]
Sent: Wednesday, December 17, 2014 2:06 PM
To: Savolainen, Petri (NSN - FI/Espoo)
Cc: Petri Savolainen; lng-odp-forward
Subject: Re: [lng-odp] [PATCH] Remove packet l2/l3/l4 offset adjustments

You are correct that the API states this. What others are pointing out are the 
non-intutive implications of choosing to define the API this way.  You've not 
provided a convincing rationale for making this choice.   While you can assert 
your right not to do so, it would be helpful to others if you did.

On Wed, Dec 17, 2014 at 5:51 AM, Savolainen, Petri (NSN - FI/Espoo) 
<[email protected]<mailto:[email protected]>> wrote:
The API says already:

“Operation does not modify packet segmentation or move data. Handles and
pointers remain valid. User is responsible to update packet meta-data
offsets when needed.”

If application modifies packet headers (adds/removes/changes them), it must 
update those offsets that it or some other block after it in the chain cares 
about (reloads from the packet). It may leave some offsets unchanged because it 
knows that those are not needed any more.

Some more words can be added, if the current text is not clear enough. The 
current implementation does not implement the spec. This patch fixes that issue.


-Petri




From: ext Bill Fischofer 
[mailto:[email protected]<mailto:[email protected]>]
Sent: Wednesday, December 17, 2014 1:33 PM
To: Petri Savolainen
Cc: lng-odp-forward
Subject: Re: [lng-odp] [PATCH] Remove packet l2/l3/l4 offset adjustments

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.

On Wed, Dec 17, 2014 at 3:12 AM, Petri Savolainen 
<[email protected]<mailto:[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]<mailto:[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]<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