xnvme

Enums

xnvme_enumerate_action

enum xnvme_enumerate_action

Values:

enumerator XNVME_ENUMERATE_DEV_KEEP_OPEN

Keep device-handle open after callback returns.

enumerator XNVME_ENUMERATE_DEV_CLOSE

Close device-handle when callback returns.

xnvme_pr

enum xnvme_pr

Options for pretty-printer (*_pr, *_fpr) functions.

See

libxnvme_pp.h

Values:

enumerator XNVME_PR_DEF

XNVME_PR_DEF: Default options.

enumerator XNVME_PR_YAML

XNVME_PR_YAML: Print formatted as YAML.

enumerator XNVME_PR_TERSE

XNVME_PR_TERSE: Print without formatting.

xnvme_queue_opts

enum xnvme_queue_opts

Command Queue initialization options.

Values:

enumerator XNVME_QUEUE_IOPOLL

XNVME_QUEUE_IOPOLL: queue. is polled for completions.

enumerator XNVME_QUEUE_SQPOLL

XNVME_QUEUE_SQPOLL: queue. is polled for submissions.

Structs

xnvme_be_attr

struct xnvme_be_attr

Public Members

const char *name

Backend name.

const char **schemes

The default URI ‘scheme’, as in, the URI-definition below:

scheme:target[?option=val]

For which this backend identifies devices

uint8_t nschemes

Number of schemes in ‘schemes’.

uint8_t enabled

Whether the backend is ‘enabled’.

uint8_t _rsvd[6]

xnvme_be_attr_list

struct xnvme_be_attr_list

Representation of xNVMe library backend attributes.

List of xNVMe library backend attributes.

Public Members

uint32_t capacity

Remaining unused entries.

int count

Number of used entries.

struct xnvme_be_attr item[]

Array of items.

xnvme_cmd_ctx

struct xnvme_cmd_ctx

The xNVMe Command Context.

Public Functions

SLIST_ENTRY (xnvme_cmd_ctx) link

Public Members

struct xnvme_spec_cmd cmd

Command to be processed.

struct xnvme_spec_cpl cpl

Completion result from processing.

struct xnvme_dev *dev

Device associated with the command.

Fields for command option: XNVME_CMD_ASYNC

struct xnvme_cmd_ctx.[anonymous] async

Field containing command-options, the field is initialized by helper-functions.

uint32_t opts
uint8_t be_rsvd[4]

Fields reserved for use by library internals.

Field for including the command-context in BSD-style singly-linked-lists (SLIST)

xnvme_enumeration

struct xnvme_enumeration

List of devices found on the system usable with xNVMe.

Public Members

uint32_t capacity

Remaining unused entries.

uint32_t nentries

Used entries.

struct xnvme_ident entries[]

Device entries.

xnvme_ident

struct xnvme_ident

Representation of device identifiers once decoded from text-representation.

Public Members

char uri[XNVME_IDENT_URI_LEN]
uint32_t dtype
uint32_t nsid
uint8_t csi
uint8_t rsvd[3]

xnvme_lba_range

struct xnvme_lba_range

Representation of a range of logical-block-addresses aka LBAs.

Public Members

uint64_t slba

Range start-LBA; begins at and includes this address.

uint64_t elba

Range end-LBA; ends at and includes this address.

uint32_t naddrs

Number of addresses in range [slba, elba].

uint64_t nbytes

Number of bytes covered by [slba, elba].

struct xnvme_lba_range.[anonymous] attr

xnvme_opts

struct xnvme_opts

xNVMe options

See

xnvme_dev_open()

Public Members

const char *be

Backend/system interface to use.

const char *dev

Device manager/enumerator.

const char *mem

Memory allocator to use for buffers.

const char *sync

Synchronous Command-interface.

const char *async
const char *admin

Administrative Command-interface

uint32_t nsid

Namespace identifier.

union xnvme_opts.[anonymous] [anonymous]
uint32_t create_mode

OS file creation-mode.

uint8_t poll_io

io_uring: enable io-polling

uint8_t poll_sq

io_uring: enable sqthread-polling

uint8_t register_files

io_uring: enable file-regirations

uint8_t register_buffers

io_uring: enable buffer-registration

struct xnvme_opts.[anonymous] css

SPDK controller-setup: do command-set-selection.

uint32_t use_cmb_sqs

SPDK controller-setup: use controller-memory-buffer for sq.

uint32_t shm_id

SPDK multi-processing: shared-memory-id.

uint32_t main_core

SPDK multi-processing: main-core.

const char *core_mask

SPDK multi-processing: core-mask.

const char *adrfam

SPDK fabrics: address-family, IPv4/IPv6.

uint32_t spdk_fabrics

Is assigned a value by backend if SPDK uses fabrics.

xnvme_timer

struct xnvme_timer

Encapsulation of a basic wall-clock timer, start/stop clock.

Public Members

uint64_t start
uint64_t stop

Functions

XNVME_ILOG2

static inline uint64_t XNVME_ILOG2(uint64_t x)

XNVME_MAX

static inline int XNVME_MAX(int x, int y)

Calculate the maximum of the given x and y

Parameters
  • x

  • y

Returns

The maximum of x and y

XNVME_MIN

static inline int XNVME_MIN(int x, int y)

Calculate the minimum of the given x and y

Parameters
  • x

  • y

Returns

The maximum of x and y

XNVME_MIN_S64

static inline int64_t XNVME_MIN_S64(int64_t x, int64_t y)

Calculate the minimum of the given x and y

Parameters
  • x

  • y

Returns

The maximum of x and y

XNVME_MIN_U64

static inline uint64_t XNVME_MIN_U64(uint64_t x, uint64_t y)

Calculate the minimum of the given x and y

Parameters
  • x

  • y

Returns

The maximum of x and y

xnvme_be_attr_fpr

int xnvme_be_attr_fpr(FILE *stream, const struct xnvme_be_attr *attr, int opts)

Prints the given backend attribute to the given output stream.

Parameters
  • stream – output stream used for printing

  • attr – Pointer to the xnvme_be_attr to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_be_attr_list_bundled

int xnvme_be_attr_list_bundled(struct xnvme_be_attr_list **list)

List backends bundled with the library.

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvme_be_attr_list_fpr

int xnvme_be_attr_list_fpr(FILE *stream, const struct xnvme_be_attr_list *list, int opts)

Prints the given backend attribute list to the given output stream.

Parameters
  • stream – output stream used for printing

  • list – Pointer to the backend attribute list to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_be_attr_list_pr

int xnvme_be_attr_list_pr(const struct xnvme_be_attr_list *list, int opts)

Prints the given backend attribute list to standard out.

Parameters
  • list – Pointer to the backend attribute list to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_be_attr_pr

int xnvme_be_attr_pr(const struct xnvme_be_attr *attr, int opts)

Prints the given backend attribute to stdout.

Parameters
Returns

On success, the number of characters printed is returned.

xnvme_buf_alloc

void *xnvme_buf_alloc(const struct xnvme_dev *dev, size_t nbytes)

Allocate a buffer for IO with the given device.

The buffer will be aligned to device geometry and DMA allocated if required by the backend for command payloads

Note

nbytes must be greater than zero and a multiple of minimal granularity

Note

De-allocate the buffer using xnvme_buf_free()

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • nbytes – The size of the allocated buffer in bytes

Returns

On success, a pointer to the allocated memory is returned. On error, NULL is returned and errno set to indicate the error.

xnvme_buf_free

void xnvme_buf_free(const struct xnvme_dev *dev, void *buf)

Free the given IO buffer allocated with xnvme_buf_alloc()

Parameters

xnvme_buf_phys_alloc

void *xnvme_buf_phys_alloc(const struct xnvme_dev *dev, size_t nbytes, uint64_t *phys)

Allocate a buffer of physical memory, aligned for IO with the given device.

Note

nbytes must be greater than zero and a multiple of minimal granularity

Note

De-allocate the buffer using xnvme_buf_phys_free()

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • nbytes – The size of the allocated buffer in bytes

  • phys – A pointer to the variable to hold the physical address of the allocated buffer. If NULL, the physical address is not returned.

Returns

On success, a pointer to the allocated memory is returned. On error, NULL is returned and errno set to indicate the error.

xnvme_buf_phys_free

void xnvme_buf_phys_free(const struct xnvme_dev *dev, void *buf)

Free the given buffer of physical memory allocated with xnvme_buf_phys_alloc()

Parameters

xnvme_buf_phys_realloc

void *xnvme_buf_phys_realloc(const struct xnvme_dev *dev, void *buf, size_t nbytes, uint64_t *phys)

Re-allocate a buffer of physical memory, aligned for IO with the given device.

Note

nbytes must be greater than zero and a multiple of minimal granularity

Note

De-allocate the buffer using xnvme_buf_phys_free()

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • buf – The buffer to reallocate

  • nbytes – The size of the allocated buffer in bytes

  • phys – A pointer to the variable to hold the physical address of the allocated buffer. If NULL, the physical address is not returned.

