Skip to content

Commit ca6e0ea

Browse files
Krishna GudipatiJames Bottomley
authored andcommitted
[SCSI] bfa: Update RME interrupt handling.
- Made changes to always acknowledge RME interrupt and update consumer index (CI) when RME interrupt is generated. - Made changes to have ASIC specific hw_rspq_ack() handler. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 9afbcfa commit ca6e0ea

4 files changed

Lines changed: 73 additions & 28 deletions

File tree

‎drivers/scsi/bfa/bfa.h‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ struct bfa_msix_s {
177177
struct bfa_hwif_s {
178178
void (*hw_reginit)(struct bfa_s *bfa);
179179
void (*hw_reqq_ack)(struct bfa_s *bfa, int reqq);
180-
void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq);
180+
void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq, u32 ci);
181181
void (*hw_msix_init)(struct bfa_s *bfa, int nvecs);
182182
void (*hw_msix_ctrl_install)(struct bfa_s *bfa);
183183
void (*hw_msix_queue_install)(struct bfa_s *bfa);
@@ -268,10 +268,8 @@ struct bfa_iocfc_s {
268268
((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa))
269269
#define bfa_msix_uninstall(__bfa) \
270270
((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa))
271-
#define bfa_isr_rspq_ack(__bfa, __queue) do { \
272-
if ((__bfa)->iocfc.hwif.hw_rspq_ack) \
273-
(__bfa)->iocfc.hwif.hw_rspq_ack(__bfa, __queue); \
274-
} while (0)
271+
#define bfa_isr_rspq_ack(__bfa, __queue, __ci) \
272+
((__bfa)->iocfc.hwif.hw_rspq_ack(__bfa, __queue, __ci))
275273
#define bfa_isr_reqq_ack(__bfa, __queue) do { \
276274
if ((__bfa)->iocfc.hwif.hw_reqq_ack) \
277275
(__bfa)->iocfc.hwif.hw_reqq_ack(__bfa, __queue); \
@@ -311,7 +309,7 @@ void bfa_msix_rspq(struct bfa_s *bfa, int vec);
311309
void bfa_msix_lpu_err(struct bfa_s *bfa, int vec);
312310

313311
void bfa_hwcb_reginit(struct bfa_s *bfa);
314-
void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq);
312+
void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci);
315313
void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs);
316314
void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa);
317315
void bfa_hwcb_msix_queue_install(struct bfa_s *bfa);
@@ -324,7 +322,8 @@ void bfa_hwcb_msix_get_rme_range(struct bfa_s *bfa, u32 *start,
324322
void bfa_hwct_reginit(struct bfa_s *bfa);
325323
void bfa_hwct2_reginit(struct bfa_s *bfa);
326324
void bfa_hwct_reqq_ack(struct bfa_s *bfa, int rspq);
327-
void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq);
325+
void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci);
326+
void bfa_hwct2_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci);
328327
void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs);
329328
void bfa_hwct_msix_ctrl_install(struct bfa_s *bfa);
330329
void bfa_hwct_msix_queue_install(struct bfa_s *bfa);

‎drivers/scsi/bfa/bfa_core.c‎

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ bfa_isr_rspq(struct bfa_s *bfa, int qid)
237237
u32 pi, ci;
238238
struct list_head *waitq;
239239

240-
bfa_isr_rspq_ack(bfa, qid);
241-
242240
ci = bfa_rspq_ci(bfa, qid);
243241
pi = bfa_rspq_pi(bfa, qid);
244242

@@ -251,11 +249,9 @@ bfa_isr_rspq(struct bfa_s *bfa, int qid)
251249
}
252250

253251
/*
254-
* update CI
252+
* acknowledge RME completions and update CI
255253
*/
256-
bfa_rspq_ci(bfa, qid) = pi;
257-
writel(pi, bfa->iocfc.bfa_regs.rme_q_ci[qid]);
258-
mmiowb();
254+
bfa_isr_rspq_ack(bfa, qid, ci);
259255

