Re: [PATCH 04/20] RDMA/core: Introduce ib_map_mr_sg_pi to map data/protection sgl's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6/6/2019 1:31 AM, Sagi Grimberg wrote:

+/**
+ * ib_map_mr_sg_pi() - Map the dma mapped SG lists for PI (protection
+ *     information) and set an appropriate memory region for registration.
+ * @mr:             memory region
+ * @data_sg:        dma mapped scatterlist for data
+ * @data_sg_nents:  number of entries in data_sg
+ * @data_sg_offset: offset in bytes into data_sg
+ * @meta_sg:        dma mapped scatterlist for metadata
+ * @meta_sg_nents:  number of entries in meta_sg
+ * @meta_sg_offset: offset in bytes into meta_sg
+ * @page_size:      page vector desired page size
+ *
+ * Constraints:
+ * - The MR must be allocated with type IB_MR_TYPE_INTEGRITY.
+ *
+ * Returns the number of sg elements that were mapped to the memory region.

Question, is it possible that all data sges were mapped but not all
meta sges? Given that there is a non-trivial accounting on the relations
between data and meta sges maybe the return value should be
success/failure?

if data_sges will be mapped but not all meta_sges then the check of return value n == data_nents + meta_nents will fail.

That check is in the ulp, the API preferably should not assume that the
ulp will do that and not try to map the remaining sges with a different
mr as it is much less trivial to do than the normal mr mapping.


That's why I suggest to return success/fail and not the number of
SG elems that were mapped.

It's not a problem doing it, but I wanted it to be similar return code and the regular data mapping function.

I guess it safer to return success/fail..


I don't understand the concern here.

Can you give an example ?

In case your max nents for data+meta is 16 but you get data_sg=15
and meta_sg=2, its not that if you map 15+1 you can trivially continue
from that point.

This can't happen since if max_nents is 16, I limit the max_data_nents to 8 and max_meta_nents to 8.


Or, if this cannot happen we need to describe why here.

failures can always happen :)

Yes, but what I was referring to is the difference between the normal
mr_map_sg and the mr_map_sg_pi. srp for example actually uses the
continuation of the number of mapped sg returned, it cannot do the
same with the pi version.

Well I guess we can still use this API in SRP and set the pointers and offsets correctly.




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux