Hi,

I propose that we'd remove the odp_packet_unshared_len() call.

The rationale is:
* Application rarely needs this to be maintained by ODP (never ?)
  * Application may maintain offsets/lengths e.g. in packet user area
  * Application may utilize knowledge about the context:
    e.g. in this pipeline stage all UDP payload is multi-referenced, etc
* It's not practical for ODP to maintain accurate byte counts when multiple 
references point into to the same packet (or reference of it) in different 
locations. Accurate book keeping would require that packet_free(ref) would 
update unshared_len on other references as well.

For example, three references to a packet.

     ref1      ref2  ref3
      |         |     |
      v         v     v 
      +--------------------+
      |         |  B  | A  |
      +--------------------+

For ref1, unshared_len is "packet_len - (A + B)". When ref2 is freed, 
unshared_len of ref1 should change to "packet_len - A". Additional book keeping 
and synchronization would be needed just for that to happen. A HW based pool 
would not do such update either. Currently, I leave it unchanged until all 
references are freed.

It's easy to imagine more complex examples using references of references, or 
race conditions. E.g. during free of ref2, another thread creates new reference 
between ref1 and ref2, so unshared_len of ref1 should be updated to "packet_len 
- (A + C)", instead of "packet_len - A".


-Petri

Reply via email to