nvme: add a new custom transport SPDK_NVME_TRANSPORT_VFIOUSER

The new custom transport can enable NVMe driver running with
NVMe over vfio-user target.

Change-Id: I5f90e8516eaca08fc3eab658b29b760a03326ff7
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5996
Community-CI: Broadcom CI
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:
Changpeng Liu 2021-01-20 17:26:25 +08:00 committed by Jim Harris
parent b30d57cdad
commit 6308a24f56
3 changed files with 23 additions and 5 deletions

View File

@ -47,8 +47,13 @@ are added for Directive Send and Directive Receive command, respectively.
Added a new function `spdk_nvme_ctrlr_reset_subsystem` to perform a NVMe Added a new function `spdk_nvme_ctrlr_reset_subsystem` to perform a NVMe
subsystem reset. Note: The NVMf target does not support the subsystem reset yet. subsystem reset. Note: The NVMf target does not support the subsystem reset yet.
Add a new function 'spdk_nvme_bytes_to_numd' to transfer bytes to number of Add a new function 'spdk_nvme_bytes_to_numd' to transfer bytes to number of
dwords. dwords.
Added a new custom transport `SPDK_NVME_TRANSPORT_VFIOUSER` to enable NVMe
driver running with NVMe over vfio-user target.
### event ### event
The pci_whitelist and pci_blacklist members of struct spdk_app_opts have been The pci_whitelist and pci_blacklist members of struct spdk_app_opts have been

View File

@ -48,11 +48,12 @@ extern "C" {
#include "spdk/nvme_spec.h" #include "spdk/nvme_spec.h"
#include "spdk/nvmf_spec.h" #include "spdk/nvmf_spec.h"
#define SPDK_NVME_TRANSPORT_NAME_FC "FC" #define SPDK_NVME_TRANSPORT_NAME_FC "FC"
#define SPDK_NVME_TRANSPORT_NAME_PCIE "PCIE" #define SPDK_NVME_TRANSPORT_NAME_PCIE "PCIE"
#define SPDK_NVME_TRANSPORT_NAME_RDMA "RDMA" #define SPDK_NVME_TRANSPORT_NAME_RDMA "RDMA"
#define SPDK_NVME_TRANSPORT_NAME_TCP "TCP" #define SPDK_NVME_TRANSPORT_NAME_TCP "TCP"
#define SPDK_NVME_TRANSPORT_NAME_CUSTOM "CUSTOM" #define SPDK_NVME_TRANSPORT_NAME_VFIOUSER "VFIOUSER"
#define SPDK_NVME_TRANSPORT_NAME_CUSTOM "CUSTOM"
#define SPDK_NVMF_PRIORITY_MAX_LEN 4 #define SPDK_NVMF_PRIORITY_MAX_LEN 4
@ -320,6 +321,11 @@ enum spdk_nvme_transport_type {
*/ */
SPDK_NVME_TRANSPORT_TCP = SPDK_NVMF_TRTYPE_TCP, SPDK_NVME_TRANSPORT_TCP = SPDK_NVMF_TRTYPE_TCP,
/**
* Custom VFIO User Transport (Not spec defined)
*/
SPDK_NVME_TRANSPORT_VFIOUSER = 1024,
/** /**
* Custom Transport (Not spec defined) * Custom Transport (Not spec defined)
*/ */

View File

@ -1030,6 +1030,9 @@ spdk_nvme_trid_populate_transport(struct spdk_nvme_transport_id *trid,
case SPDK_NVME_TRANSPORT_TCP: case SPDK_NVME_TRANSPORT_TCP:
trstring = SPDK_NVME_TRANSPORT_NAME_TCP; trstring = SPDK_NVME_TRANSPORT_NAME_TCP;
break; break;
case SPDK_NVME_TRANSPORT_VFIOUSER:
trstring = SPDK_NVME_TRANSPORT_NAME_VFIOUSER;
break;
case SPDK_NVME_TRANSPORT_CUSTOM: case SPDK_NVME_TRANSPORT_CUSTOM:
trstring = SPDK_NVME_TRANSPORT_NAME_CUSTOM; trstring = SPDK_NVME_TRANSPORT_NAME_CUSTOM;
break; break;
@ -1082,6 +1085,8 @@ spdk_nvme_transport_id_parse_trtype(enum spdk_nvme_transport_type *trtype, const
*trtype = SPDK_NVME_TRANSPORT_FC; *trtype = SPDK_NVME_TRANSPORT_FC;
} else if (strcasecmp(str, "TCP") == 0) { } else if (strcasecmp(str, "TCP") == 0) {
*trtype = SPDK_NVME_TRANSPORT_TCP; *trtype = SPDK_NVME_TRANSPORT_TCP;
} else if (strcasecmp(str, "VFIOUSER") == 0) {
*trtype = SPDK_NVME_TRANSPORT_VFIOUSER;
} else { } else {
*trtype = SPDK_NVME_TRANSPORT_CUSTOM; *trtype = SPDK_NVME_TRANSPORT_CUSTOM;
} }
@ -1100,6 +1105,8 @@ spdk_nvme_transport_id_trtype_str(enum spdk_nvme_transport_type trtype)
return "FC"; return "FC";
case SPDK_NVME_TRANSPORT_TCP: case SPDK_NVME_TRANSPORT_TCP:
return "TCP"; return "TCP";
case SPDK_NVME_TRANSPORT_VFIOUSER:
return "VFIOUSER";
case SPDK_NVME_TRANSPORT_CUSTOM: case SPDK_NVME_TRANSPORT_CUSTOM:
return "CUSTOM"; return "CUSTOM";
default: default: