libxnvme_opts.h#

Structs#

xnvme_opts#

struct xnvme_opts#

xNVMe options

See also

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.

Asynchronous Command-interface

uint32_t nsid#

Namespace identifier.

uint8_t rdonly#

OS open; for read only.

uint8_t wronly#

OS open; for write only.

uint8_t rdwr#

OS open; for read and write.

uint8_t create#

OS open; create if it does not exist.

uint8_t truncate#

OS open; truncate content.

uint8_t direct#

OS open; bypass OS-managed caching.

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_css 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: DPDK shared-memory-id.

uint32_t main_core#

SPDK: main-core.

const char *core_mask#

SPDK: core-mask.

const char *iova_mode#

SPDK env-init: DPDK IOVA mode (“va” or “pa”).

const char *adrfam#

SPDK fabrics: address-family, IPv4/IPv6.

const char *subnqn#

SPDK fabrics: Subsystem NQN.

const char *hostnqn#

SPDK fabrics: Host NQN.

uint32_t admin_timeout#

SPDK fabrics: enable admin command timeout.

uint32_t command_timeout#

SPDK fabrics: enable io command timeout.

uint32_t spdk_fabrics#

Is assigned a value by backend if SPDK uses fabrics.

uint32_t keep_alive_timeout_ms#

SPDK fabrics: set keep alive timeout.

size_t host_heap_size#

upcie: host DMA heap size in bytes (0 = default 1 GiB)

size_t device_heap_size#

upcie-cuda/upcie-hip: GPU device heap size in bytes (0 = default 1 GiB)

uint32_t gpu_id#

upcie-cuda/upcie-hip: GPU ordinal to use (default 0)

uint32_t homi_id#

upcie: the control-plane server to attach to; 0 opens the controller here

xnvme_opts_css#

struct xnvme_opts_css#

Public Members

uint32_t value#
uint32_t given#

Functions#

xnvme_opts_set_defaults#

int xnvme_opts_set_defaults(struct xnvme_opts *opts)#

Set the defaults of the given ‘opts’.

Fields without a default are left as they are; zero-initialize ‘opts’ first, as in ‘struct xnvme_opts opts = {0};’.

Parameters:
  • opts – The options to set the defaults of

Returns:

On success, 0 is returned. On error, negative errno is returned: -EINVAL when opts is NULL.

Header#

/**
 * SPDX-FileCopyrightText: Samsung Electronics Co., Ltd
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 * @file libxnvme_opts.h
 */

struct xnvme_opts_css {
	uint32_t value;
	uint32_t given;
};

/**
 * xNVMe options
 *
 * @see xnvme_dev_open()
 *
 * @struct xnvme_opts
 */
struct xnvme_opts {
	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;         ///> Asynchronous Command-interface
	const char *admin;         ///< Administrative Command-interface
	uint32_t nsid;             ///< Namespace identifier
	uint8_t rdonly;            ///< OS open; for read only
	uint8_t wronly;            ///< OS open; for write only
	uint8_t rdwr;              ///< OS open; for read and write
	uint8_t create;            ///< OS open; create if it does not exist
	uint8_t truncate;          ///< OS open; truncate content
	uint8_t direct;            ///< OS open; bypass OS-managed caching
	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_css 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: DPDK shared-memory-id
	uint32_t main_core;        ///< SPDK: main-core
	const char *core_mask;     ///< SPDK: core-mask
	const char *iova_mode;     ///< SPDK env-init: DPDK IOVA mode ("va" or "pa")
	const char *adrfam;        ///< SPDK fabrics: address-family, IPv4/IPv6
	const char *subnqn;        ///< SPDK fabrics: Subsystem NQN
	const char *hostnqn;       ///< SPDK fabrics: Host NQN
	uint32_t admin_timeout;    ///< SPDK fabrics: enable admin command timeout
	uint32_t command_timeout;  ///< SPDK fabrics: enable io command timeout
	uint32_t spdk_fabrics;     ///< Is assigned a value by backend if SPDK uses fabrics
	uint32_t keep_alive_timeout_ms; ///< SPDK fabrics: set keep alive timeout
	size_t host_heap_size;          ///< upcie: host DMA heap size in bytes (0 = default 1 GiB)
	size_t device_heap_size; ///< upcie-cuda/upcie-hip: GPU device heap size in bytes (0 =
				 ///< default 1 GiB)
	uint32_t gpu_id;         ///< upcie-cuda/upcie-hip: GPU ordinal to use (default 0)

	/** upcie: the control-plane server to attach to; 0 opens the controller here */
	uint32_t homi_id;
};

/**
 * Set the defaults of the given 'opts'
 *
 * Fields without a default are left as they are; zero-initialize 'opts' first, as in
 * 'struct xnvme_opts opts = {0};'.
 *
 * @param opts The options to set the defaults of
 *
 * @return On success, 0 is returned. On error, negative `errno` is returned: -EINVAL when
 * `opts` is NULL.
 */
int
xnvme_opts_set_defaults(struct xnvme_opts *opts);