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

NVMe-oF Target transport plugin API. More...

Data Structures

union  nvmf_h2c_msg
 
union  nvmf_c2h_msg
 
struct  spdk_nvmf_dif_info
 
struct  spdk_nvmf_stripped_data
 
struct  spdk_nvmf_request
 
struct  spdk_nvmf_qpair
 
struct  spdk_nvmf_transport_poll_group
 
struct  spdk_nvmf_poll_group
 
struct  spdk_nvmf_listener
 
struct  spdk_nvmf_ctrlr_data
 A subset of struct spdk_nvme_ctrlr_data that are emulated by a fabrics device. More...
 
struct  spdk_nvmf_transport
 
struct  spdk_nvmf_transport_ops
 
struct  spdk_nvmf_registers
 A subset of struct spdk_nvme_registers that are emulated by a fabrics device. More...
 
struct  spdk_nvmf_ctrlr_feat
 
struct  spdk_nvmf_ctrlr_migr_data
 

Macros

#define SPDK_NVMF_MAX_SGL_ENTRIES   16
 
#define NVMF_REQ_MAX_BUFFERS   (SPDK_NVMF_MAX_SGL_ENTRIES * 2 + 1)
 
#define SPDK_NVMF_MIGR_MAX_PENDING_AERS   256
 
#define SPDK_NVMF_MAX_ASYNC_EVENTS   4
 
#define NVMF_DATA_BUFFER_ALIGNMENT   VALUE_4KB
 
#define NVMF_DATA_BUFFER_MASK   (NVMF_DATA_BUFFER_ALIGNMENT - 1LL)
 
#define SPDK_NVMF_DEFAULT_ACCEPT_POLL_RATE_US   10000
 
#define MAX_MEMPOOL_NAME_LENGTH   40
 
#define SPDK_NVMF_TRANSPORT_REGISTER(name, transport_ops)
 

Typedefs

typedef void(* spdk_nvmf_state_change_done) (void *cb_arg, int status)
 
typedef void(* spdk_nvmf_transport_qpair_fini_cb) (void *cb_arg)
 

Enumerations

enum  spdk_nvmf_zcopy_phase {
  NVMF_ZCOPY_PHASE_NONE , NVMF_ZCOPY_PHASE_INIT , NVMF_ZCOPY_PHASE_EXECUTE , NVMF_ZCOPY_PHASE_END_PENDING ,
  NVMF_ZCOPY_PHASE_COMPLETE , NVMF_ZCOPY_PHASE_INIT_FAILED
}
 
enum  spdk_nvmf_qpair_state {
  SPDK_NVMF_QPAIR_UNINITIALIZED = 0 , SPDK_NVMF_QPAIR_CONNECTING , SPDK_NVMF_QPAIR_AUTHENTICATING , SPDK_NVMF_QPAIR_ENABLED ,
  SPDK_NVMF_QPAIR_DEACTIVATING , SPDK_NVMF_QPAIR_ERROR
}
 

Functions

 SPDK_STATIC_ASSERT (sizeof(union nvmf_h2c_msg)==64, "Incorrect size")
 
 SPDK_STATIC_ASSERT (sizeof(union nvmf_c2h_msg)==16, "Incorrect size")
 
 SPDK_STATIC_ASSERT (sizeof(struct spdk_nvmf_request)==816, "Incorrect size")
 
static int32_t spdk_nvmf_qpair_get_numa_id (struct spdk_nvmf_qpair *qpair)
 
void spdk_nvmf_transport_register (const struct spdk_nvmf_transport_ops *ops)
 Register the operations for a given transport type.
 
int spdk_nvmf_ctrlr_connect (struct spdk_nvmf_request *req)
 
void spdk_nvmf_tgt_new_qpair (struct spdk_nvmf_tgt *tgt, struct spdk_nvmf_qpair *qpair)
 Function to be called for each newly discovered qpair.
 
static bool spdk_nvmf_qpair_is_active (struct spdk_nvmf_qpair *qpair)
 
 SPDK_STATIC_ASSERT (sizeof(struct spdk_nvmf_registers)==40, "Incorrect size")
 
