The buffer event FIFO circular queue, used between the LNet Kernel Core and LNet transport.
Unlike the standard m0_queue, this queue supports a producer and consumer in different address spaces sharing the queue via shared memory. No locking is required by this single producer or consumer.
◆ bev_cqueue_add()
Adds a new element to the circular buffer queue in the consumer address space.
- Note
- The new element must already be blessed via bev_link_bless() in the producer address space. The cbl_c_self of the new element, ql, is set by bev_cqueue_add().
- Parameters
-
q | the queue |
ql | the element to add |
- Precondition
- q->cbcq_nr > 0 && q->cbcq_consumer != NULL && nlx_core_kmem_loc_invariant(&ql->cbl_p_self_loc)
Definition at line 628 of file bev_cqueue.c.
◆ bev_cqueue_fini()
Finalise the buffer event queue. Buffer events in the queue are freed using the specified callback.
- Note
- This operation is to be used only by the consumer.
Definition at line 682 of file bev_cqueue.c.
◆ bev_cqueue_get()
Gets the oldest element in the FIFO circular queue, advancing the divider.
- Parameters
-
- Returns
- the link to the element in the consumer context, NULL when the queue is empty
Definition at line 722 of file bev_cqueue.c.
◆ bev_cqueue_init()
Initialises the buffer event queue. Should be invoked in the consumer address space only.
- Note
- both elements, ql1 and ql2 must be blessed via bev_link_bless() in the producer address space before they are used here.
- Parameters
-
q | buffer event queue to initialise |
ql1 | the first element in the new queue |
ql2 | the second element in the new queue |
- Precondition
- q != NULL && q->cbcq_nr == 0 && ql1 != NULL && ql2 != NULL
- Postcondition
- bev_cqueue_invariant(q) && q->cbcq_count == 0
Definition at line 658 of file bev_cqueue.c.
◆ bev_cqueue_invariant()
◆ bev_cqueue_is_empty()
Tests if the buffer event queue is empty.
Definition at line 702 of file bev_cqueue.c.
◆ bev_cqueue_pnext()
Determines the next element in the queue that can be used by the producer. This operation causes the page containing the next element to be mapped using kmap_atomic()
.
- Note
- This operation is to be used only by the producer.
- Parameters
-
- Returns
- a pointer to the next available element in the producer context
- Precondition
- bev_cqueue_invariant(q)
- Postcondition
- p->cbl_c_self != q->cbcq_consumer
Definition at line 40 of file kbev_cqueue.c.
◆ bev_cqueue_put()
Puts (produces) an element so it can be consumed. The caller must first call bev_cqueue_pnext() to ensure such an element exists. The page containing the element is unmapped using kunmap_atomic()
.
- Parameters
-
- Precondition
- bev_cqueue_invariant(q) && p->cbl_c_self != q->cbcq_consumer
Definition at line 69 of file kbev_cqueue.c.
◆ bev_cqueue_size()
Returns total size of the event queue, including in-use and free elements.
Definition at line 711 of file bev_cqueue.c.
◆ bev_link_bless()
Blesses the nlx_core_bev_link of a nlx_core_bev_cqueue element, assigning the producer self value.
- Parameters
-
ql | The link to bless, the caller must have already mapped the element into the producer address space. |
pg | The page object corresponding to the link object. |
Definition at line 92 of file kbev_cqueue.c.