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

NVMe over Fabrics target public API. More...

Data Structures

struct  spdk_nvmf_target_opts
 
struct  spdk_nvmf_transport_opts
 
struct  spdk_nvmf_listen_opts
 
struct  spdk_nvmf_poll_group_stat
 
struct  spdk_nvmf_referral_opts
 
struct  spdk_nvmf_host_opts
 
struct  spdk_nvmf_listener_opts
 
struct  spdk_nvmf_ns_opts
 NVMe-oF target namespace creation options. More...
 
struct  spdk_nvmf_registrant_info
 
struct  spdk_nvmf_reservation_info
 
struct  spdk_nvmf_ns_reservation_ops
 

Macros

#define NVMF_TGT_NAME_MAX_LENGTH   256
 
#define SPDK_TLS_PSK_MAX_LEN   200
 
#define SPDK_NVMF_MAX_NUM_REGISTRANTS   16
 

Typedefs

typedef void(* spdk_nvmf_tgt_subsystem_listen_done_fn) (void *ctx, int status)
 Function to be called once asynchronous listen add and remove operations are completed.
 
typedef void spdk_nvmf_tgt_destroy_done_fn(void *ctx, int status)
 
typedef void(* spdk_nvmf_poll_group_destroy_done_fn) (void *cb_arg, int status)
 
typedef void(* nvmf_qpair_disconnect_cb) (void *ctx)
 
typedef void(* nvmf_subsystem_destroy_cb) (void *cb_arg)
 
typedef void(* spdk_nvmf_subsystem_state_change_done) (struct spdk_nvmf_subsystem *subsystem, void *cb_arg, int status)
 Function to be called once the subsystem has changed state.
 
typedef void(* spdk_nvmf_transport_create_done_cb) (void *cb_arg, struct spdk_nvmf_transport *transport)
 
typedef void(* spdk_nvmf_transport_destroy_done_cb) (void *cb_arg)
 
typedef void(* spdk_nvmf_tgt_add_transport_done_fn) (void *cb_arg, int status)
 Function to be called once transport add is complete.
 
typedef void(* spdk_nvmf_tgt_pause_polling_cb_fn) (void *cb_arg, int status)
 Function to be called once target pause is complete.
 
typedef void(* spdk_nvmf_tgt_resume_polling_cb_fn) (void *cb_arg, int status)
 Function to be called once target resume is complete.
 

Enumerations

enum  spdk_nvmf_tgt_discovery_filter { SPDK_NVMF_TGT_DISCOVERY_MATCH_ANY = 0 , SPDK_NVMF_TGT_DISCOVERY_MATCH_TRANSPORT_TYPE = 1u << 0u , SPDK_NVMF_TGT_DISCOVERY_MATCH_TRANSPORT_ADDRESS = 1u << 1u , SPDK_NVMF_TGT_DISCOVERY_MATCH_TRANSPORT_SVCID = 1u << 2u }
 Specify filter rules which are applied during discovery log generation. More...
 

Functions

 SPDK_STATIC_ASSERT (sizeof(struct spdk_nvmf_transport_opts)==72, "Incorrect size")
 
 SPDK_STATIC_ASSERT (sizeof(struct spdk_nvmf_listen_opts)==32, "Incorrect size")
 
void spdk_nvmf_listen_opts_init (struct spdk_nvmf_listen_opts *opts, size_t opts_size)
 Initialize listen options.
 
int spdk_nvmf_tgt_add_referral (struct spdk_nvmf_tgt *tgt, const struct spdk_nvmf_referral_opts *opts)
 Add a discovery service referral to an NVMe-oF target.
 
int spdk_nvmf_tgt_remove_referral (struct spdk_nvmf_tgt *tgt, const struct spdk_nvmf_referral_opts *opts)
 Remove a discovery service referral from an NVMeoF target.
 
struct spdk_nvmf_tgt * spdk_nvmf_tgt_create (struct spdk_nvmf_target_opts *opts)
 Construct an NVMe-oF target.
 
void spdk_nvmf_tgt_destroy (struct spdk_nvmf_tgt *tgt, spdk_nvmf_tgt_destroy_done_fn cb_fn, void *cb_arg)
 Destroy an NVMe-oF target.
 
const char * spdk_nvmf_tgt_get_name (struct spdk_nvmf_tgt *tgt)
 Get the name of an NVMe-oF target.
 
struct spdk_nvmf_tgt * spdk_nvmf_get_tgt (const char *name)
 Get a pointer to an NVMe-oF target.
 
struct spdk_nvmf_tgt * spdk_nvmf_get_first_tgt (void)
 Get the pointer to the first NVMe-oF target.
 
struct spdk_nvmf_tgt * spdk_nvmf_get_next_tgt (struct spdk_nvmf_tgt *prev)
 Get the pointer to the first NVMe-oF target.
 
void spdk_nvmf_tgt_write_config_json (struct spdk_json_write_ctx *w, struct spdk_nvmf_tgt *tgt)
 Write NVMe-oF target configuration into provided JSON context.
 
int spdk_nvmf_tgt_listen_ext (struct spdk_nvmf_tgt *tgt, const struct spdk_nvme_transport_id *trid, struct spdk_nvmf_listen_opts *opts)
 Begin accepting new connections at the address provided.
 
int spdk_nvmf_tgt_stop_listen (struct spdk_nvmf_tgt *tgt, struct spdk_nvme_transport_id *trid)
 Stop accepting new connections at the provided address.
 
struct spdk_nvmf_poll_groupspdk_nvmf_poll_group_create (struct spdk_nvmf_tgt *tgt)
 Create a poll group.
 
struct spdk_nvmf_poll_groupspdk_nvmf_get_optimal_poll_group (struct spdk_nvmf_qpair *qpair)
 Get optimal nvmf poll group for the qpair.
 
void spdk_nvmf_poll_group_destroy (struct spdk_nvmf_poll_group *group, spdk_nvmf_poll_group_destroy_done_fn cb_fn, void *cb_arg)
 Destroy a poll group.
 
int spdk_nvmf_poll_group_add (struct spdk_nvmf_poll_group *group, struct spdk_nvmf_qpair *qpair)
 Add the given qpair to the poll group.
 
int spdk_nvmf_qpair_disconnect (struct spdk_nvmf_qpair *qpair)
 Disconnect an NVMe-oF qpair.
 
int spdk_nvmf_qpair_get_peer_trid (struct spdk_nvmf_qpair *qpair, struct spdk_nvme_transport_id *trid)
 Get the peer's transport ID for this queue pair.
 
int spdk_nvmf_qpair_get_local_trid (struct spdk_nvmf_qpair *qpair, struct spdk_nvme_transport_id *trid)
 Get the local transport ID for this queue pair.
 
int spdk_nvmf_qpair_get_listen_trid (struct spdk_nvmf_qpair *qpair, struct spdk_nvme_transport_id *trid)
 Get the associated listener transport ID for this queue pair.
 
struct spdk_nvmf_subsystem * spdk_nvmf_subsystem_create (struct spdk_nvmf_tgt *tgt, const char *nqn, enum spdk_nvmf_subtype type, uint32_t num_ns)
 Create an NVMe-oF subsystem.
 
int spdk_nvmf_subsystem_destroy (struct spdk_nvmf_subsystem *subsystem, nvmf_subsystem_destroy_cb cpl_cb, void *cpl_cb_arg)
 Destroy an NVMe-oF subsystem.
 
int spdk_nvmf_subsystem_start (struct spdk_nvmf_subsystem *subsystem, spdk_nvmf_subsystem_state_change_done cb_fn, void *cb_arg)
 Transition an NVMe-oF subsystem from Inactive to Active state.
 
int spdk_nvmf_subsystem_stop (struct spdk_nvmf_subsystem *subsystem, spdk_nvmf_subsystem_state_change_done cb_fn, void *cb_arg)
 Transition an NVMe-oF subsystem from Active to Inactive state.
 
int spdk_nvmf_subsystem_pause (struct spdk_nvmf_subsystem *subsystem, uint32_t nsid, spdk_nvmf_subsystem_state_change_done cb_fn, void *cb_arg)
 Transition an NVMe-oF subsystem from Active to Paused state.
 
int spdk_nvmf_subsystem_resume (struct spdk_nvmf_subsystem *subsystem, spdk_nvmf_subsystem_state_change_done cb_fn, void *cb_arg)
 Transition an NVMe-oF subsystem from Paused to Active state.
 
struct spdk_nvmf_subsystem * spdk_nvmf_tgt_find_subsystem (struct spdk_nvmf_tgt *tgt, const char *subnqn)
 Search the target for a subsystem with the given NQN.
 
struct spdk_nvmf_subsystem * spdk_nvmf_subsystem_get_first (struct spdk_nvmf_tgt *tgt)
 Begin iterating over all known subsystems.
 
struct spdk_nvmf_subsystem * spdk_nvmf_subsystem_get_next (struct spdk_nvmf_subsystem *subsystem)
 Continue iterating over all known subsystems.
 
int spdk_nvmf_ns_add_host (struct spdk_nvmf_subsystem *subsystem, uint32_t nsid, const char *hostnqn, uint32_t flags)
 Make the specified namespace visible to the specified host.
 
int spdk_nvmf_ns_remove_host (struct spdk_nvmf_subsystem *subsystem, uint32_t nsid, const char *hostnqn, uint32_t flags)
 Make the specified namespace not visible to the specified host.
 
int spdk_nvmf_subsystem_add_host (struct spdk_nvmf_subsystem *subsystem, const char *hostnqn, const struct spdk_json_val *params)
 Allow the given host NQN to connect to the given subsystem.
 
int spdk_nvmf_subsystem_add_host_ext (struct spdk_nvmf_subsystem *subsystem, const char *hostnqn, struct spdk_nvmf_host_opts *opts)
 Allow the given host to connect to the given subsystem.
 
int spdk_nvmf_subsystem_remove_host (struct spdk_nvmf_subsystem *subsystem, const char *hostnqn)
 Remove the given host NQN from the list of allowed hosts.
 
int spdk_nvmf_subsystem_disconnect_host (struct spdk_nvmf_subsystem *subsystem, const char *hostnqn, spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn, void *cb_arg)
 Disconnect all connections originating from the provided hostnqn.
 
int spdk_nvmf_subsystem_set_allow_any_host (struct spdk_nvmf_subsystem *subsystem, bool allow_any_host)
 Set whether a subsystem should allow any host or only hosts in the allowed list.
 
bool spdk_nvmf_subsystem_get_allow_any_host (const struct spdk_nvmf_subsystem *subsystem)
 Check whether a subsystem should allow any host or only hosts in the allowed list.
 
bool spdk_nvmf_subsystem_host_allowed (struct spdk_nvmf_subsystem *subsystem, const char *hostnqn)
 Check if the given host is allowed to connect to the subsystem.
 
struct spdk_nvmf_host * spdk_nvmf_subsystem_get_first_host (struct spdk_nvmf_subsystem *subsystem)
 Get the first allowed host in a subsystem.
 
struct spdk_nvmf_host * spdk_nvmf_subsystem_get_next_host (struct spdk_nvmf_subsystem *subsystem, struct spdk_nvmf_host *prev_host)
 Get the next allowed host in a subsystem.
 
const char * spdk_nvmf_host_get_nqn (const struct spdk_nvmf_host *host)
 Get a host's NQN.
 
void spdk_nvmf_subsystem_add_listener (struct spdk_nvmf_subsystem *subsystem, struct spdk_nvme_transport_id *trid, spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn, void *cb_arg)
 Accept new connections on the address provided.
 
 SPDK_STATIC_ASSERT (sizeof(struct spdk_nvmf_listener_opts)==24, "Incorrect size")
 
void spdk_nvmf_subsystem_listener_opts_init (struct spdk_nvmf_listener_opts *opts, size_t size)
 Initialize options structure for listener creation.
 
void spdk_nvmf_subsystem_add_listener_ext (struct spdk_nvmf_subsystem *subsystem, struct spdk_nvme_transport_id *trid, spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn, void *cb_arg, struct spdk_nvmf_listener_opts *opts)
 Accept new connections on the address provided.
 
int spdk_nvmf_subsystem_remove_listener (struct spdk_nvmf_subsystem *subsystem, const struct spdk_nvme_transport_id *trid)
 Remove the listener from subsystem.
 
bool spdk_nvmf_subsystem_listener_allowed (struct spdk_nvmf_subsystem *subsystem, const struct spdk_nvme_transport_id *trid)
 Check if connections originated from the given address are allowed to connect to the subsystem.
 
struct spdk_nvmf_subsystem_listener * spdk_nvmf_subsystem_get_first_listener (struct spdk_nvmf_subsystem *subsystem)
 Get the first allowed listen address in the subsystem.
 
struct spdk_nvmf_subsystem_listener * spdk_nvmf_subsystem_get_next_listener (struct spdk_nvmf_subsystem *subsystem, struct spdk_nvmf_subsystem_listener *prev_listener)
 Get the next allowed listen address in a subsystem.
 
const struct spdk_nvme_transport_idspdk_nvmf_subsystem_listener_get_trid (struct spdk_nvmf_subsystem_listener *listener)
 Get a listen address' transport ID.
 
void spdk_nvmf_subsystem_allow_any_listener (struct spdk_nvmf_subsystem *subsystem, bool allow_any_listener)
 Set whether a subsystem should allow any listen address or only addresses in the allowed list.
 
bool spdk_nvmf_subsystem_any_listener_allowed (struct spdk_nvmf_subsystem *subsystem)
 Check whether a subsystem allows any listen address or only addresses in the allowed list.
 
int spdk_nvmf_subsystem_set_ana_reporting (struct spdk_nvmf_subsystem *subsystem, bool ana_reporting)
 Set whether a subsystem supports Asymmetric Namespace Access (ANA) reporting.
 
bool spdk_nvmf_subsystem_get_ana_reporting (struct spdk_nvmf_subsystem *subsystem)
 Get whether a subsystem supports Asymmetric Namespace Access (ANA) reporting.
 
void spdk_nvmf_subsystem_set_ana_state (struct spdk_nvmf_subsystem *subsystem, const struct spdk_nvme_transport_id *trid, enum spdk_nvme_ana_state ana_state, uint32_t anagrpid, spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn, void *cb_arg)
 Set Asymmetric Namespace Access (ANA) state for the specified ANA group id.
 
int spdk_nvmf_subsystem_get_ana_state (struct spdk_nvmf_subsystem *subsystem, const struct spdk_nvme_transport_id *trid, uint32_t anagrpid, enum spdk_nvme_ana_state *ana_state)
 Get Asymmetric Namespace Access (ANA) state for the specified ANA group id.
 
int spdk_nvmf_subsystem_set_cntlid_range (struct spdk_nvmf_subsystem *subsystem, uint16_t min_cntlid, uint16_t max_cntlid)
 Sets the controller ID range for a subsystem.
 
 SPDK_STATIC_ASSERT (sizeof(struct spdk_nvmf_ns_opts)==72, "Incorrect size")
 
void spdk_nvmf_ns_opts_get_defaults (struct spdk_nvmf_ns_opts *opts, size_t opts_size)
 Get default namespace creation options.
 
uint32_t spdk_nvmf_subsystem_add_ns_ext (struct spdk_nvmf_subsystem *subsystem, const char *bdev_name, const struct spdk_nvmf_ns_opts *opts, size_t opts_size, const char *ptpl_file)
 Add a namespace to a subsystems in the PAUSED or INACTIVE states.
 
int spdk_nvmf_subsystem_remove_ns (struct spdk_nvmf_subsystem *subsystem, uint32_t nsid)
 Remove a namespace from a subsystem.
 
struct spdk_nvmf_ns * spdk_nvmf_subsystem_get_first_ns (struct spdk_nvmf_subsystem *subsystem)
 Get the first allocated namespace in a subsystem.
 
struct spdk_nvmf_ns * spdk_nvmf_subsystem_get_next_ns (struct spdk_nvmf_subsystem *subsystem, struct spdk_nvmf_ns *prev_ns)
 Get the next allocated namespace in a subsystem.
 
struct spdk_nvmf_ns * spdk_nvmf_subsystem_get_ns (struct spdk_nvmf_subsystem *subsystem, uint32_t nsid)
 Get a namespace in a subsystem by NSID.
 
uint32_t spdk_nvmf_subsystem_get_max_namespaces (const struct spdk_nvmf_subsystem *subsystem)
 Get the maximum number of namespaces allowed in a subsystem.
 
uint16_t spdk_nvmf_subsystem_get_min_cntlid (const struct spdk_nvmf_subsystem *subsystem)
 Get the minimum controller ID allowed in a subsystem.
 
