diff options
author | MengjinWu <mengjin.wu@intel.com> | 2022-09-22 09:27:58 +0000 |
---|---|---|
committer | Jim Harris <james.r.harris@intel.com> | 2022-09-22 22:13:19 +0000 |
commit | 100c53718dceffb743b92932b69e042dcb902b45 (patch) | |
tree | f9b5587a017484b7fa87edce7007a8f1510ab78d | |
parent | dfc989439662457d39bac524be72e8ea1c20e817 (diff) |
nvmf/tcp: add in_capsule_data_size check before init
in_capsule_data_size should not be larger than max_io_size.
Signed-off-by: MengjinWu <mengjin.wu@intel.com>
Change-Id: I636724c888b9e5abc4cffac96bff24021e172498
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14618
Community-CI: Mellanox Build Bot
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>
-rw-r--r-- | lib/nvmf/tcp.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index 8bbb459b3..aa634a892 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -649,9 +649,18 @@ nvmf_tcp_create(struct spdk_nvmf_transport_opts *opts) /* I/O unit size cannot be larger than max I/O size */ if (opts->io_unit_size > opts->max_io_size) { + SPDK_WARNLOG("TCP param io_unit_size %u can't be larger than max_io_size %u. Using max_io_size as io_unit_size\n", + opts->io_unit_size, opts->max_io_size); opts->io_unit_size = opts->max_io_size; } + /* In capsule data size cannot be larger than max I/O size */ + if (opts->in_capsule_data_size > opts->max_io_size) { + SPDK_WARNLOG("TCP param ICD size %u can't be larger than max_io_size %u. Using max_io_size as ICD size\n", + opts->io_unit_size, opts->max_io_size); + opts->in_capsule_data_size = opts->max_io_size; + } + 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); |