Skip to content

Commit c912126

Browse files
bvanasschejgunthorpe
authored andcommitted
RDMA/core: Set DMA parameters correctly
The dma_set_max_seg_size() call in setup_dma_device() does not have any effect since device->dev.dma_parms is NULL. Fix this by initializing device->dev.dma_parms first. Link: https://lore.kernel.org/r/[email protected] Fixes: d10bcf9 ("RDMA/umem: Combine contiguous PAGE_SIZE regions in SGEs") Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent a401fb8 commit c912126

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/infiniband/core/device.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,9 +1196,21 @@ static void setup_dma_device(struct ib_device *device)
11961196
WARN_ON_ONCE(!parent);
11971197
device->dma_device = parent;
11981198
}
1199-
/* Setup default max segment size for all IB devices */
1200-
dma_set_max_seg_size(device->dma_device, SZ_2G);
12011199

1200+
if (!device->dev.dma_parms) {
1201+
if (parent) {
1202+
/*
1203+
* The caller did not provide DMA parameters, so
1204+
* 'parent' probably represents a PCI device. The PCI
1205+
* core sets the maximum segment size to 64
1206+
* KB. Increase this parameter to 2 GB.
1207+
*/
1208+
device->dev.dma_parms = parent->dma_parms;
1209+
dma_set_max_seg_size(device->dma_device, SZ_2G);
1210+
} else {
1211+
WARN_ON_ONCE(true);
1212+
}
1213+
}
12021214
}
12031215

12041216
/*

0 commit comments

Comments
 (0)