Skip to content

Commit b631956

Browse files
steffen-maiermartinkpetersen
authored andcommitted
scsi: zfcp: fix sysfs block queue limit output for max_segment_size
Since v2.6.35 commit 6832298 ("[SCSI] zfcp: Report scatter-gather limits to SCSI and block layer"), zfcp set dma_parms.max_segment_size == PAGE_SIZE (but without using the setter dma_set_max_seg_size()) and scsi_host_template.dma_boundary == PAGE_SIZE - 1. v5.0-rc1 commit 50c2e91 ("scsi: introduce a max_segment_size host_template parameters") introduced a new field scsi_host_template.max_segment_size. If an LLDD such as zfcp does not set it, scsi_host_alloc() uses BLK_MAX_SEGMENT_SIZE = 65536 for Scsi_Host.max_segment_size. __scsi_init_queue() announced the minimum of Scsi_Host.max_segment_size and dma_parms.max_segment_size to the block layer. For zfcp: min(65536, 4096) == 4096 which was still good. v5.0 commit a8cf59a ("scsi: communicate max segment size to the DMA mapping code") announces Scsi_Host.max_segment_size to the block layer and overwrites dma_parms.max_segment_size with Scsi_Host.max_segment_size. For zfcp dma_parms.max_segment_size == Scsi_Host.max_segment_size == 65536 which is also reflected in block queue limits. $ cd /sys/bus/ccw/drivers/zfcp $ cd 0.0.3c40/host5/rport-5:0-4/target5:0:4/5:0:4:10/block/sdi/queue $ cat max_segment_size 65536 Zfcp I/O still works because dma_boundary implicitly still keeps the effective max segment size <= PAGE_SIZE. However, dma_boundary does not seem visible to user space, but max_segment_size is visible and shows a misleading wrong value. Fix it and inherit the stable tag of a8cf59a. Devices on our bus ccw support DMA but no DMA mapping. Of multiple device types on the ccw bus, only zfcp needs dma_parms for SCSI limits. So, leave dma_parms setup in zfcp and do not move it to the bus. Signed-off-by: Steffen Maier <maier@linux.ibm.com> Fixes: 50c2e91 ("scsi: introduce a max_segment_size host_template parameters") Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d672475 commit b631956

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

drivers/s390/scsi/zfcp_aux.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
403403
goto failed;
404404

405405
/* report size limit per scatter-gather segment */
406-
adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN;
407406
adapter->ccw_device->dev.dma_parms = &adapter->dma_parms;
408407

409408
adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM;

drivers/s390/scsi/zfcp_scsi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ static struct scsi_host_template zfcp_scsi_host_template = {
428428
.max_sectors = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1)
429429
* ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2) * 8,
430430
/* GCD, adjusted later */
431+
/* report size limit per scatter-gather segment */
432+
.max_segment_size = ZFCP_QDIO_SBALE_LEN,
431433
.dma_boundary = ZFCP_QDIO_SBALE_LEN - 1,
432434
.shost_attrs = zfcp_sysfs_shost_attrs,
433435
.sdev_attrs = zfcp_sysfs_sdev_attrs,

0 commit comments

Comments
 (0)