uint16_t spdk_nvmf_subsystem_get_max_cntlid (const struct spdk_nvmf_subsystem *subsystem)
 Get the maximum controller ID allowed in a subsystem.
 
uint32_t spdk_nvmf_ns_get_id (const struct spdk_nvmf_ns *ns)
 Get a namespace's NSID.
 
struct spdk_bdevspdk_nvmf_ns_get_bdev (struct spdk_nvmf_ns *ns)
 Get a namespace's associated bdev.
 
void spdk_nvmf_ns_get_opts (const struct spdk_nvmf_ns *ns, struct spdk_nvmf_ns_opts *opts, size_t opts_size)
 Get the options specified for a namespace.
 
const char * spdk_nvmf_subsystem_get_sn (const struct spdk_nvmf_subsystem *subsystem)
 Get the serial number of the specified subsystem.
 
int spdk_nvmf_subsystem_set_sn (struct spdk_nvmf_subsystem *subsystem, const char *sn)
 Set the serial number for the specified subsystem.
 
const char * spdk_nvmf_subsystem_get_mn (const struct spdk_nvmf_subsystem *subsystem)
 Get the model number of the specified subsystem.
 
int spdk_nvmf_subsystem_set_mn (struct spdk_nvmf_subsystem *subsystem, const char *mn)
 Set the model number for the specified subsystem.
 
const char * spdk_nvmf_subsystem_get_nqn (const struct spdk_nvmf_subsystem *subsystem)
 Get the NQN of the specified subsystem.
 
enum spdk_nvmf_subtype spdk_nvmf_subsystem_get_type (struct spdk_nvmf_subsystem *subsystem)
 Get the type of the specified subsystem.
 
uint32_t spdk_nvmf_subsystem_get_max_nsid (struct spdk_nvmf_subsystem *subsystem)
 Get maximum namespace id of the specified subsystem.
 
bool spdk_nvmf_subsystem_is_discovery (struct spdk_nvmf_subsystem *subsystem)
 Checks whether a given subsystem is a discovery subsystem.
 
bool spdk_nvmf_transport_opts_init (const char *transport_name, struct spdk_nvmf_transport_opts *opts, size_t opts_size)
 Initialize transport options.
 
struct spdk_nvmf_transportspdk_nvmf_transport_create (const char *transport_name, struct spdk_nvmf_transport_opts *opts)
 Create a protocol transport - deprecated, please use spdk_nvmf_transport_create_async.
 
int spdk_nvmf_transport_create_async (const char *transport_name, struct spdk_nvmf_transport_opts *opts, spdk_nvmf_transport_create_done_cb cb_fn, void *cb_arg)
 Create a protocol transport.
 
int spdk_nvmf_transport_destroy (struct spdk_nvmf_transport *transport, spdk_nvmf_transport_destroy_done_cb cb_fn, void *cb_arg)
 Destroy a protocol transport.
 
struct spdk_nvmf_transportspdk_nvmf_tgt_get_transport (struct spdk_nvmf_tgt *tgt, const char *transport_name)
 Get an existing transport from the target.
 
struct spdk_nvmf_transportspdk_nvmf_transport_get_first (struct spdk_nvmf_tgt *tgt)
 Get the first transport registered with the given target.
 
struct spdk_nvmf_transportspdk_nvmf_transport_get_next (struct spdk_nvmf_transport *transport)
 Get the next transport in a target's list.
 
const struct spdk_nvmf_transport_optsspdk_nvmf_get_transport_opts (struct spdk_nvmf_transport *transport)
 Get the opts for a given transport.
 
spdk_nvme_transport_type_t spdk_nvmf_get_transport_type (struct spdk_nvmf_transport *transport)
 Get the transport type for a given transport.
 
const char * spdk_nvmf_get_transport_name (struct spdk_nvmf_transport *transport)
 Get the transport name for a given transport.
 
void spdk_nvmf_tgt_add_transport (struct spdk_nvmf_tgt *tgt, struct spdk_nvmf_transport *transport, spdk_nvmf_tgt_add_transport_done_fn cb_fn, void *cb_arg)
 Add a transport to a target.
 
int spdk_nvmf_tgt_pause_polling (struct spdk_nvmf_tgt *tgt, spdk_nvmf_tgt_pause_polling_cb_fn cb_fn, void *cb_arg)
 Pause polling on the given target.
 
int spdk_nvmf_tgt_resume_polling (struct spdk_nvmf_tgt *tgt, spdk_nvmf_tgt_resume_polling_cb_fn cb_fn, void *cb_arg)
 Resume polling on the given target.
 
int spdk_nvmf_transport_listen (struct spdk_nvmf_transport *transport, const struct spdk_nvme_transport_id *trid, struct spdk_nvmf_listen_opts *opts)
 Add listener to transport and begin accepting new connections.
 
int spdk_nvmf_transport_stop_listen (struct spdk_nvmf_transport *transport, const struct spdk_nvme_transport_id *trid)
 Remove listener from transport and stop accepting new connections.
 
int spdk_nvmf_transport_stop_listen_async (struct spdk_nvmf_transport *transport, const struct spdk_nvme_transport_id *trid, struct spdk_nvmf_subsystem *subsystem, spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn, void *cb_arg)
 Stop accepting new connections at the provided address.
 
void spdk_nvmf_poll_group_dump_stat (struct spdk_nvmf_poll_group *group, struct spdk_json_write_ctx *w)
 Dump poll group statistics into JSON.
 
void spdk_nvmf_rdma_init_hooks (struct spdk_nvme_rdma_hooks *hooks)
 Set the global hooks for the RDMA transport, if necessary.
 
void spdk_nvmf_set_custom_ns_reservation_ops (const struct spdk_nvmf_ns_reservation_ops *ops)
 Set custom handlers for namespace reservation operations.
 

Detailed Description

NVMe over Fabrics target public API.

Typedef Documentation

◆ spdk_nvmf_subsystem_state_change_done

typedef void(* spdk_nvmf_subsystem_state_change_done) (struct spdk_nvmf_subsystem *subsystem, void *cb_arg, int status)

Function to be called once the subsystem has changed state.

Parameters
subsystemNVMe-oF subsystem that has changed state.
cb_argArgument passed to callback function.
status0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_tgt_add_transport_done_fn

typedef void(* spdk_nvmf_tgt_add_transport_done_fn) (void *cb_arg, int status)

Function to be called once transport add is complete.

Parameters
cb_argCallback argument passed to this function.
status0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_tgt_pause_polling_cb_fn

typedef void(* spdk_nvmf_tgt_pause_polling_cb_fn) (void *cb_arg, int status)

Function to be called once target pause is complete.

Parameters
cb_argCallback argument passed to this function.
status0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_tgt_resume_polling_cb_fn

typedef void(* spdk_nvmf_tgt_resume_polling_cb_fn) (void *cb_arg, int status)

Function to be called once target resume is complete.

Parameters
cb_argCallback argument passed to this function.
status0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_tgt_subsystem_listen_done_fn

typedef void(* spdk_nvmf_tgt_subsystem_listen_done_fn) (void *ctx, int status)

Function to be called once asynchronous listen add and remove operations are completed.

See spdk_nvmf_subsystem_add_listener() and spdk_nvmf_transport_stop_listen_async().

Parameters
ctxContext argument passed to this function.
status0 if it completed successfully, or negative errno if it failed.

Enumeration Type Documentation

◆ spdk_nvmf_tgt_discovery_filter

Specify filter rules which are applied during discovery log generation.

Enumerator
SPDK_NVMF_TGT_DISCOVERY_MATCH_ANY 

Log all listeners in discovery log page.

SPDK_NVMF_TGT_DISCOVERY_MATCH_TRANSPORT_TYPE 

Only log listeners with the same transport type on which the DISCOVERY command was received.

SPDK_NVMF_TGT_DISCOVERY_MATCH_TRANSPORT_ADDRESS 

Only log listeners with the same transport address on which the DISCOVERY command was received.

SPDK_NVMF_TGT_DISCOVERY_MATCH_TRANSPORT_SVCID 

Only log listeners with the same transport svcid on which the DISCOVERY command was received.

Function Documentation

◆ spdk_nvmf_get_first_tgt()

struct spdk_nvmf_tgt * spdk_nvmf_get_first_tgt ( void )

Get the pointer to the first NVMe-oF target.

