aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNithin Dabilpuram <ndabilpuram@marvell.com>2021-02-12 14:22:22 +0530
committerMatias Elo <matias.elo@nokia.com>2021-03-31 15:57:30 +0300
commit2f2a749af15722c41f6d3bff18726d2c2a0d5293 (patch)
treea5008558a6d1d6270480d629881388953b679fce
parent58e81f7547a039231330b37644fd1a1de7d38fc7 (diff)
api: event: introduce packet Tx completion event
Introduce packet Tx completion event which indicates a packet's Tx completion. It also holds a user defined context pointer. This patch also adds odp_packet_tx_compl_t type handling functions to free the compl to platform, and to get user context pointer from odp_packet_tx_compl_t event. Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
-rw-r--r--include/odp/api/abi-default/event.h3
-rw-r--r--include/odp/api/abi-default/packet.h5
-rw-r--r--include/odp/api/spec/event.h3
-rw-r--r--include/odp/api/spec/packet.h65
4 files changed, 75 insertions, 1 deletions
diff --git a/include/odp/api/abi-default/event.h b/include/odp/api/abi-default/event.h
index a63571ca0..8976252f3 100644
--- a/include/odp/api/abi-default/event.h
+++ b/include/odp/api/abi-default/event.h
@@ -30,7 +30,8 @@ typedef enum {
ODP_EVENT_TIMEOUT = 3,
ODP_EVENT_CRYPTO_COMPL = 4,
ODP_EVENT_IPSEC_STATUS = 5,
- ODP_EVENT_PACKET_VECTOR = 6
+ ODP_EVENT_PACKET_VECTOR = 6,
+ ODP_EVENT_PACKET_TX_COMPL = 7,
} odp_event_type_t;
typedef enum {
diff --git a/include/odp/api/abi-default/packet.h b/include/odp/api/abi-default/packet.h
index 3660cfa29..712f83ef6 100644
--- a/include/odp/api/abi-default/packet.h
+++ b/include/odp/api/abi-default/packet.h
@@ -22,6 +22,9 @@ typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_seg_t;
/** @internal Dummy type for strong typing */
typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_vector_t;
+/** @internal Dummy type for strong typing */
+typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_tx_compl_t;
+
/** @ingroup odp_packet
* @{
*/
@@ -29,11 +32,13 @@ typedef struct { char dummy; /**< *internal Dummy */ } _odp_abi_packet_vector_t;
typedef _odp_abi_packet_t *odp_packet_t;
typedef _odp_abi_packet_seg_t *odp_packet_seg_t;
typedef _odp_abi_packet_vector_t *odp_packet_vector_t;
+typedef _odp_abi_packet_tx_compl_t *odp_packet_tx_compl_t;
#define ODP_PACKET_INVALID ((odp_packet_t)0)
#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)0)
#define ODP_PACKET_OFFSET_INVALID 0xffff
#define ODP_PACKET_VECTOR_INVALID ((odp_packet_vector_t)0)
+#define ODP_PACKET_TX_COMPL_INVALID ((odp_packet_tx_compl_t)0)
typedef uint8_t odp_proto_l2_type_t;
diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h
index dc61b6e31..32fd37c29 100644
--- a/include/odp/api/spec/event.h
+++ b/include/odp/api/spec/event.h
@@ -60,6 +60,9 @@ extern "C" {
* - IPSEC status update event (odp_ipsec_status_t)
* - ODP_EVENT_PACKET_VECTOR
* - Vector of packet events (odp_packet_t) as odp_packet_vector_t
+ * - ODP_EVENT_PACKET_TX_COMPL
+ * - Packet Tx completion event (odp_packet_tx_compl_t) generated as a result of a Packet Tx
+ * completion.
*/
/**
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index c00d4e998..1e370a245 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -188,6 +188,16 @@ extern "C" {
*/
/**
+ * @typedef odp_packet_tx_compl_t
+ * ODP Packet Tx completion
+ */
+
+/**
+ * @def ODP_PACKET_TX_COMPL_INVALID
+ * Invalid packet Tx completion
+ */
+
+/**
* Protocol
*/
typedef enum odp_proto_t {
@@ -2347,6 +2357,61 @@ uint64_t odp_packet_vector_to_u64(odp_packet_vector_t hdl);
/*
*
+ * Packet Tx completion event handling routines
+ * ********************************************************
+ */
+
+/**
+ * Get packet Tx completion handle from event
+ *
+ * Converts an ODP_EVENT_PACKET_TX_COMPL type event to packet Tx completion
+ * handle.
+ *
+ * @param ev Event handle
+ *
+ * @return Packet Tx completion handle
+ *
+ * @see odp_event_type()
+ */
+odp_packet_tx_compl_t odp_packet_tx_compl_from_event(odp_event_t ev);
+
+/** Convert packet Tx completion to event
+ *
+ * @param tx_compl Packet Tx completion
+ *
+ * @return Event handle
+ */
+odp_event_t odp_packet_tx_compl_to_event(odp_packet_tx_compl_t tx_compl);
+
+/**
+ * Free packet Tx completion
+ *
+ * Frees the packet Tx completion back to platform. It frees packet Tx
+ * completion that gets allocated as part of packet Tx completion request
+ * for a given packet.
+ *
+ * @param tx_compl Packet Tx completion handle
+ *
+ * @see odp_packet_tx_completion_request()
+ */
+void odp_packet_tx_compl_free(odp_packet_tx_compl_t tx_compl);
+
+/**
+ * User context pointer
+ *
+ * Return user context pointer from packet Tx completion event.
+ * This is the same value set to packet using odp_packet_user_ptr_set().
+ *
+ * @param tx_compl Packet Tx completion handle
+ *
+ * @return User context pointer
+ *
+ * @see odp_packet_user_ptr_set()
+ */
+void *odp_packet_tx_compl_user_ptr(odp_packet_tx_compl_t tx_compl);
+
+/*
+ *
* Debugging
* ********************************************************
*