Commit c448ecfa authored by Don Brace's avatar Don Brace Committed by Martin K. Petersen

hpsa: add timeouts for driver initiated commands

faulty drives can cause the driver to hang during a
scan operation.
Reviewed-by: default avatarScott Teel <scott.teel@microsemi.com>
Reviewed-by: default avatarKevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: default avatarDon Brace <don.brace@microsemi.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ded1be4a
...@@ -2831,7 +2831,7 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr, ...@@ -2831,7 +2831,7 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
goto out; goto out;
} }
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_FROMDEVICE, NO_TIMEOUT); PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
ei = c->err_info; ei = c->err_info;
...@@ -2857,7 +2857,7 @@ static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr, ...@@ -2857,7 +2857,7 @@ static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr,
/* fill_cmd can't fail here, no data buffer to map. */ /* fill_cmd can't fail here, no data buffer to map. */
(void) fill_cmd(c, reset_type, h, NULL, 0, 0, (void) fill_cmd(c, reset_type, h, NULL, 0, 0,
scsi3addr, TYPE_MSG); scsi3addr, TYPE_MSG);
rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
if (rc) { if (rc) {
dev_warn(&h->pdev->dev, "Failed to send reset command\n"); dev_warn(&h->pdev->dev, "Failed to send reset command\n");
goto out; goto out;
...@@ -3105,7 +3105,7 @@ static int hpsa_get_raid_map(struct ctlr_info *h, ...@@ -3105,7 +3105,7 @@ static int hpsa_get_raid_map(struct ctlr_info *h,
return -1; return -1;
} }
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_FROMDEVICE, NO_TIMEOUT); PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
ei = c->err_info; ei = c->err_info;
...@@ -3148,7 +3148,7 @@ static int hpsa_bmic_sense_subsystem_information(struct ctlr_info *h, ...@@ -3148,7 +3148,7 @@ static int hpsa_bmic_sense_subsystem_information(struct ctlr_info *h,
c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff; c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_FROMDEVICE, NO_TIMEOUT); PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
ei = c->err_info; ei = c->err_info;
...@@ -3176,7 +3176,7 @@ static int hpsa_bmic_id_controller(struct ctlr_info *h, ...@@ -3176,7 +3176,7 @@ static int hpsa_bmic_id_controller(struct ctlr_info *h,
goto out; goto out;
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_FROMDEVICE, NO_TIMEOUT); PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
ei = c->err_info; ei = c->err_info;
...@@ -3207,7 +3207,7 @@ static int hpsa_bmic_id_physical_device(struct ctlr_info *h, ...@@ -3207,7 +3207,7 @@ static int hpsa_bmic_id_physical_device(struct ctlr_info *h,
c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff; c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE, hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
NO_TIMEOUT); DEFAULT_TIMEOUT);
ei = c->err_info; ei = c->err_info;
if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) { if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
hpsa_scsi_interpret_error(h, c); hpsa_scsi_interpret_error(h, c);
...@@ -3275,7 +3275,7 @@ static void hpsa_get_enclosure_info(struct ctlr_info *h, ...@@ -3275,7 +3275,7 @@ static void hpsa_get_enclosure_info(struct ctlr_info *h,
c->Request.CDB[5] = 0; c->Request.CDB[5] = 0;
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
NO_TIMEOUT); DEFAULT_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
...@@ -3487,7 +3487,7 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical, ...@@ -3487,7 +3487,7 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
if (extended_response) if (extended_response)
c->Request.CDB[1] = extended_response; c->Request.CDB[1] = extended_response;
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_FROMDEVICE, NO_TIMEOUT); PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
ei = c->err_info; ei = c->err_info;
...@@ -3594,7 +3594,8 @@ static int hpsa_volume_offline(struct ctlr_info *h, ...@@ -3594,7 +3594,8 @@ static int hpsa_volume_offline(struct ctlr_info *h,
c = cmd_alloc(h); c = cmd_alloc(h);
(void) fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, scsi3addr, TYPE_CMD); (void) fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, scsi3addr, TYPE_CMD);
rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
DEFAULT_TIMEOUT);
if (rc) { if (rc) {
cmd_free(h, c); cmd_free(h, c);
return 0; return 0;
...@@ -3669,7 +3670,8 @@ static int hpsa_device_supports_aborts(struct ctlr_info *h, ...@@ -3669,7 +3670,8 @@ static int hpsa_device_supports_aborts(struct ctlr_info *h,
c = cmd_alloc(h); c = cmd_alloc(h);
(void) fill_cmd(c, HPSA_ABORT_MSG, h, &tag, 0, 0, scsi3addr, TYPE_MSG); (void) fill_cmd(c, HPSA_ABORT_MSG, h, &tag, 0, 0, scsi3addr, TYPE_MSG);
(void) hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); (void) hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
DEFAULT_TIMEOUT);
/* no unmap needed here because no data xfer. */ /* no unmap needed here because no data xfer. */
ei = c->err_info; ei = c->err_info;
switch (ei->CommandStatus) { switch (ei->CommandStatus) {
...@@ -5439,7 +5441,7 @@ static int hpsa_send_test_unit_ready(struct ctlr_info *h, ...@@ -5439,7 +5441,7 @@ static int hpsa_send_test_unit_ready(struct ctlr_info *h,
/* Send the Test Unit Ready, fill_cmd can't fail, no mapping */ /* Send the Test Unit Ready, fill_cmd can't fail, no mapping */
(void) fill_cmd(c, TEST_UNIT_READY, h, (void) fill_cmd(c, TEST_UNIT_READY, h,
NULL, 0, 0, lunaddr, TYPE_CMD); NULL, 0, 0, lunaddr, TYPE_CMD);
rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
if (rc) if (rc)
return rc; return rc;
/* no unmap needed here because no data xfer. */ /* no unmap needed here because no data xfer. */
...@@ -5663,7 +5665,7 @@ static int hpsa_send_abort(struct ctlr_info *h, unsigned char *scsi3addr, ...@@ -5663,7 +5665,7 @@ static int hpsa_send_abort(struct ctlr_info *h, unsigned char *scsi3addr,
0, 0, scsi3addr, TYPE_MSG); 0, 0, scsi3addr, TYPE_MSG);
if (h->needs_abort_tags_swizzled) if (h->needs_abort_tags_swizzled)
swizzle_abort_tag(&c->Request.CDB[4]); swizzle_abort_tag(&c->Request.CDB[4]);
(void) hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); (void) hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
hpsa_get_tag(h, abort, &taglower, &tagupper); hpsa_get_tag(h, abort, &taglower, &tagupper);
dev_dbg(&h->pdev->dev, "%s: Tag:0x%08x:%08x: do_simple_cmd(abort) completed.\n", dev_dbg(&h->pdev->dev, "%s: Tag:0x%08x:%08x: do_simple_cmd(abort) completed.\n",
__func__, tagupper, taglower); __func__, tagupper, taglower);
...@@ -5828,7 +5830,7 @@ static int hpsa_send_abort_ioaccel2(struct ctlr_info *h, ...@@ -5828,7 +5830,7 @@ static int hpsa_send_abort_ioaccel2(struct ctlr_info *h,
c = cmd_alloc(h); c = cmd_alloc(h);
setup_ioaccel2_abort_cmd(c, h, abort, reply_queue); setup_ioaccel2_abort_cmd(c, h, abort, reply_queue);
c2 = &h->ioaccel2_cmd_pool[c->cmdindex]; c2 = &h->ioaccel2_cmd_pool[c->cmdindex];
(void) hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); (void) hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
hpsa_get_tag(h, abort, &taglower, &tagupper); hpsa_get_tag(h, abort, &taglower, &tagupper);
dev_dbg(&h->pdev->dev, dev_dbg(&h->pdev->dev,
"%s: Tag:0x%08x:%08x: do_simple_cmd(ioaccel2 abort) completed.\n", "%s: Tag:0x%08x:%08x: do_simple_cmd(ioaccel2 abort) completed.\n",
...@@ -6373,7 +6375,8 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) ...@@ -6373,7 +6375,8 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
c->SG[0].Len = cpu_to_le32(iocommand.buf_size); c->SG[0].Len = cpu_to_le32(iocommand.buf_size);
c->SG[0].Ext = cpu_to_le32(HPSA_SG_LAST); /* not chaining */ c->SG[0].Ext = cpu_to_le32(HPSA_SG_LAST); /* not chaining */
} }
rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
DEFAULT_TIMEOUT);
if (iocommand.buf_size > 0) if (iocommand.buf_size > 0)
hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL); hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);
check_ioctl_unit_attention(h, c); check_ioctl_unit_attention(h, c);
...@@ -6505,7 +6508,8 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) ...@@ -6505,7 +6508,8 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
} }
c->SG[--i].Ext = cpu_to_le32(HPSA_SG_LAST); c->SG[--i].Ext = cpu_to_le32(HPSA_SG_LAST);
} }
status = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); status = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
DEFAULT_TIMEOUT);
if (sg_used) if (sg_used)
hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL); hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL);
check_ioctl_unit_attention(h, c); check_ioctl_unit_attention(h, c);
...@@ -8728,7 +8732,7 @@ static void hpsa_flush_cache(struct ctlr_info *h) ...@@ -8728,7 +8732,7 @@ static void hpsa_flush_cache(struct ctlr_info *h)
goto out; goto out;
} }
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_TODEVICE, NO_TIMEOUT); PCI_DMA_TODEVICE, DEFAULT_TIMEOUT);
if (rc) if (rc)
goto out; goto out;
if (c->err_info->CommandStatus != 0) if (c->err_info->CommandStatus != 0)
...@@ -8767,7 +8771,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) ...@@ -8767,7 +8771,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
goto errout; goto errout;
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_FROMDEVICE, NO_TIMEOUT); PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
if ((rc != 0) || (c->err_info->CommandStatus != 0)) if ((rc != 0) || (c->err_info->CommandStatus != 0))
goto errout; goto errout;
...@@ -8779,7 +8783,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) ...@@ -8779,7 +8783,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
goto errout; goto errout;
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_TODEVICE, NO_TIMEOUT); PCI_DMA_TODEVICE, DEFAULT_TIMEOUT);
if ((rc != 0) || (c->err_info->CommandStatus != 0)) if ((rc != 0) || (c->err_info->CommandStatus != 0))
goto errout; goto errout;
...@@ -8789,7 +8793,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) ...@@ -8789,7 +8793,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
goto errout; goto errout;
rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
PCI_DMA_FROMDEVICE, NO_TIMEOUT); PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
if ((rc != 0) || (c->err_info->CommandStatus != 0)) if ((rc != 0) || (c->err_info->CommandStatus != 0))
goto errout; goto errout;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment