nvme/pcie: merge physically contiguous SGEs

There's no need to split a bufffer if it's physically
contiguous. We can now merge buffers that would be
previously split by the nvme_pcie driver and also
separate SGEs provided by the user that happen to be
physically contiguous.

Change-Id: I9c9de31d52a9dc9e384806555cb94609aff0ccf3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/417061
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2018-06-27 20:56:36 +02:00 committed by Jim Harris
parent 3320c06b4c
commit 5f14637246

View File

@ -1818,6 +1818,13 @@ nvme_pcie_qpair_build_hw_sgl_request(struct spdk_nvme_qpair *qpair, struct nvme_
remaining_user_sge_len -= length; remaining_user_sge_len -= length;
virt_addr += length; virt_addr += length;
if (nseg > 0 && phys_addr ==
(*(sgl - 1)).address + (*(sgl - 1)).unkeyed.length) {
/* extend previous entry */
(*(sgl - 1)).unkeyed.length += length;
continue;
}
sgl->unkeyed.type = SPDK_NVME_SGL_TYPE_DATA_BLOCK; sgl->unkeyed.type = SPDK_NVME_SGL_TYPE_DATA_BLOCK;
sgl->unkeyed.length = length; sgl->unkeyed.length = length;
sgl->address = phys_addr; sgl->address = phys_addr;