nvmf: Add Fibre Channel defs and usage to nvme lib

Add FC definitions to nvme header and library functions.

Change-Id: I8980f55d834c1e1d4f415756cb7a46a3ff1c7db3
Signed-off-by: John Barnard <john.barnard@broadcom.com>
Reviewed-on: https://review.gerrithub.io/416434
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
John Barnard 2018-06-19 15:33:52 -07:00 committed by Jim Harris
parent b7322649db
commit 79cffd37ca
3 changed files with 19 additions and 3 deletions

View File

@ -183,6 +183,11 @@ enum spdk_nvme_transport_type {
* RDMA Transport (RoCE, iWARP, etc.)
*/
SPDK_NVME_TRANSPORT_RDMA = SPDK_NVMF_TRTYPE_RDMA,
/**
* Fibre Channel (FC) Transport
*/
SPDK_NVME_TRANSPORT_FC = SPDK_NVMF_TRTYPE_FC,
};
/**
@ -210,14 +215,16 @@ struct spdk_nvme_transport_id {
* Transport address of the NVMe-oF endpoint. For transports which use IP
* addressing (e.g. RDMA), this should be an IP address. For PCIe, this
* can either be a zero length string (the whole bus) or a PCI address
* in the format DDDD:BB:DD.FF or DDDD.BB.DD.FF
* in the format DDDD:BB:DD.FF or DDDD.BB.DD.FF. For FC the string is
* formatted as: nn-0xWWNN:pn-0xWWPN where a)WWN isthe Node_Name of the
* target NVMe_Port and b)WWPN is the N_Port_Name of the target NVMe_Port.
*/
char traddr[SPDK_NVMF_TRADDR_MAX_LEN + 1];
/**
* Transport service id of the NVMe-oF endpoint. For transports which use
* IP addressing (e.g. RDMA), this field shoud be the port number. For PCIe,
* this is always a zero length string.
* and FC this is always a zero length string.
*/
char trsvcid[SPDK_NVMF_TRSVCID_MAX_LEN + 1];
@ -241,7 +248,7 @@ struct spdk_nvme_transport_id {
* ------------ | -----
* trtype | Transport type (e.g. PCIe, RDMA)
* adrfam | Address family (e.g. IPv4, IPv6)
* traddr | Transport address (e.g. 0000:04:00.0 for PCIe or 192.168.100.8 for RDMA)
* traddr | Transport address (e.g. 0000:04:00.0 for PCIe, 192.168.100.8 for RDMA, or WWN for FC)
* trsvcid | Transport service identifier (e.g. 4420)
* subnqn | Subsystem NQN
*

View File

@ -645,6 +645,8 @@ spdk_nvme_transport_id_parse_trtype(enum spdk_nvme_transport_type *trtype, const
*trtype = SPDK_NVME_TRANSPORT_PCIE;
} else if (strcasecmp(str, "RDMA") == 0) {
*trtype = SPDK_NVME_TRANSPORT_RDMA;
} else if (strcasecmp(str, "FC") == 0) {
*trtype = SPDK_NVME_TRANSPORT_FC;
} else {
return -ENOENT;
}
@ -659,6 +661,8 @@ spdk_nvme_transport_id_trtype_str(enum spdk_nvme_transport_type trtype)
return "PCIe";
case SPDK_NVME_TRANSPORT_RDMA:
return "RDMA";
case SPDK_NVME_TRANSPORT_FC:
return "FC";
default:
return NULL;
}

View File

@ -57,11 +57,13 @@ nvme_transport_unknown(enum spdk_nvme_transport_type trtype)
#define TRANSPORT_FABRICS_RDMA(func_name, args) case SPDK_NVME_TRANSPORT_RDMA: SPDK_UNREACHABLE();
#define TRANSPORT_RDMA_AVAILABLE false
#endif
#define TRANSPORT_FABRICS_FC(func_name, args) case SPDK_NVME_TRANSPORT_FC: SPDK_UNREACHABLE();
#define NVME_TRANSPORT_CALL(trtype, func_name, args) \
do { \
switch (trtype) { \
TRANSPORT_PCIE(func_name, args) \
TRANSPORT_FABRICS_RDMA(func_name, args) \
TRANSPORT_FABRICS_FC(func_name, args) \
TRANSPORT_DEFAULT(trtype) \
} \
SPDK_UNREACHABLE(); \
@ -76,6 +78,9 @@ spdk_nvme_transport_available(enum spdk_nvme_transport_type trtype)
case SPDK_NVME_TRANSPORT_RDMA:
return TRANSPORT_RDMA_AVAILABLE;
case SPDK_NVME_TRANSPORT_FC:
return false;
}
return false;