From: Bart Van Assche <bvanassche@acm.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leonro@mellanox.com>,
Doug Ledford <dledford@redhat.com>,
linux-rdma@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
"Michael J . Ruhl" <michael.j.ruhl@intel.com>,
Ira Weiny <ira.weiny@intel.com>, Adit Ranadive <aditr@vmware.com>,
Shiraz Saleem <shiraz.saleem@intel.com>,
Gal Pressman <galpress@amazon.com>,
Selvin Xavier <selvin.xavier@broadcom.com>
Subject: [PATCH v2 4/4] RDMA/core: Set DMA parameters correctly
Date: Fri, 25 Oct 2019 15:58:30 -0700 [thread overview]
Message-ID: <20191025225830.257535-5-bvanassche@acm.org> (raw)
In-Reply-To: <20191025225830.257535-1-bvanassche@acm.org>
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.
Cc: Michael J. Ruhl <michael.j.ruhl@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Adit Ranadive <aditr@vmware.com>
Cc: Shiraz Saleem <shiraz.saleem@intel.com>
Cc: Gal Pressman <galpress@amazon.com>
Cc: Selvin Xavier <selvin.xavier@broadcom.com>
Fixes: d10bcf947a3e ("RDMA/umem: Combine contiguous PAGE_SIZE regions in SGEs")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/infiniband/core/device.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index eb35b663a742..a93c23867fb5 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -1196,9 +1196,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 2 GB.
+ */
+ device->dev.dma_parms = parent->dma_parms;
+ dma_set_max_seg_size(device->dma_device, SZ_2G);
+ } else {
+ WARN_ON_ONCE(true);
+ }
+ }
}
/*
--
2.24.0.rc0.303.g954a862665-goog
next prev parent reply other threads:[~2019-10-25 22:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 22:58 [PATCH v2 0/4] Fixes related to the DMA max_segment_size parameter Bart Van Assche
2019-10-25 22:58 ` [PATCH v2 1/4] RDMA/core: Fix ib_dma_max_seg_size() Bart Van Assche
2019-10-25 22:58 ` [PATCH v2 2/4] rdma_rxe: Increase DMA max_segment_size parameter Bart Van Assche
2019-10-25 22:58 ` [PATCH v2 3/4] siw: " Bart Van Assche
2019-10-25 22:58 ` Bart Van Assche [this message]
2019-10-28 17:58 ` [PATCH v2 0/4] Fixes related to the " Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191025225830.257535-5-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=aditr@vmware.com \
--cc=dledford@redhat.com \
--cc=galpress@amazon.com \
--cc=ira.weiny@intel.com \
--cc=jgg@ziepe.ca \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=michael.j.ruhl@intel.com \
--cc=selvin.xavier@broadcom.com \
--cc=shiraz.saleem@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).