Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147081
b: refs/heads/master
c: 789a424
h: refs/heads/master
i:
  147079: 28c46cf
v: v3
  • Loading branch information
scameron@beardog.cca.cpqcorp.net authored and Jens Axboe committed Jun 9, 2009
1 parent 126caf2 commit 2f93024
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c2ab40296894d1f7ad9714550fdf9b96d4e9ee6
refs/heads/master: 789a424ad1352b335960e7c56494d0410577fa61
77 changes: 45 additions & 32 deletions trunk/drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2292,26 +2292,12 @@ static int check_target_status(ctlr_info_t *h, CommandList_struct *c)
return IO_ERROR;
}

static int sendcmd_withirq_core(ctlr_info_t *h, CommandList_struct *c)
static int process_sendcmd_error(ctlr_info_t *h, CommandList_struct *c)
{
DECLARE_COMPLETION_ONSTACK(wait);
u64bit buff_dma_handle;
unsigned long flags;
int return_status = IO_OK;

resend_cmd2:
c->waiting = &wait;
/* Put the request on the tail of the queue and send it */
spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
addQ(&h->reqQ, c);
h->Qdepth++;
start_io(h);
spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);

wait_for_completion(&wait);

if (c->err_info->CommandStatus == 0)
goto command_done;
if (c->err_info->CommandStatus == CMD_SUCCESS)
return IO_OK;

switch (c->err_info->CommandStatus) {
case CMD_TARGET_STATUS:
Expand All @@ -2322,7 +2308,7 @@ static int sendcmd_withirq_core(ctlr_info_t *h, CommandList_struct *c)
/* expected for inquiry and report lun commands */
break;
case CMD_INVALID:
printk(KERN_WARNING "cciss: Cmd 0x%02x is "
printk(KERN_WARNING "cciss: cmd 0x%02x is "
"reported invalid\n", c->Request.CDB[0]);
return_status = IO_ERROR;
break;
Expand Down Expand Up @@ -2355,26 +2341,52 @@ static int sendcmd_withirq_core(ctlr_info_t *h, CommandList_struct *c)
printk(KERN_WARNING
"cciss%d: unsolicited abort 0x%02x\n", h->ctlr,
c->Request.CDB[0]);
if (c->retry_count < MAX_CMD_RETRIES) {
printk(KERN_WARNING
"cciss%d: retrying 0x%02x\n", h->ctlr,
c->Request.CDB[0]);
c->retry_count++;
/* erase the old error information */
memset(c->err_info, 0,
sizeof(ErrorInfo_struct));
return_status = IO_OK;
INIT_COMPLETION(wait);
goto resend_cmd2;
}
return_status = IO_ERROR;
return_status = IO_NEEDS_RETRY;
break;
default:
printk(KERN_WARNING "cciss: cmd 0x%02x returned "
"unknown status %x\n", c->Request.CDB[0],
c->err_info->CommandStatus);
return_status = IO_ERROR;
}
return return_status;
}

static int sendcmd_withirq_core(ctlr_info_t *h, CommandList_struct *c,
int attempt_retry)
{
DECLARE_COMPLETION_ONSTACK(wait);
u64bit buff_dma_handle;
unsigned long flags;
int return_status = IO_OK;

resend_cmd2:
c->waiting = &wait;
/* Put the request on the tail of the queue and send it */
spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
addQ(&h->reqQ, c);
h->Qdepth++;
start_io(h);
spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);

wait_for_completion(&wait);

if (c->err_info->CommandStatus == 0 || !attempt_retry)
goto command_done;

return_status = process_sendcmd_error(h, c);

if (return_status == IO_NEEDS_RETRY &&
c->retry_count < MAX_CMD_RETRIES) {
printk(KERN_WARNING "cciss%d: retrying 0x%02x\n", h->ctlr,
c->Request.CDB[0]);
c->retry_count++;
/* erase the old error information */
memset(c->err_info, 0, sizeof(ErrorInfo_struct));
return_status = IO_OK;
INIT_COMPLETION(wait);
goto resend_cmd2;
}

command_done:
/* unlock the buffers from DMA */
Expand All @@ -2399,7 +2411,8 @@ static int sendcmd_withirq(__u8 cmd, int ctlr, void *buff, size_t size,
return_status = fill_cmd(c, cmd, ctlr, buff, size, page_code,
scsi3addr, cmd_type);
if (return_status == IO_OK)
return_status = sendcmd_withirq_core(h, c);
return_status = sendcmd_withirq_core(h, c, 1);

cmd_free(h, c, 0);
return return_status;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/block/cciss.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#define IO_OK 0
#define IO_ERROR 1
#define IO_NEEDS_RETRY 3

#define VENDOR_LEN 8
#define MODEL_LEN 16
Expand Down

0 comments on commit 2f93024

Please sign in to comment.