diff mbox

[API-NEXT,PATCHv2,1/6] api: pktio: add pktio index conversion APIs

Message ID 1460668001-25533-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer April 14, 2016, 9:06 p.m. UTC
Add the two APIs odp_pktio_to_index() and odp_pktio_from_index() to enable
applications to convert PktIO handles to and from indices for managing
user contexts and related associated data.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 include/odp/api/spec/packet_io.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox

Patch

diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 466cab6..bb14c43 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -908,6 +908,26 @@  int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t offset);
 int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom);
 
 /**
+ * Get pktio index from handle
+ *
+ * @param pktio   Pktio handle
+ *
+ * @return        Pktio index (0..odp_config_pktio_entries()-1)
+ * @retval <0     Error (e.g., handle not valid)
+ */
+int odp_pktio_to_index(odp_pktio_t pktio);
+
+/**
+ * Get pktio handle from index
+ *
+ * @param ndx      Pktio index
+ *
+ * @return         Pktio handle
+ * @retval ODP_PKTIO_INVALID on error
+ */
+odp_pktio_t odp_pktio_from_index(int ndx);
+
+/**
  * Get printable value for an odp_pktio_t
  *
  * @param pktio   odp_pktio_t handle to be printed