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>
This commit is contained in:
parent
dfc9894396
commit
100c53718d
@ -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 */
|
/* I/O unit size cannot be larger than max I/O size */
|
||||||
if (opts->io_unit_size > opts->max_io_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;
|
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;
|
sge_count = opts->max_io_size / opts->io_unit_size;
|
||||||
if (sge_count > SPDK_NVMF_MAX_SGL_ENTRIES) {
|
if (sge_count > SPDK_NVMF_MAX_SGL_ENTRIES) {
|
||||||
SPDK_ERRLOG("Unsupported IO Unit size specified, %d bytes\n", opts->io_unit_size);
|
SPDK_ERRLOG("Unsupported IO Unit size specified, %d bytes\n", opts->io_unit_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user