![]() |
FD.io VPP
v18.07-34-g55fbdb9
Vector Packet Processing
|
Unidirectional shared-memory multi-ring message queue. More...
Include dependency graph for message_queue.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | svm_msg_q_ring_ |
| struct | svm_msg_q_ |
| struct | svm_msg_q_ring_cfg_ |
| struct | svm_msg_q_cfg_ |
| union | svm_msg_q_msg_t |
Typedefs | |
| typedef struct svm_msg_q_ring_ | svm_msg_q_ring_t |
| typedef struct svm_msg_q_ | svm_msg_q_t |
| typedef struct svm_msg_q_ring_cfg_ | svm_msg_q_ring_cfg_t |
| typedef struct svm_msg_q_cfg_ | svm_msg_q_cfg_t |
Functions | |
| svm_msg_q_t * | svm_msg_q_alloc (svm_msg_q_cfg_t *cfg) |
| Allocate message queue. More... | |
| void | svm_msg_q_free (svm_msg_q_t *mq) |
| Free message queue. More... | |
| svm_msg_q_msg_t | svm_msg_q_alloc_msg (svm_msg_q_t *mq, u32 nbytes) |
| Allocate message buffer. More... | |
| void | svm_msg_q_free_msg (svm_msg_q_t *mq, svm_msg_q_msg_t *msg) |
| Free message buffer. More... | |
| int | svm_msg_q_add (svm_msg_q_t *mq, svm_msg_q_msg_t msg, int nowait) |
| Producer enqueue one message to queue. More... | |
| int | svm_msg_q_sub (svm_msg_q_t *mq, svm_msg_q_msg_t *msg, svm_q_conditional_wait_t cond, u32 time) |
| Consumer dequeue one message from queue. More... | |
| void * | svm_msg_q_msg_data (svm_msg_q_t *mq, svm_msg_q_msg_t *msg) |
| Get data for message in queu. More... | |
Unidirectional shared-memory multi-ring message queue.
Definition in file message_queue.h.
| typedef struct svm_msg_q_cfg_ svm_msg_q_cfg_t |
| typedef struct svm_msg_q_ring_cfg_ svm_msg_q_ring_cfg_t |
| typedef struct svm_msg_q_ring_ svm_msg_q_ring_t |
| typedef struct svm_msg_q_ svm_msg_q_t |
| int svm_msg_q_add | ( | svm_msg_q_t * | mq, |
| svm_msg_q_msg_t | msg, | ||
| int | nowait | ||
| ) |
Producer enqueue one message to queue.
Prior to calling this, the producer should've obtained a message buffer from one of the rings by calling svm_msg_q_alloc_msg.
| mq | message queue |
| msg | message (pointer to ring position) to be enqueued |
| nowait | flag to indicate if request is blocking or not |
Definition at line 143 of file message_queue.c.
Here is the call graph for this function:| svm_msg_q_t* svm_msg_q_alloc | ( | svm_msg_q_cfg_t * | cfg | ) |
Allocate message queue.
Allocates a message queue on the heap. Based on the configuration options, apart from the message queue this also allocates (one or multiple) shared-memory rings for the messages.
| cfg | configuration options: queue len, consumer pid, ring configs |
Definition at line 20 of file message_queue.c.
Here is the call graph for this function:| svm_msg_q_msg_t svm_msg_q_alloc_msg | ( | svm_msg_q_t * | mq, |
| u32 | nbytes | ||
| ) |
Allocate message buffer.
Message is allocated on the first available ring capable of holding the requested number of bytes.
| mq | message queue |
| nbytes | number of bytes needed for message |
Definition at line 66 of file message_queue.c.
| void svm_msg_q_free | ( | svm_msg_q_t * | mq | ) |
Free message queue.
| mq | message queue to be freed |
Definition at line 53 of file message_queue.c.
Here is the call graph for this function:| void svm_msg_q_free_msg | ( | svm_msg_q_t * | mq, |
| svm_msg_q_msg_t * | msg | ||
| ) |
Free message buffer.
Marks message buffer on ring as free.
| mq | message queue |
| msg | message to be freed |
Definition at line 105 of file message_queue.c.
| void* svm_msg_q_msg_data | ( | svm_msg_q_t * | mq, |
| svm_msg_q_msg_t * | msg | ||
| ) |
Get data for message in queu.
| mq | message queue |
| msg | message for which the data is requested |
Definition at line 98 of file message_queue.c.
Here is the call graph for this function:| int svm_msg_q_sub | ( | svm_msg_q_t * | mq, |
| svm_msg_q_msg_t * | msg, | ||
| svm_q_conditional_wait_t | cond, | ||
| u32 | time | ||
| ) |
Consumer dequeue one message from queue.
This returns the message pointing to the data in the message rings. The consumer is expected to call svm_msg_q_free_msg once it finishes processing/copies the message data.
| mq | message queue |
| msg | pointer to structure where message is to be received |
| cond | flag that indicates if request should block or not |
Definition at line 150 of file message_queue.c.
Here is the call graph for this function: