From 6134d778d46ed24bc3379a1ed2ef7bd54a230397 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Fri, 9 Nov 2018 17:02:25 +0800 Subject: [PATCH] conf: Transport should be explictly configured in conf file According to the currrent logic, it should be explictly defined in the configuration file if the NVMe-oF target is started by configuration file without using rpc calls. If no transport is defined, we do not need to parse the following subsystems but should terminate the NVMe-oF target . Change-Id: I2e2db8406a30a9bf7e54d38f8d08a8d92ef158c9 Signed-off-by: Ziye Yang Reviewed-on: https://review.gerrithub.io/432376 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Shuhei Matsumoto Reviewed-by: Seth Howell Reviewed-by: Ben Walker --- etc/spdk/nvmf.conf.in | 26 ++++++++++++++++++-------- lib/event/subsystems/nvmf/conf.c | 12 +++++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/etc/spdk/nvmf.conf.in b/etc/spdk/nvmf.conf.in index f39c3283b..811d3e48f 100644 --- a/etc/spdk/nvmf.conf.in +++ b/etc/spdk/nvmf.conf.in @@ -60,14 +60,23 @@ # Define NVMf protocol global options [Nvmf] - # Set the maximum number of submission and completion queues per session. - # Setting this to '8', for example, allows for 8 submission and 8 completion queues - # per session. - MaxQueuesPerSession 4 + # Set how often the acceptor polls for incoming connections. The acceptor is also + # responsible for polling existing connections that have gone idle. 0 means continuously + # poll. Units in microseconds. + AcceptorPollRate 10000 + +[Transport] + # Set a transport type, this is mandatory + Type RDMA # Set the maximum number of outstanding I/O per queue. #MaxQueueDepth 128 + # Set the maximum number of submission and completion queues per session. + # Setting this to '8', for example, allows for 8 submission and 8 completion queues + # per session. + #MaxQueuesPerSession 4 + # Set the maximum in-capsule data size. Must be a multiple of 16. # 0 is a valid choice. #InCapsuleDataSize 4096 @@ -75,10 +84,11 @@ # Set the maximum I/O size. Must be a multiple of 4096. #MaxIOSize 131072 - # Set how often the acceptor polls for incoming connections. The acceptor is also - # responsible for polling existing connections that have gone idle. 0 means continuously - # poll. Units in microseconds. - AcceptorPollRate 10000 + # Set the I/O unit size, and this value should not be larger than MaxIOSize + #IOUnitSize 131072 + + # Set the maximum number of IO for admin queue + #MaxAQDepth 32 [Nvme] # NVMe Device Whitelist diff --git a/lib/event/subsystems/nvmf/conf.c b/lib/event/subsystems/nvmf/conf.c index cace0bea4..402ea1ac4 100644 --- a/lib/event/subsystems/nvmf/conf.c +++ b/lib/event/subsystems/nvmf/conf.c @@ -544,6 +544,13 @@ spdk_nvmf_parse_transports(spdk_nvmf_parse_conf_done_fn cb_fn) ctx->cb_fn = cb_fn; ctx->sp = spdk_conf_first_section(NULL); + if (ctx->sp == NULL) { + free(ctx); + cb_fn(0); + + return 0; + } + while (ctx->sp != NULL) { if (spdk_conf_section_match_prefix(ctx->sp, "Transport")) { spdk_nvmf_parse_transport(ctx); @@ -554,7 +561,10 @@ spdk_nvmf_parse_transports(spdk_nvmf_parse_conf_done_fn cb_fn) /* if we get here, there are no transports defined in conf file */ free(ctx); - cb_fn(spdk_nvmf_parse_subsystems()); + SPDK_ERRLOG("\nNo valid transport is defined yet.\n" + "When using configuration file, at least one valid transport must be defined.\n" + "You can refer the [Transport] section in spdk/etc/spdk/nvmf.conf.in as an example.\n"); + cb_fn(-1); return 0; }