Combined with spdk_nvmf_get_next_tgt to iterate over all available targets.

Returns
The first NVMe-oF target.

◆ spdk_nvmf_get_next_tgt()

struct spdk_nvmf_tgt * spdk_nvmf_get_next_tgt ( struct spdk_nvmf_tgt * prev)

Get the pointer to the first NVMe-oF target.

Combined with spdk_nvmf_get_first_tgt to iterate over all available targets.

Parameters
prevA pointer to the last NVMe-oF target.
Returns
The first NVMe-oF target.

◆ spdk_nvmf_get_optimal_poll_group()

struct spdk_nvmf_poll_group * spdk_nvmf_get_optimal_poll_group ( struct spdk_nvmf_qpair * qpair)

Get optimal nvmf poll group for the qpair.

Parameters
qpairRequested qpair
Returns
a poll group on success, or NULL on failure.

◆ spdk_nvmf_get_tgt()

struct spdk_nvmf_tgt * spdk_nvmf_get_tgt ( const char * name)

Get a pointer to an NVMe-oF target.

In order to support some legacy applications and RPC methods that may rely on the concept that there is only one target, the name parameter can be passed as NULL. If there is only one available target, that target will be returned. Otherwise, name is a required parameter.

Parameters
nameThe name provided when the target was created.
Returns
The target with the given name, or NULL if no match was found.

◆ spdk_nvmf_get_transport_name()

const char * spdk_nvmf_get_transport_name ( struct spdk_nvmf_transport * transport)

Get the transport name for a given transport.

Parameters
transportThe transport to query
Returns
the transport name for the given transport

◆ spdk_nvmf_get_transport_opts()

const struct spdk_nvmf_transport_opts * spdk_nvmf_get_transport_opts ( struct spdk_nvmf_transport * transport)

Get the opts for a given transport.

Parameters
transportThe transport to query
Returns
The opts associated with the given transport

◆ spdk_nvmf_get_transport_type()

spdk_nvme_transport_type_t spdk_nvmf_get_transport_type ( struct spdk_nvmf_transport * transport)

Get the transport type for a given transport.

Parameters
transportThe transport to query
Returns
the transport type for the given transport

◆ spdk_nvmf_host_get_nqn()

const char * spdk_nvmf_host_get_nqn ( const struct spdk_nvmf_host * host)

Get a host's NQN.

Parameters
hostHost to query.
Returns
NQN of host.

◆ spdk_nvmf_listen_opts_init()

void spdk_nvmf_listen_opts_init ( struct spdk_nvmf_listen_opts * opts,
size_t opts_size )

Initialize listen options.

Parameters
optsListener options.
opts_sizeMust be set to sizeof(struct spdk_nvmf_listen_opts).

◆ spdk_nvmf_ns_add_host()

int spdk_nvmf_ns_add_host ( struct spdk_nvmf_subsystem * subsystem,
uint32_t nsid,
const char * hostnqn,
uint32_t flags )

Make the specified namespace visible to the specified host.

May only be performed on subsystems in the PAUSED or INACTIVE states.

Parameters
subsystemSubsystem the namespace belong to.
nsidNamespace ID to be made visible.
hostnqnThe NQN for the host.
flagsMust be zero (reserved for future use).
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_ns_get_bdev()

struct spdk_bdev * spdk_nvmf_ns_get_bdev ( struct spdk_nvmf_ns * ns)

Get a namespace's associated bdev.

Parameters
nsNamespace to query.
Returns
backing bdev of ns.

◆ spdk_nvmf_ns_get_id()

uint32_t spdk_nvmf_ns_get_id ( const struct spdk_nvmf_ns * ns)

Get a namespace's NSID.

Parameters
nsNamespace to query.
Returns
NSID of ns.

◆ spdk_nvmf_ns_get_opts()

void spdk_nvmf_ns_get_opts ( const struct spdk_nvmf_ns * ns,
struct spdk_nvmf_ns_opts * opts,
size_t opts_size )

Get the options specified for a namespace.

Parameters
nsNamespace to query.
optsOutput parameter for options.
opts_sizesizeof(*opts)

◆ spdk_nvmf_ns_opts_get_defaults()

void spdk_nvmf_ns_opts_get_defaults ( struct spdk_nvmf_ns_opts * opts,
size_t opts_size )

Get default namespace creation options.

Parameters
optsNamespace options to fill with defaults.
opts_sizesizeof(struct spdk_nvmf_ns_opts)

◆ spdk_nvmf_ns_remove_host()

int spdk_nvmf_ns_remove_host ( struct spdk_nvmf_subsystem * subsystem,
uint32_t nsid,
const char * hostnqn,
uint32_t flags )

Make the specified namespace not visible to the specified host.

May only be performed on subsystems in the PAUSED or INACTIVE states.

Parameters
subsystemSubsystem the namespace belong to.
nsidNamespace ID to be made not visible.
hostnqnThe NQN for the host.
flagsMust be zero (reserved for future use).
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_poll_group_add()

int spdk_nvmf_poll_group_add ( struct spdk_nvmf_poll_group * group,
struct spdk_nvmf_qpair * qpair )

Add the given qpair to the poll group.

Parameters
groupThe group to add qpair to.
qpairThe qpair to add.
Returns
0 on success, -1 on failure.

◆ spdk_nvmf_poll_group_create()

struct spdk_nvmf_poll_group * spdk_nvmf_poll_group_create ( struct spdk_nvmf_tgt * tgt)

Create a poll group.

Parameters
tgtThe target to create a poll group.
Returns
a poll group on success, or NULL on failure.

◆ spdk_nvmf_poll_group_destroy()

void spdk_nvmf_poll_group_destroy ( struct spdk_nvmf_poll_group * group,
spdk_nvmf_poll_group_destroy_done_fn cb_fn,
void * cb_arg )

Destroy a poll group.

Parameters
groupThe poll group to destroy.
cb_fnA callback that will be called once the poll group is destroyed.
cb_argA context argument passed to cb_fn.

◆ spdk_nvmf_poll_group_dump_stat()

void spdk_nvmf_poll_group_dump_stat ( struct spdk_nvmf_poll_group * group,
struct spdk_json_write_ctx * w )

Dump poll group statistics into JSON.

Parameters
groupThe group which statistics should be dumped.
wThe JSON write context to which statistics should be dumped.

◆ spdk_nvmf_qpair_disconnect()

int spdk_nvmf_qpair_disconnect ( struct spdk_nvmf_qpair * qpair)

Disconnect an NVMe-oF qpair.

Parameters
qpairThe NVMe-oF qpair to disconnect.
Returns
0 upon success.
-ENOMEM if the function specific context could not be allocated.
-EINPROGRESS if the qpair is already in the process of disconnect.

◆ spdk_nvmf_qpair_get_listen_trid()

int spdk_nvmf_qpair_get_listen_trid ( struct spdk_nvmf_qpair * qpair,
struct spdk_nvme_transport_id * trid )

Get the associated listener transport ID for this queue pair.

This function will first zero the trid structure, and then fill in the relevant trid fields to identify the listener. The relevant fields will depend on the transport, but the subnqn will never be a relevant field for purposes of this function.

Parameters
qpairThe NVMe-oF qpair
tridOutput parameter that will contain the transport id.
Returns
0 for success.
-EINVAL if the qpair is not connected.

◆ spdk_nvmf_qpair_get_local_trid()

int spdk_nvmf_qpair_get_local_trid ( struct spdk_nvmf_qpair * qpair,
struct spdk_nvme_transport_id * trid )

Get the local transport ID for this queue pair.

This function will first zero the trid structure, and then fill in the relevant trid fields to identify the listener. The relevant fields will depend on the transport, but the subnqn will never be a relevant field for purposes of this function.

Parameters
qpairThe NVMe-oF qpair
tridOutput parameter that will contain the transport id.
Returns
0 for success.
-EINVAL if the qpair is not connected.

◆ spdk_nvmf_qpair_get_peer_trid()

int spdk_nvmf_qpair_get_peer_trid ( struct spdk_nvmf_qpair * qpair,
struct spdk_nvme_transport_id * trid )

Get the peer's transport ID for this queue pair.

This function will first zero the trid structure, and then fill in the relevant trid fields to identify the listener. The relevant fields will depend on the transport, but the subnqn will never be a relevant field for purposes of this function.

Parameters
qpairThe NVMe-oF qpair
tridOutput parameter that will contain the transport id.
Returns
0 for success.
-EINVAL if the qpair is not connected.

