Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156307
b: refs/heads/master
c: 94bced3
h: refs/heads/master
i:
  156305: 9efa503
  156303: ce0111c
v: v3
  • Loading branch information
Karen Higgins authored and James Bottomley committed Jul 30, 2009
1 parent d633bc7 commit af13598
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 55 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: 6187c242089d334102be76427a5a020240e6c19a
refs/heads/master: 94bced3c1b371014cbd187f2df5539b13a0e3b90
15 changes: 7 additions & 8 deletions trunk/drivers/scsi/qla4xxx/ql4_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ void qla4xxx_dump_buffer(void *b, uint32_t size)
uint32_t cnt;
uint8_t *c = b;

printk(" 0 1 2 3 4 5 6 7 8 9 Ah Bh Ch Dh Eh "
printk(" 0 1 2 3 4 5 6 7 8 9 Ah Bh Ch Dh Eh "
"Fh\n");
printk("------------------------------------------------------------"
"--\n");
for (cnt = 0; cnt < size; cnt++, c++) {
printk(KERN_DEBUG "%02x", *c);
if (!(cnt % 16))
printk(KERN_DEBUG "\n");
for (cnt = 0; cnt < size; c++) {
printk(KERN_INFO "%02x", *c);
if (!(++cnt % 16))
printk(KERN_INFO "\n");

else
printk(KERN_DEBUG " ");
printk(KERN_INFO " ");
}
if (cnt % 16)
printk(KERN_DEBUG "\n");
printk(KERN_INFO "\n");
}

7 changes: 7 additions & 0 deletions trunk/drivers/scsi/qla4xxx/ql4_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ struct srb {
uint16_t cc_stat;
u_long r_start; /* Time we recieve a cmd from OS */
u_long u_start; /* Time when we handed the cmd to F/W */

/* Used for extended sense / status continuation */
uint8_t *req_sense_ptr;
uint16_t req_sense_len;
uint16_t reserved2;
};

/*
Expand Down Expand Up @@ -436,6 +441,8 @@ struct scsi_qla_host {
/* Map ddb_list entry by FW ddb index */
struct ddb_entry *fw_ddb_index_map[MAX_DDB_ENTRIES];

/* Saved srb for status continuation entry processing */
struct srb *status_srb;
};

