> Subject: Re: [PATCH 2/4] RDMA/core: Set DMA parameters correctly > > On 10/21/19 10:44 AM, Saleem, Shiraz wrote: > >> diff --git a/drivers/infiniband/core/device.c > >> b/drivers/infiniband/core/device.c > >> index a667636f74bf..a523d844ad9d 100644 > >> --- a/drivers/infiniband/core/device.c > >> +++ b/drivers/infiniband/core/device.c > >> @@ -1199,9 +1199,21 @@ static void setup_dma_device(struct ib_device > *device) > >> WARN_ON_ONCE(!parent); > >> device->dma_device = parent; > >> } > >> - /* Setup default max segment size for all IB devices */ > >> - dma_set_max_seg_size(device->dma_device, SZ_2G); > >> > >> + if (!device->dev.dma_parms) { > >> + if (parent) { > >> + /* > >> + * The caller did not provide DMA parameters, so > >> + * 'parent' probably represents a PCI device. The PCI > >> + * core sets the maximum segment size to 64 > >> + * KB. Increase this parameter to 2G. > >> + */ > >> + device->dev.dma_parms = parent->dma_parms; > >> + dma_set_max_seg_size(device->dma_device, SZ_2G); > > > > Did you mean dma_set_max_seg_size(&device->dev, SZ_2G)? > > Have you realized that that call has the same effect as what I proposed since both > devices share the dma_parms parameter? > I hadn’t. This makes more sense now.