Loading...
Searching...
No Matches
nvme.h File Reference

Nvme block device abstraction layer. More...

Data Structures

struct  spdk_bdev_nvme_ctrlr_opts
 
struct  spdk_bdev_nvme_opts
 

Typedefs

typedef void(* spdk_bdev_nvme_create_cb) (void *ctx, size_t bdev_count, int rc)
 
typedef void(* spdk_bdev_nvme_set_multipath_policy_cb) (void *cb_arg, int rc)
 

Enumerations

enum  spdk_bdev_nvme_multipath_policy { BDEV_NVME_MP_POLICY_ACTIVE_PASSIVE , BDEV_NVME_MP_POLICY_ACTIVE_ACTIVE }
 
enum  spdk_bdev_nvme_multipath_selector { BDEV_NVME_MP_SELECTOR_ROUND_ROBIN = 1 , BDEV_NVME_MP_SELECTOR_QUEUE_DEPTH }
 
enum  spdk_bdev_timeout_action { SPDK_BDEV_NVME_TIMEOUT_ACTION_NONE = 0 , SPDK_BDEV_NVME_TIMEOUT_ACTION_RESET , SPDK_BDEV_NVME_TIMEOUT_ACTION_ABORT }
 

Functions

 SPDK_STATIC_ASSERT (sizeof(struct spdk_bdev_nvme_opts)==128, "Incorrect size")
 
int spdk_bdev_nvme_create (struct spdk_nvme_transport_id *trid, const char *base_name, const char **names, uint32_t count, spdk_bdev_nvme_create_cb cb_fn, void *cb_ctx, struct spdk_nvme_ctrlr_opts *drv_opts, struct spdk_bdev_nvme_ctrlr_opts *bdev_opts)
 Connect to the NVMe controller and populate namespaces as bdevs.
 
void spdk_bdev_nvme_set_multipath_policy (const char *name, enum spdk_bdev_nvme_multipath_policy policy, enum spdk_bdev_nvme_multipath_selector selector, uint32_t rr_min_io, spdk_bdev_nvme_set_multipath_policy_cb cb_fn, void *cb_arg)
 Set multipath policy of the NVMe bdev.
 
void spdk_bdev_nvme_get_default_ctrlr_opts (struct spdk_bdev_nvme_ctrlr_opts *opts)
 
void spdk_bdev_nvme_get_opts (struct spdk_bdev_nvme_opts *opts, size_t opts_size)
 Get the default value for bdev nvme options.
 
int spdk_bdev_nvme_set_opts (const struct spdk_bdev_nvme_opts *opts)
 Set the bdev nvme options.
 

Detailed Description

Nvme block device abstraction layer.

Function Documentation

◆ spdk_bdev_nvme_create()

int spdk_bdev_nvme_create ( struct spdk_nvme_transport_id * trid,
const char * base_name,
const char ** names,
uint32_t count,
spdk_bdev_nvme_create_cb cb_fn,
void * cb_ctx,
struct spdk_nvme_ctrlr_opts * drv_opts,
struct spdk_bdev_nvme_ctrlr_opts * bdev_opts )

Connect to the NVMe controller and populate namespaces as bdevs.

Parameters
tridTransport ID for nvme controller.
base_nameBase name for the nvme subsystem.
namesPointer to string array to get bdev names.
countMaximum count of the string array 'names'. Restricts the length of 'names' array only, not the count of bdevs created.
cb_fnCallback function to be called after all the bdevs are created or updated if already created.
cb_ctxContext to pass to cb_fn.
drv_optsNVMe driver options.
bdev_optsNVMe bdev options.
Returns
0 on success, negative errno on failure.

◆ spdk_bdev_nvme_get_opts()

void spdk_bdev_nvme_get_opts ( struct spdk_bdev_nvme_opts * opts,
size_t opts_size )

Get the default value for bdev nvme options.

Parameters
[out]optsBdev nvme options object to be filled with default values.
opts_sizeMust be set to sizeof(struct spdk_bdev_nvme_opts).

◆ spdk_bdev_nvme_set_multipath_policy()

void spdk_bdev_nvme_set_multipath_policy ( const char * name,
enum spdk_bdev_nvme_multipath_policy policy,
enum spdk_bdev_nvme_multipath_selector selector,
uint32_t rr_min_io,
spdk_bdev_nvme_set_multipath_policy_cb cb_fn,
void * cb_arg )

Set multipath policy of the NVMe bdev.

Parameters
nameNVMe bdev name.
policyMultipath policy (active-passive or active-active).
selectorMultipath selector (round_robin, queue_depth).
rr_min_ioNumber of IO to route to a path before switching to another for round-robin.
cb_fnFunction to be called back after completion.
cb_argArgument passed to the callback function.

◆ spdk_bdev_nvme_set_opts()

int spdk_bdev_nvme_set_opts ( const struct spdk_bdev_nvme_opts * opts)

Set the bdev nvme options.

Parameters
optsNew value of bdev nvme options to be set.
Returns
0 on success, negative errno on failure.