Commit 958d4a32 authored by Eric Moore's avatar Eric Moore Committed by James Bottomley

[SCSI] mpt fusion: cleanup eh handlers

nice cosmetic cleaning of eh thread callback funtions
Signed-off-by: default avatarEric Moore <Eric.Moore@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 4023c474
...@@ -1727,20 +1727,35 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) ...@@ -1727,20 +1727,35 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
u32 ctx2abort; u32 ctx2abort;
int scpnt_idx; int scpnt_idx;
int retval; int retval;
VirtDevice *vdev; VirtDevice *vdevice;
ulong sn = SCpnt->serial_number; ulong sn = SCpnt->serial_number;
MPT_ADAPTER *ioc;
/* If we can't locate our host adapter structure, return FAILED status. /* If we can't locate our host adapter structure, return FAILED status.
*/ */
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) { if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) {
SCpnt->result = DID_RESET << 16; SCpnt->result = DID_RESET << 16;
SCpnt->scsi_done(SCpnt); SCpnt->scsi_done(SCpnt);
dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: " dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: Can't locate "
"Can't locate host! (sc=%p)\n", "host! (sc=%p)\n", SCpnt));
SCpnt));
return FAILED; return FAILED;
} }
ioc = hd->ioc;
printk(MYIOC_s_INFO_FMT "attempting task abort! (sc=%p)\n",
ioc->name, SCpnt);
scsi_print_command(SCpnt);
vdevice = SCpnt->device->hostdata;
if (!vdevice || !vdevice->vtarget) {
dtmprintk((MYIOC_s_DEBUG_FMT "task abort: device has been "
"deleted (sc=%p)\n", ioc->name, SCpnt));
SCpnt->result = DID_NO_CONNECT << 16;
SCpnt->scsi_done(SCpnt);
retval = 0;
goto out;
}
/* Find this command /* Find this command
*/ */
if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) { if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) {
...@@ -1749,21 +1764,20 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) ...@@ -1749,21 +1764,20 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
*/ */
SCpnt->result = DID_RESET << 16; SCpnt->result = DID_RESET << 16;
dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: " dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: "
"Command not in the active list! (sc=%p)\n", "Command not in the active list! (sc=%p)\n", ioc->name,
hd->ioc->name, SCpnt)); SCpnt));
return SUCCESS; retval = 0;
goto out;
} }
if (hd->resetPending) if (hd->resetPending) {
return FAILED; retval = FAILED;
goto out;
}
if (hd->timeouts < -1) if (hd->timeouts < -1)
hd->timeouts++; hd->timeouts++;
printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n",
hd->ioc->name, SCpnt);
scsi_print_command(SCpnt);
/* Most important! Set TaskMsgContext to SCpnt's MsgContext! /* Most important! Set TaskMsgContext to SCpnt's MsgContext!
* (the IO to be ABORT'd) * (the IO to be ABORT'd)
* *
...@@ -1776,18 +1790,17 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) ...@@ -1776,18 +1790,17 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
hd->abortSCpnt = SCpnt; hd->abortSCpnt = SCpnt;
vdev = SCpnt->device->hostdata;
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
vdev->vtarget->channel, vdev->vtarget->id, vdev->lun, vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun,
ctx2abort, mptscsih_get_tm_timeout(hd->ioc)); ctx2abort, mptscsih_get_tm_timeout(ioc));
if (SCPNT_TO_LOOKUP_IDX(SCpnt) == scpnt_idx && if (SCPNT_TO_LOOKUP_IDX(SCpnt) == scpnt_idx &&
SCpnt->serial_number == sn) SCpnt->serial_number == sn)
retval = FAILED; retval = FAILED;
printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", out:
hd->ioc->name, printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n",
((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
if (retval == 0) if (retval == 0)
return SUCCESS; return SUCCESS;
...@@ -1809,32 +1822,40 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt) ...@@ -1809,32 +1822,40 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
{ {
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
int retval; int retval;
VirtDevice *vdev; VirtDevice *vdevice;
MPT_ADAPTER *ioc;
/* If we can't locate our host adapter structure, return FAILED status. /* If we can't locate our host adapter structure, return FAILED status.
*/ */
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: " dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: Can't "
"Can't locate host! (sc=%p)\n", "locate host! (sc=%p)\n", SCpnt));
SCpnt));
return FAILED; return FAILED;
} }
if (hd->resetPending) ioc = hd->ioc;
return FAILED; printk(MYIOC_s_INFO_FMT "attempting target reset! (sc=%p)\n",
ioc->name, SCpnt);
printk(KERN_WARNING MYNAM ": %s: attempting target reset! (sc=%p)\n",
hd->ioc->name, SCpnt);
scsi_print_command(SCpnt); scsi_print_command(SCpnt);
vdev = SCpnt->device->hostdata; if (hd->resetPending) {
retval = FAILED;
goto out;
}
vdevice = SCpnt->device->hostdata;
if (!vdevice || !vdevice->vtarget) {
retval = 0;
goto out;
}
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
vdev->vtarget->channel, vdev->vtarget->id, vdevice->vtarget->channel, vdevice->vtarget->id, 0, 0,
0, 0, mptscsih_get_tm_timeout(hd->ioc)); mptscsih_get_tm_timeout(ioc));
printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n", out:
hd->ioc->name, printk (MYIOC_s_INFO_FMT "target reset: %s (sc=%p)\n",
((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
if (retval == 0) if (retval == 0)
return SUCCESS; return SUCCESS;
...@@ -1858,18 +1879,19 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt) ...@@ -1858,18 +1879,19 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
int retval; int retval;
VirtDevice *vdev; VirtDevice *vdev;
MPT_ADAPTER *ioc;
/* If we can't locate our host adapter structure, return FAILED status. /* If we can't locate our host adapter structure, return FAILED status.
*/ */
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: " dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: Can't "
"Can't locate host! (sc=%p)\n", "locate host! (sc=%p)\n", SCpnt ));
SCpnt ) );
return FAILED; return FAILED;
} }
printk(KERN_WARNING MYNAM ": %s: attempting bus reset! (sc=%p)\n", ioc = hd->ioc;
hd->ioc->name, SCpnt); printk(MYIOC_s_INFO_FMT "attempting bus reset! (sc=%p)\n",
ioc->name, SCpnt);
scsi_print_command(SCpnt); scsi_print_command(SCpnt);
if (hd->timeouts < -1) if (hd->timeouts < -1)
...@@ -1877,11 +1899,10 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt) ...@@ -1877,11 +1899,10 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
vdev = SCpnt->device->hostdata; vdev = SCpnt->device->hostdata;
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
vdev->vtarget->channel, 0, 0, 0, mptscsih_get_tm_timeout(hd->ioc)); vdev->vtarget->channel, 0, 0, 0, mptscsih_get_tm_timeout(ioc));
printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n", printk(MYIOC_s_INFO_FMT "bus reset: %s (sc=%p)\n",
hd->ioc->name, ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
if (retval == 0) if (retval == 0)
return SUCCESS; return SUCCESS;
...@@ -1902,37 +1923,38 @@ int ...@@ -1902,37 +1923,38 @@ int
mptscsih_host_reset(struct scsi_cmnd *SCpnt) mptscsih_host_reset(struct scsi_cmnd *SCpnt)
{ {
MPT_SCSI_HOST * hd; MPT_SCSI_HOST * hd;
int status = SUCCESS; int retval;
MPT_ADAPTER *ioc;
/* If we can't locate the host to reset, then we failed. */ /* If we can't locate the host to reset, then we failed. */
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: " dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: Can't "
"Can't locate host! (sc=%p)\n", "locate host! (sc=%p)\n", SCpnt));
SCpnt ) );
return FAILED; return FAILED;
} }
printk(KERN_WARNING MYNAM ": %s: Attempting host reset! (sc=%p)\n", ioc = hd->ioc;
hd->ioc->name, SCpnt); printk(MYIOC_s_INFO_FMT "attempting host reset! (sc=%p)\n",
ioc->name, SCpnt);
/* If our attempts to reset the host failed, then return a failed /* If our attempts to reset the host failed, then return a failed
* status. The host will be taken off line by the SCSI mid-layer. * status. The host will be taken off line by the SCSI mid-layer.
*/ */
if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){ if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0) {
status = FAILED; retval = FAILED;
} else { } else {
/* Make sure TM pending is cleared and TM state is set to /* Make sure TM pending is cleared and TM state is set to
* NONE. * NONE.
*/ */
retval = 0;
hd->tmPending = 0; hd->tmPending = 0;
hd->tmState = TM_STATE_NONE; hd->tmState = TM_STATE_NONE;
} }
dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: " printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n",
"Status = %s\n", ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
(status == SUCCESS) ? "SUCCESS" : "FAILED" ) );
return status; return retval;
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
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