diff mbox

[API-NEXT,PATCHv3,1/4] api: packet reference count support

Message ID 1442389983-17007-2-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Sept. 16, 2015, 7:53 a.m. UTC
Add api for packet reference count support. Which is useful in case:
 - multicast support
 - TCP retransmission
 - traffic generator

Introduced new call: newpkt = odp_packet_create_ref(pkt) which creates
reference to original packet, but handles for reference packet and original
are different.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 include/odp/api/config.h | 5 +++++
 include/odp/api/packet.h | 9 +++++++++
 2 files changed, 14 insertions(+)
diff mbox

Patch

diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index 302eaf5..2441f72 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -126,6 +126,11 @@  extern "C" {
  */
 #define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
 
+/**
+ * Maximum packet references.
+ */
+#define ODP_CONFIG_PACKET_REFS 2
+
 /** Maximum number of shared memory blocks.
  *
  * This the the number of separate SHM areas that can be reserved concurrently
diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 5d46b7b..f9745fb 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -125,6 +125,15 @@  odp_packet_t odp_packet_from_event(odp_event_t ev);
  */
 odp_event_t odp_packet_to_event(odp_packet_t pkt);
 
+/**
+ * Create reference for packet handle
+ *
+ * @param pkt  Packet handle
+ *
+ * @return New packet handle
+ */
+odp_packet_t odp_packet_create_ref(odp_packet_t pkt);
+
 /*
  *
  * Pointers and lengths