On Wed, Jun 05, 2019 at 05:02:09PM -0700, Sagi Grimberg wrote:
> if the lld does not explicitly sets this, scsi takes BLK_MAX_SEGMENT_SIZE
> and sets it using dma_set_max_seg_size(). In our case, this will affect
> all the rdma device consumers.
>
> Fix it by setting shost max_segment_size according to the device
> capability.
>
> Reported-by: Jason Gunthorpe <[email protected]>
> Signed-off-by: Sagi Grimberg <[email protected]>
> ---
> This goes on top of hch patchset:
> "properly communicate queue limits to the DMA layer"
>
> Normally this should go through the rdma tree, so we can
> either get it through jens with hch patchset. Alternatively
> this is a fix that should go to rc anyways?
I don't think this make sense.
>
> drivers/infiniband/ulp/iser/iscsi_iser.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c
> b/drivers/infiniband/ulp/iser/iscsi_iser.c
> index 56848232eb81..2984a366dd7d 100644
> --- a/drivers/infiniband/ulp/iser/iscsi_iser.c
> +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
> @@ -653,6 +653,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
> SHOST_DIX_GUARD_CRC);
> }
>
> + shost->max_segment_size = ib_dma_max_seg_size(ib_dev);
> if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
> shost->virt_boundary_mask = ~MASK_4K;
We only really need this settings in the IB_DEVICE_SG_GAPS_REG case,
as the segement size is unlimited on the PRP-like scheme used by the
other MR types anyway, and set as such by the block layer. I.e.g this
should become:
if (ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG)
shost->max_segment_size = ib_dma_max_seg_size(ib_dev);
else
shost->virt_boundary_mask = ~MASK_4K;