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
This commit is contained in:

committed by
Damjan Marion

parent
9b8121cdc0
commit
f35fef2446
@ -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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -95,7 +95,7 @@ typedef struct
|
||||
int int_fd;
|
||||
|
||||
uint64_t int_count;
|
||||
uint32_t alloc_bufs;
|
||||
uint32_t next_buf; /* points to next free buffer */
|
||||
} memif_queue_t;
|
||||
|
||||
typedef struct memif_msg_queue_elt
|
||||
|
Reference in New Issue
Block a user