rdma: make semantic changes to fill_buffers func

Changing i to iovcnt in all references to the req->iov structure will be
important when we start processing multi-sgl requests.

Change-Id: I90a9b6d872b94f846ae7d29a45dd2703eafa6175
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449201
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Seth Howell 2019-03-26 06:35:34 -07:00 committed by Jim Harris
parent e70a759489
commit 934775db43

View File

@ -1337,6 +1337,7 @@ nvmf_rdma_fill_buffers(struct spdk_nvmf_rdma_transport *rtransport,
void *buf = NULL;
uint64_t translation_len;
uint32_t remaining_length = length;
uint32_t iovcnt;
uint32_t i = 0;
@ -1353,14 +1354,16 @@ nvmf_rdma_fill_buffers(struct spdk_nvmf_rdma_transport *rtransport,
}
}
rdma_req->req.iov[i].iov_base = (void *)((uintptr_t)(buf + NVMF_DATA_BUFFER_MASK) &
~NVMF_DATA_BUFFER_MASK);
rdma_req->req.iov[i].iov_len = spdk_min(remaining_length, rtransport->transport.opts.io_unit_size);
iovcnt = rdma_req->req.iovcnt;
rdma_req->req.iov[iovcnt].iov_base = (void *)((uintptr_t)(buf + NVMF_DATA_BUFFER_MASK) &
~NVMF_DATA_BUFFER_MASK);
rdma_req->req.iov[iovcnt].iov_len = spdk_min(remaining_length,
rtransport->transport.opts.io_unit_size);
rdma_req->req.iovcnt++;
rdma_req->data.buffers[i] = buf;
wr->sg_list[i].addr = (uintptr_t)(rdma_req->req.iov[i].iov_base);
wr->sg_list[i].length = rdma_req->req.iov[i].iov_len;
translation_len = rdma_req->req.iov[i].iov_len;
rdma_req->data.buffers[iovcnt] = buf;
wr->sg_list[i].addr = (uintptr_t)(rdma_req->req.iov[iovcnt].iov_base);
wr->sg_list[i].length = rdma_req->req.iov[iovcnt].iov_len;
translation_len = rdma_req->req.iov[iovcnt].iov_len;
if (!g_nvmf_hooks.get_rkey) {
wr->sg_list[i].lkey = ((struct ibv_mr *)spdk_mem_map_translate(device->map,
@ -1370,9 +1373,9 @@ nvmf_rdma_fill_buffers(struct spdk_nvmf_rdma_transport *rtransport,
(uint64_t)buf, &translation_len);
}
remaining_length -= rdma_req->req.iov[i].iov_len;
remaining_length -= rdma_req->req.iov[iovcnt].iov_len;
if (translation_len < rdma_req->req.iov[i].iov_len) {
if (translation_len < rdma_req->req.iov[iovcnt].iov_len) {
SPDK_ERRLOG("Data buffer split over multiple RDMA Memory Regions\n");
return -EINVAL;
}