Skip to content

Commit 775c774

Browse files
Krishna GudipatiJames Bottomley
authored andcommitted
[SCSI] bfa: IOC and PLL init changes for Brocade-1860 Fabric Adapter.
- Introduced IOC poll mechanism which replaces current interrupt based FW READY method. - The timer based poll routine in IOC will query the ioc_fwstate register to see if there is a state change in FW, and sends the READY event. - Bug fixes in the new asic PLL initialization. - Added logic to handle CPE/RME queue interrupts before iocfc config done. 1. Use the queue_process flag to see if iocfc configuration is done in INTX mode. 2. Split the MSIX handler installation in two - one for IOC intr handler and the other for cpe/rme queue handler - and delay assigning queue handlers until iocfc config is done in MSIX mode. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent dd5aaf4 commit 775c774

10 files changed

Lines changed: 188 additions & 137 deletions

File tree

‎drivers/scsi/bfa/bfa.h‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ struct bfa_hwif_s {
228228
void (*hw_reqq_ack)(struct bfa_s *bfa, int reqq);
229229
void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq);
230230
void (*hw_msix_init)(struct bfa_s *bfa, int nvecs);
231-
void (*hw_msix_install)(struct bfa_s *bfa);
231+
void (*hw_msix_ctrl_install)(struct bfa_s *bfa);
232+
void (*hw_msix_queue_install)(struct bfa_s *bfa);
232233
void (*hw_msix_uninstall)(struct bfa_s *bfa);
233234
void (*hw_isr_mode_set)(struct bfa_s *bfa, bfa_boolean_t msix);
234235
void (*hw_msix_getvecs)(struct bfa_s *bfa, u32 *vecmap,
@@ -271,8 +272,10 @@ struct bfa_iocfc_s {
271272
bfa_ioc_portid(&(__bfa)->ioc)
272273
#define bfa_msix_init(__bfa, __nvecs) \
273274
((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs))
274-
#define bfa_msix_install(__bfa) \
275-
((__bfa)->iocfc.hwif.hw_msix_install(__bfa))
275+
#define bfa_msix_ctrl_install(__bfa) \
276+
((__bfa)->iocfc.hwif.hw_msix_ctrl_install(__bfa))
277+
#define bfa_msix_queue_install(__bfa) \
278+
((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa))
276279
#define bfa_msix_uninstall(__bfa) \
277280
((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa))
278281
#define bfa_isr_mode_set(__bfa, __msix) do { \
@@ -314,7 +317,8 @@ void bfa_hwcb_reginit(struct bfa_s *bfa);
314317
void bfa_hwcb_reqq_ack(struct bfa_s *bfa, int rspq);
315318
void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq);
316319
void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs);
317-
void bfa_hwcb_msix_install(struct bfa_s *bfa);
320+
void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa);
321+
void bfa_hwcb_msix_queue_install(struct bfa_s *bfa);
318322
void bfa_hwcb_msix_uninstall(struct bfa_s *bfa);
319323
void bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix);
320324
void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,
@@ -326,7 +330,8 @@ void bfa_hwct2_reginit(struct bfa_s *bfa);
326330
void bfa_hwct_reqq_ack(struct bfa_s *bfa, int rspq);
327331
void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq);
328332
void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs);
329-
void bfa_hwct_msix_install(struct bfa_s *bfa);
333+
void bfa_hwct_msix_ctrl_install(struct bfa_s *bfa);
334+
void bfa_hwct_msix_queue_install(struct bfa_s *bfa);
330335
void bfa_hwct_msix_uninstall(struct bfa_s *bfa);
331336
void bfa_hwct_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix);
332337
void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,

‎drivers/scsi/bfa/bfa_core.c‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ bfa_intx(struct bfa_s *bfa)
248248
writel(qintr, bfa->iocfc.bfa_regs.intr_status);
249249

250250
for (queue = 0; queue < BFI_IOC_MAX_CQS_ASIC; queue++) {
251-
if (intr & (__HFN_INT_RME_Q0 << queue))
251+
if ((intr & (__HFN_INT_RME_Q0 << queue)) && bfa->queue_process)
252252
bfa_isr_rspq(bfa, queue & (BFI_IOC_MAX_CQS - 1));
253253
}
254254
intr &= ~qintr;
@@ -262,7 +262,7 @@ bfa_intx(struct bfa_s *bfa)
262262
writel(qintr, bfa->iocfc.bfa_regs.intr_status);
263263

264264
for (queue = 0; queue < BFI_IOC_MAX_CQS_ASIC; queue++) {
265-
if (intr & (__HFN_INT_CPE_Q0 << queue))
265+
if ((intr & (__HFN_INT_CPE_Q0 << queue)) && bfa->queue_process)
266266
bfa_isr_reqq(bfa, queue & (BFI_IOC_MAX_CQS - 1));
267267
}
268268
intr &= ~qintr;
@@ -282,7 +282,7 @@ bfa_isr_enable(struct bfa_s *bfa)
282282