◆ spdk_nvmf_rdma_init_hooks()

void spdk_nvmf_rdma_init_hooks ( struct spdk_nvme_rdma_hooks * hooks)

Set the global hooks for the RDMA transport, if necessary.

This call is optional and must be performed prior to probing for any devices. By default, the RDMA transport will use the ibverbs library to create protection domains and register memory. This is a mechanism to subvert that and use an existing registration.

This function may only be called one time per process.

Parameters
hooksfor initializing global hooks

◆ spdk_nvmf_set_custom_ns_reservation_ops()

void spdk_nvmf_set_custom_ns_reservation_ops ( const struct spdk_nvmf_ns_reservation_ops * ops)

Set custom handlers for namespace reservation operations.

This call allows to override the default namespace reservation operations with custom handlers. This function may only be called before any namespace has been added.

Parameters
opsThe reservation ops handers

◆ spdk_nvmf_subsystem_add_host()

int spdk_nvmf_subsystem_add_host ( struct spdk_nvmf_subsystem * subsystem,
const char * hostnqn,
const struct spdk_json_val * params )

Allow the given host NQN to connect to the given subsystem.

Adding a host that's already allowed results in an error.

Parameters
subsystemSubsystem to add host to.
hostnqnThe NQN for the host.
paramsTransport specific parameters.
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_subsystem_add_host_ext()

int spdk_nvmf_subsystem_add_host_ext ( struct spdk_nvmf_subsystem * subsystem,
const char * hostnqn,
struct spdk_nvmf_host_opts * opts )

Allow the given host to connect to the given subsystem.

Parameters
subsystemSubsystem to add host to.
hostnqnHost's NQN.
optsHost's options.
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_subsystem_add_listener()

void spdk_nvmf_subsystem_add_listener ( struct spdk_nvmf_subsystem * subsystem,
struct spdk_nvme_transport_id * trid,
spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn,
void * cb_arg )

Accept new connections on the address provided.

This does not start the listener. Use spdk_nvmf_tgt_listen_ext() for that.

May only be performed on subsystems in the PAUSED or INACTIVE states. No namespaces are required to be paused.

Parameters
subsystemSubsystem to add listener to.
tridThe address to accept connections from.
cb_fnA callback that will be called once the association is complete.
cb_argArgument passed to cb_fn.

◆ spdk_nvmf_subsystem_add_listener_ext()

void spdk_nvmf_subsystem_add_listener_ext ( struct spdk_nvmf_subsystem * subsystem,
struct spdk_nvme_transport_id * trid,
spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn,
void * cb_arg,
struct spdk_nvmf_listener_opts * opts )

Accept new connections on the address provided.

This does not start the listener. Use spdk_nvmf_tgt_listen_ext() for that.

May only be performed on subsystems in the PAUSED or INACTIVE states. No namespaces are required to be paused.

Parameters
subsystemSubsystem to add listener to.
tridThe address to accept connections from.
cb_fnA callback that will be called once the association is complete.
cb_argArgument passed to cb_fn.
optsNULL or options requested for listener creation.

◆ spdk_nvmf_subsystem_add_ns_ext()

uint32_t spdk_nvmf_subsystem_add_ns_ext ( struct spdk_nvmf_subsystem * subsystem,
const char * bdev_name,
const struct spdk_nvmf_ns_opts * opts,
size_t opts_size,
const char * ptpl_file )

Add a namespace to a subsystems in the PAUSED or INACTIVE states.

May only be performed on subsystems in the PAUSED or INACTIVE states.

Parameters
subsystemSubsystem to add namespace to.
bdev_nameBlock device name to add as a namespace.
optsNamespace options, or NULL to use defaults.
opts_sizesizeof(*opts)
ptpl_filePersist through power loss file path.
Returns
newly added NSID on success, or 0 on failure.

◆ spdk_nvmf_subsystem_allow_any_listener()

void spdk_nvmf_subsystem_allow_any_listener ( struct spdk_nvmf_subsystem * subsystem,
bool allow_any_listener )

Set whether a subsystem should allow any listen address or only addresses in the allowed list.

Parameters
subsystemSubsystem to allow dynamic listener assignment.
allow_any_listenertrue to allow dynamic listener assignment for this subsystem, or false to enforce the list configured during subsystem setup.

◆ spdk_nvmf_subsystem_any_listener_allowed()

bool spdk_nvmf_subsystem_any_listener_allowed ( struct spdk_nvmf_subsystem * subsystem)

Check whether a subsystem allows any listen address or only addresses in the allowed list.

Parameters
subsystemSubsystem to query.
Returns
true if this subsystem allows dynamic management of listen address list, or false if only allows addresses in the list configured during subsystem setup.

◆ spdk_nvmf_subsystem_create()

struct spdk_nvmf_subsystem * spdk_nvmf_subsystem_create ( struct spdk_nvmf_tgt * tgt,
const char * nqn,
enum spdk_nvmf_subtype type,
uint32_t num_ns )

Create an NVMe-oF subsystem.

Subsystems are in one of three states: Inactive, Active, Paused. This state affects which operations may be performed on the subsystem. Upon creation, the subsystem will be in the Inactive state and may be activated by calling spdk_nvmf_subsystem_start(). No I/O will be processed in the Inactive or Paused states, but changes to the state of the subsystem may be made.

Parameters
tgtThe NVMe-oF target that will own this subsystem.
nqnThe NVMe qualified name of this subsystem.
typeWhether this subsystem is an I/O subsystem or a Discovery subsystem.
num_nsThe maximum number of namespaces this subsystem may contain.
Returns
a pointer to a NVMe-oF subsystem on success, or NULL on failure.

◆ spdk_nvmf_subsystem_destroy()

int spdk_nvmf_subsystem_destroy ( struct spdk_nvmf_subsystem * subsystem,
nvmf_subsystem_destroy_cb cpl_cb,
void * cpl_cb_arg )

Destroy an NVMe-oF subsystem.

A subsystem may only be destroyed when in the Inactive state. See spdk_nvmf_subsystem_stop(). A subsystem may be destroyed asynchronously, in that case cpl_cb will be called

Parameters
subsystemThe NVMe-oF subsystem to destroy.
cpl_cbOptional callback to be called if the subsystem is destroyed asynchronously, only called if return value is -EINPROGRESS
cpl_cb_argOptional user context to be passed to cpl_cb
Return values
0if subsystem is destroyed, cpl_cb is not called is that case
-EINVAlif subsystem is a NULL pointer
-EAGAINif subsystem is not in INACTIVE state
-EALREADYif subsystem destruction is already started
-EINPROGRESSif subsystem is destroyed asynchronously, cpl_cb will be called in that case

◆ spdk_nvmf_subsystem_disconnect_host()

int spdk_nvmf_subsystem_disconnect_host ( struct spdk_nvmf_subsystem * subsystem,
const char * hostnqn,
spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn,
void * cb_arg )

Disconnect all connections originating from the provided hostnqn.

To disconnect and block all new connections from a host, first call spdk_nvmf_subsystem_remove_host() to remove it from the list of allowed hosts, then call spdk_nvmf_subsystem_disconnect_host() to close any remaining connections.

Parameters
subsystemSubsystem to operate on
hostnqnThe NQN for the host
cb_fnThe function to call on completion.
cb_argThe argument to pass to the cb_fn.
Returns
int. 0 when the asynchronous process starts successfully or a negated errno on failure.

◆ spdk_nvmf_subsystem_get_allow_any_host()

bool spdk_nvmf_subsystem_get_allow_any_host ( const struct spdk_nvmf_subsystem * subsystem)

Check whether a subsystem should allow any host or only hosts in the allowed list.

Parameters
subsystemSubsystem to query.
Returns
true if any host is allowed to connect to this subsystem, or false if connecting hosts must be in the list configured with spdk_nvmf_subsystem_add_host().

◆ spdk_nvmf_subsystem_get_ana_reporting()

bool spdk_nvmf_subsystem_get_ana_reporting ( struct spdk_nvmf_subsystem * subsystem)

Get whether a subsystem supports Asymmetric Namespace Access (ANA) reporting.

Parameters
subsystemSubsystem to check
Returns
true if subsystem supports ANA reporting, false otherwise.

◆ spdk_nvmf_subsystem_get_ana_state()