const struct spdk_nvmf_registersspdk_nvmf_ctrlr_get_regs (struct spdk_nvmf_ctrlr *ctrlr)
 
void spdk_nvmf_request_free_buffers (struct spdk_nvmf_request *req, struct spdk_nvmf_transport_poll_group *group, struct spdk_nvmf_transport *transport)
 
int spdk_nvmf_request_get_buffers (struct spdk_nvmf_request *req, struct spdk_nvmf_transport_poll_group *group, struct spdk_nvmf_transport *transport, uint32_t length)
 
bool spdk_nvmf_request_get_dif_ctx (struct spdk_nvmf_request *req, struct spdk_dif_ctx *dif_ctx)
 
void spdk_nvmf_request_exec (struct spdk_nvmf_request *req)
 
int spdk_nvmf_request_free (struct spdk_nvmf_request *req)
 
int spdk_nvmf_request_complete (struct spdk_nvmf_request *req)
 
void spdk_nvmf_request_zcopy_start (struct spdk_nvmf_request *req)
 
void spdk_nvmf_request_zcopy_end (struct spdk_nvmf_request *req, bool commit)
 
static bool spdk_nvmf_request_using_zcopy (const struct spdk_nvmf_request *req)
 
void spdk_nvmf_poll_group_remove (struct spdk_nvmf_qpair *qpair)
 Remove the given qpair from the poll group.
 
struct spdk_nvmf_subsystem * spdk_nvmf_ctrlr_get_subsystem (struct spdk_nvmf_ctrlr *ctrlr)
 Get the NVMe-oF subsystem associated with this controller.
 
uint16_t spdk_nvmf_ctrlr_get_id (struct spdk_nvmf_ctrlr *ctrlr)
 Get the NVMe-oF controller ID.
 
 SPDK_STATIC_ASSERT (sizeof(struct spdk_nvmf_ctrlr_feat)==40, "Incorrect size")
 
 SPDK_STATIC_ASSERT (offsetof(struct spdk_nvmf_ctrlr_migr_data, regs) - offsetof(struct spdk_nvmf_ctrlr_migr_data, data_size)==16, "Incorrect header size")
 
 SPDK_STATIC_ASSERT (offsetof(struct spdk_nvmf_ctrlr_migr_data, feat) - offsetof(struct spdk_nvmf_ctrlr_migr_data, regs)==256, "Incorrect regs size")
 
 SPDK_STATIC_ASSERT (offsetof(struct spdk_nvmf_ctrlr_migr_data, cntlid) - offsetof(struct spdk_nvmf_ctrlr_migr_data, feat)==256, "Incorrect feat size")
 
 SPDK_STATIC_ASSERT (sizeof(struct spdk_nvmf_ctrlr_migr_data)==4096, "Incorrect size")
 
int spdk_nvmf_ctrlr_save_migr_data (struct spdk_nvmf_ctrlr *ctrlr, struct spdk_nvmf_ctrlr_migr_data *data)
 Save the NVMe-oF controller state and configuration.
 
int spdk_nvmf_ctrlr_restore_migr_data (struct spdk_nvmf_ctrlr *ctrlr, const struct spdk_nvmf_ctrlr_migr_data *data)
 Restore the NVMe-oF controller state and configuration.
 
static enum spdk_nvme_data_transfer spdk_nvmf_req_get_xfer (struct spdk_nvmf_request *req)
 
int spdk_nvmf_ctrlr_async_event_error_event (struct spdk_nvmf_ctrlr *ctrlr, enum spdk_nvme_async_event_info_error info)
 Complete Asynchronous Event as Error.
 
void spdk_nvmf_ctrlr_abort_aer (struct spdk_nvmf_ctrlr *ctrlr)
 Abort outstanding Asynchronous Event Requests (AERs).
 

Detailed Description

NVMe-oF Target transport plugin API.

Macro Definition Documentation

◆ SPDK_NVMF_TRANSPORT_REGISTER

