nvmf: Add subsystem modes
Change-Id: I74f69eb10e4d8807a323f463775f4953fe0baee0 Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
parent
861e78bf48
commit
d439f4408a
@ -49,6 +49,13 @@
|
|||||||
|
|
||||||
# Define an NVMf Subsystem.
|
# Define an NVMf Subsystem.
|
||||||
# - NQN is required and must be unique.
|
# - NQN is required and must be unique.
|
||||||
|
# - Mode may be either "Direct" or "Virtual". Direct means that physical
|
||||||
|
# devices attached to the target will be presented to hosts as if they
|
||||||
|
# were directly attached to the host. No software emulation or command
|
||||||
|
# validation is performed. Virtual means that an NVMe controller is
|
||||||
|
# emulated in software and the namespaces it contains map to block devices
|
||||||
|
# on the target system. These block devices do not need to be NVMe devices.
|
||||||
|
# Only Direct mode is currently supported.
|
||||||
# - Between 1 and 255 Listen directives are allowed. This defines
|
# - Between 1 and 255 Listen directives are allowed. This defines
|
||||||
# the addresses on which new connections may be accepted. The format
|
# the addresses on which new connections may be accepted. The format
|
||||||
# is Listen <type> <address> where type currently can only be RDMA.
|
# is Listen <type> <address> where type currently can only be RDMA.
|
||||||
@ -58,6 +65,7 @@
|
|||||||
# - Exactly 1 Controller directive.
|
# - Exactly 1 Controller directive.
|
||||||
[Subsystem1]
|
[Subsystem1]
|
||||||
NQN nqn.2016-06.io.spdk:cnode1
|
NQN nqn.2016-06.io.spdk:cnode1
|
||||||
|
Mode Direct
|
||||||
Listen RDMA 15.15.15.2:4420
|
Listen RDMA 15.15.15.2:4420
|
||||||
Host nqn.2016-06.io.spdk:init
|
Host nqn.2016-06.io.spdk:init
|
||||||
Controller Nvme0
|
Controller Nvme0
|
||||||
@ -65,6 +73,7 @@
|
|||||||
# Multiple subsystems are allowed.
|
# Multiple subsystems are allowed.
|
||||||
[Subsystem2]
|
[Subsystem2]
|
||||||
NQN nqn.2016-06.io.spdk:cnode2
|
NQN nqn.2016-06.io.spdk:cnode2
|
||||||
|
Mode Direct
|
||||||
Listen RDMA 192.168.2.21:4420
|
Listen RDMA 192.168.2.21:4420
|
||||||
Host nqn.2016-06.io.spdk:init
|
Host nqn.2016-06.io.spdk:init
|
||||||
Controller Nvme1
|
Controller Nvme1
|
||||||
|
@ -310,7 +310,7 @@ spdk_nvmf_allocate_lcore(uint64_t mask, uint32_t lcore)
|
|||||||
static int
|
static int
|
||||||
spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
|
spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
|
||||||
{
|
{
|
||||||
const char *val, *nqn;
|
const char *val, *nqn, *mode;
|
||||||
struct spdk_nvmf_subsystem *subsystem;
|
struct spdk_nvmf_subsystem *subsystem;
|
||||||
struct spdk_nvmf_ctrlr *nvmf_ctrlr;
|
struct spdk_nvmf_ctrlr *nvmf_ctrlr;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
@ -341,6 +341,25 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode = spdk_conf_section_get_val(sp, "Mode");
|
||||||
|
if (mode == NULL) {
|
||||||
|
nvmf_delete_subsystem(subsystem);
|
||||||
|
SPDK_ERRLOG("No Mode specified for Subsystem %d\n", sp->num);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp(mode, "Direct") == 0) {
|
||||||
|
subsystem->mode = NVMF_SUBSYSTEM_MODE_DIRECT;
|
||||||
|
} else if (strcasecmp(mode, "Virtual") == 0) {
|
||||||
|
nvmf_delete_subsystem(subsystem);
|
||||||
|
SPDK_ERRLOG("Virtual Subsystems are not yet supported.\n");
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
nvmf_delete_subsystem(subsystem);
|
||||||
|
SPDK_ERRLOG("Invalid Subsystem mode: %s\n", mode);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse Listen sections */
|
/* Parse Listen sections */
|
||||||
for (i = 0; i < MAX_LISTEN_ADDRESSES; i++) {
|
for (i = 0; i < MAX_LISTEN_ADDRESSES; i++) {
|
||||||
char *transport_name, *listen_addr;
|
char *transport_name, *listen_addr;
|
||||||
|
@ -42,6 +42,11 @@ struct spdk_nvmf_conn;
|
|||||||
|
|
||||||
#define MAX_NQN_SIZE 255
|
#define MAX_NQN_SIZE 255
|
||||||
|
|
||||||
|
enum spdk_nvmf_subsystem_mode {
|
||||||
|
NVMF_SUBSYSTEM_MODE_DIRECT = 0,
|
||||||
|
NVMF_SUBSYSTEM_MODE_VIRTUAL = 1,
|
||||||
|
};
|
||||||
|
|
||||||
struct spdk_nvmf_listen_addr {
|
struct spdk_nvmf_listen_addr {
|
||||||
char *traddr;
|
char *traddr;
|
||||||
char *trsvc; /* TODO: Change to trsvcid */
|
char *trsvc; /* TODO: Change to trsvcid */
|
||||||
@ -62,6 +67,7 @@ struct spdk_nvmf_host {
|
|||||||
struct spdk_nvmf_subsystem {
|
struct spdk_nvmf_subsystem {
|
||||||
uint16_t num;
|
uint16_t num;
|
||||||
char subnqn[MAX_NQN_SIZE];
|
char subnqn[MAX_NQN_SIZE];
|
||||||
|
enum spdk_nvmf_subsystem_mode mode;
|
||||||
enum spdk_nvmf_subtype subtype;
|
enum spdk_nvmf_subtype subtype;
|
||||||
struct nvmf_session *session;
|
struct nvmf_session *session;
|
||||||
struct spdk_nvme_ctrlr *ctrlr;
|
struct spdk_nvme_ctrlr *ctrlr;
|
||||||
|
@ -11,5 +11,6 @@
|
|||||||
|
|
||||||
[Subsystem1]
|
[Subsystem1]
|
||||||
NQN "nqn.2016-06.io.spdk:cnode1"
|
NQN "nqn.2016-06.io.spdk:cnode1"
|
||||||
|
Mode Direct
|
||||||
Listen RDMA 192.168.100.8:4420
|
Listen RDMA 192.168.100.8:4420
|
||||||
Controller Nvme0
|
Controller Nvme0
|
||||||
|
Loading…
Reference in New Issue
Block a user