int spdk_nvmf_subsystem_get_ana_state ( struct spdk_nvmf_subsystem * subsystem,
const struct spdk_nvme_transport_id * trid,
uint32_t anagrpid,
enum spdk_nvme_ana_state * ana_state )

Get Asymmetric Namespace Access (ANA) state for the specified ANA group id.

Parameters
subsystemSubsystem to operate on
tridAddress for which the ANA is to be looked up
anagrpidThe ANA group ID to check for
ana_stateOutput parameter that will contain the ANA state
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_subsystem_get_first()

struct spdk_nvmf_subsystem * spdk_nvmf_subsystem_get_first ( struct spdk_nvmf_tgt * tgt)

Begin iterating over all known subsystems.

If no subsystems are present, return NULL.

Parameters
tgtThe NVMe-oF target to iterate.
Returns
a pointer to the first NVMe-oF subsystem on success, or NULL on failure.

◆ spdk_nvmf_subsystem_get_first_host()

struct spdk_nvmf_host * spdk_nvmf_subsystem_get_first_host ( struct spdk_nvmf_subsystem * subsystem)

Get the first allowed host in a subsystem.

Parameters
subsystemSubsystem to query.
Returns
first allowed host in this subsystem, or NULL if none allowed.

◆ spdk_nvmf_subsystem_get_first_listener()

struct spdk_nvmf_subsystem_listener * spdk_nvmf_subsystem_get_first_listener ( struct spdk_nvmf_subsystem * subsystem)

Get the first allowed listen address in the subsystem.

Parameters
subsystemSubsystem to query.
Returns
first allowed listen address in this subsystem, or NULL if none allowed.

◆ spdk_nvmf_subsystem_get_first_ns()

struct spdk_nvmf_ns * spdk_nvmf_subsystem_get_first_ns ( struct spdk_nvmf_subsystem * subsystem)

Get the first allocated namespace in a subsystem.

Parameters
subsystemSubsystem to query.
Returns
first allocated namespace in this subsystem, or NULL if this subsystem has no namespaces.

◆ spdk_nvmf_subsystem_get_max_cntlid()

uint16_t spdk_nvmf_subsystem_get_max_cntlid ( const struct spdk_nvmf_subsystem * subsystem)

Get the maximum controller ID allowed in a subsystem.

Parameters
subsystemSubsystem to query.
Returns
Maximum controller ID allowed in the subsystem.

◆ spdk_nvmf_subsystem_get_max_namespaces()

uint32_t spdk_nvmf_subsystem_get_max_namespaces ( const struct spdk_nvmf_subsystem * subsystem)

Get the maximum number of namespaces allowed in a subsystem.

Parameters
subsystemSubsystem to query.
Returns
Maximum number of namespaces allowed in the subsystem, or 0 for unlimited.

◆ spdk_nvmf_subsystem_get_max_nsid()

uint32_t spdk_nvmf_subsystem_get_max_nsid ( struct spdk_nvmf_subsystem * subsystem)

Get maximum namespace id of the specified subsystem.

Parameters
subsystemSubsystem to query.
Returns
maximum namespace id

◆ spdk_nvmf_subsystem_get_min_cntlid()

uint16_t spdk_nvmf_subsystem_get_min_cntlid ( const struct spdk_nvmf_subsystem * subsystem)

Get the minimum controller ID allowed in a subsystem.

Parameters
subsystemSubsystem to query.
Returns
Minimum controller ID allowed in the subsystem.

◆ spdk_nvmf_subsystem_get_mn()

const char * spdk_nvmf_subsystem_get_mn ( const struct spdk_nvmf_subsystem * subsystem)

Get the model number of the specified subsystem.

Parameters
subsystemSubsystem to query.
Returns
model number of the specified subsystem.

◆ spdk_nvmf_subsystem_get_next()

struct spdk_nvmf_subsystem * spdk_nvmf_subsystem_get_next ( struct spdk_nvmf_subsystem * subsystem)

Continue iterating over all known subsystems.

If no additional subsystems, return NULL.

Parameters
subsystemPrevious subsystem returned from spdk_nvmf_subsystem_get_first or spdk_nvmf_subsystem_get_next.
Returns
a pointer to the next NVMe-oF subsystem on success, or NULL on failure.

◆ spdk_nvmf_subsystem_get_next_host()

struct spdk_nvmf_host * spdk_nvmf_subsystem_get_next_host ( struct spdk_nvmf_subsystem * subsystem,
struct spdk_nvmf_host * prev_host )

Get the next allowed host in a subsystem.

Parameters
subsystemSubsystem to query.
prev_hostPrevious host returned from this function.
Returns
next allowed host in this subsystem, or NULL if prev_host was the last host.

◆ spdk_nvmf_subsystem_get_next_listener()

struct spdk_nvmf_subsystem_listener * spdk_nvmf_subsystem_get_next_listener ( struct spdk_nvmf_subsystem * subsystem,
struct spdk_nvmf_subsystem_listener * prev_listener )

Get the next allowed listen address in a subsystem.

Parameters
subsystemSubsystem to query.
prev_listenerPrevious listen address for this subsystem.
Returns
next allowed listen address in this subsystem, or NULL if prev_listener was the last address.

◆ spdk_nvmf_subsystem_get_next_ns()

struct spdk_nvmf_ns * spdk_nvmf_subsystem_get_next_ns ( struct spdk_nvmf_subsystem * subsystem,
struct spdk_nvmf_ns * prev_ns )

Get the next allocated namespace in a subsystem.

Parameters
subsystemSubsystem to query.
prev_nsPrevious ns returned from this function.
Returns
next allocated namespace in this subsystem, or NULL if prev_ns was the last namespace.

◆ spdk_nvmf_subsystem_get_nqn()

const char * spdk_nvmf_subsystem_get_nqn ( const struct spdk_nvmf_subsystem * subsystem)

Get the NQN of the specified subsystem.

Parameters
subsystemSubsystem to query.
Returns
NQN of the specified subsystem.

◆ spdk_nvmf_subsystem_get_ns()

struct spdk_nvmf_ns * spdk_nvmf_subsystem_get_ns ( struct spdk_nvmf_subsystem * subsystem,
uint32_t nsid )

Get a namespace in a subsystem by NSID.

Parameters
subsystemSubsystem to search.
nsidNamespace ID to find.
Returns
namespace matching nsid, or NULL if nsid was not found.

◆ spdk_nvmf_subsystem_get_sn()

const char * spdk_nvmf_subsystem_get_sn ( const struct spdk_nvmf_subsystem * subsystem)

Get the serial number of the specified subsystem.

Parameters
subsystemSubsystem to query.
Returns
serial number of the specified subsystem.

◆ spdk_nvmf_subsystem_get_type()

enum spdk_nvmf_subtype spdk_nvmf_subsystem_get_type ( struct spdk_nvmf_subsystem * subsystem)

Get the type of the specified subsystem.

Parameters
subsystemSubsystem to query.
Returns
the type of the specified subsystem.

◆ spdk_nvmf_subsystem_host_allowed()

bool spdk_nvmf_subsystem_host_allowed ( struct spdk_nvmf_subsystem * subsystem,
const char * hostnqn )

Check if the given host is allowed to connect to the subsystem.

Parameters
subsystemThe subsystem to query.
hostnqnThe NQN of the host.
Returns
true if allowed, false if not.

◆ spdk_nvmf_subsystem_is_discovery()

bool spdk_nvmf_subsystem_is_discovery ( struct spdk_nvmf_subsystem * subsystem)

Checks whether a given subsystem is a discovery subsystem.

Parameters
subsystemSubsystem to check.
Returns
true if a given subsystem is a discovery subsystem, false if the subsystem is an nvm subsystem

◆ spdk_nvmf_subsystem_listener_allowed()

bool spdk_nvmf_subsystem_listener_allowed ( struct spdk_nvmf_subsystem * subsystem,
const struct spdk_nvme_transport_id * trid )

Check if connections originated from the given address are allowed to connect to the subsystem.

Parameters
subsystemThe subsystem to query.
tridThe listen address.
Returns
true if allowed, or false if not.

◆ spdk_nvmf_subsystem_listener_get_trid()

const struct spdk_nvme_transport_id * spdk_nvmf_subsystem_listener_get_trid ( struct spdk_nvmf_subsystem_listener * listener)

Get a listen address' transport ID.

Parameters
listenerThis listener.
Returns
the transport ID for this listener.

◆ spdk_nvmf_subsystem_listener_opts_init()

