scsi: communicate max segment size to the DMA mapping code

When a host driver sets a maximum segment size we should not only propagate
that setting to the block layer, which can merge segments, but also to the
DMA mapping layer which can merge segments as well.

Fixes: 50c2e9107f ("scsi: introduce a max_segment_size host_template parameters")
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
This commit is contained in:
Christoph Hellwig 2019-01-16 17:12:15 +01:00 • committed by Martin K. Petersen
commit a8cf59a669
5 changed files with 20 additions and 29 deletions

View file

@ -1747,11 +1747,10 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
shost->max_sectors = (shost->sg_tablesize * 8) + 112;
}
error = dma_set_max_seg_size(&pdev->dev,
(aac->adapter_info.options & AAC_OPT_NEW_COMM) ?
(shost->max_sectors << 9) : 65536);
if (error)
goto out_deinit;
if (aac->adapter_info.options & AAC_OPT_NEW_COMM)
shost->max_segment_size = shost->max_sectors << 9;
else
shost->max_segment_size = 65536;
/*
* Firmware printf works only with older firmware.

View file

@ -1842,8 +1842,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
blk_queue_segment_boundary(q, shost->dma_boundary);
dma_set_seg_boundary(dev, shost->dma_boundary);
blk_queue_max_segment_size(q,
min(shost->max_segment_size, dma_get_max_seg_size(dev)));
blk_queue_max_segment_size(q, shost->max_segment_size);
dma_set_max_seg_size(dev, shost->max_segment_size);
/*
* Set a reasonable default alignment: The larger of 32-byte (dword),