nvmf: Set a minimum and maximum queues per session

Change-Id: I68d6fe5e3dfeb1e4709ce39654c61505189711bc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-07-18 15:19:55 -07:00 committed by Benjamin Walker
parent 944695ca21
commit 7219b20124
3 changed files with 8 additions and 13 deletions

View File

@ -60,6 +60,10 @@ struct spdk_nvmf_probe_ctx {
int function;
};
#define SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_DEFAULT 4
#define SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_MIN 2
#define SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_MAX 1024
static int
spdk_nvmf_parse_nvmf_tgt(void)
{
@ -80,9 +84,8 @@ spdk_nvmf_parse_nvmf_tgt(void)
}
max_queues_per_sess = spdk_conf_section_get_intval(sp, "MaxQueuesPerSession");
if (max_queues_per_sess < 0) {
max_queues_per_sess = SPDK_NVMF_DEFAULT_MAX_QUEUES_PER_SESSION;
}
max_queues_per_sess = nvmf_max(max_queues_per_sess, SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_MIN);
max_queues_per_sess = nvmf_min(max_queues_per_sess, SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_MAX);
rc = nvmf_tgt_init(max_queue_depth, max_queues_per_sess);
return rc;

View File

@ -130,15 +130,7 @@ nvmf_tgt_init(int max_queue_depth, int max_queues_per_sess)
return -EINVAL;
}
if (max_queues_per_sess >= 1 &&
max_queues_per_sess <= SPDK_NVMF_DEFAULT_MAX_QUEUES_PER_SESSION) {
g_nvmf_tgt.max_queues_per_session = max_queues_per_sess;
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "MaxQueuesPerSession: %d\n",
g_nvmf_tgt.max_queues_per_session);
} else {
SPDK_ERRLOG("Invalid MaxQueuesPerSession: %d\n", max_queues_per_sess);
return -EINVAL;
}
rc = pthread_mutex_init(&g_nvmf_tgt.mutex, NULL);
if (rc != 0) {

View File

@ -45,6 +45,7 @@
#include "spdk/queue.h"
#define nvmf_min(a,b) (((a)<(b))?(a):(b))
#define nvmf_max(a,b) (((a)>(b))?(a):(b))
#define DEFAULT_BB_SIZE (128 * 1024)
@ -56,7 +57,6 @@
#define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1
#define SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH 128
#define SPDK_NVMF_DEFAULT_MAX_QUEUES_PER_SESSION 4
#define SPDK_NVMF_DEFAULT_SIN_PORT ((uint16_t)4420)
#define OBJECT_NVMF_IO 0x30