aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_dbg.c
diff options
context:
space:
mode:
authorAnirban Chakraborty <anirban.chakraborty@qlogic.com>2008-12-09 19:45:39 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 12:24:33 -0500
commit73208dfd7ab19f379d73e8a0fbf30f92c203e5e8 (patch)
treef69be5e89817d17b066ece4dbe04e395339c0754 /drivers/scsi/qla2xxx/qla_dbg.c
parent85b4aa4926a50210b683ac89326e338e7d131211 (diff)
[SCSI] qla2xxx: add support for multi-queue adapter
Following changes have been made. 1. qla_hw_data structure holds an array for request queue pointers, and an array for response queue pointers. 2. The base request and response queues are created by default. 3. Additional request and response queues are created at the time of vport creation. If queue resources are exhausted during vport creation, newly created vports use the default queue. 4. Requests are sent to the request queue that the vport was assigned in the beginning. 5. Responses are completed on the response queue with which the request queue is associated with. [fixup memcpy argument reversal spotted by davej@redhat.com] Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_dbg.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c67
1 files changed, 53 insertions, 14 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index f15f903aec55..1cf77772623b 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -23,11 +23,10 @@ qla2xxx_prep_dump(struct qla_hw_data *ha, struct qla2xxx_fw_dump *fw_dump)
23} 23}
24 24
25static inline void * 25static inline void *
26qla2xxx_copy_queues(scsi_qla_host_t *vha, void *ptr) 26qla2xxx_copy_queues(struct qla_hw_data *ha, void *ptr)
27{ 27{
28 struct req_que *req = vha->hw->req; 28 struct req_que *req = ha->req_q_map[0];
29 struct rsp_que *rsp = vha->hw->rsp; 29 struct rsp_que *rsp = ha->rsp_q_map[0];
30
31 /* Request queue. */ 30 /* Request queue. */
32 memcpy(ptr, req->ring, req->length * 31 memcpy(ptr, req->ring, req->length *
33 sizeof(request_t)); 32 sizeof(request_t));
@@ -327,6 +326,7 @@ qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
327 unsigned long flags; 326 unsigned long flags;
328 struct qla2300_fw_dump *fw; 327 struct qla2300_fw_dump *fw;
329 void *nxt; 328 void *nxt;
329 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
330 330
331 flags = 0; 331 flags = 0;
332 332
@@ -461,7 +461,7 @@ qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
461 ha->fw_memory_size - 0x11000 + 1, &nxt); 461 ha->fw_memory_size - 0x11000 + 1, &nxt);
462 462
463 if (rval == QLA_SUCCESS) 463 if (rval == QLA_SUCCESS)
464 qla2xxx_copy_queues(vha, nxt); 464 qla2xxx_copy_queues(ha, nxt);
465 465
466 if (rval != QLA_SUCCESS) { 466 if (rval != QLA_SUCCESS) {
467 qla_printk(KERN_WARNING, ha, 467 qla_printk(KERN_WARNING, ha,
@@ -471,7 +471,7 @@ qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
471 } else { 471 } else {
472 qla_printk(KERN_INFO, ha, 472 qla_printk(KERN_INFO, ha,
473 "Firmware dump saved to temp buffer (%ld/%p).\n", 473 "Firmware dump saved to temp buffer (%ld/%p).\n",
474 vha->host_no, ha->fw_dump); 474 base_vha->host_no, ha->fw_dump);
475 ha->fw_dumped = 1; 475 ha->fw_dumped = 1;
476 } 476 }
477 477
@@ -497,6 +497,7 @@ qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
497 uint16_t __iomem *dmp_reg; 497 uint16_t __iomem *dmp_reg;
498 unsigned long flags; 498 unsigned long flags;
499 struct qla2100_fw_dump *fw; 499 struct qla2100_fw_dump *fw;
500 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
500 501
501 risc_address = 0; 502 risc_address = 0;
502 mb0 = mb2 = 0; 503 mb0 = mb2 = 0;
@@ -667,7 +668,7 @@ qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
667 } 668 }
668 669
669 if (rval == QLA_SUCCESS) 670 if (rval == QLA_SUCCESS)
670 qla2xxx_copy_queues(vha, &fw->risc_ram[cnt]); 671 qla2xxx_copy_queues(ha, &fw->risc_ram[cnt]);
671 672
672 if (rval != QLA_SUCCESS) { 673 if (rval != QLA_SUCCESS) {
673 qla_printk(KERN_WARNING, ha, 674 qla_printk(KERN_WARNING, ha,
@@ -677,7 +678,7 @@ qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
677 } else { 678 } else {
678 qla_printk(KERN_INFO, ha, 679 qla_printk(KERN_INFO, ha,
679 "Firmware dump saved to temp buffer (%ld/%p).\n", 680 "Firmware dump saved to temp buffer (%ld/%p).\n",
680 vha->host_no, ha->fw_dump); 681 base_vha->host_no, ha->fw_dump);
681 ha->fw_dumped = 1; 682 ha->fw_dumped = 1;
682 } 683 }
683 684
@@ -701,6 +702,7 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
701 struct qla24xx_fw_dump *fw; 702 struct qla24xx_fw_dump *fw;
702 uint32_t ext_mem_cnt; 703 uint32_t ext_mem_cnt;
703 void *nxt; 704 void *nxt;
705 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
704 706
705 risc_address = ext_mem_cnt = 0; 707 risc_address = ext_mem_cnt = 0;
706 flags = 0; 708 flags = 0;
@@ -910,7 +912,7 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
910 if (rval != QLA_SUCCESS) 912 if (rval != QLA_SUCCESS)
911 goto qla24xx_fw_dump_failed_0; 913 goto qla24xx_fw_dump_failed_0;
912 914
913 nxt = qla2xxx_copy_queues(vha, nxt); 915 nxt = qla2xxx_copy_queues(ha, nxt);
914 if (ha->eft) 916 if (ha->eft)
915 memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size)); 917 memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
916 918
@@ -923,7 +925,7 @@ qla24xx_fw_dump_failed_0:
923 } else { 925 } else {
924 qla_printk(KERN_INFO, ha, 926 qla_printk(KERN_INFO, ha,
925 "Firmware dump saved to temp buffer (%ld/%p).\n", 927 "Firmware dump saved to temp buffer (%ld/%p).\n",
926 vha->host_no, ha->fw_dump); 928 base_vha->host_no, ha->fw_dump);
927 ha->fw_dumped = 1; 929 ha->fw_dumped = 1;
928 } 930 }
929 931
@@ -940,6 +942,7 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
940 uint32_t risc_address; 942 uint32_t risc_address;
941 struct qla_hw_data *ha = vha->hw; 943 struct qla_hw_data *ha = vha->hw;
942 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 944 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
945 struct device_reg_25xxmq __iomem *reg25;
943 uint32_t __iomem *dmp_reg; 946 uint32_t __iomem *dmp_reg;
944 uint32_t *iter_reg; 947 uint32_t *iter_reg;
945 uint16_t __iomem *mbx_reg; 948 uint16_t __iomem *mbx_reg;
@@ -948,6 +951,11 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
948 uint32_t ext_mem_cnt; 951 uint32_t ext_mem_cnt;
949 void *nxt; 952 void *nxt;
950 struct qla2xxx_fce_chain *fcec; 953 struct qla2xxx_fce_chain *fcec;
954 struct qla2xxx_mq_chain *mq = NULL;
955 uint32_t qreg_size;
956 uint8_t req_cnt, rsp_cnt, que_cnt;
957 uint32_t que_idx;
958 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
951 959
952 risc_address = ext_mem_cnt = 0; 960 risc_address = ext_mem_cnt = 0;
953 flags = 0; 961 flags = 0;
@@ -992,6 +1000,29 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
992 fw->pcie_regs[1] = htonl(RD_REG_DWORD(dmp_reg++)); 1000 fw->pcie_regs[1] = htonl(RD_REG_DWORD(dmp_reg++));
993 fw->pcie_regs[2] = htonl(RD_REG_DWORD(dmp_reg)); 1001 fw->pcie_regs[2] = htonl(RD_REG_DWORD(dmp_reg));
994 fw->pcie_regs[3] = htonl(RD_REG_DWORD(&reg->iobase_window)); 1002 fw->pcie_regs[3] = htonl(RD_REG_DWORD(&reg->iobase_window));
1003
1004 /* Multi queue registers */
1005 if (ha->mqenable) {
1006 qreg_size = sizeof(struct qla2xxx_mq_chain);
1007 mq = kzalloc(qreg_size, GFP_KERNEL);
1008 if (!mq)
1009 goto qla25xx_fw_dump_failed_0;
1010 req_cnt = find_first_zero_bit(ha->req_qid_map, ha->max_queues);
1011 rsp_cnt = find_first_zero_bit(ha->rsp_qid_map, ha->max_queues);
1012 que_cnt = req_cnt > rsp_cnt ? req_cnt : rsp_cnt;
1013 mq->count = htonl(que_cnt);
1014 mq->chain_size = htonl(qreg_size);
1015 mq->type = __constant_htonl(DUMP_CHAIN_MQ);
1016 for (cnt = 0; cnt < que_cnt; cnt++) {
1017 reg25 = (struct device_reg_25xxmq *) ((void *)
1018 ha->mqiobase + cnt * QLA_QUE_PAGE);
1019 que_idx = cnt * 4;
1020 mq->qregs[que_idx] = htonl(reg25->req_q_in);
1021 mq->qregs[que_idx+1] = htonl(reg25->req_q_out);
1022 mq->qregs[que_idx+2] = htonl(reg25->rsp_q_in);
1023 mq->qregs[que_idx+3] = htonl(reg25->rsp_q_out);
1024 }
1025 }
995 WRT_REG_DWORD(&reg->iobase_window, 0x00); 1026 WRT_REG_DWORD(&reg->iobase_window, 0x00);
996 RD_REG_DWORD(&reg->iobase_window); 1027 RD_REG_DWORD(&reg->iobase_window);
997 1028
@@ -1219,7 +1250,7 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
1219 goto qla25xx_fw_dump_failed_0; 1250 goto qla25xx_fw_dump_failed_0;
1220 1251
1221 /* Fibre Channel Trace Buffer. */ 1252 /* Fibre Channel Trace Buffer. */
1222 nxt = qla2xxx_copy_queues(vha, nxt); 1253 nxt = qla2xxx_copy_queues(ha, nxt);
1223 if (ha->eft) 1254 if (ha->eft)
1224 memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size)); 1255 memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
1225 1256
@@ -1229,7 +1260,14 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
1229 1260
1230 ha->fw_dump->version |= __constant_htonl(DUMP_CHAIN_VARIANT); 1261 ha->fw_dump->version |= __constant_htonl(DUMP_CHAIN_VARIANT);
1231 1262
1232 fcec = nxt + ntohl(ha->fw_dump->eft_size); 1263 if (ha->mqenable) {
1264 nxt = nxt + ntohl(ha->fw_dump->eft_size);
1265 memcpy(nxt, mq, qreg_size);
1266 kfree(mq);
1267 fcec = nxt + qreg_size;
1268 } else {
1269 fcec = nxt + ntohl(ha->fw_dump->eft_size);
1270 }
1233 fcec->type = __constant_htonl(DUMP_CHAIN_FCE | DUMP_CHAIN_LAST); 1271 fcec->type = __constant_htonl(DUMP_CHAIN_FCE | DUMP_CHAIN_LAST);
1234 fcec->chain_size = htonl(sizeof(struct qla2xxx_fce_chain) + 1272 fcec->chain_size = htonl(sizeof(struct qla2xxx_fce_chain) +
1235 fce_calc_size(ha->fce_bufs)); 1273 fce_calc_size(ha->fce_bufs));
@@ -1252,7 +1290,7 @@ qla25xx_fw_dump_failed_0:
1252 } else { 1290 } else {
1253 qla_printk(KERN_INFO, ha, 1291 qla_printk(KERN_INFO, ha,
1254 "Firmware dump saved to temp buffer (%ld/%p).\n", 1292 "Firmware dump saved to temp buffer (%ld/%p).\n",
1255 vha->host_no, ha->fw_dump); 1293 base_vha->host_no, ha->fw_dump);
1256 ha->fw_dumped = 1; 1294 ha->fw_dumped = 1;
1257 } 1295 }
1258 1296
@@ -1260,7 +1298,6 @@ qla25xx_fw_dump_failed:
1260 if (!hardware_locked) 1298 if (!hardware_locked)
1261 spin_unlock_irqrestore(&ha->hardware_lock, flags); 1299 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1262} 1300}
1263
1264/****************************************************************************/ 1301/****************************************************************************/
1265/* Driver Debug Functions. */ 1302/* Driver Debug Functions. */
1266/****************************************************************************/ 1303/****************************************************************************/
@@ -1307,3 +1344,5 @@ qla2x00_dump_buffer(uint8_t * b, uint32_t size)
1307 if (cnt % 16) 1344 if (cnt % 16)
1308 printk("\n"); 1345 printk("\n");
1309} 1346}
1347
1348