260256
/*
261257
* Resume any pending requests in the corresponding reqq.
@@ -325,23 +321,19 @@ bfa_intx(struct bfa_s *bfa)
325321
int queue;
326322

327323
intr = readl(bfa->iocfc.bfa_regs.intr_status);
328-
if (!intr)
329-
return BFA_FALSE;
330324

331325
qintr = intr & (__HFN_INT_RME_MASK | __HFN_INT_CPE_MASK);
332326
if (qintr)
333327
writel(qintr, bfa->iocfc.bfa_regs.intr_status);
334328

335329
/*
336-
* RME completion queue interrupt
330+
* Unconditional RME completion queue interrupt
337331
*/
338-
qintr = intr & __HFN_INT_RME_MASK;
339-
if (qintr && bfa->queue_process) {
332+
if (bfa->queue_process) {
340333
for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
341334
bfa_isr_rspq(bfa, queue);
342335
}
343336

344-
intr &= ~qintr;
345337
if (!intr)
346338
return BFA_TRUE;
347339

@@ -432,7 +424,8 @@ bfa_msix_lpu_err(struct bfa_s *bfa, int vec)
432424
__HFN_INT_MBOX_LPU1_CT2);
433425
intr &= __HFN_INT_ERR_MASK_CT2;
434426
} else {
435-
halt_isr = intr & __HFN_INT_LL_HALT;
427+
halt_isr = bfa_asic_id_ct(bfa->ioc.pcidev.device_id) ?
428+
(intr & __HFN_INT_LL_HALT) : 0;
436429
pss_isr = intr & __HFN_INT_ERR_PSS;
437430
lpu_isr = intr & (__HFN_INT_MBOX_LPU0 | __HFN_INT_MBOX_LPU1);
438431
intr &= __HFN_INT_ERR_MASK;
@@ -578,7 +571,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
578571
} else {
579572
iocfc->hwif.hw_reginit = bfa_hwcb_reginit;
580573
iocfc->hwif.hw_reqq_ack = NULL;
581-
iocfc->hwif.hw_rspq_ack = NULL;
574+
iocfc->hwif.hw_rspq_ack = bfa_hwcb_rspq_ack;
582575
iocfc->hwif.hw_msix_init = bfa_hwcb_msix_init;
583576
iocfc->hwif.hw_msix_ctrl_install = bfa_hwcb_msix_ctrl_install;
584577
iocfc->hwif.hw_msix_queue_install = bfa_hwcb_msix_queue_install;
@@ -595,7 +588,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
595588
if (bfa_asic_id_ct2(bfa_ioc_devid(&bfa->ioc))) {
596589
iocfc->hwif.hw_reginit = bfa_hwct2_reginit;
597590
iocfc->hwif.hw_isr_mode_set = NULL;
598-
iocfc->hwif.hw_rspq_ack = NULL;
591+
iocfc->hwif.hw_rspq_ack = bfa_hwct2_rspq_ack;
599592
}
600593

601594
iocfc->hwif.hw_reginit(bfa);
@@ -685,7 +678,7 @@ bfa_iocfc_start_submod(struct bfa_s *bfa)
685678

686679
bfa->queue_process = BFA_TRUE;
687680
for (i = 0; i < BFI_IOC_MAX_CQS; i++)
688-
bfa_isr_rspq_ack(bfa, i);
681+
bfa_isr_rspq_ack(bfa, i, bfa_rspq_ci(bfa, i));
689682

690683
for (i = 0; hal_mods[i]; i++)
691684
hal_mods[i]->start(bfa);

‎drivers/scsi/bfa/bfa_hw_cb.c‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,36 @@ bfa_hwcb_reqq_ack_msix(struct bfa_s *bfa, int reqq)
4242
bfa->iocfc.bfa_regs.intr_status);
4343
}
4444

