Skip to content

Commit 7b867cf

Browse files
Anirban Chakrabortyjejb
authored andcommitted
[SCSI] qla2xxx: Refactor qla data structures
Following changes have been made to the qla2xxx FC driver in preparation for the multi- queue and future SR IOV hardware. 1. scsi_qla_host structure has been changed to contain scsi host specific data only. 2. A new structure, qla_hw_data is created to contain HBA specific hardware data. 3. Request and response IO specific data strucures are created. 4. The global list of fcports for the hba is not maintained anymore, instead a fcport list is construted on per scsi_qla_host. Signed-of-by: Anirban Chakraborty <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent a9b589d commit 7b867cf

File tree

9 files changed

+1479
-1387
lines changed

9 files changed

+1479
-1387
lines changed

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 162 additions & 136 deletions
Large diffs are not rendered by default.

drivers/scsi/qla2xxx/qla_dbg.c

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <linux/delay.h>
1010

1111
static inline void
12-
qla2xxx_prep_dump(scsi_qla_host_t *ha, struct qla2xxx_fw_dump *fw_dump)
12+
qla2xxx_prep_dump(struct qla_hw_data *ha, struct qla2xxx_fw_dump *fw_dump)
1313
{
1414
fw_dump->fw_major_version = htonl(ha->fw_major_version);
1515
fw_dump->fw_minor_version = htonl(ha->fw_minor_version);
@@ -23,22 +23,25 @@ qla2xxx_prep_dump(scsi_qla_host_t *ha, struct qla2xxx_fw_dump *fw_dump)
2323
}
2424

2525
static inline void *
26-
qla2xxx_copy_queues(scsi_qla_host_t *ha, void *ptr)
26+
qla2xxx_copy_queues(scsi_qla_host_t *vha, void *ptr)
2727
{
28+
struct req_que *req = vha->hw->req;
29+
struct rsp_que *rsp = vha->hw->rsp;
30+
2831
/* Request queue. */
29-
memcpy(ptr, ha->request_ring, ha->request_q_length *
32+
memcpy(ptr, req->ring, req->length *
3033
sizeof(request_t));
3134

3235
/* Response queue. */
33-
ptr += ha->request_q_length * sizeof(request_t);
34-
memcpy(ptr, ha->response_ring, ha->response_q_length *
36+
ptr += req->length * sizeof(request_t);
37+
memcpy(ptr, rsp->ring, rsp->length *
3538
sizeof(response_t));
3639

37-
return ptr + (ha->response_q_length * sizeof(response_t));
40+
return ptr + (rsp->length * sizeof(response_t));
3841
}
3942

4043
static int
41-
qla24xx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint32_t *ram,
44+
qla24xx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint32_t *ram,
4245
uint32_t ram_dwords, void **nxt)
4346
{
4447
int rval;
@@ -112,7 +115,7 @@ qla24xx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint32_t *ram,
112115
}
113116

114117
static int
115-
qla24xx_dump_memory(scsi_qla_host_t *ha, uint32_t *code_ram,
118+
qla24xx_dump_memory(struct qla_hw_data *ha, uint32_t *code_ram,
116119
uint32_t cram_size, void **nxt)
117120
{
118121
int rval;
@@ -163,7 +166,7 @@ qla24xx_pause_risc(struct device_reg_24xx __iomem *reg)
163166
}
164167

165168
static int
166-
qla24xx_soft_reset(scsi_qla_host_t *ha)
169+
qla24xx_soft_reset(struct qla_hw_data *ha)
167170
{
168171
int rval = QLA_SUCCESS;
169172
uint32_t cnt;
@@ -215,8 +218,8 @@ qla24xx_soft_reset(scsi_qla_host_t *ha)
215218
}
216219

217220
static int
218-
qla2xxx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint16_t *ram,
219-
uint32_t ram_words, void **nxt)
221+
qla2xxx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint16_t *ram,
222+
uint16_t ram_words, void **nxt)
220223
{
221224
int rval;
222225
uint32_t cnt, stat, timer, words, idx;
@@ -314,11 +317,11 @@ qla2xxx_read_window(struct device_reg_2xxx __iomem *reg, uint32_t count,
314317
* @hardware_locked: Called with the hardware_lock
315318
*/
316319
void
317-
qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
320+
qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
318321
{
319322
int rval;
320323
uint32_t cnt;
321-
324+
struct qla_hw_data *ha = vha->hw;
322325
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
323326
uint16_t __iomem *dmp_reg;
324327
unsigned long flags;
@@ -458,7 +461,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
458461
ha->fw_memory_size - 0x11000 + 1, &nxt);
459462

460463
if (rval == QLA_SUCCESS)
461-
qla2xxx_copy_queues(ha, nxt);
464+
qla2xxx_copy_queues(vha, nxt);
462465

463466
if (rval != QLA_SUCCESS) {
464467
qla_printk(KERN_WARNING, ha,
@@ -468,7 +471,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
468471
} else {
469472
qla_printk(KERN_INFO, ha,
470473
"Firmware dump saved to temp buffer (%ld/%p).\n",
471-
ha->host_no, ha->fw_dump);
474+
vha->host_no, ha->fw_dump);
472475
ha->fw_dumped = 1;
473476
}
474477

@@ -483,12 +486,13 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
483486
* @hardware_locked: Called with the hardware_lock
484487
*/
485488
void
486-
qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
489+
qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
487490
{
488491
int rval;
489492
uint32_t cnt, timer;
490493
uint16_t risc_address;
491494
uint16_t mb0, mb2;
495+
struct qla_hw_data *ha = vha->hw;
492496
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
493497
uint16_t __iomem *dmp_reg;
494498
unsigned long flags;
@@ -663,7 +667,7 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
663667
}
664668

665669
if (rval == QLA_SUCCESS)
666-
qla2xxx_copy_queues(ha, &fw->risc_ram[cnt]);
670+
qla2xxx_copy_queues(vha, &fw->risc_ram[cnt]);
667671

668672
if (rval != QLA_SUCCESS) {
669673
qla_printk(KERN_WARNING, ha,
@@ -673,7 +677,7 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
673677
} else {
674678
qla_printk(KERN_INFO, ha,
675679
"Firmware dump saved to temp buffer (%ld/%p).\n",
676-
ha->host_no, ha->fw_dump);
680+
vha->host_no, ha->fw_dump);
677681
ha->fw_dumped = 1;
678682
}
679683

@@ -683,12 +687,12 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
683687
}
684688

685689
void
686-
qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
690+
qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
687691
{
688692
int rval;
689693
uint32_t cnt;
690694
uint32_t risc_address;
691-
695+
struct qla_hw_data *ha = vha->hw;
692696
struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
693697
uint32_t __iomem *dmp_reg;
694698
uint32_t *iter_reg;
@@ -906,7 +910,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
906910
if (rval != QLA_SUCCESS)
907911
goto qla24xx_fw_dump_failed_0;
908912

909-
nxt = qla2xxx_copy_queues(ha, nxt);
913+
nxt = qla2xxx_copy_queues(vha, nxt);
910914
if (ha->eft)
911915
memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
912916

@@ -919,7 +923,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
919923
} else {
920924
qla_printk(KERN_INFO, ha,
921925
"Firmware dump saved to temp buffer (%ld/%p).\n",
922-
ha->host_no, ha->fw_dump);
926+
vha->host_no, ha->fw_dump);
923927
ha->fw_dumped = 1;
924928
}
925929

