hpsa: factor out hpsa_ioaccel_submit function
clean up command submission Reviewed-by: Scott Teel <scott.teel@pmcs.com> Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Reviewed-by: Hannes Reinecke <hare@Suse.de> Signed-off-by: Webb Scales <webbnh@hp.com> Signed-off-by: Don Brace <don.brace@pmcs.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
This commit is contained in:
parent
4a8da22b32
commit
592a0ad5ae
|
@ -4375,6 +4375,33 @@ static inline void hpsa_cmd_partial_init(struct ctlr_info *h, int index,
|
||||||
c->busaddr = (u32) cmd_dma_handle;
|
c->busaddr = (u32) cmd_dma_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int hpsa_ioaccel_submit(struct ctlr_info *h,
|
||||||
|
struct CommandList *c, struct scsi_cmnd *cmd,
|
||||||
|
unsigned char *scsi3addr)
|
||||||
|
{
|
||||||
|
struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
|
||||||
|
int rc = IO_ACCEL_INELIGIBLE;
|
||||||
|
|
||||||
|
cmd->host_scribble = (unsigned char *) c;
|
||||||
|
|
||||||
|
if (dev->offload_enabled) {
|
||||||
|
hpsa_cmd_init(h, c->cmdindex, c);
|
||||||
|
c->cmd_type = CMD_SCSI;
|
||||||
|
c->scsi_cmd = cmd;
|
||||||
|
rc = hpsa_scsi_ioaccel_raid_map(h, c);
|
||||||
|
if (rc < 0) /* scsi_dma_map failed. */
|
||||||
|
rc = SCSI_MLQUEUE_HOST_BUSY;
|
||||||
|
} else if (dev->ioaccel_handle) {
|
||||||
|
hpsa_cmd_init(h, c->cmdindex, c);
|
||||||
|
c->cmd_type = CMD_SCSI;
|
||||||
|
c->scsi_cmd = cmd;
|
||||||
|
rc = hpsa_scsi_ioaccel_direct_map(h, c);
|
||||||
|
if (rc < 0) /* scsi_dma_map failed. */
|
||||||
|
rc = SCSI_MLQUEUE_HOST_BUSY;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
static void hpsa_command_resubmit_worker(struct work_struct *work)
|
static void hpsa_command_resubmit_worker(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct scsi_cmnd *cmd;
|
struct scsi_cmnd *cmd;
|
||||||
|
@ -4386,15 +4413,46 @@ static void hpsa_command_resubmit_worker(struct work_struct *work)
|
||||||
dev = cmd->device->hostdata;
|
dev = cmd->device->hostdata;
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
cmd->result = DID_NO_CONNECT << 16;
|
cmd->result = DID_NO_CONNECT << 16;
|
||||||
|
cmd_free(c->h, c);
|
||||||
cmd->scsi_done(cmd);
|
cmd->scsi_done(cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (c->cmd_type == CMD_IOACCEL2) {
|
||||||
|
struct ctlr_info *h = c->h;
|
||||||
|
struct io_accel2_cmd *c2 = &h->ioaccel2_cmd_pool[c->cmdindex];
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (c2->error_data.serv_response ==
|
||||||
|
IOACCEL2_STATUS_SR_TASK_COMP_SET_FULL) {
|
||||||
|
rc = hpsa_ioaccel_submit(h, c, cmd, dev->scsi3addr);
|
||||||
|
if (rc == 0)
|
||||||
|
return;
|
||||||
|
if (rc == SCSI_MLQUEUE_HOST_BUSY) {
|
||||||
|
/*
|
||||||
|
* If we get here, it means dma mapping failed.
|
||||||
|
* Try again via scsi mid layer, which will
|
||||||
|
* then get SCSI_MLQUEUE_HOST_BUSY.
|
||||||
|
*/
|
||||||
|
cmd->result = DID_IMM_RETRY << 16;
|
||||||
|
cmd->scsi_done(cmd);
|
||||||
|
cmd_free(h, c); /* FIX-ME: on merge, change
|
||||||
|
* to cmd_tagged_free() and
|
||||||
|
* ultimately to
|
||||||
|
* hpsa_cmd_free_and_done(). */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* else, fall thru and resubmit down CISS path */
|
||||||
|
}
|
||||||
|
}
|
||||||
hpsa_cmd_partial_init(c->h, c->cmdindex, c);
|
hpsa_cmd_partial_init(c->h, c->cmdindex, c);
|
||||||
if (hpsa_ciss_submit(c->h, c, cmd, dev->scsi3addr)) {
|
if (hpsa_ciss_submit(c->h, c, cmd, dev->scsi3addr)) {
|
||||||
/*
|
/*
|
||||||
* If we get here, it means dma mapping failed. Try
|
* If we get here, it means dma mapping failed. Try
|
||||||
* again via scsi mid layer, which will then get
|
* again via scsi mid layer, which will then get
|
||||||
* SCSI_MLQUEUE_HOST_BUSY.
|
* SCSI_MLQUEUE_HOST_BUSY.
|
||||||
|
*
|
||||||
|
* hpsa_ciss_submit will have already freed c
|
||||||
|
* if it encountered a dma mapping failure.
|
||||||
*/
|
*/
|
||||||
cmd->result = DID_IMM_RETRY << 16;
|
cmd->result = DID_IMM_RETRY << 16;
|
||||||
cmd->scsi_done(cmd);
|
cmd->scsi_done(cmd);
|
||||||
|
@ -4444,31 +4502,14 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
|
||||||
if (likely(cmd->retries == 0 &&
|
if (likely(cmd->retries == 0 &&
|
||||||
cmd->request->cmd_type == REQ_TYPE_FS &&
|
cmd->request->cmd_type == REQ_TYPE_FS &&
|
||||||
h->acciopath_status)) {
|
h->acciopath_status)) {
|
||||||
|
rc = hpsa_ioaccel_submit(h, c, cmd, scsi3addr);
|
||||||
cmd->host_scribble = (unsigned char *) c;
|
if (rc == 0)
|
||||||
|
return 0;
|
||||||
if (dev->offload_enabled) {
|
if (rc == SCSI_MLQUEUE_HOST_BUSY) {
|
||||||
hpsa_cmd_init(h, c->cmdindex, c);
|
cmd_free(h, c); /* FIX-ME: on merge, change to
|
||||||
c->cmd_type = CMD_SCSI;
|
* cmd_tagged_free(), and ultimately
|
||||||
c->scsi_cmd = cmd;
|
* to hpsa_cmd_resolve_and_free(). */
|
||||||
rc = hpsa_scsi_ioaccel_raid_map(h, c);
|
return SCSI_MLQUEUE_HOST_BUSY;
|
||||||
if (rc == 0)
|
|
||||||
return 0; /* Sent on ioaccel path */
|
|
||||||
if (rc < 0) { /* scsi_dma_map failed. */
|
|
||||||
cmd_free(h, c);
|
|
||||||
return SCSI_MLQUEUE_HOST_BUSY;
|
|
||||||
}
|
|
||||||
} else if (dev->ioaccel_handle) {
|
|
||||||
hpsa_cmd_init(h, c->cmdindex, c);
|
|
||||||
c->cmd_type = CMD_SCSI;
|
|
||||||
c->scsi_cmd = cmd;
|
|
||||||
rc = hpsa_scsi_ioaccel_direct_map(h, c);
|
|
||||||
if (rc == 0)
|
|
||||||
return 0; /* Sent on direct map path */
|
|
||||||
if (rc < 0) { /* scsi_dma_map failed. */
|
|
||||||
cmd_free(h, c);
|
|
||||||
return SCSI_MLQUEUE_HOST_BUSY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hpsa_ciss_submit(h, c, cmd, scsi3addr);
|
return hpsa_ciss_submit(h, c, cmd, scsi3addr);
|
||||||
|
|
Loading…
Reference in a new issue