Returns

On success, a pointer to the allocated memory is returned. On error, NULL is returned and errno set to indicate the error.

xnvme_buf_realloc

void *xnvme_buf_realloc(const struct xnvme_dev *dev, void *buf, size_t nbytes)

Reallocate a buffer for IO with the given device.

The buffer will be aligned to device geometry and DMA allocated if required by the backend for IO

Note

nbytes must be greater than zero and a multiple of minimal granularity

Note

De-allocate the buffer using xnvme_buf_free()

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • buf – The buffer to reallocate

  • nbytes – The size of the allocated buffer in bytes

Returns

On success, a pointer to the allocated memory is returned. On error, NULL is returned and errno set to indicate the error.

xnvme_buf_virt_alloc

void *xnvme_buf_virt_alloc(size_t alignment, size_t nbytes)

Allocate a buffer of virtual memory of the given alignment and nbytes

Note

You must use xnvme_buf_virt_free() to de-allocate the buffer

Parameters
  • alignment – The alignment in bytes

  • nbytes – The size of the buffer in bytes

Returns

On success, a pointer to the allocated memory is return. On error, NULL is returned and errno set to indicate the error

xnvme_buf_virt_free

void xnvme_buf_virt_free(void *buf)

Free the given virtual memory buffer.

Parameters

xnvme_buf_vtophys

int xnvme_buf_vtophys(const struct xnvme_dev *dev, void *buf, uint64_t *phys)

Retrieve the physical address of the given buffer.

The intended use for this function is to provide the physical-address of a buffer-allocation allocated with xnvme_buf_phys_alloc() or xnvme_buf_alloc(), where the ‘phys’ argument was either not provided.

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • buf – Pointer to a buffer allocated with xnvme_buf_alloc()

  • phys – A pointer to the variable to hold the physical address of the given buffer.

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvme_cmd_ctx_clear

void xnvme_cmd_ctx_clear(struct xnvme_cmd_ctx *ctx)

Clears/resets the given xnvme_cmd_ctx.

Parameters

xnvme_cmd_ctx_cpl_status

static inline int xnvme_cmd_ctx_cpl_status(struct xnvme_cmd_ctx *ctx)

Encapsulate completion-error checking here for now.

Parameters
Returns

On success, 0 is return. On error, a non-zero value is returned.

xnvme_cmd_ctx_from_dev

struct xnvme_cmd_ctx xnvme_cmd_ctx_from_dev(struct xnvme_dev *dev)

Retrieve a command-context for issuing commands to the given device.

Parameters
Returns

A xnvme_cmd_ctx initialized synchronous command on the given device

xnvme_cmd_ctx_from_queue

struct xnvme_cmd_ctx *xnvme_cmd_ctx_from_queue(struct xnvme_queue *queue)

Retrieve a command-text for issuing commands via the given queue.

Parameters
  • queue – Pointer to the xnvme_queue to retrieve a command-context for

Returns

On success, a pointer to a xnvme_cmd_ctx is returned. On error, NULL is returned and errno set to indicate the error.

xnvme_cmd_ctx_pr

void xnvme_cmd_ctx_pr(const struct xnvme_cmd_ctx *ctx, int UNUSED_opts)

Prints a humanly readable representation the given xnvme_cmd_ctx.

Parameters
  • ctx – Pointer to the xnvme_cmd_ctx to print

  • UNUSED_opts – Printer options

xnvme_cmd_ctx_set_cb

static inline void xnvme_cmd_ctx_set_cb(struct xnvme_cmd_ctx *ctx, xnvme_queue_cb cb, void *cb_arg)

Assign a callback-function and argument to be used with the given command-context.

Parameters
  • ctx – Pointer to the xnvme_cmd_ctx to setup callback 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_cmd_pass

int xnvme_cmd_pass(struct xnvme_cmd_ctx *ctx, void *dbuf, size_t dbuf_nbytes, void *mbuf, size_t mbuf_nbytes)

Pass a NVMe IO Command through to the device via the given xnvme_cmd_ctx.

Parameters
  • ctx – Pointer to command context (xnvme_cmd_ctx)

  • dbuf – pointer to data-payload

  • dbuf_nbytes – size of data-payload in bytes

  • mbuf – pointer to meta-payload

  • mbuf_nbytes – size of the meta-payload in bytes

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvme_cmd_pass_admin

int xnvme_cmd_pass_admin(struct xnvme_cmd_ctx *ctx, void *dbuf, size_t dbuf_nbytes, void *mbuf, size_t mbuf_nbytes)

Pass a NVMe Admin Command through to the device with minimal intervention.