45+
/*
46+
* Actions to respond RME Interrupt for Crossbow ASIC:
47+
* - Write 1 to Interrupt Status register
48+
* INTX - done in bfa_intx()
49+
* MSIX - done in bfa_hwcb_rspq_ack_msix()
50+
* - Update CI (only if new CI)
51+
*/
4552
static void
46-
bfa_hwcb_rspq_ack_msix(struct bfa_s *bfa, int rspq)
53+
bfa_hwcb_rspq_ack_msix(struct bfa_s *bfa, int rspq, u32 ci)
4754
{
4855
writel(__HFN_INT_RME_Q0 << RME_Q_NUM(bfa_ioc_pcifn(&bfa->ioc), rspq),
49-
bfa->iocfc.bfa_regs.intr_status);
56+
bfa->iocfc.bfa_regs.intr_status);
57+
58+
if (bfa_rspq_ci(bfa, rspq) == ci)
59+
return;
60+
61+
bfa_rspq_ci(bfa, rspq) = ci;
62+
writel(ci, bfa->iocfc.bfa_regs.rme_q_ci[rspq]);
63+
mmiowb();
64+
}
65+
66+
void
67+
bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci)
68+
{
69+
if (bfa_rspq_ci(bfa, rspq) == ci)
70+
return;
71+
72+
bfa_rspq_ci(bfa, rspq) = ci;
73+
writel(ci, bfa->iocfc.bfa_regs.rme_q_ci[rspq]);
74+
mmiowb();
5075
}
5176

5277
void
@@ -149,8 +174,13 @@ bfa_hwcb_msix_uninstall(struct bfa_s *bfa)
149174
void
150175
bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix)
151176
{
152-
bfa->iocfc.hwif.hw_reqq_ack = bfa_hwcb_reqq_ack_msix;
153-
bfa->iocfc.hwif.hw_rspq_ack = bfa_hwcb_rspq_ack_msix;
177+
if (msix) {
178+
bfa->iocfc.hwif.hw_reqq_ack = bfa_hwcb_reqq_ack_msix;
179+
bfa->iocfc.hwif.hw_rspq_ack = bfa_hwcb_rspq_ack_msix;
180+
} else {
181+
bfa->iocfc.hwif.hw_reqq_ack = NULL;
182+
bfa->iocfc.hwif.hw_rspq_ack = bfa_hwcb_rspq_ack;
183+
}
154184
}
155185

156186
void

‎drivers/scsi/bfa/bfa_hw_ct.c‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,36 @@ bfa_hwct_reqq_ack(struct bfa_s *bfa, int reqq)
6464
writel(r32, bfa->iocfc.bfa_regs.cpe_q_ctrl[reqq]);
6565
}
6666

67+
/*
68+
* Actions to respond RME Interrupt for Catapult ASIC:
69+
* - Write 1 to Interrupt Status register (INTx only - done in bfa_intx())
70+
* - Acknowledge by writing to RME Queue Control register
71+
* - Update CI
72+
*/
6773
void
68-
bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq)
74+
bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci)
6975
{
7076
u32 r32;
7177

7278
r32 = readl(bfa->iocfc.bfa_regs.rme_q_ctrl[rspq]);
7379
writel(r32, bfa->iocfc.bfa_regs.rme_q_ctrl[rspq]);
80+
81+
bfa_rspq_ci(bfa, rspq) = ci;
82+
writel(ci, bfa->iocfc.bfa_regs.rme_q_ci[rspq]);
83+
mmiowb();
84+
}
85+
86+
/*
87+
* Actions to respond RME Interrupt for Catapult2 ASIC:
88+
* - Write 1 to Interrupt Status register (INTx only - done in bfa_intx())
89+
* - Update CI
90+
*/
91+
void
92+
bfa_hwct2_rspq_ack(struct bfa_s *bfa, int rspq, u32 ci)
93+
{
94+
bfa_rspq_ci(bfa, rspq) = ci;
95+
writel(ci, bfa->iocfc.bfa_regs.rme_q_ci[rspq]);
96+
mmiowb();
7497
}
7598

7699
void

0 commit comments

Comments
 (0)