Commit 73e0dcff authored by James Bottomley's avatar James Bottomley

mptfusion: streamline queuecommand

From: 	Moore, Eric Dean <Eric.Moore@lsil.com>

This cleans up mptscsih_qcmd function.
This patch previously submitted by hch@.
Signed-off-by: default avatarEric Moore <Eric.Moore@lsil.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent bc95de84
...@@ -1688,11 +1688,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1688,11 +1688,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
u32 cmd_len; u32 cmd_len;
int my_idx; int my_idx;
int ii; int ii;
int rc;
int did_errcode;
int issueCmd;
did_errcode = 0;
hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
target = SCpnt->device->id; target = SCpnt->device->id;
lun = SCpnt->device->lun; lun = SCpnt->device->lun;
...@@ -1791,72 +1787,66 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1791,72 +1787,66 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
/* Now add the SG list /* Now add the SG list
* Always have a SGE even if null length. * Always have a SGE even if null length.
*/ */
rc = SUCCESS;
if (datalen == 0) { if (datalen == 0) {
/* Add a NULL SGE */ /* Add a NULL SGE */
mptscsih_add_sge((char *)&pScsiReq->SGL, MPT_SGE_FLAGS_SSIMPLE_READ | 0, mptscsih_add_sge((char *)&pScsiReq->SGL, MPT_SGE_FLAGS_SSIMPLE_READ | 0,
(dma_addr_t) -1); (dma_addr_t) -1);
} else { } else {
/* Add a 32 or 64 bit SGE */ /* Add a 32 or 64 bit SGE */
rc = mptscsih_AddSGE(hd->ioc, SCpnt, pScsiReq, my_idx); if (mptscsih_AddSGE(hd->ioc, SCpnt, pScsiReq, my_idx) != SUCCESS)
goto fail;
} }
hd->ScsiLookup[my_idx] = SCpnt;
if (rc == SUCCESS) { SCpnt->host_scribble = NULL;
hd->ScsiLookup[my_idx] = SCpnt;
SCpnt->host_scribble = NULL;
/* SCSI specific processing */
issueCmd = 1;
if (hd->is_spi) {
int dvStatus = hd->ioc->spi_data.dvStatus[target];
if (dvStatus || hd->ioc->spi_data.forceDv) {
#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
if ((dvStatus & MPT_SCSICFG_NEED_DV) || if (hd->is_spi) {
(hd->ioc->spi_data.forceDv & MPT_SCSICFG_NEED_DV)) { int dvStatus = hd->ioc->spi_data.dvStatus[target];
unsigned long lflags; int issueCmd = 1;
/* Schedule DV if necessary */
spin_lock_irqsave(&dvtaskQ_lock, lflags); if (dvStatus || hd->ioc->spi_data.forceDv) {
if (!dvtaskQ_active) {
dvtaskQ_active = 1; if ((dvStatus & MPT_SCSICFG_NEED_DV) ||
spin_unlock_irqrestore(&dvtaskQ_lock, lflags); (hd->ioc->spi_data.forceDv & MPT_SCSICFG_NEED_DV)) {
INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd); unsigned long lflags;
/* Schedule DV if necessary */
schedule_work(&mptscsih_dvTask); spin_lock_irqsave(&dvtaskQ_lock, lflags);
} else { if (!dvtaskQ_active) {
spin_unlock_irqrestore(&dvtaskQ_lock, lflags); dvtaskQ_active = 1;
} spin_unlock_irqrestore(&dvtaskQ_lock, lflags);
hd->ioc->spi_data.forceDv &= ~MPT_SCSICFG_NEED_DV; INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd);
}
schedule_work(&mptscsih_dvTask);
/* Trying to do DV to this target, extend timeout. } else {
* Wait to issue until flag is clear spin_unlock_irqrestore(&dvtaskQ_lock, lflags);
*/
if (dvStatus & MPT_SCSICFG_DV_PENDING) {
mod_timer(&SCpnt->eh_timeout, jiffies + 40 * HZ);
issueCmd = 0;
} }
hd->ioc->spi_data.forceDv &= ~MPT_SCSICFG_NEED_DV;
}
/* Set the DV flags. /* Trying to do DV to this target, extend timeout.
*/ * Wait to issue until flag is clear
if (dvStatus & MPT_SCSICFG_DV_NOT_DONE) */
mptscsih_set_dvflags(hd, pScsiReq); if (dvStatus & MPT_SCSICFG_DV_PENDING) {
#endif mod_timer(&SCpnt->eh_timeout, jiffies + 40 * HZ);
issueCmd = 0;
} }
}
if (issueCmd) { /* Set the DV flags.
mpt_put_msg_frame(ScsiDoneCtx, hd->ioc, mf); */
dmfprintk((MYIOC_s_INFO_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n", if (dvStatus & MPT_SCSICFG_DV_NOT_DONE)
hd->ioc->name, SCpnt, mf, my_idx)); mptscsih_set_dvflags(hd, pScsiReq);
DBG_DUMP_REQUEST_FRAME(mf)
} else if (!issueCmd)
goto fail; goto fail;
} else }
goto fail; }
#endif
mpt_put_msg_frame(ScsiDoneCtx, hd->ioc, mf);
dmfprintk((MYIOC_s_INFO_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n",
hd->ioc->name, SCpnt, mf, my_idx));
DBG_DUMP_REQUEST_FRAME(mf)
return 0; return 0;
fail: fail:
......
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