283283
bfa_trc(bfa, pci_func);
284284

285-
bfa_msix_install(bfa);
285+
bfa_msix_ctrl_install(bfa);
286286

287287
if (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id)) {
288288
umsk = __HFN_INT_ERR_MASK_CT2;
@@ -326,9 +326,6 @@ bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m)
326326
void
327327
bfa_msix_rspq(struct bfa_s *bfa, int vec)
328328
{
329-
if (!bfa->rme_process)
330-
return;
331-
332329
bfa_isr_rspq(bfa, vec - bfa->iocfc.hwif.rme_vec_q0);
333330
}
334331

@@ -512,7 +509,8 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
512509
iocfc->hwif.hw_reqq_ack = bfa_hwct_reqq_ack;
513510
iocfc->hwif.hw_rspq_ack = bfa_hwct_rspq_ack;
514511
iocfc->hwif.hw_msix_init = bfa_hwct_msix_init;
515-
iocfc->hwif.hw_msix_install = bfa_hwct_msix_install;
512+
iocfc->hwif.hw_msix_ctrl_install = bfa_hwct_msix_ctrl_install;
513+
iocfc->hwif.hw_msix_queue_install = bfa_hwct_msix_queue_install;
516514
iocfc->hwif.hw_msix_uninstall = bfa_hwct_msix_uninstall;
517515
iocfc->hwif.hw_isr_mode_set = bfa_hwct_isr_mode_set;
518516
iocfc->hwif.hw_msix_getvecs = bfa_hwct_msix_getvecs;
@@ -524,7 +522,8 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
524522
iocfc->hwif.hw_reqq_ack = bfa_hwcb_reqq_ack;
525523
iocfc->hwif.hw_rspq_ack = bfa_hwcb_rspq_ack;
526524
iocfc->hwif.hw_msix_init = bfa_hwcb_msix_init;
527-
iocfc->hwif.hw_msix_install = bfa_hwcb_msix_install;
525+
iocfc->hwif.hw_msix_ctrl_install = bfa_hwcb_msix_ctrl_install;
526+
iocfc->hwif.hw_msix_queue_install = bfa_hwcb_msix_queue_install;
528527
iocfc->hwif.hw_msix_uninstall = bfa_hwcb_msix_uninstall;
529528
iocfc->hwif.hw_isr_mode_set = bfa_hwcb_isr_mode_set;
530529
iocfc->hwif.hw_msix_getvecs = bfa_hwcb_msix_getvecs;
@@ -640,7 +639,7 @@ bfa_iocfc_start_submod(struct bfa_s *bfa)
640639
{
641640
int i;
642641

643-
bfa->rme_process = BFA_TRUE;
642+
bfa->queue_process = BFA_TRUE;
644643
for (i = 0; i < BFI_IOC_MAX_CQS; i++)
645644
bfa->iocfc.hwif.hw_rspq_ack(bfa, i);
646645

@@ -742,6 +741,11 @@ bfa_iocfc_cfgrsp(struct bfa_s *bfa)
742741
*/
743742
bfa_iocfc_qreg(bfa, &cfgrsp->qreg);
744743

744+
/*
745+
* Install MSIX queue handlers
746+
*/
747+
bfa_msix_queue_install(bfa);
748+
745749
/*
746750
* Configuration is complete - initialize/start submodules
747751
*/
@@ -813,7 +817,7 @@ bfa_iocfc_hbfail_cbfn(void *bfa_arg)
813817
{
814818
struct bfa_s *bfa = bfa_arg;
815819

816-
bfa->rme_process = BFA_FALSE;
820+
bfa->queue_process = BFA_FALSE;
817821

818822
bfa_isr_disable(bfa);
819823
bfa_iocfc_disable_submod(bfa);
@@ -917,7 +921,7 @@ bfa_iocfc_stop(struct bfa_s *bfa)
917921
{
918922
bfa->iocfc.action = BFA_IOCFC_ACT_STOP;
919923

920-
bfa->rme_process = BFA_FALSE;
924+
bfa->queue_process = BFA_FALSE;
921925
bfa_ioc_disable(&bfa->ioc);
922926
}
923927

@@ -1017,7 +1021,7 @@ bfa_iocfc_disable(struct bfa_s *bfa)
10171021
"IOC Disable");
10181022
bfa->iocfc.action = BFA_IOCFC_ACT_DISABLE;
10191023

1020-
bfa->rme_process = BFA_FALSE;
1024+
bfa->queue_process = BFA_FALSE;
10211025
bfa_ioc_disable(&bfa->ioc);
10221026
}
10231027

‎drivers/scsi/bfa/bfa_hw_cb.c‎

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,44 +85,72 @@ bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap,
8585
*num_vecs = __HFN_NUMINTS;
8686
}
8787

