Re: [PATCH 02/13] IB/core: allow passing mapping an offset into the SG in ib_map_mr_sg

Sagi Grimberg
2016-02-29T11:35:44Z

> I looked at this in a bit more detail, and I think we need both.
>
> For PAGE_SIZE or smaller SG entries you're correct, and we don't
> need the offset for dma_addr. But it doesn't harm either.

I think it can harm us.

> But for lager SG entries we need it to calculate the correct
> base address.

I'm not sure if this is true either. Can you explain why?

The Memory region mapping is described by:
1. page vector: [addr0, addr1, addr2,...]
2. iova: the first byte offset
3. length: the total byte count of the mr
4. page_size: size of each page in the page vector

This means that the HCA assumes that each address in
the page vector has the size of page_size, also the region
can start at some offset (iova - addr0), and it has some length.

So say the HCA wants to write 8k to the MR:
first page_size (4k) will be written starting from addr0, and
the next page_size (4k) will be written starting from addr1.
If you set addr0 = page_addr + offset then the HW will assume it can
access addr0 + page_size which is not what we want.

I think that the page vectors should contain page addresses and not
incorporate offsets.

Thoughts?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html