libxnvme_queue.h#
Enums#
xnvme_queue_opts#
Functions#
xnvme_queue_drain#
-
int xnvme_queue_drain(struct xnvme_queue *queue)#
Process outstanding commands on the given xnvme_queue until it is empty.
- Parameters:
queue – Pointer to the xnvme_queue to wait/process commands on
- Returns:
On success, number of commands processed, may be 0. On error, negative
errno
is returned.
xnvme_queue_get_capacity#
-
uint32_t xnvme_queue_get_capacity(struct xnvme_queue *queue)#
Get the capacity of the given xnvme_queue.
- Parameters:
queue – Pointer to the xnvme_queue to query for capacity
- Returns:
On success, capacity of given xnvme_queue text is returned. On error, 0 is returned e.g. errors are silent
xnvme_queue_get_cmd_ctx#
-
struct xnvme_cmd_ctx *xnvme_queue_get_cmd_ctx(struct xnvme_queue *queue)#
Retrieve a command-context from the given queue for async.
command execution with the queue
Note
The command-context is managed by the queue, thus, return it to the queue via xnvme_queue_put_cmd_ctx
Note
This is not thread-safe
- Parameters:
queue – Pointer to the xnvme_queue to retrieve a command-context for
- Returns:
On success, a command-context is returned. On error, NULL is returned and
errno
is set to indicate the error.
xnvme_queue_get_completion_fd#
-
int xnvme_queue_get_completion_fd(struct xnvme_queue *queue)#
Get the completion event fd on the given xnvme_queue.
- Parameters:
queue – Pointer to the xnvme_queue to query for outstanding commands
- Returns:
On success, an eventfd() file descriptor is returned. On error, negative
errno
is returned.
xnvme_queue_get_outstanding#
-
uint32_t xnvme_queue_get_outstanding(struct xnvme_queue *queue)#
Get the number of outstanding commands on the given xnvme_queue.
- Parameters:
queue – Pointer to the xnvme_queue to query for outstanding commands
- Returns:
On success, number of outstanding commands are returned. On error, 0 is returned e.g. errors are silent
xnvme_queue_init#
-
int xnvme_queue_init(struct xnvme_dev *dev, uint16_t capacity, int opts, struct xnvme_queue **queue)#
Allocate a Command Queue for asynchronous command submission and completion.
- Parameters:
dev – Device handle (xnvme_dev) obtained with xnvme_dev_open()
capacity – Maximum number of outstanding commands on the initialized queue, note that it must be a power of 2 within the range [1,4096]
opts – Queue options
queue – Pointer-pointer to the xnvme_queue to initialize
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_queue_poke#
-
int xnvme_queue_poke(struct xnvme_queue *queue, uint32_t max)#
Process completions of commands on the given xnvme_queue.
Set process ‘max’ to limit number of completions, 0 means no max.
- Parameters:
queue – Pointer to the xnvme_queue to poke for completions
max – The max number of completions to complete
- Returns:
On success, number of completions processed, may be 0. On error, negative
errno
is returned.
xnvme_queue_put_cmd_ctx#
-
int xnvme_queue_put_cmd_ctx(struct xnvme_queue *queue, struct xnvme_cmd_ctx *ctx)#
Hand back a command-context previously retrieve using xnvme_queue_get_cmd_ctx.
Note
This function is not thread-safe
- Parameters:
queue – Pointer to the xnvme_queue to hand back the command-context to
ctx – Pointer to command context (xnvme_cmd_ctx)
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_queue_set_cb#
-
int xnvme_queue_set_cb(struct xnvme_queue *queue, xnvme_queue_cb cb, void *cb_arg)#
Assign a callback-function and argument to be used with the xnvme_cmd_ctx of the queue.
- Parameters:
queue – The xnvme_queue to assign default callback function for
cb – The callback function to use
cb_arg – The callback argument to use
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_queue_term#
-
int xnvme_queue_term(struct xnvme_queue *queue)#
Tear down the given xnvme_queue.
- Parameters:
queue – Pointer to the xnvme_queue to tear down
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_queue_wait#
-
int xnvme_queue_wait(struct xnvme_queue *queue)#
DEPRECATED: expect that this function will be removed in an upcoming release.
- Parameters:
queue – Pointer to the xnvme_queue to wait/process commands on
- Returns:
On success, number of commands processed, may be 0. On error, negative
errno
is returned.