aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManoj Kumar <kumarmn@us.ibm.com>2015-10-21 16:11:10 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-10-30 03:58:09 -0400
commit471a5a60aaf13b2323d2b63d212bbdd6ce2bef28 (patch)
treea2b2778ede4b8b257f4e8665d3b84060df258c5f
parent3ebf203093b4ee07d62ef1a02dbbf7a293770388 (diff)
cxlflash: Fix read capacity timeout
The timeout value for read capacity is too small. Certain devices may take longer to respond and thus the command may prematurely timeout. Additionally the literal used for the timeout is stale. Update the timeout to 30 seconds (matches the value used in sd.c) and rework the timeout literal to a more appropriate description. Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com> Reviewed-by: Brian King <brking@linux.vnet.ibm.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r--drivers/scsi/cxlflash/superpipe.c9
-rw-r--r--drivers/scsi/cxlflash/superpipe.h2
-rw-r--r--drivers/scsi/cxlflash/vlun.c4
3 files changed, 7 insertions, 8 deletions
diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c
index 7df985d7830c..c3c229ec7d0c 100644
--- a/drivers/scsi/cxlflash/superpipe.c
+++ b/drivers/scsi/cxlflash/superpipe.c
@@ -296,7 +296,7 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli)
296 int rc = 0; 296 int rc = 0;
297 int result = 0; 297 int result = 0;
298 int retry_cnt = 0; 298 int retry_cnt = 0;
299 u32 tout = (MC_DISCOVERY_TIMEOUT * HZ); 299 u32 to = CMD_TIMEOUT * HZ;
300 300
301retry: 301retry:
302 cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL); 302 cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
@@ -315,8 +315,7 @@ retry:
315 retry_cnt ? "re" : "", scsi_cmd[0]); 315 retry_cnt ? "re" : "", scsi_cmd[0]);
316 316
317 result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf, 317 result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf,
318 CMD_BUFSIZE, sense_buf, tout, CMD_RETRIES, 318 CMD_BUFSIZE, sense_buf, to, CMD_RETRIES, 0, NULL);
319 0, NULL);
320 319
321 if (driver_byte(result) == DRIVER_SENSE) { 320 if (driver_byte(result) == DRIVER_SENSE) {
322 result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */ 321 result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */
@@ -1376,8 +1375,8 @@ out_attach:
1376 attach->block_size = gli->blk_len; 1375 attach->block_size = gli->blk_len;
1377 attach->mmio_size = sizeof(afu->afu_map->hosts[0].harea); 1376 attach->mmio_size = sizeof(afu->afu_map->hosts[0].harea);
1378 attach->last_lba = gli->max_lba; 1377 attach->last_lba = gli->max_lba;
1379 attach->max_xfer = (sdev->host->max_sectors * MAX_SECTOR_UNIT) / 1378 attach->max_xfer = sdev->host->max_sectors * MAX_SECTOR_UNIT;
1380 gli->blk_len; 1379 attach->max_xfer /= gli->blk_len;
1381 1380
1382out: 1381out:
1383 attach->adap_fd = fd; 1382 attach->adap_fd = fd;
diff --git a/drivers/scsi/cxlflash/superpipe.h b/drivers/scsi/cxlflash/superpipe.h
index 3f7856b66427..fffb179a8413 100644
--- a/drivers/scsi/cxlflash/superpipe.h
+++ b/drivers/scsi/cxlflash/superpipe.h
@@ -28,7 +28,7 @@ extern struct cxlflash_global global;
28*/ 28*/
29#define MC_CHUNK_SIZE (1 << MC_RHT_NMASK) /* in LBAs */ 29#define MC_CHUNK_SIZE (1 << MC_RHT_NMASK) /* in LBAs */
30 30
31#define MC_DISCOVERY_TIMEOUT 5 /* 5 secs */ 31#define CMD_TIMEOUT 30 /* 30 secs */
32#define CMD_RETRIES 5 /* 5 retries for scsi_execute */ 32#define CMD_RETRIES 5 /* 5 retries for scsi_execute */
33 33
34#define MAX_SECTOR_UNIT 512 /* max_sector is in 512 byte multiples */ 34#define MAX_SECTOR_UNIT 512 /* max_sector is in 512 byte multiples */
diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c
index 6d6608bb4bb0..68994c42c81f 100644
--- a/drivers/scsi/cxlflash/vlun.c
+++ b/drivers/scsi/cxlflash/vlun.c
@@ -414,7 +414,7 @@ static int write_same16(struct scsi_device *sdev,
414 int ws_limit = SISLITE_MAX_WS_BLOCKS; 414 int ws_limit = SISLITE_MAX_WS_BLOCKS;
415 u64 offset = lba; 415 u64 offset = lba;
416 int left = nblks; 416 int left = nblks;
417 u32 tout = sdev->request_queue->rq_timeout; 417 u32 to = sdev->request_queue->rq_timeout;
418 struct cxlflash_cfg *cfg = (struct cxlflash_cfg *)sdev->host->hostdata; 418 struct cxlflash_cfg *cfg = (struct cxlflash_cfg *)sdev->host->hostdata;
419 struct device *dev = &cfg->dev->dev; 419 struct device *dev = &cfg->dev->dev;
420 420
@@ -434,7 +434,7 @@ static int write_same16(struct scsi_device *sdev,
434 &scsi_cmd[10]); 434 &scsi_cmd[10]);
435 435
436 result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf, 436 result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf,
437 CMD_BUFSIZE, sense_buf, tout, CMD_RETRIES, 437 CMD_BUFSIZE, sense_buf, to, CMD_RETRIES,
438 0, NULL); 438 0, NULL);
439 if (result) { 439 if (result) {
440 dev_err_ratelimited(dev, "%s: command failed for " 440 dev_err_ratelimited(dev, "%s: command failed for "