Hi,

I still think that packet ref API should be defined so that an implementation 
may fall back to doing packet copy instead of reference to shared data (if it 
simply cannot handle packets by reference). Now after implementing packet ref 
API as copy (in about 90 lines), only issues are with tests like this one ...

        ref = odp_packet_ref(pkt, 100);
        odp_packet_free(ref);

        /* Verify that pkt no longer has a ref */
        CU_ASSERT(odp_packet_has_ref(pkt) == 0);

... since free(ref) would need to update also 'pkt'.

I think we should lesser the synchronization guarantees of 
odp_packet_has_ref(), so that it returns if a packet "may have" still have 
multiple references. And same thing for odp_packet_unshared_len() (may have 
shared bytes). If application needs to be sure, it would need to be assured 
some other way (e.g. calculating itself how many references was created / 
freed). Most application would not be interested on the book keeping, but on 
the possibility of creating and using references.

-Petri







Reply via email to