This patch adds support for packet references and splices following discussions at LAS16 on this subject.
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 manipulation 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 are two new APIs for working with spliced packets as these seem necessary for completeness: - odp_packet_is_a_splice() tells whether an input packet is a splice, and if so how many spliced packets it contains - odp_packet_is_spliced() tells whether any splices have been created on this packet, and if so how many. Note that there is no odp_packet_unsplice() API. To remove a splice from a base packet currently requres that the splice be freed via an odp_packet_free() call. We should discuss and decide if such an API is warranted for symmetry. Changes for v6: - Correct splice handling in odp_packet_offset(), odp_packet_trunc_head(), and odp_packet_trunc_tail() Changes for v5: - Struct layout and pathlength optimizations - Correct array addressing in validation test suite Changes for v4: - Add negative tests to validation test suite - Fix implementation bugs relating to negative tests Changes for v3: - Bug fixes (detected by the validation tests) - Addition of validation tests for these new APIs - Diagrams and User Guide documentation for these new APIs Changes for v2: - Bug fixes - Enhance ODP packet segment APIs to behave properly with spliced packets Bill Fischofer (5): api: packet: add support for packet splices and references linux-generic: packet: implement splice/reference apis validation: packet: add packet splice/reference tests doc: images: add images for packet splice/reference documentation doc: userguide: add user documentation for packet splice/reference APIs doc/images/doublesplice.svg | 67 ++++++ doc/images/pktref.svg | 49 ++++ doc/images/splice.svg | 64 ++++++ doc/users-guide/users-guide-packet.adoc | 118 ++++++++++ include/odp/api/spec/packet.h | 103 +++++++++ .../linux-generic/include/odp_packet_internal.h | 54 ++++- platform/linux-generic/odp_packet.c | 246 ++++++++++++++++++--- test/common_plat/validation/api/packet/packet.c | 176 +++++++++++++++ test/common_plat/validation/api/packet/packet.h | 1 + 9 files changed, 840 insertions(+), 38 deletions(-) create mode 100644 doc/images/doublesplice.svg create mode 100644 doc/images/pktref.svg create mode 100644 doc/images/splice.svg -- 2.7.4