Skip to content

Commit 12b2aaa

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
nvme-rdma: fix in-casule data send for chained sgls
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: 38e1800 ("nvme-rdma: Avoid preallocating big SGL for data") Reported-by: Walker, Benjamin <[email protected]> Signed-off-by: Sagi Grimberg <[email protected]> Reviewed-by: Max Gurtovoy <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent a4b58f1 commit 12b2aaa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/nvme/host/rdma.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,16 +1320,17 @@ static int nvme_rdma_map_sg_inline(struct nvme_rdma_queue *queue,
13201320
int count)
13211321
{
13221322
struct nvme_sgl_desc *sg = &c->common.dptr.sgl;
1323-
struct scatterlist *sgl = req->data_sgl.sg_table.sgl;
13241323
struct ib_sge *sge = &req->sge[1];
1324+
struct scatterlist *sgl;
13251325
u32 len = 0;
13261326
int i;
13271327

1328-
for (i = 0; i < count; i++, sgl++, sge++) {
1328+
for_each_sg(req->data_sgl.sg_table.sgl, sgl, count, i) {
13291329
sge->addr = sg_dma_address(sgl);
13301330
sge->length = sg_dma_len(sgl);
13311331
sge->lkey = queue->device->pd->local_dma_lkey;
13321332
len += sge->length;
1333+
sge++;
13331334
}
13341335

13351336
sg->addr = cpu_to_le64(queue->ctrl->ctrl.icdoff);

0 commit comments

Comments
 (0)