#define SPDK_NVMF_TRANSPORT_REGISTER ( name,
transport_ops )
Value:
static void __attribute__((constructor)) _spdk_nvmf_transport_register_##name(void) \
{ \
spdk_nvmf_transport_register(transport_ops); \
}

Function Documentation

◆ spdk_nvmf_ctrlr_abort_aer()

void spdk_nvmf_ctrlr_abort_aer ( struct spdk_nvmf_ctrlr * ctrlr)

Abort outstanding Asynchronous Event Requests (AERs).

Completes AERs with ABORTED_BY_REQUEST status code.

Parameters
ctrlrController whose AERs are going to be aborted.

◆ spdk_nvmf_ctrlr_async_event_error_event()

int spdk_nvmf_ctrlr_async_event_error_event ( struct spdk_nvmf_ctrlr * ctrlr,
enum spdk_nvme_async_event_info_error info )

Complete Asynchronous Event as Error.

Parameters
ctrlrController whose AER is going to be completed.
infoAsynchronous Event Error Information to be reported.
Returns
int. 0 if it completed successfully, or negative errno if it failed.

◆ spdk_nvmf_ctrlr_get_id()

uint16_t spdk_nvmf_ctrlr_get_id ( struct spdk_nvmf_ctrlr * ctrlr)

Get the NVMe-oF controller ID.

Parameters
ctrlrThe NVMe-oF controller
Returns
The NVMe-oF controller ID

◆ spdk_nvmf_ctrlr_get_subsystem()

struct spdk_nvmf_subsystem * spdk_nvmf_ctrlr_get_subsystem ( struct spdk_nvmf_ctrlr * ctrlr)

Get the NVMe-oF subsystem associated with this controller.

Parameters
ctrlrThe NVMe-oF controller
Returns
The NVMe-oF subsystem

◆ spdk_nvmf_ctrlr_restore_migr_data()

int spdk_nvmf_ctrlr_restore_migr_data ( struct spdk_nvmf_ctrlr * ctrlr,
const struct spdk_nvmf_ctrlr_migr_data * data )

Restore the NVMe-oF controller state and configuration.

The API is experimental.

It is allowed to restore the data only when the nvmf subsystem is in paused state.

To preserve thread safety this function must be executed on the same thread the NVMe-OF controller was created.

AERs shall be restored using spdk_nvmf_request_exec after this function is executed.

Parameters
ctrlrThe NVMe-oF controller
dataThe NVMe-oF controller state and configuration to be restored
Returns
0 on success or a negated errno on failure.

◆ spdk_nvmf_ctrlr_save_migr_data()

int spdk_nvmf_ctrlr_save_migr_data ( struct spdk_nvmf_ctrlr * ctrlr,
struct spdk_nvmf_ctrlr_migr_data * data )

Save the NVMe-oF controller state and configuration.

The API is experimental.

It is allowed to save the data only when the nvmf subsystem is in paused state i.e. there are no outstanding cmds in nvmf layer (other than aer), pending async event completions are getting blocked.

To preserve thread safety this function must be executed on the same thread the NVMe-OF controller was created.

Parameters
ctrlrThe NVMe-oF controller
dataThe NVMe-oF controller state and configuration to be saved
Returns
0 on success or a negated errno on failure.

◆ spdk_nvmf_poll_group_remove()

void spdk_nvmf_poll_group_remove ( struct spdk_nvmf_qpair * qpair)

Remove the given qpair from the poll group.

Parameters
qpairThe qpair to remove.

◆ spdk_nvmf_tgt_new_qpair()

void spdk_nvmf_tgt_new_qpair ( struct spdk_nvmf_tgt * tgt,
struct spdk_nvmf_qpair * qpair )

Function to be called for each newly discovered qpair.

Parameters
tgtThe nvmf target
qpairThe newly discovered qpair.

◆ spdk_nvmf_transport_register()

void spdk_nvmf_transport_register ( const struct spdk_nvmf_transport_ops * ops)

Register the operations for a given transport type.

This function should be invoked by referencing the macro SPDK_NVMF_TRANSPORT_REGISTER macro in the transport's .c file.

Parameters
opsThe operations associated with an NVMe-oF transport.