On 6/5/2019 8:38 PM, 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.
I don't understand the concern here.
Can you give an example ?
Or, if this cannot happen we need to describe why here.
failures can always happen :)