nvmf: define transport-specific address union

For now, it just contains RDMA, plus a raw byte array to allow generic
copying.

Change-Id: I02fe11f99dd8b49000de0dba991cd34c99fd7a4a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-07-15 09:34:25 -07:00
parent ac470faa01
commit 2653cb49a7
4 changed files with 12 additions and 10 deletions

View File

@ -364,6 +364,12 @@ struct spdk_nvmf_rdma_transport_specific_address {
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_rdma_transport_specific_address) == 256,
"Incorrect size");
union spdk_nvmf_transport_specific_address {
uint8_t raw[256];
struct spdk_nvmf_rdma_transport_specific_address rdma;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvmf_transport_specific_address) == 256, "Incorrect size");
struct spdk_nvmf_discovery_log_page_entry {
uint8_t trtype; /* transport type */
uint8_t adrfam; /* address family */
@ -376,9 +382,7 @@ struct spdk_nvmf_discovery_log_page_entry {
uint8_t reserved1[192];
uint8_t subnqn[256];
uint8_t traddr[256];
union {
struct spdk_nvmf_rdma_transport_specific_address rdma;
} tsas;
union spdk_nvmf_transport_specific_address tsas;
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_discovery_log_page_entry) == 1024, "Incorrect size");

View File

@ -127,10 +127,10 @@ spdk_nvmf_port_create(int tag)
port->state = GROUP_INIT;
port->tag = tag;
port->type = FABRIC_RDMA;
port->rdma.rdma_qptype = SPDK_NVMF_QP_TYPE_RELIABLE_CONNECTED;
port->tsas.rdma.rdma_qptype = SPDK_NVMF_QP_TYPE_RELIABLE_CONNECTED;
/* No provider specified */
port->rdma.rdma_prtype = SPDK_NVMF_RDMA_NO_PROVIDER;
port->rdma.rdma_cms = SPDK_NVMF_RDMA_CMS_RDMA_CM;
port->tsas.rdma.rdma_prtype = SPDK_NVMF_RDMA_NO_PROVIDER;
port->tsas.rdma.rdma_cms = SPDK_NVMF_RDMA_CMS_RDMA_CM;
TAILQ_INIT(&port->head);

View File

@ -77,7 +77,7 @@ struct spdk_nvmf_port {
int tag;
enum group_state state;
enum fabric_type type;
struct spdk_nvmf_rdma_transport_specific_address rdma;
union spdk_nvmf_transport_specific_address tsas;
TAILQ_HEAD(, spdk_nvmf_fabric_intf) head;
TAILQ_ENTRY(spdk_nvmf_port) tailq;
};

View File

@ -224,9 +224,7 @@ spdk_format_discovery_log(struct spdk_nvmf_discovery_log_page *disc_log, uint32_
snprintf(entry->trsvcid, 32, "%s", fabric_intf->sin_port);
snprintf(entry->traddr, 256, "%s", fabric_intf->host);
snprintf(entry->subnqn, 256, "%s", subsystem->subnqn);
entry->tsas.rdma.rdma_qptype = port->rdma.rdma_qptype;
entry->tsas.rdma.rdma_prtype = port->rdma.rdma_prtype;
entry->tsas.rdma.rdma_cms = port->rdma.rdma_cms;
entry->tsas = port->tsas;
}
numrec++;
}