88+
/*
89+
* Dummy interrupt handler for handling spurious interrupts.
90+
*/
91+
static void
92+
bfa_hwcb_msix_dummy(struct bfa_s *bfa, int vec)
93+
{
94+
}
95+
8896
/*
8997
* No special setup required for crossbow -- vector assignments are implicit.
9098
*/
9199
void
92100
bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs)
93101
{
94-
int i;
95-
96102
WARN_ON((nvecs != 1) && (nvecs != __HFN_NUMINTS));
97103

98104
bfa->msix.nvecs = nvecs;
99-
if (nvecs == 1) {
100-
for (i = 0; i < BFI_MSIX_CB_MAX; i++)
105+
bfa_hwcb_msix_uninstall(bfa);
106+
}
107+
108+
void
109+
bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa)
110+
{
111+
int i;
112+
113+
if (bfa->msix.nvecs == 0)
114+
return;
115+
116+
if (bfa->msix.nvecs == 1) {
117+
for (i = BFI_MSIX_RME_QMAX_CB+1; i < BFI_MSIX_CB_MAX; i++)
101118
bfa->msix.handler[i] = bfa_msix_all;
102119
return;
103120
}
104121

105-
for (i = BFI_MSIX_CPE_QMIN_CB; i <= BFI_MSIX_CPE_QMAX_CB; i++)
106-
bfa->msix.handler[i] = bfa_msix_reqq;
107-
108-
for (i = BFI_MSIX_RME_QMIN_CB; i <= BFI_MSIX_RME_QMAX_CB; i++)
109-
bfa->msix.handler[i] = bfa_msix_rspq;
110-
111-
for (; i < BFI_MSIX_CB_MAX; i++)
122+
for (i = BFI_MSIX_RME_QMAX_CB+1; i < BFI_MSIX_CB_MAX; i++)
112123
bfa->msix.handler[i] = bfa_msix_lpu_err;
113124
}
114125

115-
/*
116-
* Crossbow -- dummy, interrupts are masked
117-
*/
118126
void
119-
bfa_hwcb_msix_install(struct bfa_s *bfa)
127+
bfa_hwcb_msix_queue_install(struct bfa_s *bfa)
120128
{
129+
int i;
130+
131+
if (bfa->msix.nvecs == 0)
132+
return;
133+
134+
if (bfa->msix.nvecs == 1) {
135+
for (i = BFI_MSIX_CPE_QMIN_CB; i <= BFI_MSIX_RME_QMAX_CB; i++)
136+
bfa->msix.handler[i] = bfa_msix_all;
137+
return;
138+
}
139+
140+
for (i = BFI_MSIX_CPE_QMIN_CB; i <= BFI_MSIX_CPE_QMAX_CB; i++)
141+
bfa->msix.handler[i] = bfa_msix_reqq;
142+
143+
for (i = BFI_MSIX_RME_QMIN_CB; i <= BFI_MSIX_RME_QMAX_CB; i++)
144+
bfa->msix.handler[i] = bfa_msix_rspq;
121145
}
122146

123147
void
124148
bfa_hwcb_msix_uninstall(struct bfa_s *bfa)
125149
{
150+
int i;
151+
152+
for (i = 0; i < BFI_MSIX_CB_MAX; i++)
153+
bfa->msix.handler[i] = bfa_hwcb_msix_dummy;
126154
}
127155

128156
/*

‎drivers/scsi/bfa/bfa_hw_ct.c‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,27 @@ bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs)
9696
}
9797

9898
void
99-
bfa_hwct_msix_install(struct bfa_s *bfa)
99+
bfa_hwct_msix_ctrl_install(struct bfa_s *bfa)
100+
{
101+
if (bfa->msix.nvecs == 0)
102+
return;
103+
104+
if (bfa->msix.nvecs == 1)
105+
bfa->msix.handler[BFI_MSIX_LPU_ERR_CT] = bfa_msix_all;
106+
else
107+
bfa->msix.handler[BFI_MSIX_LPU_ERR_CT] = bfa_msix_lpu_err;
108+
}
109+
110+
void
111+
bfa_hwct_msix_queue_install(struct bfa_s *bfa)
100112
{
101113
int i;
102114

103115
if (bfa->msix.nvecs == 0)
104116
return;
105117

106118
if (bfa->msix.nvecs == 1) {
107-
for (i = 0; i < BFI_MSIX_CT_MAX; i++)
119+
for (i = BFI_MSIX_CPE_QMIN_CT; i < BFI_MSIX_CT_MAX; i++)
108120
bfa->msix.handler[i] = bfa_msix_all;
109121
return;
110122
}
@@ -114,8 +126,6 @@ bfa_hwct_msix_install(struct bfa_s *bfa)
114126

115127
for (i = BFI_MSIX_RME_QMIN_CT; i <= BFI_MSIX_RME_QMAX_CT; i++)
116128
bfa->msix.handler[i] = bfa_msix_rspq;
117-
118-
bfa->msix.handler[BFI_MSIX_LPU_ERR_CT] = bfa_msix_lpu_err;
119129
}
120130

121131
void

0 commit comments

Comments
 (0)