void spdk_nvmf_subsystem_listener_opts_init ( struct spdk_nvmf_listener_opts * opts,
size_t size )

Initialize options structure for listener creation.

Parameters
optsOptions structure to initialize.
sizeSize of the structure.

◆ spdk_nvmf_subsystem_pause()

int spdk_nvmf_subsystem_pause ( struct spdk_nvmf_subsystem * subsystem,
uint32_t nsid,
spdk_nvmf_subsystem_state_change_done cb_fn,
void * cb_arg )

Transition an NVMe-oF subsystem from Active to Paused state.

In a paused state, all admin queues are frozen across the whole subsystem. If a namespace ID is provided, all commands to that namespace are quiesced and incoming commands for that namespace are queued until the subsystem is resumed.

Parameters
subsystemThe NVMe-oF subsystem.
nsidThe namespace to pause. If 0, pause no namespaces.
cb_fnA function that will be called once the subsystem has changed state.
cb_argArgument passed to cb_fn.
Returns
0 on success, or negated errno on failure. The callback provided will only be called on success.

◆ spdk_nvmf_subsystem_remove_host()

int spdk_nvmf_subsystem_remove_host ( struct spdk_nvmf_subsystem * subsystem,
const char * hostnqn )

Remove the given host NQN from the list of allowed hosts.

This call only removes the host from the allowed list of hosts. If a host with the given NQN is already connected it will not be disconnected, but it will not be able to create new connections.

Parameters
subsystemSubsystem to remove host from.
hostnqnThe NQN for the host.
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_subsystem_remove_listener()

int spdk_nvmf_subsystem_remove_listener ( struct spdk_nvmf_subsystem * subsystem,
const struct spdk_nvme_transport_id * trid )

Remove the listener from subsystem.

New connections to the address won't be propagated to the subsystem. However to stop listening at target level one must use the spdk_nvmf_tgt_stop_listen().

May only be performed on subsystems in the PAUSED or INACTIVE states. No namespaces are required to be paused.

Parameters
subsystemSubsystem to remove listener from.
tridThe address to no longer accept connections from.
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_subsystem_remove_ns()

int spdk_nvmf_subsystem_remove_ns ( struct spdk_nvmf_subsystem * subsystem,
uint32_t nsid )

Remove a namespace from a subsystem.

May only be performed on subsystems in the PAUSED or INACTIVE states. Additionally, the namespace must be paused.

Parameters
subsystemSubsystem the namespace belong to.
nsidNamespace ID to be removed.
Returns
0 on success, -1 on failure.

◆ spdk_nvmf_subsystem_resume()

int spdk_nvmf_subsystem_resume ( struct spdk_nvmf_subsystem * subsystem,
spdk_nvmf_subsystem_state_change_done cb_fn,
void * cb_arg )

Transition an NVMe-oF subsystem from Paused to Active state.

This resumes the entire subsystem, including any paused namespaces.

Parameters
subsystemThe NVMe-oF subsystem.
cb_fnA function that will be called once the subsystem has changed state.
cb_argArgument passed to cb_fn.
Returns
0 on success, or negated errno on failure. The callback provided will only be called on success.

◆ spdk_nvmf_subsystem_set_allow_any_host()

int spdk_nvmf_subsystem_set_allow_any_host ( struct spdk_nvmf_subsystem * subsystem,
bool allow_any_host )

Set whether a subsystem should allow any host or only hosts in the allowed list.

Parameters
subsystemSubsystem to modify.
allow_any_hosttrue to allow any host to connect to this subsystem, or false to enforce the list configured with spdk_nvmf_subsystem_add_host().
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_subsystem_set_ana_reporting()

int spdk_nvmf_subsystem_set_ana_reporting ( struct spdk_nvmf_subsystem * subsystem,
bool ana_reporting )

Set whether a subsystem supports Asymmetric Namespace Access (ANA) reporting.

May only be performed on subsystems in the INACTIVE state.

Parameters
subsystemSubsystem to modify.
ana_reportingtrue to support or false not to support ANA reporting.
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_subsystem_set_ana_state()

void spdk_nvmf_subsystem_set_ana_state ( struct spdk_nvmf_subsystem * subsystem,
const struct spdk_nvme_transport_id * trid,
enum spdk_nvme_ana_state ana_state,
uint32_t anagrpid,
spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn,
void * cb_arg )

Set Asymmetric Namespace Access (ANA) state for the specified ANA group id.

May only be performed on subsystems in the INACTIVE or PAUSED state.

Parameters
subsystemSubsystem to operate on
tridAddress for which the new state will apply
ana_stateThe ANA state which is to be set
anagrpidThe ANA group ID to operate on
cb_fnThe function to call on completion
cb_argThe argument to pass to the cb_fn

◆ spdk_nvmf_subsystem_set_cntlid_range()

int spdk_nvmf_subsystem_set_cntlid_range ( struct spdk_nvmf_subsystem * subsystem,
uint16_t min_cntlid,
uint16_t max_cntlid )

Sets the controller ID range for a subsystem.

Valid range is [1, 0xFFEF]. May only be performed on subsystems in the INACTIVE state.

Parameters
subsystemSubsystem to modify.
min_cntlidMinimum controller ID.
max_cntlidMaximum controller ID.
Returns
0 on success, or negated errno value on failure.

◆ spdk_nvmf_subsystem_set_mn()

int spdk_nvmf_subsystem_set_mn ( struct spdk_nvmf_subsystem * subsystem,
const char * mn )

Set the model number for the specified subsystem.

Parameters
subsystemSubsystem to set for.
mnmodel number to set.
Returns
0 on success, -1 on failure.

◆ spdk_nvmf_subsystem_set_sn()

int spdk_nvmf_subsystem_set_sn ( struct spdk_nvmf_subsystem * subsystem,
const char * sn )

Set the serial number for the specified subsystem.

Parameters
subsystemSubsystem to set for.
snserial number to set.
Returns
0 on success, -1 on failure.

◆ spdk_nvmf_subsystem_start()

int spdk_nvmf_subsystem_start ( struct spdk_nvmf_subsystem * subsystem,
spdk_nvmf_subsystem_state_change_done cb_fn,
void * cb_arg )

Transition an NVMe-oF subsystem from Inactive to Active state.

Parameters
subsystemThe NVMe-oF subsystem.
cb_fnA function that will be called once the subsystem has changed state.
cb_argArgument passed to cb_fn.
Returns
0 on success, or negated errno on failure. The callback provided will only be called on success.

◆ spdk_nvmf_subsystem_stop()

int spdk_nvmf_subsystem_stop ( struct spdk_nvmf_subsystem * subsystem,
spdk_nvmf_subsystem_state_change_done cb_fn,
void * cb_arg )

Transition an NVMe-oF subsystem from Active to Inactive state.

Parameters
subsystemThe NVMe-oF subsystem.
cb_fnA function that will be called once the subsystem has changed state.
cb_argArgument passed to cb_fn.
Returns
0 on success, or negated errno on failure. The callback provided will only be called on success.

◆ spdk_nvmf_tgt_add_referral()

int spdk_nvmf_tgt_add_referral ( struct spdk_nvmf_tgt * tgt,
const struct spdk_nvmf_referral_opts * opts )

Add a discovery service referral to an NVMe-oF target.

Parameters
tgtThe target to which the referral will be added
optsOptions describing the referral referral.
Returns
0 on success or a negated errno on failure

◆ spdk_nvmf_tgt_add_transport()

void spdk_nvmf_tgt_add_transport ( struct spdk_nvmf_tgt * tgt,
struct spdk_nvmf_transport * transport,
spdk_nvmf_tgt_add_transport_done_fn cb_fn,
void * cb_arg )

Add a transport to a target.

Parameters
tgtThe NVMe-oF target
transportThe transport to add
cb_fnA callback that will be called once the transport is created
cb_argA context argument passed to cb_fn.

◆ spdk_nvmf_tgt_create()

struct spdk_nvmf_tgt * spdk_nvmf_tgt_create ( struct spdk_nvmf_target_opts * opts)

Construct an NVMe-oF target.

Parameters
optsa pointer to an spdk_nvmf_target_opts structure.
Returns
a pointer to a NVMe-oF target on success, or NULL on failure.

◆ spdk_nvmf_tgt_destroy()

void spdk_nvmf_tgt_destroy ( struct spdk_nvmf_tgt * tgt,
spdk_nvmf_tgt_destroy_done_fn cb_fn,
void * cb_arg )