@@ -929,12 +933,12 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
929933
}
930934

931935
void
932-
qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
936+
qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
933937
{
934938
int rval;
935939
uint32_t cnt;
936940
uint32_t risc_address;
937-
941+
struct qla_hw_data *ha = vha->hw;
938942
struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
939943
uint32_t __iomem *dmp_reg;
940944
uint32_t *iter_reg;
@@ -1215,7 +1219,7 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
12151219
goto qla25xx_fw_dump_failed_0;
12161220

12171221
/* Fibre Channel Trace Buffer. */
1218-
nxt = qla2xxx_copy_queues(ha, nxt);
1222+
nxt = qla2xxx_copy_queues(vha, nxt);
12191223
if (ha->eft)
12201224
memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
12211225

@@ -1248,7 +1252,7 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
12481252
} else {
12491253
qla_printk(KERN_INFO, ha,
12501254
"Firmware dump saved to temp buffer (%ld/%p).\n",
1251-
ha->host_no, ha->fw_dump);
1255+
vha->host_no, ha->fw_dump);
12521256
ha->fw_dumped = 1;
12531257
}
12541258

@@ -1262,9 +1266,10 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
12621266
/****************************************************************************/
12631267

12641268
void
1265-
qla2x00_dump_regs(scsi_qla_host_t *ha)
1269+
qla2x00_dump_regs(scsi_qla_host_t *vha)
12661270
{
12671271
int i;
1272+
struct qla_hw_data *ha = vha->hw;
12681273
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
12691274
struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24;
12701275
uint16_t __iomem *mbx_reg;
@@ -1274,7 +1279,7 @@ qla2x00_dump_regs(scsi_qla_host_t *ha)
12741279

12751280
printk("Mailbox registers:\n");
12761281
for (i = 0; i < 6; i++)
1277-
printk("scsi(%ld): mbox %d 0x%04x \n", ha->host_no, i,
1282+
printk("scsi(%ld): mbox %d 0x%04x \n", vha->host_no, i,
12781283
RD_REG_WORD(mbx_reg++));
12791284
}
12801285

0 commit comments

Comments
 (0)