nvme/pci: fix mapping length initialization for contig SGL request

mapping length is initialized with 0 and spdk_vtophys() returns
min(*mapping_length, cur_size) or 0. So length -= mapping_length has no
effect and req will be failed when nseg reaches NVME_MAX_SGL_DESCRIPTORS
Initialize mapping_length = request length

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477575 (master)
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>

(cherry picked from commit a092fac4a2)
Change-Id: I9082866b7f8055d99fa6930a78335b3b0fdf9b2b
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478356
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Alexey Marchuk 2019-12-11 16:19:48 +03:00 committed by Tomasz Zawadzki
parent af1784a971
commit d1fc4a28e9

View File

@ -1840,6 +1840,7 @@ nvme_pcie_qpair_build_contig_hw_sgl_request(struct spdk_nvme_qpair *qpair, struc
length = req->payload_size;
virt_addr = req->payload.contig_or_cb_arg + req->payload_offset;
mapping_length = length;
while (length > 0) {
if (nseg >= NVME_MAX_SGL_DESCRIPTORS) {