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,29 +1787,26 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1791,29 +1787,26 @@ 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;
} }
if (rc == SUCCESS) {
hd->ScsiLookup[my_idx] = SCpnt; hd->ScsiLookup[my_idx] = SCpnt;
SCpnt->host_scribble = NULL; SCpnt->host_scribble = NULL;
/* SCSI specific processing */ #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
issueCmd = 1;
if (hd->is_spi) { if (hd->is_spi) {
int dvStatus = hd->ioc->spi_data.dvStatus[target]; int dvStatus = hd->ioc->spi_data.dvStatus[target];
int issueCmd = 1;
if (dvStatus || hd->ioc->spi_data.forceDv) { if (dvStatus || hd->ioc->spi_data.forceDv) {
#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
if ((dvStatus & MPT_SCSICFG_NEED_DV) || if ((dvStatus & MPT_SCSICFG_NEED_DV) ||
(hd->ioc->spi_data.forceDv & MPT_SCSICFG_NEED_DV)) { (hd->ioc->spi_data.forceDv & MPT_SCSICFG_NEED_DV)) {
unsigned long lflags; unsigned long lflags;
...@@ -1843,20 +1836,17 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1843,20 +1836,17 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
*/ */
if (dvStatus & MPT_SCSICFG_DV_NOT_DONE) if (dvStatus & MPT_SCSICFG_DV_NOT_DONE)
mptscsih_set_dvflags(hd, pScsiReq); mptscsih_set_dvflags(hd, pScsiReq);
#endif
if (!issueCmd)
goto fail;
} }
} }
#endif
if (issueCmd) {
mpt_put_msg_frame(ScsiDoneCtx, hd->ioc, mf); mpt_put_msg_frame(ScsiDoneCtx, hd->ioc, mf);
dmfprintk((MYIOC_s_INFO_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n", dmfprintk((MYIOC_s_INFO_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n",
hd->ioc->name, SCpnt, mf, my_idx)); hd->ioc->name, SCpnt, mf, my_idx));
DBG_DUMP_REQUEST_FRAME(mf) DBG_DUMP_REQUEST_FRAME(mf)
} else
goto fail;
} else
goto fail;
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