nvmf/tcp: add admin queue depth check before init

max_aq_depth should be not smaller than 2 or greater
than 4096

Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: I205fbb4345cfdc41ebaf30c953da263fe9f0e9a8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14691
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
MengjinWu 2022-09-27 15:11:03 +00:00 committed by Konrad Sztyber
parent bf887576cb
commit f1bec928d1

View File

@ -32,6 +32,8 @@
#define SPDK_NVMF_TCP_MIN_IO_QUEUE_DEPTH 2
#define SPDK_NVMF_TCP_MAX_IO_QUEUE_DEPTH 65535
#define SPDK_NVMF_TCP_MIN_ADMIN_QUEUE_DEPTH 2
#define SPDK_NVMF_TCP_MAX_ADMIN_QUEUE_DEPTH 4096
#define SPDK_NVMF_TCP_DEFAULT_MAX_IO_QUEUE_DEPTH 128
#define SPDK_NVMF_TCP_DEFAULT_MAX_ADMIN_QUEUE_DEPTH 128
@ -684,6 +686,15 @@ nvmf_tcp_create(struct spdk_nvmf_transport_opts *opts)
opts->max_queue_depth = SPDK_NVMF_TCP_DEFAULT_MAX_IO_QUEUE_DEPTH;
}
/* max admin queue depth cannot be smaller than 2 or larger than 4096 */
if (opts->max_aq_depth < SPDK_NVMF_TCP_MIN_ADMIN_QUEUE_DEPTH ||
opts->max_aq_depth > SPDK_NVMF_TCP_MAX_ADMIN_QUEUE_DEPTH) {
SPDK_WARNLOG("TCP param max_aq_depth %u can't be smaller than %u or larger than %u. Using default value %u\n",
opts->max_aq_depth, SPDK_NVMF_TCP_MIN_ADMIN_QUEUE_DEPTH,
SPDK_NVMF_TCP_MAX_ADMIN_QUEUE_DEPTH, SPDK_NVMF_TCP_DEFAULT_MAX_ADMIN_QUEUE_DEPTH);
opts->max_aq_depth = SPDK_NVMF_TCP_DEFAULT_MAX_ADMIN_QUEUE_DEPTH;
}
sge_count = opts->max_io_size / opts->io_unit_size;
if (sge_count > SPDK_NVMF_MAX_SGL_ENTRIES) {
SPDK_ERRLOG("Unsupported IO Unit size specified, %d bytes\n", opts->io_unit_size);