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:
parent
944695ca21
commit
7219b20124
@ -60,6 +60,10 @@ struct spdk_nvmf_probe_ctx {
|
|||||||
int function;
|
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
|
static int
|
||||||
spdk_nvmf_parse_nvmf_tgt(void)
|
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");
|
max_queues_per_sess = spdk_conf_section_get_intval(sp, "MaxQueuesPerSession");
|
||||||
if (max_queues_per_sess < 0) {
|
max_queues_per_sess = nvmf_max(max_queues_per_sess, SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_MIN);
|
||||||
max_queues_per_sess = SPDK_NVMF_DEFAULT_MAX_QUEUES_PER_SESSION;
|
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);
|
rc = nvmf_tgt_init(max_queue_depth, max_queues_per_sess);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -130,15 +130,7 @@ nvmf_tgt_init(int max_queue_depth, int max_queues_per_sess)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_queues_per_sess >= 1 &&
|
g_nvmf_tgt.max_queues_per_session = max_queues_per_sess;
|
||||||
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);
|
rc = pthread_mutex_init(&g_nvmf_tgt.mutex, NULL);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "spdk/queue.h"
|
#include "spdk/queue.h"
|
||||||
|
|
||||||
#define nvmf_min(a,b) (((a)<(b))?(a):(b))
|
#define nvmf_min(a,b) (((a)<(b))?(a):(b))
|
||||||
|
#define nvmf_max(a,b) (((a)>(b))?(a):(b))
|
||||||
|
|
||||||
#define DEFAULT_BB_SIZE (128 * 1024)
|
#define DEFAULT_BB_SIZE (128 * 1024)
|
||||||
|
|
||||||
@ -56,7 +57,6 @@
|
|||||||
|
|
||||||
#define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1
|
#define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1
|
||||||
#define SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH 128
|
#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 SPDK_NVMF_DEFAULT_SIN_PORT ((uint16_t)4420)
|
||||||
|
|
||||||
#define OBJECT_NVMF_IO 0x30
|
#define OBJECT_NVMF_IO 0x30
|
||||||
|
Loading…
Reference in New Issue
Block a user