fabrics.h
Fabrics-specific definitions.
-
struct nvme_fabrics_config
Defines all linux nvme fabrics initiator options
Definition
struct nvme_fabrics_config {
char *host_traddr;
char *host_iface;
int queue_size;
int nr_io_queues;
int reconnect_delay;
int ctrl_loss_tmo;
int fast_io_fail_tmo;
int keep_alive_tmo;
int nr_write_queues;
int nr_poll_queues;
int tos;
bool duplicate_connect;
bool disable_sqflow;
bool hdr_digest;
bool data_digest;
bool tls;
};
Members
host_traddrHost transport address
host_ifaceHost interface name
queue_sizeNumber of IO queue entries
nr_io_queuesNumber of controller IO queues to establish
reconnect_delayTime between two consecutive reconnect attempts.
ctrl_loss_tmoOverride the default controller reconnect attempt timeout in seconds
fast_io_fail_tmoSet the fast I/O fail timeout in seconds.
keep_alive_tmoOverride the default keep-alive-timeout to this value in seconds
nr_write_queuesNumber of queues to use for exclusively for writing
nr_poll_queuesNumber of queues to reserve for polling completions
tosType of service
duplicate_connectAllow multiple connections to the same target
disable_sqflowDisable controller sq flow control
hdr_digestGenerate/verify header digest (TCP)
data_digestGenerate/verify data digest (TCP)
tlsStart TLS on the connection (TCP)
-
const char *nvmf_trtype_str(__u8 trtype)
Decode TRTYPE field
Parameters
__u8 trtypevalue to be decoded
Description
Decode the transport type field in the discovery log page entry.
Return
decoded string
-
const char *nvmf_adrfam_str(__u8 adrfam)
Decode ADRFAM field
Parameters
__u8 adrfamvalue to be decoded
Description
Decode the address family field in the discovery log page entry.
Return
decoded string
-
const char *nvmf_subtype_str(__u8 subtype)
Decode SUBTYPE field
Parameters
__u8 subtypevalue to be decoded
Description
Decode the subsystem type field in the discovery log page entry.
Return
decoded string
-
const char *nvmf_treq_str(__u8 treq)
Decode TREQ field
Parameters
__u8 treqvalue to be decoded
Description
Decode the transport requirements field in the discovery log page entry.
Return
decoded string
-
const char *nvmf_eflags_str(__u16 eflags)
Decode EFLAGS field
Parameters
__u16 eflagsvalue to be decoded
Description
Decode the EFLAGS field in the discovery log page entry.
Return
decoded string
-
const char *nvmf_sectype_str(__u8 sectype)
Decode SECTYPE field
Parameters
__u8 sectypevalue to be decoded
Description
Decode the SECTYPE field in the discovery log page entry.
Return
decoded string
-
const char *nvmf_prtype_str(__u8 prtype)
Decode RDMA Provider type field
Parameters
__u8 prtypevalue to be decoded
Description
Decode the RDMA Provider type field in the discovery log page entry.
Return
decoded string
-
const char *nvmf_qptype_str(__u8 qptype)
Decode RDMA QP Service type field
Parameters
__u8 qptypevalue to be decoded
Description
Decode the RDMA QP Service type field in the discovery log page entry.
Return
decoded string
-
const char *nvmf_cms_str(__u8 cms)
Decode RDMA connection management service field
Parameters
__u8 cmsvalue to be decoded
Description
Decode the RDMA connection management service field in the discovery log page entry.
Return
decoded string
-
void nvmf_default_config(struct nvme_fabrics_config *cfg)
Default values for fabrics configuration
Parameters
struct nvme_fabrics_config *cfgconfig values to set
Description
Initializes cfg with default values.
-
void nvmf_update_config(nvme_ctrl_t c, const struct nvme_fabrics_config *cfg)
Update fabrics configuration values
Parameters
nvme_ctrl_t cController to be modified
const struct nvme_fabrics_config *cfgUpdated configuration values
Description
Updates the values from c with the configuration values from cfg; all non-default values from cfg will overwrite the values in c.
-
int nvmf_add_ctrl(nvme_host_t h, nvme_ctrl_t c, const struct nvme_fabrics_config *cfg)
Connect a controller and update topology
Parameters
nvme_host_t hHost to which the controller should be attached
nvme_ctrl_t cController to be connected
const struct nvme_fabrics_config *cfgDefault configuration for the controller
Description
Issues a ‘connect’ command to the NVMe-oF controller and inserts c into the topology using h as parent. c must be initialized and not connected to the topology.
Return
0 on success; on failure errno is set and -1 is returned.
-
int nvmf_get_discovery_log(nvme_ctrl_t c, struct nvmf_discovery_log **logp, int max_retries)
Return the discovery log page
Parameters
nvme_ctrl_t cDiscover controller to use
struct nvmf_discovery_log **logpPointer to the log page to be returned
int max_retriesmaximum number of log page entries to be returned
Return
0 on success; on failure -1 is returned and errno is set
-
char *nvmf_hostnqn_generate()
Generate a machine specific host nqn
Parameters
Return
An nvm namespace qualified name string based on the machine identifier, or NULL if not successful.
-
char *nvmf_hostnqn_from_file()
Reads the host nvm qualified name from the config default location in /etc/nvme/
Parameters
Return
The host nqn, or NULL if unsuccessful. If found, the caller is responsible to free the string.
-
char *nvmf_hostid_from_file()
Reads the host identifier from the config default location in /etc/nvme/.
Parameters
Return
- The host identifier, or NULL if unsuccessful. If found, the caller
is responsible to free the string.
-
nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h, struct nvmf_disc_log_entry *e, const struct nvme_fabrics_config *defcfg, bool *discover)
Connect controller based on the discovery log page entry
Parameters
nvme_host_t hHost to which the controller should be connected
struct nvmf_disc_log_entry *eDiscovery log page entry
const struct nvme_fabrics_config *defcfgDefault configuration to be used for the new controller
bool *discoverSet to ‘true’ if the new controller is a discovery controller
Return
Pointer to the new controller
-
bool nvmf_is_registration_supported(nvme_ctrl_t c)
check whether registration can be performed.
Parameters
nvme_ctrl_t cController instance
Description
Only discovery controllers (DC) that comply with TP8010 support explicit registration with the DIM PDU. These can be identified by looking at the value of a dctype in the Identify command response. A value of 1 (DDC) or 2 (CDC) indicates that the DC supports explicit registration.
Return
true if controller supports explicit registration. false otherwise.
-
int nvmf_register_ctrl(nvme_ctrl_t c, enum nvmf_dim_tas tas, __u32 *result)
Perform registration task with a DC
Parameters
nvme_ctrl_t cController instance
enum nvmf_dim_tas tasTask field of the Command Dword 10 (cdw10). Indicates whether to perform a Registration, Deregistration, or Registration-update.
__u32 *resultThe command-specific result returned by the DC upon command completion.
Description
Perform registration task with a Discovery Controller (DC). Three tasks are supported: register, deregister, and registration update.
Return
0 on success; on failure -1 is returned and errno is set