Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666694
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/4] g_NCR5380: Fix PDMA transfer size |
| Date | 2017-06-15 14:30 +0200 |
| Message-ID | <tSC4p-2pM-11@gated-at.bofh.it> (permalink) |
| References | <tSC4p-2pM-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Ondrej Zary <linux@rainbow-software.org>
generic_NCR5380_dma_xfer_len() incorrectly uses cmd->transfersize
which causes rescan-scsi-bus and CD-ROM access to hang the system.
Use cmd->SCp.this_residual instead, like other NCR5380 drivers.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
drivers/scsi/g_NCR5380.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 67c8dac321ad..14ef4e8c4713 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -76,6 +76,7 @@
#define IRQ_AUTO 254
#define MAX_CARDS 8
+#define DMA_MAX_SIZE 32768
/* old-style parameters for compatibility */
static int ncr_irq = -1;
@@ -629,23 +630,16 @@ static inline int generic_NCR5380_pwrite(struct NCR5380_hostdata *hostdata,
static int generic_NCR5380_dma_xfer_len(struct NCR5380_hostdata *hostdata,
struct scsi_cmnd *cmd)
{
- int transfersize = cmd->transfersize;
+ int transfersize = cmd->SCp.this_residual;
if (hostdata->flags & FLAG_NO_PSEUDO_DMA)
return 0;
- /* Limit transfers to 32K, for xx400 & xx406
- * pseudoDMA that transfers in 128 bytes blocks.
- */
- if (transfersize > 32 * 1024 && cmd->SCp.this_residual &&
- !(cmd->SCp.this_residual % transfersize))
- transfersize = 32 * 1024;
-
/* 53C400 datasheet: non-modulo-128-byte transfers should use PIO */
if (transfersize % 128)
transfersize = 0;
- return transfersize;
+ return min(transfersize, DMA_MAX_SIZE);
}
/*
--
2.13.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] g_NCR5380: PDMA fixes and cleanup Finn Thain <fthain@telegraphics.com.au> - 2017-06-15 14:30 +0200 [PATCH 2/4] g_NCR5380: End PDMA transfer correctly on target disconnection Finn Thain <fthain@telegraphics.com.au> - 2017-06-15 14:30 +0200 [PATCH 1/4] g_NCR5380: Fix PDMA transfer size Finn Thain <fthain@telegraphics.com.au> - 2017-06-15 14:30 +0200 [PATCH 3/4] g_NCR5380: Limit sg_tablesize to avoid PDMA read overruns on DTC436 Finn Thain <fthain@telegraphics.com.au> - 2017-06-15 14:30 +0200 [PATCH 4/4] g_NCR5380: Cleanup comments and whitespace Finn Thain <fthain@telegraphics.com.au> - 2017-06-15 14:30 +0200
csiph-web