On 7/22/2015 8:44 PM, Jason Gunthorpe wrote:
On Wed, Jul 22, 2015 at 09:50:12AM -0700, Christoph Hellwig wrote:
+/**
+ * ib_map_mr_sg() - Populates MR with a dma mapped SG list
+ * @mr: memory region
+ * @sg: dma mapped scatterlist
+ * @sg_nents: number of entries in sg
+ * @access: access permissions
I know moving the access flags here was my idea originally, but I seem
convinced by your argument that it might fit in better with the posting
helper. Or did someone else come up with a better argument that mine
for moving it here?
I was hoping we'd move the DMA flush and translate into here and make
it mandatory. Is there any reason not to do that?
The reason I didn't added it in was so the ULPs can make sure they meet
the restrictions of ib_map_mr_sg(). Allow SRP to iterate on his
SG list set partials and iSER to detect gaps (they need to dma map
for that).
+int ib_map_mr_sg(struct ib_mr *mr,
+ struct scatterlist *sg,
+ unsigned short sg_nents,
+ unsigned int access)
+{
+ int rc;
+
+ if (!mr->device->map_mr_sg)
+ return -ENOSYS;
+
+ rc = mr->device->map_mr_sg(mr, sg, sg_nents);
Do we really need a driver callout here? It seems like we should
The call out makes sense to me..
The driver will convert the scatter list directly into whatever HW
representation it needs and prepare everything for posting. Every
driver has a different HW format, so it must be a callout.
Also it seems like this returns 0/-error. How do callers like SRP
see that it only did a partial mapping and it needs another MR?
I would think it is an error to pass in more sg_nents than the MR was
created with, so SRP should never get a partial mapping as it should
never ask for more than max_entries.
(? Sagi, did I get the intent of this right?)
Error is returned when:
- sg_nents > max_entries
- sg has gaps
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html