diff mbox

[RFC,API-NEXT] api: packet: add packet references and composites

Message ID 1452178213-23805-2-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Jan. 7, 2016, 2:50 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 include/odp/api/packet.h | 98 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)
diff mbox

Patch

diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 8651a47..4e62453 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -177,6 +177,37 @@  odp_packet_t odp_packet_from_event(odp_event_t ev);
  */
 odp_event_t odp_packet_to_event(odp_packet_t pkt);
 
+/**
+ * Reference share modes
+ *
+ * Used to specify whether a packet reference is shared or nonshared. Header
+ * changes made by push/pull operations via shared references are seen by all
+ * other shared references to that packet. Header changes made by push/pull
+ * operations via nonshared references are unique to that reference and not
+ * seen by other references to that packet.
+ */
+typedef enum odp_packet_share_t {
+	ODP_SHARED_HEADERS,
+	ODP_NONSHARED_HEADERS,
+} odp_packet_share_t;
+
+/**
+ * Generate a packet reference
+ *
+ * Obtain another handle that refers to the same packet. A reference enables
+ * an application to retain access to a packet for things like multicasting or
+ * retransmission, as the packet will be retained until each reference to it
+ * is released via odp_packet_free().  References may be either shared or
+ * nonshared.
+ *
+ * @param pkt packet handle
+ *
+ * @param share share mode
+ *
+ * @return packet handle that is a reference to the input packet
+ */
+odp_packet_t odp_packet_ref(odp_packet_t pkt, odp_packet_share_t share);
+
 /*
  *
  * Pointers and lengths
@@ -428,6 +459,73 @@  void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len,
 			odp_packet_seg_t *seg);
 
 /*
+ * Packet Compositing
+ * ********************************************************
+ */
+
+/**
+ * Push a packet prefix
+ *
+ * Create a packet composite by prefixing one packet to another.
+ *
+ * @param pkt Base packet handle
+ *
+ * @param prefix Packet to be prefixed to pkt
+ *
+ * @return Handle to the resulting packet composite
+ * @retval ODP_PACKET_INVALID Operation failed
+ */
+odp_packet_t odp_packet_push_prefix(odp_packet_t pkt, odp_packet_t prefix);
+
+/**
+ * Pull a packet prefix from a composite packet.
+ *
+ * Decomposite a packet by removing a packet prefix
+ *
+ * @param pkt Base packet handle
+ *
+ * @param prefix Packet prefix to be pulled
+ *
+ * @return Handle to the resulting packet composite
+ * @retval ODP_PACKET_INVALID Operation failed
+ */
+odp_packet_t odp_packet_pull_prefix(odp_packet_t pkt, odp_packet_t prefix);
+
+/**
+ * Create a packet composite by suffixing one packet to another.
+ *
+ * @param pkt Base packet handle
+ *
+ * @param suffix Packet to be suffixed to pkt
+ *
+ * @return Handle to the resulting packet composite
+ * @retval ODP_PACKET_INVALID Operation failed
+ */
+odp_packet_t odp_packet_push_suffix(odp_packet_t pkt, odp_packet_t suffix);
+
+/**
+ * Pull a packet suffix from a composite packet.
+ *
+ * @param pkt Base packet handle
+ *
+ * @param suffix Packet suffix to be pulled
+ *
+ * @return Handle to the resulting packet composite
+ * @retval ODP_PACKET_INVALID Operation failed
+ */
+odp_packet_t odp_packet_pull_suffix(odp_packet_t pkt, odp_packet_t suffix);
+
+/**
+ * Indicate whether a packet is a composite
+ *
+ * @param pkt Packet handle
+ *
+ * @retval 0 Packet is not a composite
+ * @retval 1 Packet is a composite
+ */
+int odp_packet_is_composite(odp_packet_t pkt);
+
+/*
  *
  * Meta-data
  * ********************************************************