Motr  M0
LNet Buffer Event Queue Interface
Collaboration diagram for LNet Buffer Event Queue Interface:

Functions

static bool bev_cqueue_invariant (const struct nlx_core_bev_cqueue *q)
 
static void bev_cqueue_add (struct nlx_core_bev_cqueue *q, struct nlx_core_bev_link *ql)
 
static void bev_cqueue_init (struct nlx_core_bev_cqueue *q, struct nlx_core_bev_link *ql1, struct nlx_core_bev_link *ql2)
 
static void bev_cqueue_fini (struct nlx_core_bev_cqueue *q, void(*free_cb)(struct nlx_core_bev_link *))
 
static bool bev_cqueue_is_empty (const struct nlx_core_bev_cqueue *q)
 
static size_t bev_cqueue_size (const struct nlx_core_bev_cqueue *q)
 
static struct nlx_core_bev_linkbev_cqueue_get (struct nlx_core_bev_cqueue *q)
 
static struct nlx_core_bev_linkbev_cqueue_pnext (const struct nlx_core_bev_cqueue *q)
 
static void bev_cqueue_put (struct nlx_core_bev_cqueue *q, struct nlx_core_bev_link *p)
 
static void bev_link_bless (struct nlx_core_bev_link *ql, struct page *pg)
 

Detailed Description

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.

Function Documentation

◆ bev_cqueue_add()

static void bev_cqueue_add ( struct nlx_core_bev_cqueue q,
struct nlx_core_bev_link ql 
)
static

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
qthe queue
qlthe 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bev_cqueue_fini()

static void bev_cqueue_fini ( struct nlx_core_bev_cqueue q,
void(*)(struct nlx_core_bev_link *)  free_cb 
)
static

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bev_cqueue_get()

static struct nlx_core_bev_link* bev_cqueue_get ( struct nlx_core_bev_cqueue q)
static

Gets the oldest element in the FIFO circular queue, advancing the divider.

Parameters
qthe queue
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bev_cqueue_init()

static void bev_cqueue_init ( struct nlx_core_bev_cqueue q,
struct nlx_core_bev_link ql1,
struct nlx_core_bev_link ql2 
)
static

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
qbuffer event queue to initialise
ql1the first element in the new queue
ql2the 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bev_cqueue_invariant()

static bool bev_cqueue_invariant ( const struct nlx_core_bev_cqueue q)
static

Buffer event queue invariant.

Definition at line 609 of file bev_cqueue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bev_cqueue_is_empty()

static bool bev_cqueue_is_empty ( const struct nlx_core_bev_cqueue q)
static

Tests if the buffer event queue is empty.

Definition at line 702 of file bev_cqueue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bev_cqueue_pnext()

static struct nlx_core_bev_link* bev_cqueue_pnext ( const struct nlx_core_bev_cqueue q)
static

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
qthe queue
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bev_cqueue_put()

static void bev_cqueue_put ( struct nlx_core_bev_cqueue q,
struct nlx_core_bev_link p 
)
static

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
qthe queue
pcurrent element, previously obtained using bev_cqueue_pnext()
Precondition
bev_cqueue_invariant(q) && p->cbl_c_self != q->cbcq_consumer

Definition at line 69 of file kbev_cqueue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bev_cqueue_size()

static size_t bev_cqueue_size ( const struct nlx_core_bev_cqueue q)
static

Returns total size of the event queue, including in-use and free elements.

Definition at line 711 of file bev_cqueue.c.

Here is the caller graph for this function:

◆ bev_link_bless()

static void bev_link_bless ( struct nlx_core_bev_link ql,
struct page *  pg 
)
static

Blesses the nlx_core_bev_link of a nlx_core_bev_cqueue element, assigning the producer self value.

Parameters
qlThe link to bless, the caller must have already mapped the element into the producer address space.
pgThe page object corresponding to the link object.

Definition at line 92 of file kbev_cqueue.c.

Here is the call graph for this function:
Here is the caller graph for this function: