nvme-rdma: fix in-casule data send for chained sgls
authorSagi Grimberg <sagi@grimberg.me>
Fri, 28 May 2021 01:16:38 +0000 (18:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jun 2021 11:39:16 +0000 (13:39 +0200)
commitdf7c913f90c3dcda988a254141bf01eb3bb6f123
tree91ccd1285f846cd375c79cce1833d0b1a7724760
parentb198f77a3613a066cefa91f2cd9e0766612a19ce
nvme-rdma: fix in-casule data send for chained sgls

[ Upstream commit 12b2aaadb6d5ef77434e8db21f469f46fe2d392e ]

We have only 2 inline sg entries and we allow 4 sg entries for the send
wr sge. Larger sgls entries will be chained. However when we build
in-capsule send wr sge, we iterate without taking into account that the
sgl may be chained and still fit in-capsule (which can happen if the sgl
is bigger than 2, but lower-equal to 4).

Fix in-capsule data mapping to correctly iterate chained sgls.

Fixes: 38e1800275d3 ("nvme-rdma: Avoid preallocating big SGL for data")
Reported-by: Walker, Benjamin <benjamin.walker@intel.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/rdma.c