Skip to content

Commit 3fd4598

Browse files
Krishna GudipatiJames Bottomley
authored andcommitted
[SCSI] bfa: Brocade-1860 Fabric Adapter vHBA support.
- Introduced partitioning of the BFA resources. - Added h/w queue ID in CPE messages, firmware uses h/w queue ID from messages to pick a matching RME queue. - Added message header to bfa_reqq_produce(). h/w queue ID is set in the message header and firmware modules use h/w queue ID from message header instead of from cpqe event. - Made changes to allow using all 256 queues of Brocade-1860 asic. Previously only a single queue per queue group was used. - Added function tag to BFI message header. Only used by FC BFI messages. Used to translate host tag to firmware tag. bfa_lpuid() is changed to bfa_fn_lpu() that encodes both PCI function and port ID in BFI message header. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 10a0737 commit 3fd4598

12 files changed

Lines changed: 278 additions & 118 deletions

File tree

‎drivers/scsi/bfa/bfa.h‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m);
5454
((void *)((struct bfi_msg_s *)((__bfa)->iocfc.req_cq_ba[__reqq].kva) \
5555
+ bfa_reqq_pi((__bfa), (__reqq)))))
5656

57-
#define bfa_reqq_produce(__bfa, __reqq) do { \
57+
#define bfa_reqq_produce(__bfa, __reqq, __mh) do { \
58+
(__mh).mtag.h2i.qid = (__bfa)->iocfc.hw_qid[__reqq];\
5859
(__bfa)->iocfc.req_cq_pi[__reqq]++; \
5960
(__bfa)->iocfc.req_cq_pi[__reqq] &= \
6061
((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1); \
@@ -272,6 +273,7 @@ struct bfa_iocfc_s {
272273
int action;
273274
u32 req_cq_pi[BFI_IOC_MAX_CQS];
274275
u32 rsp_cq_ci[BFI_IOC_MAX_CQS];
276+
u8 hw_qid[BFI_IOC_MAX_CQS];
275277
struct bfa_cb_qe_s init_hcb_qe;
276278
struct bfa_cb_qe_s stop_hcb_qe;
277279
struct bfa_cb_qe_s dis_hcb_qe;
@@ -294,8 +296,8 @@ struct bfa_iocfc_s {
294296
struct bfa_faa_args_s faa_args;
295297
};
296298

297-
#define bfa_lpuid(__bfa) \
298-
bfa_ioc_portid(&(__bfa)->ioc)
299+
#define bfa_fn_lpu(__bfa) \
300+
bfi_fn_lpu(bfa_ioc_pcifn(&(__bfa)->ioc), bfa_ioc_portid(&(__bfa)->ioc))
299301
#define bfa_msix_init(__bfa, __nvecs) \
300302
((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs))
301303
#define bfa_msix_ctrl_install(__bfa) \
@@ -304,11 +306,18 @@ struct bfa_iocfc_s {
304306
((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa))
305307
#define bfa_msix_uninstall(__bfa) \
306308
((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa))
309+
#define bfa_isr_rspq_ack(__bfa, __queue) do { \
310+
if ((__bfa)->iocfc.hwif.hw_rspq_ack) \
311+
(__bfa)->iocfc.hwif.hw_rspq_ack(__bfa, __queue); \
312+
} while (0)
313+
#define bfa_isr_reqq_ack(__bfa, __queue) do { \
314+
if ((__bfa)->iocfc.hwif.hw_reqq_ack) \
315+
(__bfa)->iocfc.hwif.hw_reqq_ack(__bfa, __queue); \
316+
} while (0)
307317
#define bfa_isr_mode_set(__bfa, __msix) do { \
308318
if ((__bfa)->iocfc.hwif.hw_isr_mode_set) \
309319
(__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix); \
310320
} while (0)
311-
312321
#define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \
313322
((__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, \
314323
__nvecs, __maxvec))
@@ -340,7 +349,6 @@ void bfa_msix_rspq(struct bfa_s *bfa, int vec);
340349
void bfa_msix_lpu_err(struct bfa_s *bfa, int vec);
341350

342351
void bfa_hwcb_reginit(struct bfa_s *bfa);
343-
void bfa_hwcb_reqq_ack(struct bfa_s *bfa, int rspq);
344352
void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq);
345353
void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs);
346354
void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa);

‎drivers/scsi/bfa/bfa_core.c‎

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ bfa_isr_rspq(struct bfa_s *bfa, int qid)
203203
u32 pi, ci;
204204
struct list_head *waitq;
205205

206-
bfa->iocfc.hwif.hw_rspq_ack(bfa, qid);
206+
bfa_isr_rspq_ack(bfa, qid);
207207

