Commit cf53b069 authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[SCSI] qla2xxx: Generalize srb structure usage.

Lay groundwork for adding alternative asynchronous operations by
generalize and extending the SRB structure.  This allows for
follow-on patches to add support for:

- Asynchronous logins.
- ELS/CT passthru requests.
- Loopback requests.
- Non-blocking mailbox commands (ABTS, Task Management, etc).
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarGiridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent dc162b63
...@@ -189,6 +189,7 @@ struct req_que; ...@@ -189,6 +189,7 @@ struct req_que;
*/ */
typedef struct srb { typedef struct srb {
struct fc_port *fcport; struct fc_port *fcport;
uint32_t handle;
struct scsi_cmnd *cmd; /* Linux SCSI command pkt */ struct scsi_cmnd *cmd; /* Linux SCSI command pkt */
...@@ -196,6 +197,8 @@ typedef struct srb { ...@@ -196,6 +197,8 @@ typedef struct srb {
uint32_t request_sense_length; uint32_t request_sense_length;
uint8_t *request_sense_ptr; uint8_t *request_sense_ptr;
void *ctx;
} srb_t; } srb_t;
/* /*
......
...@@ -350,6 +350,7 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -350,6 +350,7 @@ qla2x00_start_scsi(srb_t *sp)
/* Build command packet */ /* Build command packet */
req->current_outstanding_cmd = handle; req->current_outstanding_cmd = handle;
req->outstanding_cmds[handle] = sp; req->outstanding_cmds[handle] = sp;
sp->handle = handle;
sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle;
req->cnt -= req_cnt; req->cnt -= req_cnt;
...@@ -778,6 +779,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -778,6 +779,7 @@ qla24xx_start_scsi(srb_t *sp)
/* Build command packet. */ /* Build command packet. */
req->current_outstanding_cmd = handle; req->current_outstanding_cmd = handle;
req->outstanding_cmds[handle] = sp; req->outstanding_cmds[handle] = sp;
sp->handle = handle;
sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle;
req->cnt -= req_cnt; req->cnt -= req_cnt;
......
...@@ -473,6 +473,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport, ...@@ -473,6 +473,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport,
sp->flags = 0; sp->flags = 0;
CMD_SP(cmd) = (void *)sp; CMD_SP(cmd) = (void *)sp;
cmd->scsi_done = done; cmd->scsi_done = done;
sp->ctx = NULL;
return sp; return sp;
} }
...@@ -709,6 +710,8 @@ qla2x00_abort_fcport_cmds(fc_port_t *fcport) ...@@ -709,6 +710,8 @@ qla2x00_abort_fcport_cmds(fc_port_t *fcport)
continue; continue;
if (sp->fcport != fcport) if (sp->fcport != fcport)
continue; continue;
if (sp->ctx)
continue;
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (ha->isp_ops->abort_command(sp)) { if (ha->isp_ops->abort_command(sp)) {
...@@ -794,7 +797,8 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -794,7 +797,8 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
if (sp == NULL) if (sp == NULL)
continue; continue;
if (sp->ctx)
continue;
if (sp->cmd != cmd) if (sp->cmd != cmd)
continue; continue;
...@@ -859,7 +863,8 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, ...@@ -859,7 +863,8 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t,
sp = req->outstanding_cmds[cnt]; sp = req->outstanding_cmds[cnt];
if (!sp) if (!sp)
continue; continue;
if (sp->ctx)
continue;
if (vha->vp_idx != sp->fcport->vha->vp_idx) if (vha->vp_idx != sp->fcport->vha->vp_idx)
continue; continue;
match = 0; match = 0;
...@@ -2986,6 +2991,8 @@ qla2x00_timer(scsi_qla_host_t *vha) ...@@ -2986,6 +2991,8 @@ qla2x00_timer(scsi_qla_host_t *vha)
sp = req->outstanding_cmds[index]; sp = req->outstanding_cmds[index];
if (!sp) if (!sp)
continue; continue;
if (sp->ctx)
continue;
sfcp = sp->fcport; sfcp = sp->fcport;
if (!(sfcp->flags & FCF_TAPE_PRESENT)) if (!(sfcp->flags & FCF_TAPE_PRESENT))
continue; continue;
......
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