This Linux kernel change "scsi: mac_scsi: Increase PIO/PDMA transfer length threshold" is included in the Linux 4.9.187 release. This change is authored by Finn Thain <fthain [at] telegraphics.com.au> on Sun Jun 9 11:19:11 2019 +1000. The commit for this change in Linux stable tree is 1949bb5 (patch) which is from upstream commit 7398cee. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 7398cee.
scsi: mac_scsi: Increase PIO/PDMA transfer length threshold commit 7398cee4c3e6aea1ba07a6449e5533ecd0b92cdd upstream. Some targets introduce delays when handshaking the response to certain commands. For example, a disk may send a 96-byte response to an INQUIRY command (or a 24-byte response to a MODE SENSE command) too slowly. Apparently the first 12 or 14 bytes are handshaked okay but then the system bus error timeout is reached while transferring the next word. Since the scsi bus phase hasn't changed, the driver then sets the target borken flag to prevent further PDMA transfers. The driver also logs the warning, "switching to slow handshake". Raise the PDMA threshold to 512 bytes so that PIO transfers will be used for these commands. This default is sufficiently low that PDMA will still be used for READ and WRITE commands. The existing threshold (16 bytes) was chosen more or less at random. However, best performance requires the threshold to be as low as possible. Those systems that don't need the PIO workaround at all may benefit from mac_scsi.setup_use_pdma=1 Cc: Michael Schmitz <email@example.com> Cc: firstname.lastname@example.org # v4.14+ Fixes: 3a0f64bfa907 ("mac_scsi: Fix pseudo DMA implementation") Signed-off-by: Finn Thain <email@example.com> Tested-by: Stan Johnson <firstname.lastname@example.org> Tested-by: Michael Schmitz <email@example.com> Signed-off-by: Martin K. Petersen <firstname.lastname@example.org> Signed-off-by: Greg Kroah-Hartman <email@example.com>
There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
drivers/scsi/mac_scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c index a590089..5648d30 100644 --- a/drivers/scsi/mac_scsi.c +++ b/drivers/scsi/mac_scsi.c @@ -54,7 +54,7 @@ module_param(setup_cmd_per_lun, int, 0); static int setup_sg_tablesize = -1; module_param(setup_sg_tablesize, int, 0); -static int setup_use_pdma = -1; +static int setup_use_pdma = 512; module_param(setup_use_pdma, int, 0); static int setup_hostid = -1; module_param(setup_hostid, int, 0); @@ -325,7 +325,7 @@ static int macscsi_dma_xfer_len(struct Scsi_Host *instance, struct NCR5380_hostdata *hostdata = shost_priv(instance); if (hostdata->flags & FLAG_NO_PSEUDO_DMA || - cmd->SCp.this_residual < 16) + cmd->SCp.this_residual < setup_use_pdma) return 0; return cmd->SCp.this_residual;