This patch adds support for packet references and splices following discussions at LAS16 on this subject. This is more than an RFC as it is fully operational, but I haven't added the validation test suite enhancements to test this until we are agreed on the syntax and semantics of these APIs. I'll post a revision with those additions once we're happy with the base functions.
I've changed things around from Petri's original proposal by splitting this into two separate APIs: odp_packet_splice() and odp_packet_ref(), where the latter is just a splice of a zero-length header on to a base packet. The various odp_packet_head/tail_push/pull/extend/truc() APIs have also been enhanced to behave sensibly when presented with a spliced packet as input. Reference counts are used to enable odp_packet_free() to not free a packet until all splices based on it are also freed. Also added is a new API odp_packet_is_spliced() that tells whether an input packet is a splice, as this seems necesssary for completeness. Note that there is no odp_packet_unsplice() API. We should discuss and decide if such an API is warranted for symmetry. Bill Fischofer (2): api: packet: add support for packet splices and references linux-generic: packet: implement splice/reference apis include/odp/api/spec/packet.h | 86 ++++++++++++ .../linux-generic/include/odp_packet_internal.h | 54 +++++++- platform/linux-generic/odp_packet.c | 149 ++++++++++++++++++--- 3 files changed, 270 insertions(+), 19 deletions(-) -- 2.7.4
