From: Finn Thain <fthain@telegraphics.com.au>
To: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Ondrej Zary <linux@rainbow-software.org>
Cc: <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Michael Schmitz <schmitzmic@gmail.com>
Subject: [PATCH v5 4/6] g_NCR5380: Limit PDMA send to 512 B to avoid data corruption on DTC3181E
Date: Thu, 29 Jun 2017 01:24:18 -0400 (EDT) [thread overview]
Message-ID: <67f209cf84a47d4d4a3719eee9cd565fef5664a0.1498713600.git.fthain@telegraphics.com.au> (raw)
In-Reply-To: <cover.1498713600.git.fthain@telegraphics.com.au>
From: Ondrej Zary <linux@rainbow-software.org>
The corruption is always the same: one byte missing at the beginning of
a 128 B block. It happens only with slow Quantum LPS 240 drive, not with
faster IBM DORS-32160. It's not clear what causes this. Documentation
for the DTC436 chip has not been made available. Hence this workaround.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
drivers/scsi/g_NCR5380.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index dedaed2d16e4..5fd227bb1830 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -45,7 +45,8 @@
int c400_blk_cnt; \
int c400_host_buf; \
int io_width; \
- int pdma_residual
+ int pdma_residual; \
+ int board
#define NCR5380_dma_xfer_len generic_NCR5380_dma_xfer_len
#define NCR5380_dma_recv_setup generic_NCR5380_pread
@@ -316,6 +317,7 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
}
hostdata = shost_priv(instance);
+ hostdata->board = board;
hostdata->io = iomem;
hostdata->region_size = region_size;
@@ -644,7 +646,12 @@ static int generic_NCR5380_dma_xfer_len(struct NCR5380_hostdata *hostdata,
/* 53C400 datasheet: non-modulo-128-byte transfers should use PIO */
if (transfersize % 128)
- transfersize = 0;
+ return 0;
+
+ /* Limit PDMA send to 512 B to avoid random corruption on DTC3181E */
+ if (hostdata->board == BOARD_DTC3181E &&
+ cmd->sc_data_direction == DMA_TO_DEVICE)
+ transfersize = min(cmd->SCp.this_residual, 512);
return min(transfersize, DMA_MAX_SIZE);
}
--
2.13.0
next prev parent reply other threads:[~2017-06-29 5:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 5:24 [PATCH v5 0/6] g_NCR5380: PDMA fixes and cleanup Finn Thain
2017-06-29 5:24 ` [PATCH v5 1/6] g_NCR5380: Fix PDMA transfer size Finn Thain
2017-06-29 5:24 ` [PATCH v5 2/6] g_NCR5380: End PDMA transfer correctly on target disconnection Finn Thain
2017-06-29 5:24 ` Finn Thain [this message]
2017-06-29 5:24 ` [PATCH v5 5/6] g_NCR5380: Re-work PDMA loops Finn Thain
2017-06-29 5:24 ` [PATCH v5 3/6] g_NCR5380: Cleanup comments and whitespace Finn Thain
2017-06-29 5:24 ` [PATCH v5 6/6] g_NCR5380: Use unambiguous terminology for PDMA send and receive Finn Thain
2017-06-29 18:06 ` [PATCH v5 0/6] g_NCR5380: PDMA fixes and cleanup Ondrej Zary
2017-06-30 7:12 ` Finn Thain
2017-06-30 18:07 ` Ondrej Zary
2017-07-01 2:40 ` Finn Thain
2017-06-29 18:30 ` Ondrej Zary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67f209cf84a47d4d4a3719eee9cd565fef5664a0.1498713600.git.fthain@telegraphics.com.au \
--to=fthain@telegraphics.com.au \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@rainbow-software.org \
--cc=martin.petersen@oracle.com \
--cc=schmitzmic@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®