Commit 17d98630 authored by Anirban Chakraborty's avatar Anirban Chakraborty Committed by James Bottomley

[SCSI] qla2xxx: changes in multiq code

Following changes have been made:
 1. Scan outstanding commands only in the queue where it is submitted
 2. Update queue registers directly in the fast path
 3. Queue specific BAR is remapped only for multiq capable adapters
Signed-off-by: default avatarAnirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 20c09df7
...@@ -181,11 +181,14 @@ ...@@ -181,11 +181,14 @@
#define RESPONSE_ENTRY_CNT_2100 64 /* Number of response entries.*/ #define RESPONSE_ENTRY_CNT_2100 64 /* Number of response entries.*/
#define RESPONSE_ENTRY_CNT_2300 512 /* Number of response entries.*/ #define RESPONSE_ENTRY_CNT_2300 512 /* Number of response entries.*/
struct req_que;
/* /*
* SCSI Request Block * SCSI Request Block
*/ */
typedef struct srb { typedef struct srb {
struct scsi_qla_host *vha; /* HA the SP is queued on */ struct scsi_qla_host *vha; /* HA the SP is queued on */
struct req_que *que;
struct fc_port *fcport; struct fc_port *fcport;
struct scsi_cmnd *cmd; /* Linux SCSI command pkt */ struct scsi_cmnd *cmd; /* Linux SCSI command pkt */
...@@ -2045,7 +2048,6 @@ typedef struct vport_params { ...@@ -2045,7 +2048,6 @@ typedef struct vport_params {
#define VP_RET_CODE_NOT_FOUND 6 #define VP_RET_CODE_NOT_FOUND 6
struct qla_hw_data; struct qla_hw_data;
struct req_que;
/* /*
* ISP operations * ISP operations
...@@ -2101,6 +2103,9 @@ struct isp_operations { ...@@ -2101,6 +2103,9 @@ struct isp_operations {
int (*get_flash_version) (struct scsi_qla_host *, void *); int (*get_flash_version) (struct scsi_qla_host *, void *);
int (*start_scsi) (srb_t *); int (*start_scsi) (srb_t *);
void (*wrt_req_reg) (struct qla_hw_data *, uint16_t, uint16_t);
void (*wrt_rsp_reg) (struct qla_hw_data *, uint16_t, uint16_t);
uint16_t (*rd_req_reg) (struct qla_hw_data *, uint16_t);
}; };
/* MSI-X Support *************************************************************/ /* MSI-X Support *************************************************************/
......
...@@ -391,4 +391,10 @@ extern int qla25xx_delete_req_que(struct scsi_qla_host *, struct req_que *); ...@@ -391,4 +391,10 @@ extern int qla25xx_delete_req_que(struct scsi_qla_host *, struct req_que *);
extern int qla25xx_delete_rsp_que(struct scsi_qla_host *, struct rsp_que *); extern int qla25xx_delete_rsp_que(struct scsi_qla_host *, struct rsp_que *);
extern int qla25xx_create_queues(struct scsi_qla_host *, uint8_t); extern int qla25xx_create_queues(struct scsi_qla_host *, uint8_t);
extern int qla25xx_delete_queues(struct scsi_qla_host *, uint8_t); extern int qla25xx_delete_queues(struct scsi_qla_host *, uint8_t);
extern uint16_t qla24xx_rd_req_reg(struct qla_hw_data *, uint16_t);
extern uint16_t qla25xx_rd_req_reg(struct qla_hw_data *, uint16_t);
extern void qla24xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla25xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla25xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla24xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t);
#endif /* _QLA_GBL_H */ #endif /* _QLA_GBL_H */
...@@ -796,7 +796,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) ...@@ -796,7 +796,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
if (!tc) { if (!tc) {
qla_printk(KERN_WARNING, ha, "Unable to allocate " qla_printk(KERN_WARNING, ha, "Unable to allocate "
"(%d KB) for FCE.\n", FCE_SIZE / 1024); "(%d KB) for FCE.\n", FCE_SIZE / 1024);
goto cont_alloc; goto try_eft;
} }
memset(tc, 0, FCE_SIZE); memset(tc, 0, FCE_SIZE);
...@@ -808,7 +808,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) ...@@ -808,7 +808,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc,
tc_dma); tc_dma);
ha->flags.fce_enabled = 0; ha->flags.fce_enabled = 0;
goto cont_alloc; goto try_eft;
} }
qla_printk(KERN_INFO, ha, "Allocated (%d KB) for FCE...\n", qla_printk(KERN_INFO, ha, "Allocated (%d KB) for FCE...\n",
......
...@@ -63,4 +63,4 @@ qla2x00_is_reserved_id(scsi_qla_host_t *vha, uint16_t loop_id) ...@@ -63,4 +63,4 @@ qla2x00_is_reserved_id(scsi_qla_host_t *vha, uint16_t loop_id)
return ((loop_id > ha->max_loop_id && loop_id < SNS_FIRST_LOOP_ID) || return ((loop_id > ha->max_loop_id && loop_id < SNS_FIRST_LOOP_ID) ||
loop_id == MANAGEMENT_SERVER || loop_id == BROADCAST); loop_id == MANAGEMENT_SERVER || loop_id == BROADCAST);
}; }
...@@ -160,7 +160,6 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -160,7 +160,6 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
struct scatterlist *sg; struct scatterlist *sg;
int i; int i;
struct req_que *req; struct req_que *req;
uint16_t que_id;
cmd = sp->cmd; cmd = sp->cmd;
...@@ -175,8 +174,7 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -175,8 +174,7 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
} }
vha = sp->vha; vha = sp->vha;
que_id = vha->req_ques[0]; req = sp->que;
req = vha->hw->req_q_map[que_id];
cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp)); cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp));
...@@ -223,7 +221,6 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -223,7 +221,6 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
struct scatterlist *sg; struct scatterlist *sg;
int i; int i;
struct req_que *req; struct req_que *req;
uint16_t que_id;
cmd = sp->cmd; cmd = sp->cmd;
...@@ -238,8 +235,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -238,8 +235,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
} }
vha = sp->vha; vha = sp->vha;
que_id = vha->req_ques[0]; req = sp->que;
req = vha->hw->req_q_map[que_id];
cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp)); cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp));
...@@ -358,6 +354,7 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -358,6 +354,7 @@ qla2x00_start_scsi(srb_t *sp)
req->current_outstanding_cmd = handle; req->current_outstanding_cmd = handle;
req->outstanding_cmds[handle] = sp; req->outstanding_cmds[handle] = sp;
sp->vha = vha; sp->vha = vha;
sp->que = req;
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;
...@@ -573,6 +570,7 @@ qla2x00_isp_cmd(struct scsi_qla_host *vha, struct req_que *req) ...@@ -573,6 +570,7 @@ qla2x00_isp_cmd(struct scsi_qla_host *vha, struct req_que *req)
{ {
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
device_reg_t __iomem *reg = ISP_QUE_REG(ha, req->id); device_reg_t __iomem *reg = ISP_QUE_REG(ha, req->id);
struct device_reg_2xxx __iomem *ioreg = &ha->iobase->isp;
DEBUG5(printk("%s(): IOCB data:\n", __func__)); DEBUG5(printk("%s(): IOCB data:\n", __func__));
DEBUG5(qla2x00_dump_buffer( DEBUG5(qla2x00_dump_buffer(
...@@ -587,8 +585,10 @@ qla2x00_isp_cmd(struct scsi_qla_host *vha, struct req_que *req) ...@@ -587,8 +585,10 @@ qla2x00_isp_cmd(struct scsi_qla_host *vha, struct req_que *req)
req->ring_ptr++; req->ring_ptr++;
/* Set chip new ring index. */ /* Set chip new ring index. */
if (ha->mqenable) if (ha->mqenable) {
RD_REG_DWORD(&reg->isp25mq.req_q_out); WRT_REG_DWORD(&reg->isp25mq.req_q_in, req->ring_index);
RD_REG_DWORD(&ioreg->hccr);
}
else { else {
if (IS_FWI2_CAPABLE(ha)) { if (IS_FWI2_CAPABLE(ha)) {
WRT_REG_DWORD(&reg->isp24.req_q_in, req->ring_index); WRT_REG_DWORD(&reg->isp24.req_q_in, req->ring_index);
...@@ -642,7 +642,6 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, ...@@ -642,7 +642,6 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
struct scatterlist *sg; struct scatterlist *sg;
int i; int i;
uint16_t que_id;
struct req_que *req; struct req_que *req;
cmd = sp->cmd; cmd = sp->cmd;
...@@ -658,8 +657,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, ...@@ -658,8 +657,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
} }
vha = sp->vha; vha = sp->vha;
que_id = vha->req_ques[0]; req = sp->que;
req = vha->hw->req_q_map[que_id];
/* Set transfer direction */ /* Set transfer direction */
if (cmd->sc_data_direction == DMA_TO_DEVICE) { if (cmd->sc_data_direction == DMA_TO_DEVICE) {
...@@ -727,7 +725,6 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -727,7 +725,6 @@ qla24xx_start_scsi(srb_t *sp)
struct scsi_cmnd *cmd = sp->cmd; struct scsi_cmnd *cmd = sp->cmd;
struct scsi_qla_host *vha = sp->vha; struct scsi_qla_host *vha = sp->vha;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
device_reg_t __iomem *reg;
uint16_t que_id; uint16_t que_id;
/* Setup device pointers. */ /* Setup device pointers. */
...@@ -735,7 +732,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -735,7 +732,7 @@ qla24xx_start_scsi(srb_t *sp)
que_id = vha->req_ques[0]; que_id = vha->req_ques[0];
req = ha->req_q_map[que_id]; req = ha->req_q_map[que_id];
reg = ISP_QUE_REG(ha, req->id); sp->que = req;
if (req->rsp) if (req->rsp)
rsp = req->rsp; rsp = req->rsp;
...@@ -780,12 +777,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -780,12 +777,7 @@ qla24xx_start_scsi(srb_t *sp)
req_cnt = qla24xx_calc_iocbs(tot_dsds); req_cnt = qla24xx_calc_iocbs(tot_dsds);
if (req->cnt < (req_cnt + 2)) { if (req->cnt < (req_cnt + 2)) {
if (ha->mqenable) cnt = ha->isp_ops->rd_req_reg(ha, req->id);
cnt = (uint16_t)
RD_REG_DWORD_RELAXED(&reg->isp25mq.req_q_out);
else
cnt = (uint16_t)
RD_REG_DWORD_RELAXED(&reg->isp24.req_q_out);
if (req->ring_index < cnt) if (req->ring_index < cnt)
req->cnt = cnt - req->ring_index; req->cnt = cnt - req->ring_index;
...@@ -846,12 +838,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -846,12 +838,7 @@ qla24xx_start_scsi(srb_t *sp)
sp->flags |= SRB_DMA_VALID; sp->flags |= SRB_DMA_VALID;
/* Set chip new ring index. */ /* Set chip new ring index. */
if (ha->mqenable) ha->isp_ops->wrt_req_reg(ha, req->id, req->ring_index);
WRT_REG_DWORD(&reg->isp25mq.req_q_in, req->ring_index);
else {
WRT_REG_DWORD(&reg->isp24.req_q_in, req->ring_index);
RD_REG_DWORD_RELAXED(&reg->isp24.req_q_in);
}
/* Manage unprocessed RIO/ZIO commands in response queue. */ /* Manage unprocessed RIO/ZIO commands in response queue. */
if (vha->flags.process_response_queue && if (vha->flags.process_response_queue &&
...@@ -870,3 +857,34 @@ queuing_error: ...@@ -870,3 +857,34 @@ queuing_error:
return QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
} }
uint16_t
qla24xx_rd_req_reg(struct qla_hw_data *ha, uint16_t id)
{
device_reg_t __iomem *reg = (void *) ha->iobase;
return RD_REG_DWORD_RELAXED(&reg->isp24.req_q_out);
}
uint16_t
qla25xx_rd_req_reg(struct qla_hw_data *ha, uint16_t id)
{
device_reg_t __iomem *reg = (void *) ha->mqiobase + QLA_QUE_PAGE * id;
return RD_REG_DWORD_RELAXED(&reg->isp25mq.req_q_out);
}
void
qla24xx_wrt_req_reg(struct qla_hw_data *ha, uint16_t id, uint16_t index)
{
device_reg_t __iomem *reg = (void *) ha->iobase;
WRT_REG_DWORD(&reg->isp24.req_q_in, index);
RD_REG_DWORD_RELAXED(&reg->isp24.req_q_in);
}
void
qla25xx_wrt_req_reg(struct qla_hw_data *ha, uint16_t id, uint16_t index)
{
device_reg_t __iomem *reg = (void *) ha->mqiobase + QLA_QUE_PAGE * id;
struct device_reg_2xxx __iomem *ioreg = &ha->iobase->isp;
WRT_REG_DWORD(&reg->isp25mq.req_q_in, index);
RD_REG_DWORD(&ioreg->hccr); /* PCI posting */
}
...@@ -1446,7 +1446,6 @@ void ...@@ -1446,7 +1446,6 @@ void
qla24xx_process_response_queue(struct rsp_que *rsp) qla24xx_process_response_queue(struct rsp_que *rsp)
{ {
struct qla_hw_data *ha = rsp->hw; struct qla_hw_data *ha = rsp->hw;
device_reg_t __iomem *reg = ISP_QUE_REG(ha, rsp->id);
struct sts_entry_24xx *pkt; struct sts_entry_24xx *pkt;
struct scsi_qla_host *vha; struct scsi_qla_host *vha;
...@@ -1500,10 +1499,7 @@ qla24xx_process_response_queue(struct rsp_que *rsp) ...@@ -1500,10 +1499,7 @@ qla24xx_process_response_queue(struct rsp_que *rsp)
} }
/* Adjust ring index */ /* Adjust ring index */
if (ha->mqenable) ha->isp_ops->wrt_rsp_reg(ha, rsp->id, rsp->ring_index);
WRT_REG_DWORD(&reg->isp25mq.rsp_q_out, rsp->ring_index);
else
WRT_REG_DWORD(&reg->isp24.rsp_q_out, rsp->ring_index);
} }
static void static void
...@@ -1702,7 +1698,7 @@ qla25xx_msix_rsp_q(int irq, void *dev_id) ...@@ -1702,7 +1698,7 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
if (!rsp->id) if (!rsp->id)
msix_disabled_hccr &= __constant_cpu_to_le32(BIT_22); msix_disabled_hccr &= __constant_cpu_to_le32(BIT_22);
else else
msix_disabled_hccr &= BIT_6; msix_disabled_hccr &= __constant_cpu_to_le32(BIT_6);
qla24xx_process_response_queue(rsp); qla24xx_process_response_queue(rsp);
...@@ -2077,3 +2073,17 @@ int qla25xx_request_irq(struct rsp_que *rsp) ...@@ -2077,3 +2073,17 @@ int qla25xx_request_irq(struct rsp_que *rsp)
return ret; return ret;
} }
void
qla25xx_wrt_rsp_reg(struct qla_hw_data *ha, uint16_t id, uint16_t index)
{
device_reg_t __iomem *reg = (void *) ha->mqiobase + QLA_QUE_PAGE * id;
WRT_REG_DWORD(&reg->isp25mq.rsp_q_out, index);
}
void
qla24xx_wrt_rsp_reg(struct qla_hw_data *ha, uint16_t id, uint16_t index)
{
device_reg_t __iomem *reg = (void *) ha->iobase;
WRT_REG_DWORD(&reg->isp24.rsp_q_out, index);
}
...@@ -3129,7 +3129,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req, ...@@ -3129,7 +3129,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req,
} }
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
rval = (int)qla2x00_mailbox_command(vha, mcp); rval = qla2x00_mailbox_command(vha, mcp);
if (rval != QLA_SUCCESS) if (rval != QLA_SUCCESS)
DEBUG2_3_11(printk(KERN_WARNING "%s(%ld): failed=%x mb0=%x.\n", DEBUG2_3_11(printk(KERN_WARNING "%s(%ld): failed=%x mb0=%x.\n",
__func__, vha->host_no, rval, mcp->mb[0])); __func__, vha->host_no, rval, mcp->mb[0]));
...@@ -3180,7 +3180,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp, ...@@ -3180,7 +3180,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp,
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
rval = (int)qla2x00_mailbox_command(vha, mcp); rval = qla2x00_mailbox_command(vha, mcp);
if (rval != QLA_SUCCESS) if (rval != QLA_SUCCESS)
DEBUG2_3_11(printk(KERN_WARNING "%s(%ld): failed=%x " DEBUG2_3_11(printk(KERN_WARNING "%s(%ld): failed=%x "
"mb0=%x.\n", __func__, "mb0=%x.\n", __func__,
......
...@@ -441,6 +441,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport, ...@@ -441,6 +441,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport,
sp->vha = vha; sp->vha = vha;
sp->fcport = fcport; sp->fcport = fcport;
sp->cmd = cmd; sp->cmd = cmd;
sp->que = ha->req_q_map[0];
sp->flags = 0; sp->flags = 0;
CMD_SP(cmd) = (void *)sp; CMD_SP(cmd) = (void *)sp;
cmd->scsi_done = done; cmd->scsi_done = done;
...@@ -775,13 +776,14 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -775,13 +776,14 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
{ {
scsi_qla_host_t *vha = shost_priv(cmd->device->host); scsi_qla_host_t *vha = shost_priv(cmd->device->host);
srb_t *sp; srb_t *sp;
int ret, i, que; int ret, i;
unsigned int id, lun; unsigned int id, lun;
unsigned long serial; unsigned long serial;
unsigned long flags; unsigned long flags;
int wait = 0; int wait = 0;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct req_que *req; struct req_que *req;
srb_t *spt;
qla2x00_block_error_handler(cmd); qla2x00_block_error_handler(cmd);
...@@ -793,13 +795,13 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -793,13 +795,13 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
id = cmd->device->id; id = cmd->device->id;
lun = cmd->device->lun; lun = cmd->device->lun;
serial = cmd->serial_number; serial = cmd->serial_number;
spt = (srb_t *) CMD_SP(cmd);
if (!spt)
return SUCCESS;
req = spt->que;
/* Check active list for command command. */ /* Check active list for command command. */
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
for (que = 0; que < QLA_MAX_HOST_QUES; que++) {
req = ha->req_q_map[vha->req_ques[que]];
if (!req)
continue;
for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) { for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) {
sp = req->outstanding_cmds[i]; sp = req->outstanding_cmds[i];
...@@ -824,7 +826,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -824,7 +826,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
break; break;
} }
}
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
/* Wait for the command to be returned. */ /* Wait for the command to be returned. */
...@@ -852,20 +853,19 @@ enum nexus_wait_type { ...@@ -852,20 +853,19 @@ enum nexus_wait_type {
static int static int
qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t,
unsigned int l, enum nexus_wait_type type) unsigned int l, srb_t *sp, enum nexus_wait_type type)
{ {
int cnt, match, status, que; int cnt, match, status;
srb_t *sp;
unsigned long flags; unsigned long flags;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct req_que *req; struct req_que *req;
status = QLA_SUCCESS; status = QLA_SUCCESS;
if (!sp)
return status;
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
for (que = 0; que < QLA_MAX_HOST_QUES; que++) { req = sp->que;
req = ha->req_q_map[vha->req_ques[que]];
if (!req)
continue;
for (cnt = 1; status == QLA_SUCCESS && for (cnt = 1; status == QLA_SUCCESS &&
cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
sp = req->outstanding_cmds[cnt]; sp = req->outstanding_cmds[cnt];
...@@ -894,7 +894,6 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, ...@@ -894,7 +894,6 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t,
status = qla2x00_eh_wait_on_command(sp->cmd); status = qla2x00_eh_wait_on_command(sp->cmd);
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
} }
}
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
return status; return status;
...@@ -934,7 +933,7 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, ...@@ -934,7 +933,7 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
goto eh_reset_failed; goto eh_reset_failed;
err = 3; err = 3;
if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id, if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id,
cmd->device->lun, type) != QLA_SUCCESS) cmd->device->lun, (srb_t *) CMD_SP(cmd), type) != QLA_SUCCESS)
goto eh_reset_failed; goto eh_reset_failed;
qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET SUCCEEDED.\n", qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET SUCCEEDED.\n",
...@@ -992,6 +991,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) ...@@ -992,6 +991,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
int ret = FAILED; int ret = FAILED;
unsigned int id, lun; unsigned int id, lun;
unsigned long serial; unsigned long serial;
srb_t *sp = (srb_t *) CMD_SP(cmd);
qla2x00_block_error_handler(cmd); qla2x00_block_error_handler(cmd);
...@@ -1018,7 +1018,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) ...@@ -1018,7 +1018,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
goto eh_bus_reset_done; goto eh_bus_reset_done;
/* Flush outstanding commands. */ /* Flush outstanding commands. */
if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, WAIT_HOST) != if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, sp, WAIT_HOST) !=
QLA_SUCCESS) QLA_SUCCESS)
ret = FAILED; ret = FAILED;
...@@ -1053,6 +1053,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) ...@@ -1053,6 +1053,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
int ret = FAILED; int ret = FAILED;
unsigned int id, lun; unsigned int id, lun;
unsigned long serial; unsigned long serial;
srb_t *sp = (srb_t *) CMD_SP(cmd);
scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
qla2x00_block_error_handler(cmd); qla2x00_block_error_handler(cmd);
...@@ -1096,7 +1097,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) ...@@ -1096,7 +1097,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
} }
/* Waiting for command to be returned to OS.*/ /* Waiting for command to be returned to OS.*/
if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, WAIT_HOST) == if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, sp, WAIT_HOST) ==
QLA_SUCCESS) QLA_SUCCESS)
ret = SUCCESS; ret = SUCCESS;
...@@ -1368,6 +1369,9 @@ static struct isp_operations qla2100_isp_ops = { ...@@ -1368,6 +1369,9 @@ static struct isp_operations qla2100_isp_ops = {
.write_optrom = qla2x00_write_optrom_data, .write_optrom = qla2x00_write_optrom_data,
.get_flash_version = qla2x00_get_flash_version, .get_flash_version = qla2x00_get_flash_version,
.start_scsi = qla2x00_start_scsi, .start_scsi = qla2x00_start_scsi,
.wrt_req_reg = NULL,
.wrt_rsp_reg = NULL,
.rd_req_reg = NULL,
}; };
static struct isp_operations qla2300_isp_ops = { static struct isp_operations qla2300_isp_ops = {
...@@ -1403,6 +1407,9 @@ static struct isp_operations qla2300_isp_ops = { ...@@ -1403,6 +1407,9 @@ static struct isp_operations qla2300_isp_ops = {
.write_optrom = qla2x00_write_optrom_data, .write_optrom = qla2x00_write_optrom_data,
.get_flash_version = qla2x00_get_flash_version, .get_flash_version = qla2x00_get_flash_version,
.start_scsi = qla2x00_start_scsi, .start_scsi = qla2x00_start_scsi,
.wrt_req_reg = NULL,
.wrt_rsp_reg = NULL,
.rd_req_reg = NULL,
}; };
static struct isp_operations qla24xx_isp_ops = { static struct isp_operations qla24xx_isp_ops = {
...@@ -1438,6 +1445,9 @@ static struct isp_operations qla24xx_isp_ops = { ...@@ -1438,6 +1445,9 @@ static struct isp_operations qla24xx_isp_ops = {
.write_optrom = qla24xx_write_optrom_data, .write_optrom = qla24xx_write_optrom_data,
.get_flash_version = qla24xx_get_flash_version, .get_flash_version = qla24xx_get_flash_version,
.start_scsi = qla24xx_start_scsi, .start_scsi = qla24xx_start_scsi,
.wrt_req_reg = qla24xx_wrt_req_reg,
.wrt_rsp_reg = qla24xx_wrt_rsp_reg,
.rd_req_reg = qla24xx_rd_req_reg,
}; };
static struct isp_operations qla25xx_isp_ops = { static struct isp_operations qla25xx_isp_ops = {
...@@ -1473,6 +1483,9 @@ static struct isp_operations qla25xx_isp_ops = { ...@@ -1473,6 +1483,9 @@ static struct isp_operations qla25xx_isp_ops = {
.write_optrom = qla24xx_write_optrom_data, .write_optrom = qla24xx_write_optrom_data,
.get_flash_version = qla24xx_get_flash_version, .get_flash_version = qla24xx_get_flash_version,
.start_scsi = qla24xx_start_scsi, .start_scsi = qla24xx_start_scsi,
.wrt_req_reg = qla24xx_wrt_req_reg,
.wrt_rsp_reg = qla24xx_wrt_rsp_reg,
.rd_req_reg = qla24xx_rd_req_reg,
}; };
static inline void static inline void
...@@ -1616,13 +1629,13 @@ skip_pio: ...@@ -1616,13 +1629,13 @@ skip_pio:
/* Determine queue resources */ /* Determine queue resources */
ha->max_queues = 1; ha->max_queues = 1;
if (ql2xmaxqueues > 1) { if (ql2xmaxqueues <= 1 || !IS_QLA25XX(ha))
goto mqiobase_exit;
ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3),
pci_resource_len(ha->pdev, 3)); pci_resource_len(ha->pdev, 3));
if (ha->mqiobase) { if (ha->mqiobase) {
/* Read MSIX vector size of the board */ /* Read MSIX vector size of the board */
pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix);
&msix);
ha->msix_count = msix; ha->msix_count = msix;
/* Max queues are bounded by available msix vectors */ /* Max queues are bounded by available msix vectors */
/* queue 0 uses two msix vectors */ /* queue 0 uses two msix vectors */
...@@ -1635,7 +1648,8 @@ skip_pio: ...@@ -1635,7 +1648,8 @@ skip_pio:
qla_printk(KERN_INFO, ha, qla_printk(KERN_INFO, ha,
"MSI-X vector count: %d\n", msix); "MSI-X vector count: %d\n", msix);
} }
}
mqiobase_exit:
ha->msix_count = ha->max_queues + 1; ha->msix_count = ha->max_queues + 1;
return (0); return (0);
...@@ -1852,6 +1866,12 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1852,6 +1866,12 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
ha->rsp_q_map[0] = rsp; ha->rsp_q_map[0] = rsp;
ha->req_q_map[0] = req; ha->req_q_map[0] = req;
if (ha->mqenable) {
ha->isp_ops->wrt_req_reg = qla25xx_wrt_req_reg;
ha->isp_ops->wrt_rsp_reg = qla25xx_wrt_rsp_reg;
ha->isp_ops->rd_req_reg = qla25xx_rd_req_reg;
}
if (qla2x00_initialize_adapter(base_vha)) { if (qla2x00_initialize_adapter(base_vha)) {
qla_printk(KERN_WARNING, ha, qla_printk(KERN_WARNING, ha,
"Failed to initialize adapter\n"); "Failed to initialize adapter\n");
......
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