aboutsummaryrefslogtreecommitdiffstats
path: root/extras/libmemif/src/libmemif.h
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2018-03-29 13:15:10 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-30 20:48:36 +0000
commit3744fc7abce0cf8694d64b670589e35c6d7bf881 (patch)
tree04f5f42458a1ab4f3f4109f890e998221b22e622 /extras/libmemif/src/libmemif.h
parent17ddc0fee1bc20d0da84dd70bb579c8844a48ef4 (diff)
libmemif: zero-copy-slave mode + header space
Slave is now able to dequeue buffers from rx queue and enqueue them to tx queue (zero-copy operation). Slave can produce buffers with headroom, which will allow adding encap without copy. Change-Id: Ia189f8de1a68be787545ed46cf78d36403e7e9bf Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras/libmemif/src/libmemif.h')
-rw-r--r--extras/libmemif/src/libmemif.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/extras/libmemif/src/libmemif.h b/extras/libmemif/src/libmemif.h
index e1f96f90c80..88b6a10f7b4 100644
--- a/extras/libmemif/src/libmemif.h
+++ b/extras/libmemif/src/libmemif.h
@@ -203,15 +203,20 @@ typedef enum
/** \brief Memif buffer
@param desc_index - ring descriptor index
- @param len - buffer length
+ @param ring - pointer to ring containing descriptor for this buffer
+ @param len - available length
@param flags - memif buffer flags
@param data - pointer to shared memory data
*/
typedef struct
{
uint16_t desc_index;
+ void *ring;
uint32_t len;
+/** next buffer present (chained buffers) */
#define MEMIF_BUFFER_FLAG_NEXT (1 << 0)
+/** states that buffer is from rx ring */
+#define MEMIF_BUFFER_FLAG_RX (1 << 1)
uint8_t flags;
void *data;
} memif_buffer_t;
@@ -423,6 +428,22 @@ int memif_control_fd_handler (int fd, uint8_t events);
*/
int memif_delete (memif_conn_handle_t * conn);
+/** \brief Memif buffer enq tx
+ @param conn - memif conenction handle
+ @param qid - number indentifying queue
+ @param bufs - memif buffers
+ @param count - number of memif buffers to enque
+ @param count_out - returns number of allocated buffers
+
+ Slave is producer of buffers.
+ If connection handle points to master returns MEMIF_ERR_INVAL_ARG.
+
+ \return memif_err_t
+*/
+int memif_buffer_enq_tx (memif_conn_handle_t conn, uint16_t qid,
+ memif_buffer_t * bufs, uint16_t count,
+ uint16_t * count_out);
+
/** \brief Memif buffer alloc
@param conn - memif conenction handle
@param qid - number indentifying queue
@@ -441,11 +462,12 @@ int memif_buffer_alloc (memif_conn_handle_t conn, uint16_t qid,
@param conn - memif conenction handle
@param qid - number indentifying queue
@param count - number of buffers to be placed on ring
+ @param headroom - offset the buffer by headroom
\return memif_err_t
*/
int memif_refill_queue (memif_conn_handle_t conn, uint16_t qid,
- uint16_t count);
+ uint16_t count, uint16_t headroom);
/** \brief Memif transmit buffer burst
@param conn - memif conenction handle