Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] qla2xxx: Fix ISP restart bug in multiq code

After restarting ISP the additional queues are not being setup correctly. The
following patch fixes the issue.
Please apply.

Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

authored by

Anirban Chakraborty and committed by
James Bottomley
29bdccbe ccbf04f2

+42 -28
+38 -24
drivers/scsi/qla2xxx/qla_init.c
··· 1258 1258 { 1259 1259 int rval; 1260 1260 unsigned long flags = 0; 1261 - int cnt; 1261 + int cnt, que; 1262 1262 struct qla_hw_data *ha = vha->hw; 1263 - struct req_que *req = ha->req_q_map[0]; 1264 - struct rsp_que *rsp = ha->rsp_q_map[0]; 1263 + struct req_que *req; 1264 + struct rsp_que *rsp; 1265 + struct scsi_qla_host *vp; 1265 1266 struct mid_init_cb_24xx *mid_init_cb = 1266 1267 (struct mid_init_cb_24xx *) ha->init_cb; 1267 1268 1268 1269 spin_lock_irqsave(&ha->hardware_lock, flags); 1269 1270 1270 1271 /* Clear outstanding commands array. */ 1271 - for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) 1272 - req->outstanding_cmds[cnt] = NULL; 1272 + for (que = 0; que < ha->max_queues; que++) { 1273 + req = ha->req_q_map[que]; 1274 + if (!req) 1275 + continue; 1276 + for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) 1277 + req->outstanding_cmds[cnt] = NULL; 1273 1278 1274 - req->current_outstanding_cmd = 0; 1279 + req->current_outstanding_cmd = 0; 1280 + 1281 + /* Initialize firmware. */ 1282 + req->ring_ptr = req->ring; 1283 + req->ring_index = 0; 1284 + req->cnt = req->length; 1285 + } 1286 + 1287 + for (que = 0; que < ha->max_queues; que++) { 1288 + rsp = ha->rsp_q_map[que]; 1289 + if (!rsp) 1290 + continue; 1291 + rsp->ring_ptr = rsp->ring; 1292 + rsp->ring_index = 0; 1293 + 1294 + /* Initialize response queue entries */ 1295 + qla2x00_init_response_q_entries(rsp); 1296 + } 1275 1297 1276 1298 /* Clear RSCN queue. */ 1277 - vha->rscn_in_ptr = 0; 1278 - vha->rscn_out_ptr = 0; 1279 - 1280 - /* Initialize firmware. */ 1281 - req->ring_ptr = req->ring; 1282 - req->ring_index = 0; 1283 - req->cnt = req->length; 1284 - rsp->ring_ptr = rsp->ring; 1285 - rsp->ring_index = 0; 1286 - 1287 - /* Initialize response queue entries */ 1288 - qla2x00_init_response_q_entries(rsp); 1289 - 1299 + list_for_each_entry(vp, &ha->vp_list, list) { 1300 + vp->rscn_in_ptr = 0; 1301 + vp->rscn_out_ptr = 0; 1302 + } 1290 1303 ha->isp_ops->config_rings(vha); 1291 1304 1292 1305 spin_unlock_irqrestore(&ha->hardware_lock, flags); ··· 3225 3212 int rval = QLA_SUCCESS; 3226 3213 uint32_t wait_time; 3227 3214 struct qla_hw_data *ha = vha->hw; 3228 - struct req_que *req = ha->req_q_map[0]; 3229 - struct rsp_que *rsp = ha->rsp_q_map[0]; 3215 + struct req_que *req = ha->req_q_map[vha->req_ques[0]]; 3216 + struct rsp_que *rsp = req->rsp; 3230 3217 3231 3218 atomic_set(&vha->loop_state, LOOP_UPDATE); 3232 3219 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); ··· 3505 3492 } 3506 3493 req = ha->req_q_map[i]; 3507 3494 if (req) { 3495 + /* Clear outstanding commands array. */ 3508 3496 req->options &= ~BIT_0; 3509 3497 ret = qla25xx_init_req_que(base_vha, req, req->options); 3510 3498 if (ret != QLA_SUCCESS) ··· 3514 3500 req->id)); 3515 3501 else 3516 3502 DEBUG2_17(printk(KERN_WARNING 3517 - "%s Rsp que:%d inited\n", __func__, 3503 + "%s Req que:%d inited\n", __func__, 3518 3504 req->id)); 3519 3505 } 3520 3506 } ··· 4165 4151 uint16_t mb[MAILBOX_REGISTER_COUNT]; 4166 4152 struct qla_hw_data *ha = vha->hw; 4167 4153 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); 4168 - struct req_que *req = ha->req_q_map[0]; 4169 - struct rsp_que *rsp = ha->rsp_q_map[0]; 4154 + struct req_que *req = ha->req_q_map[vha->req_ques[0]]; 4155 + struct rsp_que *rsp = req->rsp; 4170 4156 4171 4157 if (!vha->vp_idx) 4172 4158 return -EINVAL;
+1
drivers/scsi/qla2xxx/qla_mid.c
··· 629 629 req->ring_index = 0; 630 630 req->cnt = req->length; 631 631 req->id = que_id; 632 + req->max_q_depth = ha->req_q_map[0]->max_q_depth; 632 633 mutex_unlock(&ha->vport_lock); 633 634 634 635 ret = qla25xx_init_req_que(base_vha, req, options);
+3 -4
drivers/scsi/qla2xxx/qla_os.c
··· 1158 1158 struct req_que *req; 1159 1159 1160 1160 spin_lock_irqsave(&ha->hardware_lock, flags); 1161 - for (que = 0; que < QLA_MAX_HOST_QUES; que++) { 1162 - req = ha->req_q_map[vha->req_ques[que]]; 1161 + for (que = 0; que < ha->max_queues; que++) { 1162 + req = ha->req_q_map[que]; 1163 1163 if (!req) 1164 1164 continue; 1165 1165 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { ··· 1193 1193 scsi_qla_host_t *vha = shost_priv(sdev->host); 1194 1194 struct qla_hw_data *ha = vha->hw; 1195 1195 struct fc_rport *rport = starget_to_rport(sdev->sdev_target); 1196 - struct req_que *req = ha->req_q_map[0]; 1196 + struct req_que *req = ha->req_q_map[vha->req_ques[0]]; 1197 1197 1198 1198 if (sdev->tagged_supported) 1199 1199 scsi_activate_tcq(sdev, req->max_q_depth); ··· 1998 1998 return 0; 1999 1999 2000 2000 probe_failed: 2001 - qla2x00_free_que(ha, req, rsp); 2002 2001 qla2x00_free_device(base_vha); 2003 2002 2004 2003 scsi_host_put(base_vha->host);