Parameters
  • ctx – Pointer to command context (xnvme_cmd_ctx)

  • dbuf – pointer to data-payload

  • dbuf_nbytes – size of data-payload in bytes

  • mbuf – pointer to meta-payload

  • mbuf_nbytes – size of the meta-payload in bytes

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvme_enumerate

int xnvme_enumerate(const char *sys_uri, struct xnvme_opts *opts, xnvme_enumerate_cb cb_func, void *cb_args)

enumerate devices

Parameters
  • sys_uri – URI of the system to enumerate, when NULL, localhost/PCIe

  • opts – Options for instrumenting the runtime during enumeration

  • cb_func – Callback function to invoke for each yielded device

  • cb_args – Arguments passed to the callback function

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvme_enumeration_alloc

int xnvme_enumeration_alloc(struct xnvme_enumeration **list, uint32_t capacity)

xnvme_enumeration_append

int xnvme_enumeration_append(struct xnvme_enumeration *list, const struct xnvme_ident *entry)

xnvme_enumeration_fpp

int xnvme_enumeration_fpp(FILE *stream, struct xnvme_enumeration *list, int opts)

xnvme_enumeration_fpr

int xnvme_enumeration_fpr(FILE *stream, struct xnvme_enumeration *list, int opts)

Prints the given xnvme_enumeration to the given output stream.

Parameters
  • stream – output stream used for printing

  • list – pointer to structure to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_enumeration_free

void xnvme_enumeration_free(struct xnvme_enumeration *list)

xnvme_enumeration_pp

int xnvme_enumeration_pp(struct xnvme_enumeration *list, int opts)

xnvme_enumeration_pr

int xnvme_enumeration_pr(struct xnvme_enumeration *list, int opts)

Prints the given xnvme_enumeration to stdout.

Parameters
  • list – pointer to structure to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_ident_fpr

int xnvme_ident_fpr(FILE *stream, const struct xnvme_ident *ident, int opts)

Prints the given xnvme_ident to the given output stream.

Parameters
  • stream – output stream used for printing

  • ident – pointer to structure to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_ident_from_uri

int xnvme_ident_from_uri(const char *uri, struct xnvme_ident *ident)

Parse the given ‘uri’ into xnvme_ident.

Parameters
  • uri

  • ident – Pointer to ident to fill with values parsed from ‘uri’

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvme_ident_pr

int xnvme_ident_pr(const struct xnvme_ident *ident, int opts)

Prints the given xnvme_ident to stdout.

Parameters
  • ident – pointer to structure to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_is_pow2

static inline int xnvme_is_pow2(uint32_t val)

xnvme_lba_fpr

int xnvme_lba_fpr(FILE *stream, uint64_t lba, enum xnvme_pr opts)

Prints the given LBA to the given output stream.

Parameters
  • stream – output stream used for printing

  • lba – the LBA to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_lba_fprn

int xnvme_lba_fprn(FILE *stream, const uint64_t *lba, uint16_t nlb, enum xnvme_pr opts)

Prints the given list of Logical Block Addresses (LBAs)to the given output stream.

Parameters
  • stream – output stream used for printing

  • lba – Pointer to an array of LBAs to print

  • nlb – Number of LBAs to print from the given list

  • opts – printer options, see xnvme_pr

xnvme_lba_pr

int xnvme_lba_pr(uint64_t lba, enum xnvme_pr opts)

Prints the given Logical Block Addresses (LBA) to stdout.

Parameters
  • lba – the LBA to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_lba_prn

int xnvme_lba_prn(const uint64_t *lba, uint16_t nlb, enum xnvme_pr opts)

Print a list of Logical Block Addresses (LBAs)

Parameters
  • lba – Pointer to an array of LBAs to print

  • nlb – Length of the array in items

  • opts – Printer options

Returns

On success, the number of characters printed is returned.

xnvme_lba_range_fpr

int xnvme_lba_range_fpr(FILE *stream, struct xnvme_lba_range *range, int opts)

Prints the given backend attribute to the given output stream.

Parameters
  • stream – output stream used for printing

  • range – Pointer to the xnvme_lba_range to print

  • opts – printer options, see xnvme_pr

Returns

On success, the number of characters printed is returned.

xnvme_lba_range_from_offset_nbytes

struct xnvme_lba_range xnvme_lba_range_from_offset_nbytes(struct xnvme_dev *dev, uint64_t offset, uint64_t nbytes)

Initializes a range starting at the given byte-offset and spanning nbytes.

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • offset – Offset in bytes satisfying offset < capacity

  • nbytes – Number of bytes, satisfying offset + nbytes < capacity

