On Sun, Jan 18, 2015 at 12:22:12AM +0200, Taras Kondratiuk wrote:
> On 01/17/2015 01:29 PM, Jerin Jacob wrote:
> > odp_packet_seg_t is an opaque type, based on the implementation, the return
> > value of odp_packet_last_seg can be changed after headroom/tailroom 
> > push/pull
> > operation.
> 
> No. By definition headroom/tailroom push/pull operations don't change
> segmentation. So the last segment must remain the same.

For cavium, odp_packet_seg_t pretty much defined by the hardware spec   
(its next seg data addr and data size of the next segment) so obviously
size of the segment will change after the tailroom push/pull operation. 

If odp specification demands for same seg handle value then I need to map it as 
pointer which 
points to the value. But its adds additional overhead for no good and even if 
we make 
it as pointer, it will fail in case of odp_packet_del_data.

IMO, enforcing applications to not cache the odp_packet_seg_t for 
headroom/tailroom push/pull and odp_packet_add/del_data will give freedom to
implementation to map best odp_packet_seg_t for the hardware.

- Jerin

> 
> > 
> > Signed-off-by: Jerin Jacob <[email protected]>
> > ---
> >  test/validation/buffer/odp_packet_test.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/test/validation/buffer/odp_packet_test.c 
> > b/test/validation/buffer/odp_packet_test.c
> > index b6fa028..7c2b169 100644
> > --- a/test/validation/buffer/odp_packet_test.c
> > +++ b/test/validation/buffer/odp_packet_test.c
> > @@ -289,6 +289,9 @@ static void _verify_tailroom_shift(odp_packet_t pkt,
> >             tail = odp_packet_pull_tail(pkt, -shift);
> >     }
> >  
> > +   seg = odp_packet_last_seg(pkt);
> > +   CU_ASSERT(seg != ODP_SEGMENT_INVALID);
> > +
> >     CU_ASSERT(tail != NULL);
> >     CU_ASSERT(odp_packet_seg_data_len(pkt, seg) == seg_data_len + shift);
> >     CU_ASSERT(odp_packet_len(pkt) == pkt_data_len + shift);
> > 
> 
> 
> -- 
> Taras Kondratiuk

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

Reply via email to