nvmf: Set minimum and maximum on allowed queue depths

Change-Id: I72988b0691154165757201f5f5bc89d199249660
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-07-21 15:10:09 -07:00 committed by Benjamin Walker
parent 90cd7fc5a1
commit 207e6a604e
5 changed files with 17 additions and 18 deletions

View File

@ -64,6 +64,10 @@ struct spdk_nvmf_probe_ctx {
#define SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_MIN 2
#define SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_MAX 1024
#define SPDK_NVMF_CONFIG_QUEUE_DEPTH_DEFAULT 128
#define SPDK_NVMF_CONFIG_QUEUE_DEPTH_MIN 16
#define SPDK_NVMF_CONFIG_QUEUE_DEPTH_MAX 1024
static int
spdk_nvmf_parse_nvmf_tgt(void)
{
@ -80,10 +84,15 @@ spdk_nvmf_parse_nvmf_tgt(void)
max_queue_depth = spdk_conf_section_get_intval(sp, "MaxQueueDepth");
if (max_queue_depth < 0) {
max_queue_depth = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
max_queue_depth = SPDK_NVMF_CONFIG_QUEUE_DEPTH_DEFAULT;
}
max_queue_depth = nvmf_max(max_queue_depth, SPDK_NVMF_CONFIG_QUEUE_DEPTH_MIN);
max_queue_depth = nvmf_min(max_queue_depth, SPDK_NVMF_CONFIG_QUEUE_DEPTH_MAX);
max_queues_per_sess = spdk_conf_section_get_intval(sp, "MaxQueuesPerSession");
if (max_queues_per_sess < 0) {
max_queues_per_sess = SPDK_NVMF_CONFIG_QUEUES_PER_SESSION_DEFAULT;
}
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);

View File

@ -58,7 +58,7 @@ spdk_nvmf_initialize_pools(void)
{
SPDK_NOTICELOG("\n*** NVMf Pool Creation ***\n");
g_num_requests = MAX_SUBSYSTEMS * g_nvmf_tgt.max_queues_per_session * g_nvmf_tgt.MaxQueueDepth;
g_num_requests = MAX_SUBSYSTEMS * g_nvmf_tgt.max_queues_per_session * g_nvmf_tgt.max_queue_depth;
/* create NVMe backend request pool */
request_mempool = rte_mempool_create("NVMe_Pool",
@ -120,17 +120,8 @@ nvmf_tgt_init(int max_queue_depth, int max_queues_per_sess)
{
int rc;
if (max_queue_depth >= 1 &&
max_queue_depth <= SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH) {
g_nvmf_tgt.MaxQueueDepth = max_queue_depth;
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "MaxQueueDepth: %d\n",
g_nvmf_tgt.MaxQueueDepth);
} else {
SPDK_ERRLOG("Invalid MaxQueueDepth: %d\n", max_queue_depth);
return -EINVAL;
}
g_nvmf_tgt.max_queues_per_session = max_queues_per_sess;
g_nvmf_tgt.max_queue_depth = max_queue_depth;
rc = pthread_mutex_init(&g_nvmf_tgt.mutex, NULL);
if (rc != 0) {

View File

@ -56,7 +56,6 @@
#define SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE DEFAULT_BB_SIZE
#define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1
#define SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH 128
#define SPDK_NVMF_DEFAULT_SIN_PORT ((uint16_t)4420)
#define OBJECT_NVMF_IO 0x30
@ -99,7 +98,7 @@ struct __attribute__((packed)) nvme_read_cdw13 {
struct spdk_nvmf_globals {
pthread_mutex_t mutex;
int MaxQueueDepth;
int max_queue_depth;
int max_queues_per_session;
uint16_t sin_port;

View File

@ -628,8 +628,8 @@ nvmf_rdma_connect(struct rdma_cm_event *event)
if (host_event_data->private_data == NULL ||
host_event_data->private_data_len < sizeof(struct spdk_nvmf_rdma_request_private_data)) {
/* No private data, so use defaults. */
qp_depth = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
rw_depth = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
qp_depth = g_nvmf_tgt.max_queue_depth;
rw_depth = g_nvmf_tgt.max_queue_depth;
} else {
const struct spdk_nvmf_rdma_request_private_data *private_data = host_event_data->private_data;
qp_depth = nvmf_min(private_data->hrqsize, private_data->hsqsize);

View File

@ -47,7 +47,7 @@ nvmf_init_discovery_session_properties(struct nvmf_session *session)
{
struct spdk_nvmf_extended_identify_ctrlr_data *nvmfdata;
session->vcdata.maxcmd = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
session->vcdata.maxcmd = g_nvmf_tgt.max_queue_depth;
/* extended data for get log page supportted */
session->vcdata.lpa.edlp = 1;
session->vcdata.cntlid = 0; /* There is one controller per subsystem, so its id is 0 */
@ -100,7 +100,7 @@ nvmf_init_nvme_session_properties(struct nvmf_session *session)
session->vcdata.aerl = 0;
session->vcdata.cntlid = 0;
session->vcdata.kas = 10;
session->vcdata.maxcmd = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
session->vcdata.maxcmd = g_nvmf_tgt.max_queue_depth;
session->vcdata.mdts = SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE / 4096;
session->vcdata.sgls.keyed_sgl = 1;
session->vcdata.sgls.sgl_offset = 1;