static inline int is_qla4010(struct scsi_qla_host *ha)
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/scsi/qla4xxx/ql4_fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ struct conn_event_log_entry {
*************************************************************************/
#define IOCB_MAX_CDB_LEN 16 /* Bytes in a CBD */
#define IOCB_MAX_SENSEDATA_LEN 32 /* Bytes of sense data */
#define IOCB_MAX_EXT_SENSEDATA_LEN 60 /* Bytes of extended sense data */

/* IOCB header structure */
struct qla4_header {
Expand Down Expand Up @@ -733,6 +734,12 @@ struct status_entry {

};

/* Status Continuation entry */
struct status_cont_entry {
struct qla4_header hdr; /* 00-03 */
uint8_t ext_sense_data[IOCB_MAX_EXT_SENSEDATA_LEN]; /* 04-63 */
};

struct passthru0 {
struct qla4_header hdr; /* 00-03 */
uint32_t handle; /* 04-07 */
Expand Down
145 changes: 100 additions & 45 deletions trunk/drivers/scsi/qla4xxx/ql4_isr.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,98 @@
#include "ql4_dbg.h"
#include "ql4_inline.h"

/**
* qla4xxx_copy_sense - copy sense data into cmd sense buffer
* @ha: Pointer to host adapter structure.
* @sts_entry: Pointer to status entry structure.
* @srb: Pointer to srb structure.
**/
static void qla4xxx_copy_sense(struct scsi_qla_host *ha,
struct status_entry *sts_entry,
struct srb *srb)
{
struct scsi_cmnd *cmd = srb->cmd;
uint16_t sense_len;

memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
sense_len = le16_to_cpu(sts_entry->senseDataByteCnt);
if (sense_len == 0)
return;

/* Save total available sense length,
* not to exceed cmd's sense buffer size */
sense_len = min_t(uint16_t, sense_len, SCSI_SENSE_BUFFERSIZE);
srb->req_sense_ptr = cmd->sense_buffer;
srb->req_sense_len = sense_len;

/* Copy sense from sts_entry pkt */
sense_len = min_t(uint16_t, sense_len, IOCB_MAX_SENSEDATA_LEN);
memcpy(cmd->sense_buffer, sts_entry->senseData, sense_len);

DEBUG2(printk(KERN_INFO "scsi%ld:%d:%d:%d: %s: sense key = %x, "
"ASL= %02x, ASC/ASCQ = %02x/%02x\n", ha->host_no,
cmd->device->channel, cmd->device->id,
cmd->device->lun, __func__,
sts_entry->senseData[2] & 0x0f,
sts_entry->senseData[7],
sts_entry->senseData[12],
sts_entry->senseData[13]));

DEBUG5(qla4xxx_dump_buffer(cmd->sense_buffer, sense_len));
srb->flags |= SRB_GOT_SENSE;

/* Update srb, in case a sts_cont pkt follows */
srb->req_sense_ptr += sense_len;
srb->req_sense_len -= sense_len;
if (srb->req_sense_len != 0)
ha->status_srb = srb;
else
ha->status_srb = NULL;
}

/**
* qla4xxx_status_cont_entry - Process a Status Continuations entry.
* @ha: SCSI driver HA context
* @sts_cont: Entry pointer
*
* Extended sense data.
*/
static void
qla4xxx_status_cont_entry(struct scsi_qla_host *ha,
struct status_cont_entry *sts_cont)
{
struct srb *srb = ha->status_srb;
struct scsi_cmnd *cmd;
uint8_t sense_len;

if (srb == NULL)
return;

cmd = srb->cmd;
if (cmd == NULL) {
DEBUG2(printk(KERN_INFO "scsi%ld: %s: Cmd already returned "
"back to OS srb=%p srb->state:%d\n", ha->host_no,
__func__, srb, srb->state));
ha->status_srb = NULL;
return;
}

/* Copy sense data. */
sense_len = min_t(uint16_t, srb->req_sense_len,
IOCB_MAX_EXT_SENSEDATA_LEN);
memcpy(srb->req_sense_ptr, sts_cont->ext_sense_data, sense_len);
DEBUG5(qla4xxx_dump_buffer(srb->req_sense_ptr, sense_len));

srb->req_sense_ptr += sense_len;
srb->req_sense_len -= sense_len;

/* Place command on done queue. */
if (srb->req_sense_len == 0) {
qla4xxx_srb_compl(ha, srb);
ha->status_srb = NULL;
}
}

/**
* qla4xxx_status_entry - processes status IOCBs
* @ha: Pointer to host adapter structure.
Expand All @@ -23,7 +115,6 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
struct srb *srb;
struct ddb_entry *ddb_entry;
uint32_t residual;
uint16_t sensebytecnt;

srb = qla4xxx_del_from_active_array(ha, le32_to_cpu(sts_entry->handle));
if (!srb) {
Expand Down Expand Up @@ -92,24 +183,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
break;

/* Copy Sense Data into sense buffer. */
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);

sensebytecnt = le16_to_cpu(sts_entry->senseDataByteCnt);
if (sensebytecnt == 0)
break;

memcpy(cmd->sense_buffer, sts_entry->senseData,
min_t(uint16_t, sensebytecnt, SCSI_SENSE_BUFFERSIZE));

DEBUG2(printk("scsi%ld:%d:%d:%d: %s: sense key = %x, "
"ASC/ASCQ = %02x/%02x\n", ha->host_no,
cmd->device->channel, cmd->device->id,
cmd->device->lun, __func__,
sts_entry->senseData[2] & 0x0f,
sts_entry->senseData[12],
sts_entry->senseData[13]));

srb->flags |= SRB_GOT_SENSE;
qla4xxx_copy_sense(ha, sts_entry, srb);
break;

case SCS_INCOMPLETE:
Expand Down Expand Up @@ -176,23 +250,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
break;

/* Copy Sense Data into sense buffer. */
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);

sensebytecnt =
le16_to_cpu(sts_entry->senseDataByteCnt);
if (sensebytecnt == 0)
break;

memcpy(cmd->sense_buffer, sts_entry->senseData,
min_t(uint16_t, sensebytecnt, SCSI_SENSE_BUFFERSIZE));

DEBUG2(printk("scsi%ld:%d:%d:%d: %s: sense key = %x, "
"ASC/ASCQ = %02x/%02x\n", ha->host_no,
cmd->device->channel, cmd->device->id,
cmd->device->lun, __func__,
sts_entry->senseData[2] & 0x0f,
sts_entry->senseData[12],
sts_entry->senseData[13]));
qla4xxx_copy_sense(ha, sts_entry, srb);
} else {
/*
* If RISC reports underrun and target does not
Expand Down Expand Up @@ -268,9 +326,10 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,

status_entry_exit:

/* complete the request */
/* complete the request, if not waiting for status_continuation pkt */
srb->cc_stat = sts_entry->completionStatus;
qla4xxx_srb_compl(ha, srb);
if (ha->status_srb == NULL)
qla4xxx_srb_compl(ha, srb);
}

/**
Expand Down Expand Up @@ -305,20 +364,16 @@ static void qla4xxx_process_response_queue(struct scsi_qla_host * ha)
/* process entry */
switch (sts_entry->hdr.entryType) {
case ET_STATUS:
/*
* Common status - Single completion posted in single
* IOSB.
*/
/* Common status */
qla4xxx_status_entry(ha, sts_entry);
break;

case ET_PASSTHRU_STATUS:
break;

case ET_STATUS_CONTINUATION:
/* Just throw away the status continuation entries */
DEBUG2(printk("scsi%ld: %s: Status Continuation entry "
"- ignoring\n", ha->host_no, __func__));
qla4xxx_status_cont_entry(ha,
(struct status_cont_entry *) sts_entry);
break;

case ET_COMMAND:
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/qla4xxx/ql4_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
* See LICENSE.qla4xxx for copyright and licensing details.
*/

#define QLA4XXX_DRIVER_VERSION "5.01.00-k8"
#define QLA4XXX_DRIVER_VERSION "5.01.00-k9"

0 comments on commit af13598

Please sign in to comment.