From 70601d5e0e33df1f3d6caf22c857f00e7016a5b1 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 15 Jul 2016 13:10:33 -0700 Subject: [PATCH] nvmf: add Doxygen comments to discovery log page Also add the missing ASQSZ field. Change-Id: I67e67a6b4076de226d30882aa40afd78bc8be2af Signed-off-by: Daniel Verkamp --- include/spdk/nvmf_spec.h | 135 ++++++++++++++++++++++++++++++--------- lib/nvmf/conf.c | 2 +- lib/nvmf/rdma.c | 10 +-- lib/nvmf/request.c | 2 +- lib/nvmf/session.c | 2 +- lib/nvmf/subsystem.c | 10 +-- lib/nvmf/subsystem.h | 4 +- 7 files changed, 120 insertions(+), 45 deletions(-) diff --git a/include/spdk/nvmf_spec.h b/include/spdk/nvmf_spec.h index b5b870197..30271361d 100644 --- a/include/spdk/nvmf_spec.h +++ b/include/spdk/nvmf_spec.h @@ -81,28 +81,38 @@ enum spdk_nvmf_fabric_cmd_status_code { /** * RDMA Queue Pair service types */ -enum spdk_nvmf_rdma_qp_service_types { +enum spdk_nvmf_rdma_qptype { /** Reliable connected */ - SPDK_NVMF_QP_TYPE_RELIABLE_CONNECTED = 0x1, + SPDK_NVMF_RDMA_QPTYPE_RELIABLE_CONNECTED = 0x1, + /** Reliable datagram */ - SPDK_NVMF_OQ_TYPE_RELIABLE_DATAGRAM = 0x2, + SPDK_NVMF_RDMA_QPTYPE_RELIABLE_DATAGRAM = 0x2, }; /** * RDMA provider types */ -enum spdk_nvmf_rdma_provider_types { - SPDK_NVMF_RDMA_NO_PROVIDER = 0x1, +enum spdk_nvmf_rdma_prtype { + /** No provider specified */ + SPDK_NVMF_RDMA_PRTYPE_NONE = 0x1, + + /** InfiniBand */ SPDK_NVMF_RDMA_PRTYPE_IB = 0x2, + + /** RoCE v1 */ SPDK_NVMF_RDMA_PRTYPE_ROCE = 0x3, + + /** RoCE v2 */ SPDK_NVMF_RDMA_PRTYPE_ROCE2 = 0x4, + + /** iWARP */ SPDK_NVMF_RDMA_PRTYPE_IWARP = 0x5, }; /** * RDMA connection management service types */ -enum spdk_nvmf_rdma_connection_mgmt_service { +enum spdk_nvmf_rdma_cms { /** Sockets based endpoint addressing */ SPDK_NVMF_RDMA_CMS_RDMA_CM = 0x1, }; @@ -110,40 +120,60 @@ enum spdk_nvmf_rdma_connection_mgmt_service { /** * NVMe over Fabrics transport types */ -enum spdk_nvmf_transport_types { - SPDK_NVMF_TRANS_RDMA = 0x1, - SPDK_NVMF_TRANS_FC = 0x2, - SPDK_NVMF_TRANS_INTRA_HOST = 0xfe, +enum spdk_nvmf_trtype { + /** RDMA */ + SPDK_NVMF_TRTYPE_RDMA = 0x1, + + /** Fibre Channel */ + SPDK_NVMF_TRTYPE_FC = 0x2, + + /** Intra-host transport (loopback) */ + SPDK_NVMF_TRTYPE_INTRA_HOST = 0xfe, }; /** * Address family types */ -enum spdk_nvmf_address_family_types { - SPDK_NVMF_ADDR_FAMILY_IPV4 = 0x1, - SPDK_NVMF_ADDR_FAMILY_IPV6 = 0x2, - SPDK_NVMF_ADDR_FAMILY_IB = 0x3, - SPDK_NVMF_ADDR_FAMILY_FC = 0x4, - SPDK_NVMF_ADDR_FAMILY_INTRA_HOST = 0xfe, +enum spdk_nvmf_adrfam { + /** IPv4 (AF_INET) */ + SPDK_NVMF_ADRFAM_IPV4 = 0x1, + + /** IPv6 (AF_INET6) */ + SPDK_NVMF_ADRFAM_IPV6 = 0x2, + + /** InfiniBand (AF_IB) */ + SPDK_NVMF_ADRFAM_IB = 0x3, + + /** Fibre Channel address family */ + SPDK_NVMF_ADRFAM_FC = 0x4, + + /** Intra-host transport (loopback) */ + SPDK_NVMF_ADRFAM_INTRA_HOST = 0xfe, }; /** * NVM subsystem types */ -enum spdk_nvmf_subsystem_types { +enum spdk_nvmf_subtype { /** Discovery type for NVM subsystem */ - SPDK_NVMF_SUB_DISCOVERY = 0x1, + SPDK_NVMF_SUBTYPE_DISCOVERY = 0x1, + /** NVMe type for NVM subsystem */ - SPDK_NVMF_SUB_NVME = 0x2, + SPDK_NVMF_SUBTYPE_NVME = 0x2, }; /** * Connections shall be made over a fabric secure channel */ -enum spdk_nvmf_transport_requirements { - SPDK_NVMF_TREQ_NOT_SPECIFIED = 0x0, - SPDK_NVMF_TREQ_REQUIRED = 0x1, - SPDK_NVMF_TREQ_NOT_REQUIRED = 0x2, +enum spdk_nvmf_treq_secure_channel { + /** Not specified */ + SPDK_NVMF_TREQ_SECURE_CHANNEL_NOT_SPECIFIED = 0x0, + + /** Required */ + SPDK_NVMF_TREQ_SECURE_CHANNEL_REQUIRED = 0x1, + + /** Not required */ + SPDK_NVMF_TREQ_SECURE_CHANNEL_NOT_REQUIRED = 0x2, }; struct spdk_nvmf_fabric_auth_recv_cmd { @@ -353,36 +383,81 @@ struct spdk_nvmf_discovery_identify_data { }; SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_discovery_identify_data) == 4096, "Incorrect size"); +/** RDMA transport-specific address subtype */ struct spdk_nvmf_rdma_transport_specific_address_subtype { - uint8_t rdma_qptype; /* see spdk_nvmf_rdma_qp_service_types */ - uint8_t rdma_prtype; /* see spdk_nvmf_rdma_provider_types */ - uint8_t rdma_cms; /* see spdk_nvmf_rdma_connection_mgmt_service */ + /** RDMA QP service type (\ref spdk_nvmf_rdma_qptype) */ + uint8_t rdma_qptype; + + /** RDMA provider type (\ref spdk_nvmf_rdma_prtype) */ + uint8_t rdma_prtype; + + /** RDMA connection management service (\ref spdk_nvmf_rdma_cms) */ + uint8_t rdma_cms; + uint8_t reserved0[5]; + + /** RDMA partition key for AF_IB */ uint16_t rdma_pkey; + uint8_t reserved2[246]; }; SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_rdma_transport_specific_address_subtype) == 256, "Incorrect size"); +/** Transport-specific address subtype */ union spdk_nvmf_transport_specific_address_subtype { uint8_t raw[256]; + + /** RDMA */ struct spdk_nvmf_rdma_transport_specific_address_subtype rdma; }; SPDK_STATIC_ASSERT(sizeof(union spdk_nvmf_transport_specific_address_subtype) == 256, "Incorrect size"); +/** + * Discovery Log Page entry + */ struct spdk_nvmf_discovery_log_page_entry { - uint8_t trtype; /* transport type */ - uint8_t adrfam; /* address family */ + /** Transport type (\ref spdk_nvmf_trtype) */ + uint8_t trtype; + + /** Address family (\ref spdk_nvmf_adrfam) */ + uint8_t adrfam; + + /** Subsystem type (\ref spdk_nvmf_subtype) */ uint8_t subtype; - uint8_t treq; + + /** Transport requirements */ + struct { + /** Secure channel requirements (\ref spdk_nvmf_treq_secure_channel) */ + uint8_t secure_channel : 2; + + uint8_t reserved : 6; + } treq; + + /** NVM subsystem port ID */ uint16_t portid; + + /** Controller ID */ uint16_t cntlid; - uint8_t reserved0[24]; + + /** Admin max SQ size */ + uint16_t asqsz; + + uint8_t reserved0[22]; + + /** Transport service identifier */ uint8_t trsvcid[32]; + uint8_t reserved1[192]; + + /** NVM subsystem qualified name */ uint8_t subnqn[256]; + + /** Transport address */ uint8_t traddr[256]; + + /** Transport-specific address subtype */ union spdk_nvmf_transport_specific_address_subtype tsas; }; SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_discovery_log_page_entry) == 1024, "Incorrect size"); diff --git a/lib/nvmf/conf.c b/lib/nvmf/conf.c index fab20a9e5..c68736787 100644 --- a/lib/nvmf/conf.c +++ b/lib/nvmf/conf.c @@ -336,7 +336,7 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp) } lcore = spdk_nvmf_allocate_lcore(mask, lcore); - subsystem = nvmf_create_subsystem(sp->num, nqn, SPDK_NVMF_SUB_NVME, lcore); + subsystem = nvmf_create_subsystem(sp->num, nqn, SPDK_NVMF_SUBTYPE_NVME, lcore); if (subsystem == NULL) { return -1; } diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index 254301c4c..0eb5db09d 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -1151,15 +1151,15 @@ static void nvmf_rdma_discover(struct spdk_nvmf_listen_addr *listen_addr, struct spdk_nvmf_discovery_log_page_entry *entry) { - entry->trtype = SPDK_NVMF_TRANS_RDMA; - entry->adrfam = SPDK_NVMF_ADDR_FAMILY_IPV4; - entry->treq = SPDK_NVMF_TREQ_NOT_SPECIFIED; + entry->trtype = SPDK_NVMF_TRTYPE_RDMA; + entry->adrfam = SPDK_NVMF_ADRFAM_IPV4; + entry->treq.secure_channel = SPDK_NVMF_TREQ_SECURE_CHANNEL_NOT_SPECIFIED; snprintf(entry->trsvcid, sizeof(entry->trsvcid), "%s", listen_addr->trsvc); snprintf(entry->traddr, sizeof(entry->traddr), "%s", listen_addr->traddr); - entry->tsas.rdma.rdma_qptype = SPDK_NVMF_QP_TYPE_RELIABLE_CONNECTED; - entry->tsas.rdma.rdma_prtype = SPDK_NVMF_RDMA_NO_PROVIDER; + entry->tsas.rdma.rdma_qptype = SPDK_NVMF_RDMA_QPTYPE_RELIABLE_CONNECTED; + entry->tsas.rdma.rdma_prtype = SPDK_NVMF_RDMA_PRTYPE_NONE; entry->tsas.rdma.rdma_cms = SPDK_NVMF_RDMA_CMS_RDMA_CM; } diff --git a/lib/nvmf/request.c b/lib/nvmf/request.c index 5aaaf8e02..545f374ae 100644 --- a/lib/nvmf/request.c +++ b/lib/nvmf/request.c @@ -649,7 +649,7 @@ spdk_nvmf_request_exec(struct spdk_nvmf_request *req) RTE_VERIFY(session != NULL); subsystem = session->subsys; RTE_VERIFY(subsystem != NULL); - if (subsystem->subtype == SPDK_NVMF_SUB_DISCOVERY) { + if (subsystem->subtype == SPDK_NVMF_SUBTYPE_DISCOVERY) { done = nvmf_process_discovery_cmd(req); } else { done = nvmf_process_admin_cmd(req); diff --git a/lib/nvmf/session.c b/lib/nvmf/session.c index f700743e6..e36fe3d40 100644 --- a/lib/nvmf/session.c +++ b/lib/nvmf/session.c @@ -248,7 +248,7 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn, session->subsys = subsystem; session->max_connections_allowed = g_nvmf_tgt.MaxConnectionsPerSession; - if (subsystem->subtype == SPDK_NVMF_SUB_NVME) { + if (subsystem->subtype == SPDK_NVMF_SUBTYPE_NVME) { nvmf_init_nvme_session_properties(session); } else { nvmf_init_discovery_session_properties(session); diff --git a/lib/nvmf/subsystem.c b/lib/nvmf/subsystem.c index 6c9410c55..7e228fe0c 100644 --- a/lib/nvmf/subsystem.c +++ b/lib/nvmf/subsystem.c @@ -85,7 +85,7 @@ spdk_nvmf_subsystem_poller(void *arg) } /* For NVMe subsystems, check the backing physical device for completions. */ - if (subsystem->subtype == SPDK_NVMF_SUB_NVME) { + if (subsystem->subtype == SPDK_NVMF_SUBTYPE_NVME) { spdk_nvme_ctrlr_process_admin_completions(subsystem->ctrlr); spdk_nvme_qpair_process_completions(subsystem->io_qpair, 0); } @@ -96,7 +96,7 @@ spdk_nvmf_subsystem_poller(void *arg) struct spdk_nvmf_subsystem * nvmf_create_subsystem(int num, const char *name, - enum spdk_nvmf_subsystem_types sub_type, + enum spdk_nvmf_subtype subtype, uint32_t lcore) { struct spdk_nvmf_subsystem *subsystem; @@ -109,7 +109,7 @@ nvmf_create_subsystem(int num, const char *name, SPDK_TRACELOG(SPDK_TRACE_NVMF, "nvmf_create_subsystem: allocated subsystem %p\n", subsystem); subsystem->num = num; - subsystem->subtype = sub_type; + subsystem->subtype = subtype; snprintf(subsystem->subnqn, sizeof(subsystem->subnqn), "%s", name); TAILQ_INIT(&subsystem->listen_addrs); TAILQ_INIT(&subsystem->hosts); @@ -220,7 +220,7 @@ spdk_add_nvmf_discovery_subsystem(void) return -1; } - subsystem = nvmf_create_subsystem(0, name, SPDK_NVMF_SUB_DISCOVERY, rte_get_master_lcore()); + subsystem = nvmf_create_subsystem(0, name, SPDK_NVMF_SUBTYPE_DISCOVERY, rte_get_master_lcore()); if (subsystem == NULL) { SPDK_ERRLOG("Failed creating discovery nvmf library subsystem\n"); free(name); @@ -241,7 +241,7 @@ spdk_format_discovery_log(struct spdk_nvmf_discovery_log_page *disc_log, uint32_ struct spdk_nvmf_discovery_log_page_entry *entry; TAILQ_FOREACH(subsystem, &g_subsystems, entries) { - if (subsystem->subtype == SPDK_NVMF_SUB_DISCOVERY) { + if (subsystem->subtype == SPDK_NVMF_SUBTYPE_DISCOVERY) { continue; } diff --git a/lib/nvmf/subsystem.h b/lib/nvmf/subsystem.h index 8cc2a2d71..e97562a4d 100644 --- a/lib/nvmf/subsystem.h +++ b/lib/nvmf/subsystem.h @@ -62,7 +62,7 @@ struct spdk_nvmf_host { struct spdk_nvmf_subsystem { uint16_t num; char subnqn[MAX_NQN_SIZE]; - enum spdk_nvmf_subsystem_types subtype; + enum spdk_nvmf_subtype subtype; struct nvmf_session *session; struct spdk_nvme_ctrlr *ctrlr; struct spdk_nvme_qpair *io_qpair; @@ -80,7 +80,7 @@ struct spdk_nvmf_subsystem { struct spdk_nvmf_subsystem * nvmf_create_subsystem(int num, const char *name, - enum spdk_nvmf_subsystem_types sub_type, + enum spdk_nvmf_subtype subtype, uint32_t lcore); int