lib/nvme: add objects for transport registration.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I33d0a23b646a06acbf219ff283f094197af6b1fc
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478865
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Seth Howell 2019-12-26 09:01:57 -07:00 committed by Tomasz Zawadzki
parent 771d759312
commit 017a8f885f
2 changed files with 62 additions and 0 deletions

View File

@ -2840,6 +2840,61 @@ int spdk_nvme_cuse_register(struct spdk_nvme_ctrlr *ctrlr);
*/
void spdk_nvme_cuse_unregister(struct spdk_nvme_ctrlr *ctrlr);
struct nvme_request;
struct spdk_nvme_transport_ops {
char name[SPDK_NVMF_TRSTRING_MAX_LEN + 1];
enum spdk_nvme_transport_type type;
struct spdk_nvme_ctrlr *(*ctrlr_construct)(const struct spdk_nvme_transport_id *trid,
const struct spdk_nvme_ctrlr_opts *opts,
void *devhandle);
int (*ctrlr_scan)(struct spdk_nvme_probe_ctx *probe_ctx, bool direct_connect);
int (*ctrlr_destruct)(struct spdk_nvme_ctrlr *ctrlr);
int (*ctrlr_enable)(struct spdk_nvme_ctrlr *ctrlr);
int (*ctrlr_set_reg_4)(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint32_t value);
int (*ctrlr_set_reg_8)(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint64_t value);
int (*ctrlr_get_reg_4)(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint32_t *value);
int (*ctrlr_get_reg_8)(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint64_t *value);
uint32_t (*ctrlr_get_max_xfer_size)(struct spdk_nvme_ctrlr *ctrlr);
uint16_t (*ctrlr_get_max_sges)(struct spdk_nvme_ctrlr *ctrlr);
void *(*ctrlr_alloc_cmb_io_buffer)(struct spdk_nvme_ctrlr *ctrlr, size_t size);
int (*ctrlr_free_cmb_io_buffer)(struct spdk_nvme_ctrlr *ctrlr, void *buf, size_t size);
struct spdk_nvme_qpair *(*ctrlr_create_io_qpair)(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,
const struct spdk_nvme_io_qpair_opts *opts);
int (*ctrlr_delete_io_qpair)(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair);
int (*ctrlr_connect_qpair)(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair);
volatile struct spdk_nvme_registers *(*ctrlr_get_registers)(struct spdk_nvme_ctrlr *ctrlr);
void (*ctrlr_disconnect_qpair)(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair);
void (*qpair_abort_reqs)(struct spdk_nvme_qpair *qpair, uint32_t dnr);
int (*qpair_reset)(struct spdk_nvme_qpair *qpair);
int (*qpair_submit_request)(struct spdk_nvme_qpair *qpair, struct nvme_request *req);
int32_t (*qpair_process_completions)(struct spdk_nvme_qpair *qpair, uint32_t max_completions);
void (*admin_qpair_abort_aers)(struct spdk_nvme_qpair *qpair);
};
#ifdef __cplusplus
}
#endif

View File

@ -355,6 +355,11 @@ enum nvme_qpair_state {
NVME_QPAIR_ENABLED,
};
struct nvme_transport {
struct spdk_nvme_transport_ops ops;
TAILQ_ENTRY(nvme_transport) link;
};
struct spdk_nvme_qpair {
struct spdk_nvme_ctrlr *ctrlr;
@ -400,6 +405,8 @@ struct spdk_nvme_qpair {
void *req_buf;
const struct nvme_transport *transport;
uint8_t transport_failure_reason: 2;
};