diff options
author | Jakub Grajciar <jgrajcia@cisco.com> | 2021-01-08 15:01:13 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-01-21 13:33:44 +0000 |
commit | f35fef244682645762cdff14cf313a42dd2d750c (patch) | |
tree | 5492783b022497e9b854f4f49a2e3e274ddadd01 /extras/libmemif/src/libmemif.h | |
parent | 9b8121cdc0bc1571c10b45164c93ecd4e1f45d50 (diff) |
libmemif: buffer enqueue refactor
Refactored memif_buffer_enq_tx - dequeue buffers from any queue (rx/tx) and
enqueue them to any tx queue.
Added memif_buffer_requeue - swap descriptors of provided buffers.
Type: refactor
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Change-Id: I8482824df920aaaf8325d52a297ed57a815aaba6
Diffstat (limited to 'extras/libmemif/src/libmemif.h')
-rw-r--r-- | extras/libmemif/src/libmemif.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/extras/libmemif/src/libmemif.h b/extras/libmemif/src/libmemif.h index b55e81ae0ab..379ccd1e260 100644 --- a/extras/libmemif/src/libmemif.h +++ b/extras/libmemif/src/libmemif.h @@ -323,12 +323,10 @@ typedef enum typedef struct { uint16_t desc_index; - void *ring; + void *queue; 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; @@ -616,7 +614,8 @@ int memif_delete (memif_conn_handle_t * conn); @param count - number of memif buffers to enqueue @param count_out - returns number of allocated buffers - Slave is producer of buffers. + Enqueue buffers to specified tx queue. Can only be used by slave. + Updates desc_index field for each memif buffer. If connection handle points to master returns MEMIF_ERR_INVAL_ARG. \return memif_err_t @@ -625,6 +624,16 @@ 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 enq tx at idx + @param conn - memif connection handle + @param buf_a - memif buffer + @param buf_b - memif buffer + + Swap descriptors for provided buffers and update the buffers +*/ +int memif_buffer_requeue (memif_conn_handle_t conn, memif_buffer_t *buf_a, + memif_buffer_t *buf_b); + /** \brief Memif buffer alloc @param conn - memif connection handle @param qid - number identifying queue @@ -639,7 +648,7 @@ int memif_buffer_alloc (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t * bufs, uint16_t count, uint16_t * count_out, uint16_t size); -/** \brief Memif refill ring +/** \brief Memif refill queue @param conn - memif connection handle @param qid - number identifying queue @param count - number of buffers to be placed on ring |