Returns

On success, an initialized range is returned by value with attr.is_valid = 1. On error, a potential non, or partially, initialized struct is returned by value with attr.is_valid = 0.

xnvme_lba_range_from_slba_elba

struct xnvme_lba_range xnvme_lba_range_from_slba_elba(struct xnvme_dev *dev, uint64_t slba, uint64_t elba)

Initializes a range starting at the given start-lba (slba) and spanning naddrs.

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • slba – A valid lba on the given dev

  • elba – A valid lba on the given dev

Returns

On success, an initialized range is returned by value with attr.is_valid = 1. On error, a potential non, or partially, initialized struct is returned by value with attr.is_valid = 0.

xnvme_lba_range_from_slba_naddrs

struct xnvme_lba_range xnvme_lba_range_from_slba_naddrs(struct xnvme_dev *dev, uint64_t slba, uint64_t naddrs)

Initializes a range starting at the given start-lba (slba) and spanning naddrs.

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • slba – A valid lba on the given dev

  • naddrs – A non-zero number of addresses, satisfying slba + naddrs < device capacity

Returns

On success, an initialized range is returned by value with attr.is_valid = 1. On error, a potential non, or partially, initialized struct is returned by value with attr.is_valid = 0.

xnvme_lba_range_from_zdescr

struct xnvme_lba_range xnvme_lba_range_from_zdescr(struct xnvme_dev *dev, struct xnvme_spec_znd_descr *zdescr)

Initializes a range starting at the given zone-start-LBA and spanning zone-capacity.

Parameters
  • dev – Device handle obtained with xnvme_dev_open()

  • zdescr – Pointer to a zone-descriptor valid on the given dev

Returns

On success, an initialized range is returned by value with attr.is_valid = 1. On error, a potential non, or partially, initialized struct is returned by value with attr.is_valid = 0.

xnvme_lba_range_pr

int xnvme_lba_range_pr(struct xnvme_lba_range *range, int opts)

Prints the given backend attribute to stdout.

Parameters
Returns

On success, the number of characters printed is returned.

xnvme_opts_default

struct xnvme_opts xnvme_opts_default(void)

Returns an initialized option-struct with default values.

Returns

Zero-initialized and with default values where applicable

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_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)

Wait for completion of all outstanding commands in the given xnvme_queue.

Parameters
  • queue – Pointer to the xnvme_queue to wait for completions on

Returns

On success, number of completions processed, may be 0. On error, negative errno is returned.

xnvme_timer_bw_pr

static inline void xnvme_timer_bw_pr(struct xnvme_timer *t, const char *prefix, size_t nbytes)

Print the elapsed time in seconds and the associated data rate in MB/s.

Parameters
  • t

  • prefix

  • nbytes

xnvme_timer_elapsed

static inline double xnvme_timer_elapsed(struct xnvme_timer *t)

Get the elapsed time in seconds.

Parameters
  • t

Returns

elapsed time in seconds as a floating point number

xnvme_timer_elapsed_msecs

static inline double xnvme_timer_elapsed_msecs(struct xnvme_timer *t)

Get the elapsed time in milliseconds.

Parameters
  • t

Returns

elapsed time in milliseconds as a floating point number

xnvme_timer_elapsed_nsecs

static inline uint64_t xnvme_timer_elapsed_nsecs(struct xnvme_timer *t)

Get the elapsed time in nanoseconds.

Parameters
  • t

Returns

elapsed time in nanoseconds

xnvme_timer_elapsed_secs

static inline double xnvme_timer_elapsed_secs(struct xnvme_timer *t)

Get the elapsed time in seconds.

Parameters
  • t

Returns

elapsed time in seconds as a floating point number

xnvme_timer_elapsed_usecs

static inline double xnvme_timer_elapsed_usecs(struct xnvme_timer *t)

Get the elapsed time in microseconds.

Parameters
  • t

Returns

elapsed time in microseconds as a floating point number

xnvme_timer_pr

static inline void xnvme_timer_pr(struct xnvme_timer *t, const char *prefix)

Print the elapsed time in seconds as a floating point number.

Parameters
  • t

  • prefix

xnvme_timer_start

static inline uint64_t xnvme_timer_start(struct xnvme_timer *t)

Start the given timer.

Parameters
  • t

Returns

clock sample in nano seconds

xnvme_timer_stop

static inline uint64_t xnvme_timer_stop(struct xnvme_timer *t)

Stop the given timer.

Parameters
  • t

Returns

clock sample in nano seconds