Destroy an NVMe-oF target.

Parameters
tgtThe target to destroy. This releases all resources.
cb_fnA callback that will be called once the target is destroyed
cb_argA context argument passed to cb_fn.

◆ spdk_nvmf_tgt_find_subsystem()

struct spdk_nvmf_subsystem * spdk_nvmf_tgt_find_subsystem ( struct spdk_nvmf_tgt * tgt,
const char * subnqn )

Search the target for a subsystem with the given NQN.

Parameters
tgtThe NVMe-oF target to search from.
subnqnNQN of the subsystem.
Returns
a pointer to the NVMe-oF subsystem on success, or NULL on failure.

◆ spdk_nvmf_tgt_get_name()

const char * spdk_nvmf_tgt_get_name ( struct spdk_nvmf_tgt * tgt)

Get the name of an NVMe-oF target.

Parameters
tgtThe target from which to get the name.
Returns
The name of the target as a null terminated string.

◆ spdk_nvmf_tgt_get_transport()

struct spdk_nvmf_transport * spdk_nvmf_tgt_get_transport ( struct spdk_nvmf_tgt * tgt,
const char * transport_name )

Get an existing transport from the target.

Parameters
tgtThe NVMe-oF target
transport_nameThe name of the transport type to get.
Returns
the transport or NULL if not found

◆ spdk_nvmf_tgt_listen_ext()

int spdk_nvmf_tgt_listen_ext ( struct spdk_nvmf_tgt * tgt,
const struct spdk_nvme_transport_id * trid,
struct spdk_nvmf_listen_opts * opts )

Begin accepting new connections at the address provided.

The connections will be matched with a subsystem, which may or may not allow the connection based on a subsystem-specific list of allowed hosts. See spdk_nvmf_subsystem_add_host() and spdk_nvmf_subsystem_add_listener()

Parameters
tgtThe target associated with this listen address.
tridThe address to listen at.
optsListener options.
Returns
0 on success or a negated errno on failure.

◆ spdk_nvmf_tgt_pause_polling()

int spdk_nvmf_tgt_pause_polling ( struct spdk_nvmf_tgt * tgt,
spdk_nvmf_tgt_pause_polling_cb_fn cb_fn,
void * cb_arg )

Pause polling on the given target.

Parameters
tgtThe target to pause
cb_fnA callback that will be called once the target is paused
cb_argA context argument passed to cb_fn.
Returns
0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_tgt_remove_referral()

int spdk_nvmf_tgt_remove_referral ( struct spdk_nvmf_tgt * tgt,
const struct spdk_nvmf_referral_opts * opts )

Remove a discovery service referral from an NVMeoF target.

Parameters
tgtThe target from which the referral will be removed
optsOptions describing the referral referral.
Returns
0 on success or a negated errno on failure.

◆ spdk_nvmf_tgt_resume_polling()

int spdk_nvmf_tgt_resume_polling ( struct spdk_nvmf_tgt * tgt,
spdk_nvmf_tgt_resume_polling_cb_fn cb_fn,
void * cb_arg )

Resume polling on the given target.

Parameters
tgtThe target to resume
cb_fnA callback that will be called once the target is resumed
cb_argA context argument passed to cb_fn.
Returns
0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_tgt_stop_listen()

int spdk_nvmf_tgt_stop_listen ( struct spdk_nvmf_tgt * tgt,
struct spdk_nvme_transport_id * trid )

Stop accepting new connections at the provided address.

This is a counterpart to spdk_nvmf_tgt_listen_ext().

Parameters
tgtThe target associated with the listen address.
tridThe address to stop listening at.
Returns
int. 0 on success or a negated errno on failure.

◆ spdk_nvmf_tgt_write_config_json()

void spdk_nvmf_tgt_write_config_json ( struct spdk_json_write_ctx * w,
struct spdk_nvmf_tgt * tgt )

Write NVMe-oF target configuration into provided JSON context.

Parameters
wJSON write context
tgtThe NVMe-oF target

◆ spdk_nvmf_transport_create()

struct spdk_nvmf_transport * spdk_nvmf_transport_create ( const char * transport_name,
struct spdk_nvmf_transport_opts * opts )

Create a protocol transport - deprecated, please use spdk_nvmf_transport_create_async.

Parameters
transport_nameThe transport type to create
optsThe transport options (e.g. max_io_size). It should not be NULL, and opts_size pointed in this structure should not be zero value.
Returns
new transport or NULL if create fails

◆ spdk_nvmf_transport_create_async()

int spdk_nvmf_transport_create_async ( const char * transport_name,
struct spdk_nvmf_transport_opts * opts,
spdk_nvmf_transport_create_done_cb cb_fn,
void * cb_arg )

Create a protocol transport.

The callback will be executed asynchronously - i.e. spdk_nvmf_transport_create_async will always return prior to cb_fn being called.

Parameters
transport_nameThe transport type to create
optsThe transport options (e.g. max_io_size). It should not be NULL, and opts_size pointed in this structure should not be zero value.
cb_fnA callback that will be called once the transport is created
cb_argA context argument passed to cb_fn.
Returns
0 on success, or negative errno on failure (cb_fn will not be executed then).

◆ spdk_nvmf_transport_destroy()

int spdk_nvmf_transport_destroy ( struct spdk_nvmf_transport * transport,
spdk_nvmf_transport_destroy_done_cb cb_fn,
void * cb_arg )

Destroy a protocol transport.

Parameters
transportThe transport to destroy
cb_fnA callback that will be called once the transport is destroyed
cb_argA context argument passed to cb_fn.
Returns
0 on success, -1 on failure.

◆ spdk_nvmf_transport_get_first()

struct spdk_nvmf_transport * spdk_nvmf_transport_get_first ( struct spdk_nvmf_tgt * tgt)

Get the first transport registered with the given target.

Parameters
tgtThe NVMe-oF target
Returns
The first transport registered on the target

◆ spdk_nvmf_transport_get_next()

struct spdk_nvmf_transport * spdk_nvmf_transport_get_next ( struct spdk_nvmf_transport * transport)

Get the next transport in a target's list.

Parameters
transportA handle to a transport object
Returns
The next transport associated with the NVMe-oF target

◆ spdk_nvmf_transport_listen()

int spdk_nvmf_transport_listen ( struct spdk_nvmf_transport * transport,
const struct spdk_nvme_transport_id * trid,
struct spdk_nvmf_listen_opts * opts )

Add listener to transport and begin accepting new connections.

Parameters
transportThe transport to add listener to.
tridThe address to listen at.
optsListener options.
Returns
int. 0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_transport_opts_init()

bool spdk_nvmf_transport_opts_init ( const char * transport_name,
struct spdk_nvmf_transport_opts * opts,
size_t opts_size )

Initialize transport options.

Parameters
transport_nameThe transport type to create
optsThe transport options (e.g. max_io_size)
opts_sizeMust be set to sizeof(struct spdk_nvmf_transport_opts).
Returns
bool. true if successful, false if transport type not found.

◆ spdk_nvmf_transport_stop_listen()

int spdk_nvmf_transport_stop_listen ( struct spdk_nvmf_transport * transport,
const struct spdk_nvme_transport_id * trid )

Remove listener from transport and stop accepting new connections.

Parameters
transportThe transport to remove listener from
tridAddress to stop listen at
Returns
int. 0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_transport_stop_listen_async()

int spdk_nvmf_transport_stop_listen_async ( struct spdk_nvmf_transport * transport,
const struct spdk_nvme_transport_id * trid,
struct spdk_nvmf_subsystem * subsystem,
spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn,
void * cb_arg )

Stop accepting new connections at the provided address.

This is a counterpart to spdk_nvmf_tgt_listen_ext(). It differs from spdk_nvmf_transport_stop_listen() in that it also destroys qpairs that are connected to the specified listener. Because this function disconnects the qpairs, it has to be asynchronous.

The subsystem is matched using the subsystem parameter, not the subnqn field in the trid.

Parameters
transportThe transport associated with the listen address.
tridThe address to stop listening at. subnqn must be an empty string.
subsystemThe subsystem to match for qpairs with the specified trid. If NULL, it will disconnect all qpairs with the specified trid.
cb_fnThe function to call on completion.
cb_argThe argument to pass to the cb_fn.
Returns
int. 0 when the asynchronous process starts successfully or a negated errno on failure.