208208
ci = bfa_rspq_ci(bfa, qid);
209209
pi = bfa_rspq_pi(bfa, qid);
@@ -236,9 +236,7 @@ bfa_isr_reqq(struct bfa_s *bfa, int qid)
236236
{
237237
struct list_head *waitq;
238238

239-
qid &= (BFI_IOC_MAX_CQS - 1);
240-
241-
bfa->iocfc.hwif.hw_reqq_ack(bfa, qid);
239+
bfa_isr_reqq_ack(bfa, qid);
242240

243241
/*
244242
* Resume any pending requests in the corresponding reqq.
@@ -296,16 +294,19 @@ bfa_intx(struct bfa_s *bfa)
296294
if (!intr)
297295
return BFA_FALSE;
298296

297+
qintr = intr & (__HFN_INT_RME_MASK | __HFN_INT_CPE_MASK);
298+
if (qintr)
299+
writel(qintr, bfa->iocfc.bfa_regs.intr_status);
300+
299301
/*
300302
* RME completion queue interrupt
301303
*/
302304
qintr = intr & __HFN_INT_RME_MASK;
303-
writel(qintr, bfa->iocfc.bfa_regs.intr_status);
304-
305-
for (queue = 0; queue < BFI_IOC_MAX_CQS_ASIC; queue++) {
306-
if ((intr & (__HFN_INT_RME_Q0 << queue)) && bfa->queue_process)
307-
bfa_isr_rspq(bfa, queue & (BFI_IOC_MAX_CQS - 1));
305+
if (qintr && bfa->queue_process) {
306+
for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
307+
bfa_isr_rspq(bfa, queue);
308308
}
309+
309310
intr &= ~qintr;
310311
if (!intr)
311312
return BFA_TRUE;
@@ -314,11 +315,9 @@ bfa_intx(struct bfa_s *bfa)
314315
* CPE completion queue interrupt
315316
*/
316317
qintr = intr & __HFN_INT_CPE_MASK;
317-
writel(qintr, bfa->iocfc.bfa_regs.intr_status);
318-
319-
for (queue = 0; queue < BFI_IOC_MAX_CQS_ASIC; queue++) {
320-
if ((intr & (__HFN_INT_CPE_Q0 << queue)) && bfa->queue_process)
321-
bfa_isr_reqq(bfa, queue & (BFI_IOC_MAX_CQS - 1));
318+
if (qintr && bfa->queue_process) {
319+
for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
320+
bfa_isr_reqq(bfa, queue);
322321
}
323322
intr &= ~qintr;
324323
if (!intr)
@@ -542,7 +541,7 @@ bfa_iocfc_send_cfg(void *bfa_arg)
542541
* dma map IOC configuration itself
543542
*/
544543
bfi_h2i_set(cfg_req.mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_CFG_REQ,
545-
bfa_lpuid(bfa));
544+
bfa_fn_lpu(bfa));
546545
bfa_dma_be_addr_set(cfg_req.ioc_cfg_dma_addr, iocfc->cfg_info.pa);
547546

548547
bfa_ioc_mbox_send(&bfa->ioc, &cfg_req,
@@ -579,8 +578,8 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
579578
iocfc->hwif.cpe_vec_q0 = BFI_MSIX_CPE_QMIN_CT;
580579
} else {
581580
iocfc->hwif.hw_reginit = bfa_hwcb_reginit;
582-
iocfc->hwif.hw_reqq_ack = bfa_hwcb_reqq_ack;
583-
iocfc->hwif.hw_rspq_ack = bfa_hwcb_rspq_ack;
581+
iocfc->hwif.hw_reqq_ack = NULL;
582+
iocfc->hwif.hw_rspq_ack = NULL;
584583
iocfc->hwif.hw_msix_init = bfa_hwcb_msix_init;
585584
iocfc->hwif.hw_msix_ctrl_install = bfa_hwcb_msix_ctrl_install;
586585
iocfc->hwif.hw_msix_queue_install = bfa_hwcb_msix_queue_install;
@@ -597,6 +596,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
597596
if (bfa_asic_id_ct2(bfa_ioc_devid(&bfa->ioc))) {
598597
iocfc->hwif.hw_reginit = bfa_hwct2_reginit;
599598
iocfc->hwif.hw_isr_mode_set = NULL;
599+
iocfc->hwif.hw_rspq_ack = NULL;
600600
}
601601

602602
iocfc->hwif.hw_reginit(bfa);
@@ -701,7 +701,7 @@ bfa_iocfc_start_submod(struct bfa_s *bfa)
701701

702702
bfa->queue_process = BFA_TRUE;
703703
for (i = 0; i < BFI_IOC_MAX_CQS; i++)
704-
bfa->iocfc.hwif.hw_rspq_ack(bfa, i);
704+
bfa_isr_rspq_ack(bfa, i);
705705

706706
for (i = 0; hal_mods[i]; i++)
707707
hal_mods[i]->start(bfa);
@@ -768,6 +768,7 @@ bfa_iocfc_qreg(struct bfa_s *bfa, struct bfi_iocfc_qreg_s *qreg)
768768
void __iomem *kva = bfa_ioc_bar0(&bfa->ioc);
769769

770770
for (i = 0; i < BFI_IOC_MAX_CQS; i++) {
771+
bfa->iocfc.hw_qid[i] = qreg->hw_qid[i];
771772
r->cpe_q_ci[i] = kva + be32_to_cpu(qreg->cpe_q_ci_off[i]);
772773
r->cpe_q_pi[i] = kva + be32_to_cpu(qreg->cpe_q_pi_off[i]);
773774
r->cpe_q_ctrl[i] = kva + be32_to_cpu(qreg->cpe_qctl_off[i]);
@@ -777,6 +778,16 @@ bfa_iocfc_qreg(struct bfa_s *bfa, struct bfi_iocfc_qreg_s *qreg)
777778
}
778779
}
779780

781+
static void
782+
bfa_iocfc_res_recfg(struct bfa_s *bfa, struct bfa_iocfc_fwcfg_s *fwcfg)
783+
{
784+
bfa_fcxp_res_recfg(bfa, fwcfg->num_fcxp_reqs);
785+
bfa_uf_res_recfg(bfa, fwcfg->num_uf_bufs);
786+
bfa_rport_res_recfg(bfa, fwcfg->num_rports);
787+
bfa_fcp_res_recfg(bfa, fwcfg->num_ioim_reqs);
788+
bfa_tskim_res_recfg(bfa, fwcfg->num_tskim_reqs);
789+
}
790+
780791
/*
781792
* Update BFA configuration from firmware configuration.
782793
*/
@@ -802,6 +813,11 @@ bfa_iocfc_cfgrsp(struct bfa_s *bfa)
802813
*/
803814
bfa_iocfc_qreg(bfa, &cfgrsp->qreg);
804815

816+
/*
817+
* Re-configure resources as learnt from Firmware
818+
*/
819+
bfa_iocfc_res_recfg(bfa, fwcfg);
820+
805821
/*
806822
* Install MSIX queue handlers
807823
*/
@@ -880,7 +896,7 @@ bfa_faa_enable(struct bfa_s *bfa, bfa_cb_iocfc_t cbfn, void *cbarg)
880896

881897
memset(&faa_enable_req, 0, sizeof(struct bfi_faa_en_dis_s));
882898
bfi_h2i_set(faa_enable_req.mh, BFI_MC_IOCFC,
883-
BFI_IOCFC_H2I_FAA_ENABLE_REQ, bfa_lpuid(bfa));
899+
BFI_IOCFC_H2I_FAA_ENABLE_REQ, bfa_fn_lpu(bfa));
884900

885901
bfa_ioc_mbox_send(&bfa->ioc, &faa_enable_req,
886902
sizeof(struct bfi_faa_en_dis_s));
@@ -914,7 +930,7 @@ bfa_faa_disable(struct bfa_s *bfa, bfa_cb_iocfc_t cbfn,
914930

915931
memset(&faa_disable_req, 0, sizeof(struct bfi_faa_en_dis_s));
916932
bfi_h2i_set(faa_disable_req.mh, BFI_MC_IOCFC,
917-
BFI_IOCFC_H2I_FAA_DISABLE_REQ, bfa_lpuid(bfa));
933+
BFI_IOCFC_H2I_FAA_DISABLE_REQ, bfa_fn_lpu(bfa));
918934

919935
bfa_ioc_mbox_send(&bfa->ioc, &faa_disable_req,
920936
sizeof(struct bfi_faa_en_dis_s));
@@ -944,7 +960,7 @@ bfa_faa_query(struct bfa_s *bfa, struct bfa_faa_attr_s *attr,
944960
iocfc->faa_args.busy = BFA_TRUE;
945961
memset(&faa_attr_req, 0, sizeof(struct bfi_faa_query_s));
946962
bfi_h2i_set(faa_attr_req.mh, BFI_MC_IOCFC,
947-
BFI_IOCFC_H2I_FAA_QUERY_REQ, bfa_lpuid(bfa));
963+
BFI_IOCFC_H2I_FAA_QUERY_REQ, bfa_fn_lpu(bfa));
948964

949965
bfa_ioc_mbox_send(&bfa->ioc, &faa_attr_req,
950966
sizeof(struct bfi_faa_query_s));
@@ -1230,15 +1246,15 @@ bfa_iocfc_israttr_set(struct bfa_s *bfa, struct bfa_iocfc_intr_attr_s *attr)
12301246
return BFA_STATUS_DEVBUSY;
12311247

12321248
bfi_h2i_set(m->mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_SET_INTR_REQ,
1233-
bfa_lpuid(bfa));
1249+
bfa_fn_lpu(bfa));
12341250
m->coalesce = iocfc->cfginfo->intr_attr.coalesce;
12351251
m->delay = iocfc->cfginfo->intr_attr.delay;
12361252
m->latency = iocfc->cfginfo->intr_attr.latency;
12371253

12381254
bfa_trc(bfa, attr->delay);
12391255
bfa_trc(bfa, attr->latency);
12401256

1241-
bfa_reqq_produce(bfa, BFA_REQQ_IOC);
1257+
bfa_reqq_produce(bfa, BFA_REQQ_IOC, m->mh);
12421258
return BFA_STATUS_OK;
12431259
}
12441260

0 commit comments

Comments
 (0)