aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2011-06-24 23:24:08 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-06-29 18:02:28 -0400
commit3fd459804ff8e002db2671900debd0fc6dc6c443 (patch)
tree34d71220521bedb451182ae98a32c16906881503
parent10a07379247078448c076690657a076076bf89aa (diff)
[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>
-rw-r--r--drivers/scsi/bfa/bfa.h18
-rw-r--r--drivers/scsi/bfa/bfa_core.c62
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.c64
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.h4
-rw-r--r--drivers/scsi/bfa/bfa_fcs.c2
-rw-r--r--drivers/scsi/bfa/bfa_fcs_lport.c4
-rw-r--r--drivers/scsi/bfa/bfa_hw_cb.c10
-rw-r--r--drivers/scsi/bfa/bfa_ioc_ct.c4
-rw-r--r--drivers/scsi/bfa/bfa_svc.c188
-rw-r--r--drivers/scsi/bfa/bfa_svc.h11
-rw-r--r--drivers/scsi/bfa/bfi.h10
-rw-r--r--drivers/scsi/bfa/bfi_ms.h19
12 files changed, 278 insertions, 118 deletions
diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h
index 42769bc07ff4..ee072d99b8f9 100644
--- a/drivers/scsi/bfa/bfa.h
+++ b/drivers/scsi/bfa/bfa.h
@@ -54,7 +54,8 @@ void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m);
54 ((void *)((struct bfi_msg_s *)((__bfa)->iocfc.req_cq_ba[__reqq].kva) \ 54 ((void *)((struct bfi_msg_s *)((__bfa)->iocfc.req_cq_ba[__reqq].kva) \
55 + bfa_reqq_pi((__bfa), (__reqq))))) 55 + bfa_reqq_pi((__bfa), (__reqq)))))
56 56
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];\
58 (__bfa)->iocfc.req_cq_pi[__reqq]++; \ 59 (__bfa)->iocfc.req_cq_pi[__reqq]++; \
59 (__bfa)->iocfc.req_cq_pi[__reqq] &= \ 60 (__bfa)->iocfc.req_cq_pi[__reqq] &= \
60 ((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1); \ 61 ((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1); \
@@ -272,6 +273,7 @@ struct bfa_iocfc_s {
272 int action; 273 int action;
273 u32 req_cq_pi[BFI_IOC_MAX_CQS]; 274 u32 req_cq_pi[BFI_IOC_MAX_CQS];
274 u32 rsp_cq_ci[BFI_IOC_MAX_CQS]; 275 u32 rsp_cq_ci[BFI_IOC_MAX_CQS];
276 u8 hw_qid[BFI_IOC_MAX_CQS];
275 struct bfa_cb_qe_s init_hcb_qe; 277 struct bfa_cb_qe_s init_hcb_qe;
276 struct bfa_cb_qe_s stop_hcb_qe; 278 struct bfa_cb_qe_s stop_hcb_qe;
277 struct bfa_cb_qe_s dis_hcb_qe; 279 struct bfa_cb_qe_s dis_hcb_qe;
@@ -294,8 +296,8 @@ struct bfa_iocfc_s {
294 struct bfa_faa_args_s faa_args; 296 struct bfa_faa_args_s faa_args;
295}; 297};
296 298
297#define bfa_lpuid(__bfa) \ 299#define bfa_fn_lpu(__bfa) \
298 bfa_ioc_portid(&(__bfa)->ioc) 300 bfi_fn_lpu(bfa_ioc_pcifn(&(__bfa)->ioc), bfa_ioc_portid(&(__bfa)->ioc))
299#define bfa_msix_init(__bfa, __nvecs) \ 301#define bfa_msix_init(__bfa, __nvecs) \
300 ((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs)) 302 ((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs))
301#define bfa_msix_ctrl_install(__bfa) \ 303#define bfa_msix_ctrl_install(__bfa) \
@@ -304,11 +306,18 @@ struct bfa_iocfc_s {
304 ((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa)) 306 ((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa))
305#define bfa_msix_uninstall(__bfa) \ 307#define bfa_msix_uninstall(__bfa) \
306 ((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa)) 308 ((__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)
307#define bfa_isr_mode_set(__bfa, __msix) do { \ 317#define bfa_isr_mode_set(__bfa, __msix) do { \
308 if ((__bfa)->iocfc.hwif.hw_isr_mode_set) \ 318 if ((__bfa)->iocfc.hwif.hw_isr_mode_set) \
309 (__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix); \ 319 (__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix); \
310} while (0) 320} while (0)
311
312#define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \ 321#define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \
313 ((__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, \ 322 ((__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, \
314 __nvecs, __maxvec)) 323 __nvecs, __maxvec))
@@ -340,7 +349,6 @@ void bfa_msix_rspq(struct bfa_s *bfa, int vec);
340void bfa_msix_lpu_err(struct bfa_s *bfa, int vec); 349void bfa_msix_lpu_err(struct bfa_s *bfa, int vec);
341 350
342void bfa_hwcb_reginit(struct bfa_s *bfa); 351void bfa_hwcb_reginit(struct bfa_s *bfa);
343void bfa_hwcb_reqq_ack(struct bfa_s *bfa, int rspq);
344void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq); 352void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq);
345void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs); 353void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs);
346void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa); 354void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa);
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index f949844aa110..0048fc8646b4 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -203,7 +203,7 @@ bfa_isr_rspq(struct bfa_s *bfa, int qid)
203 u32 pi, ci; 203 u32 pi, ci;
204 struct list_head *waitq; 204 struct list_head *waitq;
205 205
206 bfa->iocfc.hwif.hw_rspq_ack(bfa, qid); 206 bfa_isr_rspq_ack(bfa, qid);
207 207
208 ci = bfa_rspq_ci(bfa, qid); 208 ci = bfa_rspq_ci(bfa, qid);
209 pi = bfa_rspq_pi(bfa, qid); 209 pi = bfa_rspq_pi(bfa, qid);
@@ -236,9 +236,7 @@ bfa_isr_reqq(struct bfa_s *bfa, int qid)
236{ 236{
237 struct list_head *waitq; 237 struct list_head *waitq;
238 238
239 qid &= (BFI_IOC_MAX_CQS - 1); 239 bfa_isr_reqq_ack(bfa, qid);
240
241 bfa->iocfc.hwif.hw_reqq_ack(bfa, qid);
242 240
243 /* 241 /*
244 * Resume any pending requests in the corresponding reqq. 242 * Resume any pending requests in the corresponding reqq.
@@ -296,16 +294,19 @@ bfa_intx(struct bfa_s *bfa)
296 if (!intr) 294 if (!intr)
297 return BFA_FALSE; 295 return BFA_FALSE;
298 296
297 qintr = intr & (__HFN_INT_RME_MASK | __HFN_INT_CPE_MASK);
298 if (qintr)
299 writel(qintr, bfa->iocfc.bfa_regs.intr_status);
300
299 /* 301 /*
300 * RME completion queue interrupt 302 * RME completion queue interrupt
301 */ 303 */
302 qintr = intr & __HFN_INT_RME_MASK; 304 qintr = intr & __HFN_INT_RME_MASK;
303 writel(qintr, bfa->iocfc.bfa_regs.intr_status); 305 if (qintr && bfa->queue_process) {
304 306 for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
305 for (queue = 0; queue < BFI_IOC_MAX_CQS_ASIC; queue++) { 307 bfa_isr_rspq(bfa, queue);
306 if ((intr & (__HFN_INT_RME_Q0 << queue)) && bfa->queue_process)
307 bfa_isr_rspq(bfa, queue & (BFI_IOC_MAX_CQS - 1));
308 } 308 }
309
309 intr &= ~qintr; 310 intr &= ~qintr;
310 if (!intr) 311 if (!intr)
311 return BFA_TRUE; 312 return BFA_TRUE;
@@ -314,11 +315,9 @@ bfa_intx(struct bfa_s *bfa)
314 * CPE completion queue interrupt 315 * CPE completion queue interrupt
315 */ 316 */
316 qintr = intr & __HFN_INT_CPE_MASK; 317 qintr = intr & __HFN_INT_CPE_MASK;
317 writel(qintr, bfa->iocfc.bfa_regs.intr_status); 318 if (qintr && bfa->queue_process) {
318 319 for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
319 for (queue = 0; queue < BFI_IOC_MAX_CQS_ASIC; queue++) { 320 bfa_isr_reqq(bfa, queue);
320 if ((intr & (__HFN_INT_CPE_Q0 << queue)) && bfa->queue_process)
321 bfa_isr_reqq(bfa, queue & (BFI_IOC_MAX_CQS - 1));
322 } 321 }
323 intr &= ~qintr; 322 intr &= ~qintr;
324 if (!intr) 323 if (!intr)
@@ -542,7 +541,7 @@ bfa_iocfc_send_cfg(void *bfa_arg)
542 * dma map IOC configuration itself 541 * dma map IOC configuration itself
543 */ 542 */
544 bfi_h2i_set(cfg_req.mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_CFG_REQ, 543 bfi_h2i_set(cfg_req.mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_CFG_REQ,
545 bfa_lpuid(bfa)); 544 bfa_fn_lpu(bfa));
546 bfa_dma_be_addr_set(cfg_req.ioc_cfg_dma_addr, iocfc->cfg_info.pa); 545 bfa_dma_be_addr_set(cfg_req.ioc_cfg_dma_addr, iocfc->cfg_info.pa);
547 546
548 bfa_ioc_mbox_send(&bfa->ioc, &cfg_req, 547 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,
579 iocfc->hwif.cpe_vec_q0 = BFI_MSIX_CPE_QMIN_CT; 578 iocfc->hwif.cpe_vec_q0 = BFI_MSIX_CPE_QMIN_CT;
580 } else { 579 } else {
581 iocfc->hwif.hw_reginit = bfa_hwcb_reginit; 580 iocfc->hwif.hw_reginit = bfa_hwcb_reginit;
582 iocfc->hwif.hw_reqq_ack = bfa_hwcb_reqq_ack; 581 iocfc->hwif.hw_reqq_ack = NULL;
583 iocfc->hwif.hw_rspq_ack = bfa_hwcb_rspq_ack; 582 iocfc->hwif.hw_rspq_ack = NULL;
584 iocfc->hwif.hw_msix_init = bfa_hwcb_msix_init; 583 iocfc->hwif.hw_msix_init = bfa_hwcb_msix_init;
585 iocfc->hwif.hw_msix_ctrl_install = bfa_hwcb_msix_ctrl_install; 584 iocfc->hwif.hw_msix_ctrl_install = bfa_hwcb_msix_ctrl_install;
586 iocfc->hwif.hw_msix_queue_install = bfa_hwcb_msix_queue_install; 585 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,
597 if (bfa_asic_id_ct2(bfa_ioc_devid(&bfa->ioc))) { 596 if (bfa_asic_id_ct2(bfa_ioc_devid(&bfa->ioc))) {
598 iocfc->hwif.hw_reginit = bfa_hwct2_reginit; 597 iocfc->hwif.hw_reginit = bfa_hwct2_reginit;
599 iocfc->hwif.hw_isr_mode_set = NULL; 598 iocfc->hwif.hw_isr_mode_set = NULL;
599 iocfc->hwif.hw_rspq_ack = NULL;
600 } 600 }
601 601
602 iocfc->hwif.hw_reginit(bfa); 602 iocfc->hwif.hw_reginit(bfa);
@@ -701,7 +701,7 @@ bfa_iocfc_start_submod(struct bfa_s *bfa)
701 701
702 bfa->queue_process = BFA_TRUE; 702 bfa->queue_process = BFA_TRUE;
703 for (i = 0; i < BFI_IOC_MAX_CQS; i++) 703 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);
705 705
706 for (i = 0; hal_mods[i]; i++) 706 for (i = 0; hal_mods[i]; i++)
707 hal_mods[i]->start(bfa); 707 hal_mods[i]->start(bfa);
@@ -768,6 +768,7 @@ bfa_iocfc_qreg(struct bfa_s *bfa, struct bfi_iocfc_qreg_s *qreg)
768 void __iomem *kva = bfa_ioc_bar0(&bfa->ioc); 768 void __iomem *kva = bfa_ioc_bar0(&bfa->ioc);
769 769
770 for (i = 0; i < BFI_IOC_MAX_CQS; i++) { 770 for (i = 0; i < BFI_IOC_MAX_CQS; i++) {
771 bfa->iocfc.hw_qid[i] = qreg->hw_qid[i];
771 r->cpe_q_ci[i] = kva + be32_to_cpu(qreg->cpe_q_ci_off[i]); 772 r->cpe_q_ci[i] = kva + be32_to_cpu(qreg->cpe_q_ci_off[i]);
772 r->cpe_q_pi[i] = kva + be32_to_cpu(qreg->cpe_q_pi_off[i]); 773 r->cpe_q_pi[i] = kva + be32_to_cpu(qreg->cpe_q_pi_off[i]);
773 r->cpe_q_ctrl[i] = kva + be32_to_cpu(qreg->cpe_qctl_off[i]); 774 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)
777 } 778 }
778} 779}
779 780
781static void
782bfa_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
780/* 791/*
781 * Update BFA configuration from firmware configuration. 792 * Update BFA configuration from firmware configuration.
782 */ 793 */
@@ -803,6 +814,11 @@ bfa_iocfc_cfgrsp(struct bfa_s *bfa)
803 bfa_iocfc_qreg(bfa, &cfgrsp->qreg); 814 bfa_iocfc_qreg(bfa, &cfgrsp->qreg);
804 815
805 /* 816 /*
817 * Re-configure resources as learnt from Firmware
818 */
819 bfa_iocfc_res_recfg(bfa, fwcfg);
820
821 /*
806 * Install MSIX queue handlers 822 * Install MSIX queue handlers
807 */ 823 */
808 bfa_msix_queue_install(bfa); 824 bfa_msix_queue_install(bfa);
@@ -880,7 +896,7 @@ bfa_faa_enable(struct bfa_s *bfa, bfa_cb_iocfc_t cbfn, void *cbarg)
880 896
881 memset(&faa_enable_req, 0, sizeof(struct bfi_faa_en_dis_s)); 897 memset(&faa_enable_req, 0, sizeof(struct bfi_faa_en_dis_s));
882 bfi_h2i_set(faa_enable_req.mh, BFI_MC_IOCFC, 898 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));
884 900
885 bfa_ioc_mbox_send(&bfa->ioc, &faa_enable_req, 901 bfa_ioc_mbox_send(&bfa->ioc, &faa_enable_req,
886 sizeof(struct bfi_faa_en_dis_s)); 902 sizeof(struct bfi_faa_en_dis_s));
@@ -914,7 +930,7 @@ bfa_faa_disable(struct bfa_s *bfa, bfa_cb_iocfc_t cbfn,
914 930
915 memset(&faa_disable_req, 0, sizeof(struct bfi_faa_en_dis_s)); 931 memset(&faa_disable_req, 0, sizeof(struct bfi_faa_en_dis_s));
916 bfi_h2i_set(faa_disable_req.mh, BFI_MC_IOCFC, 932 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));
918 934
919 bfa_ioc_mbox_send(&bfa->ioc, &faa_disable_req, 935 bfa_ioc_mbox_send(&bfa->ioc, &faa_disable_req,
920 sizeof(struct bfi_faa_en_dis_s)); 936 sizeof(struct bfi_faa_en_dis_s));
@@ -944,7 +960,7 @@ bfa_faa_query(struct bfa_s *bfa, struct bfa_faa_attr_s *attr,
944 iocfc->faa_args.busy = BFA_TRUE; 960 iocfc->faa_args.busy = BFA_TRUE;
945 memset(&faa_attr_req, 0, sizeof(struct bfi_faa_query_s)); 961 memset(&faa_attr_req, 0, sizeof(struct bfi_faa_query_s));
946 bfi_h2i_set(faa_attr_req.mh, BFI_MC_IOCFC, 962 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));
948 964
949 bfa_ioc_mbox_send(&bfa->ioc, &faa_attr_req, 965 bfa_ioc_mbox_send(&bfa->ioc, &faa_attr_req,
950 sizeof(struct bfi_faa_query_s)); 966 sizeof(struct bfi_faa_query_s));
@@ -1230,7 +1246,7 @@ bfa_iocfc_israttr_set(struct bfa_s *bfa, struct bfa_iocfc_intr_attr_s *attr)
1230 return BFA_STATUS_DEVBUSY; 1246 return BFA_STATUS_DEVBUSY;
1231 1247
1232 bfi_h2i_set(m->mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_SET_INTR_REQ, 1248 bfi_h2i_set(m->mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_SET_INTR_REQ,
1233 bfa_lpuid(bfa)); 1249 bfa_fn_lpu(bfa));
1234 m->coalesce = iocfc->cfginfo->intr_attr.coalesce; 1250 m->coalesce = iocfc->cfginfo->intr_attr.coalesce;
1235 m->delay = iocfc->cfginfo->intr_attr.delay; 1251 m->delay = iocfc->cfginfo->intr_attr.delay;
1236 m->latency = iocfc->cfginfo->intr_attr.latency; 1252 m->latency = iocfc->cfginfo->intr_attr.latency;
@@ -1238,7 +1254,7 @@ bfa_iocfc_israttr_set(struct bfa_s *bfa, struct bfa_iocfc_intr_attr_s *attr)
1238 bfa_trc(bfa, attr->delay); 1254 bfa_trc(bfa, attr->delay);
1239 bfa_trc(bfa, attr->latency); 1255 bfa_trc(bfa, attr->latency);
1240 1256
1241 bfa_reqq_produce(bfa, BFA_REQQ_IOC); 1257 bfa_reqq_produce(bfa, BFA_REQQ_IOC, m->mh);
1242 return BFA_STATUS_OK; 1258 return BFA_STATUS_OK;
1243} 1259}
1244 1260
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c
index 76d9a00ffb6a..eb14fd6193a0 100644
--- a/drivers/scsi/bfa/bfa_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcpim.c
@@ -340,6 +340,9 @@ bfa_fcpim_iocdisable(struct bfa_fcp_mod_s *fcp)
340 struct bfa_itnim_s *itnim; 340 struct bfa_itnim_s *itnim;
341 struct list_head *qe, *qen; 341 struct list_head *qe, *qen;
342 342
343 /* Enqueue unused ioim resources to free_q */
344 list_splice_tail_init(&fcpim->tskim_unused_q, &fcpim->tskim_free_q);
345
343 list_for_each_safe(qe, qen, &fcpim->itnim_q) { 346 list_for_each_safe(qe, qen, &fcpim->itnim_q) {
344 itnim = (struct bfa_itnim_s *) qe; 347 itnim = (struct bfa_itnim_s *) qe;
345 bfa_itnim_iocdisable(itnim); 348 bfa_itnim_iocdisable(itnim);
@@ -1036,7 +1039,7 @@ bfa_itnim_send_fwcreate(struct bfa_itnim_s *itnim)
1036 } 1039 }
1037 1040
1038 bfi_h2i_set(m->mh, BFI_MC_ITN, BFI_ITN_H2I_CREATE_REQ, 1041 bfi_h2i_set(m->mh, BFI_MC_ITN, BFI_ITN_H2I_CREATE_REQ,
1039 bfa_lpuid(itnim->bfa)); 1042 bfa_fn_lpu(itnim->bfa));
1040 m->fw_handle = itnim->rport->fw_handle; 1043 m->fw_handle = itnim->rport->fw_handle;
1041 m->class = FC_CLASS_3; 1044 m->class = FC_CLASS_3;
1042 m->seq_rec = itnim->seq_rec; 1045 m->seq_rec = itnim->seq_rec;
@@ -1046,7 +1049,7 @@ bfa_itnim_send_fwcreate(struct bfa_itnim_s *itnim)
1046 /* 1049 /*
1047 * queue I/O message to firmware 1050 * queue I/O message to firmware
1048 */ 1051 */
1049 bfa_reqq_produce(itnim->bfa, itnim->reqq); 1052 bfa_reqq_produce(itnim->bfa, itnim->reqq, m->mh);
1050 return BFA_TRUE; 1053 return BFA_TRUE;
1051} 1054}
1052 1055
@@ -1065,14 +1068,14 @@ bfa_itnim_send_fwdelete(struct bfa_itnim_s *itnim)
1065 } 1068 }
1066 1069
1067 bfi_h2i_set(m->mh, BFI_MC_ITN, BFI_ITN_H2I_DELETE_REQ, 1070 bfi_h2i_set(m->mh, BFI_MC_ITN, BFI_ITN_H2I_DELETE_REQ,
1068 bfa_lpuid(itnim->bfa)); 1071 bfa_fn_lpu(itnim->bfa));
1069 m->fw_handle = itnim->rport->fw_handle; 1072 m->fw_handle = itnim->rport->fw_handle;
1070 bfa_stats(itnim, fw_delete); 1073 bfa_stats(itnim, fw_delete);
1071 1074
1072 /* 1075 /*
1073 * queue I/O message to firmware 1076 * queue I/O message to firmware
1074 */ 1077 */
1075 bfa_reqq_produce(itnim->bfa, itnim->reqq); 1078 bfa_reqq_produce(itnim->bfa, itnim->reqq, m->mh);
1076 return BFA_TRUE; 1079 return BFA_TRUE;
1077} 1080}
1078 1081
@@ -2171,12 +2174,12 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
2171 */ 2174 */
2172 switch (m->cmnd.iodir) { 2175 switch (m->cmnd.iodir) {
2173 case FCP_IODIR_READ: 2176 case FCP_IODIR_READ:
2174 bfi_h2i_set(m->mh, BFI_MC_IOIM_READ, 0, bfa_lpuid(ioim->bfa)); 2177 bfi_h2i_set(m->mh, BFI_MC_IOIM_READ, 0, bfa_fn_lpu(ioim->bfa));
2175 bfa_stats(itnim, input_reqs); 2178 bfa_stats(itnim, input_reqs);
2176 ioim->itnim->stats.rd_throughput += fcp_dl; 2179 ioim->itnim->stats.rd_throughput += fcp_dl;
2177 break; 2180 break;
2178 case FCP_IODIR_WRITE: 2181 case FCP_IODIR_WRITE:
2179 bfi_h2i_set(m->mh, BFI_MC_IOIM_WRITE, 0, bfa_lpuid(ioim->bfa)); 2182 bfi_h2i_set(m->mh, BFI_MC_IOIM_WRITE, 0, bfa_fn_lpu(ioim->bfa));
2180 bfa_stats(itnim, output_reqs); 2183 bfa_stats(itnim, output_reqs);
2181 ioim->itnim->stats.wr_throughput += fcp_dl; 2184 ioim->itnim->stats.wr_throughput += fcp_dl;
2182 break; 2185 break;
@@ -2184,16 +2187,16 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
2184 bfa_stats(itnim, input_reqs); 2187 bfa_stats(itnim, input_reqs);
2185 bfa_stats(itnim, output_reqs); 2188 bfa_stats(itnim, output_reqs);
2186 default: 2189 default:
2187 bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); 2190 bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_fn_lpu(ioim->bfa));
2188 } 2191 }
2189 if (itnim->seq_rec || 2192 if (itnim->seq_rec ||
2190 (scsi_bufflen(cmnd) & (sizeof(u32) - 1))) 2193 (scsi_bufflen(cmnd) & (sizeof(u32) - 1)))
2191 bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); 2194 bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_fn_lpu(ioim->bfa));
2192 2195
2193 /* 2196 /*
2194 * queue I/O message to firmware 2197 * queue I/O message to firmware
2195 */ 2198 */
2196 bfa_reqq_produce(ioim->bfa, ioim->reqq); 2199 bfa_reqq_produce(ioim->bfa, ioim->reqq, m->mh);
2197 return BFA_TRUE; 2200 return BFA_TRUE;
2198} 2201}
2199 2202
@@ -2251,14 +2254,14 @@ bfa_ioim_send_abort(struct bfa_ioim_s *ioim)
2251 else 2254 else
2252 msgop = BFI_IOIM_H2I_IOCLEANUP_REQ; 2255 msgop = BFI_IOIM_H2I_IOCLEANUP_REQ;
2253 2256
2254 bfi_h2i_set(m->mh, BFI_MC_IOIM, msgop, bfa_lpuid(ioim->bfa)); 2257 bfi_h2i_set(m->mh, BFI_MC_IOIM, msgop, bfa_fn_lpu(ioim->bfa));
2255 m->io_tag = cpu_to_be16(ioim->iotag); 2258 m->io_tag = cpu_to_be16(ioim->iotag);
2256 m->abort_tag = ++ioim->abort_tag; 2259 m->abort_tag = ++ioim->abort_tag;
2257 2260
2258 /* 2261 /*
2259 * queue I/O message to firmware 2262 * queue I/O message to firmware
2260 */ 2263 */
2261 bfa_reqq_produce(ioim->bfa, ioim->reqq); 2264 bfa_reqq_produce(ioim->bfa, ioim->reqq, m->mh);
2262 return BFA_TRUE; 2265 return BFA_TRUE;
2263} 2266}
2264 2267
@@ -2998,7 +3001,7 @@ bfa_tskim_send(struct bfa_tskim_s *tskim)
2998 * build i/o request message next 3001 * build i/o request message next
2999 */ 3002 */
3000 bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_TM_REQ, 3003 bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_TM_REQ,
3001 bfa_lpuid(tskim->bfa)); 3004 bfa_fn_lpu(tskim->bfa));
3002 3005
3003 m->tsk_tag = cpu_to_be16(tskim->tsk_tag); 3006 m->tsk_tag = cpu_to_be16(tskim->tsk_tag);
3004 m->itn_fhdl = tskim->itnim->rport->fw_handle; 3007 m->itn_fhdl = tskim->itnim->rport->fw_handle;
@@ -3009,7 +3012,7 @@ bfa_tskim_send(struct bfa_tskim_s *tskim)
3009 /* 3012 /*
3010 * queue I/O message to firmware 3013 * queue I/O message to firmware
3011 */ 3014 */
3012 bfa_reqq_produce(tskim->bfa, itnim->reqq); 3015 bfa_reqq_produce(tskim->bfa, itnim->reqq, m->mh);
3013 return BFA_TRUE; 3016 return BFA_TRUE;
3014} 3017}
3015 3018
@@ -3033,14 +3036,14 @@ bfa_tskim_send_abort(struct bfa_tskim_s *tskim)
3033 * build i/o request message next 3036 * build i/o request message next
3034 */ 3037 */
3035 bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_ABORT_REQ, 3038 bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_ABORT_REQ,
3036 bfa_lpuid(tskim->bfa)); 3039 bfa_fn_lpu(tskim->bfa));
3037 3040
3038 m->tsk_tag = cpu_to_be16(tskim->tsk_tag); 3041 m->tsk_tag = cpu_to_be16(tskim->tsk_tag);
3039 3042
3040 /* 3043 /*
3041 * queue I/O message to firmware 3044 * queue I/O message to firmware
3042 */ 3045 */
3043 bfa_reqq_produce(tskim->bfa, itnim->reqq); 3046 bfa_reqq_produce(tskim->bfa, itnim->reqq, m->mh);
3044 return BFA_TRUE; 3047 return BFA_TRUE;
3045} 3048}
3046 3049
@@ -3112,6 +3115,7 @@ bfa_tskim_attach(struct bfa_fcpim_s *fcpim, struct bfa_meminfo_s *minfo)
3112 u16 i; 3115 u16 i;
3113 3116
3114 INIT_LIST_HEAD(&fcpim->tskim_free_q); 3117 INIT_LIST_HEAD(&fcpim->tskim_free_q);
3118 INIT_LIST_HEAD(&fcpim->tskim_unused_q);
3115 3119
3116 tskim = (struct bfa_tskim_s *) bfa_meminfo_kva(minfo); 3120 tskim = (struct bfa_tskim_s *) bfa_meminfo_kva(minfo);
3117 fcpim->tskim_arr = tskim; 3121 fcpim->tskim_arr = tskim;
@@ -3211,6 +3215,19 @@ bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim,
3211 bfa_sm_send_event(tskim, BFA_TSKIM_SM_START); 3215 bfa_sm_send_event(tskim, BFA_TSKIM_SM_START);
3212} 3216}
3213 3217
3218void
3219bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw)
3220{
3221 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
3222 struct list_head *qe;
3223 int i;
3224
3225 for (i = 0; i < (fcpim->num_tskim_reqs - num_tskim_fw); i++) {
3226 bfa_q_deq_tail(&fcpim->tskim_free_q, &qe);
3227 list_add_tail(qe, &fcpim->tskim_unused_q);
3228 }
3229}
3230
3214/* BFA FCP module - parent module for fcpim */ 3231/* BFA FCP module - parent module for fcpim */
3215 3232
3216BFA_MODULE(fcp); 3233BFA_MODULE(fcp);
@@ -3303,10 +3320,26 @@ bfa_fcp_iocdisable(struct bfa_s *bfa)
3303{ 3320{
3304 struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa); 3321 struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa);
3305 3322
3323 /* Enqueue unused ioim resources to free_q */
3324 list_splice_tail_init(&fcp->iotag_unused_q, &fcp->iotag_ioim_free_q);
3325
3306 bfa_fcpim_iocdisable(fcp); 3326 bfa_fcpim_iocdisable(fcp);
3307} 3327}
3308 3328
3309void 3329void
3330bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw)
3331{
3332 struct bfa_fcp_mod_s *mod = BFA_FCP_MOD(bfa);
3333 struct list_head *qe;
3334 int i;
3335
3336 for (i = 0; i < (mod->num_ioim_reqs - num_ioim_fw); i++) {
3337 bfa_q_deq_tail(&mod->iotag_ioim_free_q, &qe);
3338 list_add_tail(qe, &mod->iotag_unused_q);
3339 }
3340}
3341
3342void
3310bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport, 3343bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport,
3311 void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m)) 3344 void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m))
3312{ 3345{
@@ -3347,6 +3380,7 @@ bfa_iotag_attach(struct bfa_fcp_mod_s *fcp, struct bfa_meminfo_s *minfo)
3347 3380
3348 INIT_LIST_HEAD(&fcp->iotag_ioim_free_q); 3381 INIT_LIST_HEAD(&fcp->iotag_ioim_free_q);
3349 INIT_LIST_HEAD(&fcp->iotag_tio_free_q); 3382 INIT_LIST_HEAD(&fcp->iotag_tio_free_q);
3383 INIT_LIST_HEAD(&fcp->iotag_unused_q);
3350 3384
3351 num_io_req = fcp->num_ioim_reqs + fcp->num_fwtio_reqs; 3385 num_io_req = fcp->num_ioim_reqs + fcp->num_fwtio_reqs;
3352 for (i = 0; i < num_io_req; i++, iotag++) { 3386 for (i = 0; i < num_io_req; i++, iotag++) {
diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h
index e1e3221fda43..bc6b294426ec 100644
--- a/drivers/scsi/bfa/bfa_fcpim.h
+++ b/drivers/scsi/bfa/bfa_fcpim.h
@@ -42,6 +42,7 @@ void bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport,
42 void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m)); 42 void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m));
43void bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m); 43void bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m);
44void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp, struct bfa_meminfo_s *minfo); 44void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp, struct bfa_meminfo_s *minfo);
45void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw);
45 46
46#define BFA_FCP_MOD(_hal) (&(_hal)->modules.fcp_mod) 47#define BFA_FCP_MOD(_hal) (&(_hal)->modules.fcp_mod)
47#define BFA_IOTAG_FROM_TAG(_fcp, _tag) \ 48#define BFA_IOTAG_FROM_TAG(_fcp, _tag) \
@@ -118,6 +119,7 @@ struct bfa_fcpim_s {
118 struct list_head ioim_resfree_q; /* IOs waiting for f/w */ 119 struct list_head ioim_resfree_q; /* IOs waiting for f/w */
119 struct list_head ioim_comp_q; /* IO global comp Q */ 120 struct list_head ioim_comp_q; /* IO global comp Q */
120 struct list_head tskim_free_q; 121 struct list_head tskim_free_q;
122 struct list_head tskim_unused_q; /* Unused tskim Q */
121 u32 ios_active; /* current active IOs */ 123 u32 ios_active; /* current active IOs */
122 u32 delay_comp; 124 u32 delay_comp;
123 struct bfa_fcpim_del_itn_stats_s del_itn_stats; 125 struct bfa_fcpim_del_itn_stats_s del_itn_stats;
@@ -132,6 +134,7 @@ struct bfa_fcp_mod_s {
132 struct bfa_s *bfa; 134 struct bfa_s *bfa;
133 struct list_head iotag_ioim_free_q; /* free IO resources */ 135 struct list_head iotag_ioim_free_q; /* free IO resources */
134 struct list_head iotag_tio_free_q; /* free IO resources */ 136 struct list_head iotag_tio_free_q; /* free IO resources */
137 struct list_head iotag_unused_q; /* unused IO resources*/
135 struct bfa_iotag_s *iotag_arr; 138 struct bfa_iotag_s *iotag_arr;
136 struct bfa_itn_s *itn_arr; 139 struct bfa_itn_s *itn_arr;
137 int num_ioim_reqs; 140 int num_ioim_reqs;
@@ -270,6 +273,7 @@ void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
270void bfa_tskim_iodone(struct bfa_tskim_s *tskim); 273void bfa_tskim_iodone(struct bfa_tskim_s *tskim);
271void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); 274void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim);
272void bfa_tskim_cleanup(struct bfa_tskim_s *tskim); 275void bfa_tskim_cleanup(struct bfa_tskim_s *tskim);
276void bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw);
273 277
274void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, 278void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
275 u32 *dm_len); 279 u32 *dm_len);
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index 5332017f07e9..5bbb76b8e2ec 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -1298,7 +1298,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
1298 bfa_fcport_get_rx_bbcredit(bfa), 1298 bfa_fcport_get_rx_bbcredit(bfa),
1299 bfa_fcs_fabric_oper_bbscn(fabric)); 1299 bfa_fcs_fabric_oper_bbscn(fabric));
1300 1300
1301 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->lp_tag, 1301 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->bfa_tag,
1302 BFA_FALSE, FC_CLASS_3, 1302 BFA_FALSE, FC_CLASS_3,
1303 reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric, 1303 reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric,
1304 FC_MAX_PDUSZ, 0); 1304 FC_MAX_PDUSZ, 0);
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 479ccbe901b5..942443e711e5 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -898,8 +898,8 @@ bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs,
898 lport->fcs = fcs; 898 lport->fcs = fcs;
899 lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id); 899 lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id);
900 lport->vport = vport; 900 lport->vport = vport;
901 lport->lp_tag = (vport) ? vport->lps->lp_tag : 901 lport->lp_tag = (vport) ? vport->lps->bfa_tag :
902 lport->fabric->lps->lp_tag; 902 lport->fabric->lps->bfa_tag;
903 903
904 INIT_LIST_HEAD(&lport->rport_q); 904 INIT_LIST_HEAD(&lport->rport_q);
905 lport->num_rports = 0; 905 lport->num_rports = 0;
diff --git a/drivers/scsi/bfa/bfa_hw_cb.c b/drivers/scsi/bfa/bfa_hw_cb.c
index 694ebf1b0bd1..e7ffd8205dc7 100644
--- a/drivers/scsi/bfa/bfa_hw_cb.c
+++ b/drivers/scsi/bfa/bfa_hw_cb.c
@@ -35,11 +35,6 @@ bfa_hwcb_reginit(struct bfa_s *bfa)
35 } 35 }
36} 36}
37 37
38void
39bfa_hwcb_reqq_ack(struct bfa_s *bfa, int reqq)
40{
41}
42
43static void 38static void
44bfa_hwcb_reqq_ack_msix(struct bfa_s *bfa, int reqq) 39bfa_hwcb_reqq_ack_msix(struct bfa_s *bfa, int reqq)
45{ 40{
@@ -47,11 +42,6 @@ bfa_hwcb_reqq_ack_msix(struct bfa_s *bfa, int reqq)
47 bfa->iocfc.bfa_regs.intr_status); 42 bfa->iocfc.bfa_regs.intr_status);
48} 43}
49 44
50void
51bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq)
52{
53}
54
55static void 45static void
56bfa_hwcb_rspq_ack_msix(struct bfa_s *bfa, int rspq) 46bfa_hwcb_rspq_ack_msix(struct bfa_s *bfa, int rspq)
57{ 47{
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c
index 77f2b4470a69..d1b8f0caaa79 100644
--- a/drivers/scsi/bfa/bfa_ioc_ct.c
+++ b/drivers/scsi/bfa/bfa_ioc_ct.c
@@ -561,9 +561,9 @@ bfa_ioc_set_ct2_hwif(struct bfa_ioc_s *ioc)
561} 561}
562 562
563/* 563/*
564 * Temporary workaround for MSI-X resource allocation for catapult-2. 564 * Workaround for MSI-X resource allocation for catapult-2 with no asic block
565 */ 565 */
566#define HOSTFN_MSIX_DEFAULT 16 566#define HOSTFN_MSIX_DEFAULT 64
567#define HOSTFN_MSIX_VT_INDEX_MBOX_ERR 0x30138 567#define HOSTFN_MSIX_VT_INDEX_MBOX_ERR 0x30138
568#define HOSTFN_MSIX_VT_OFST_NUMVT 0x3013c 568#define HOSTFN_MSIX_VT_OFST_NUMVT 0x3013c
569#define __MSIX_VT_NUMVT__MK 0x003ff800 569#define __MSIX_VT_NUMVT__MK 0x003ff800
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index fe99ce20ec28..cfc0b09465ec 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -125,6 +125,7 @@ static void bfa_lps_stop(struct bfa_s *bfa);
125static void bfa_lps_iocdisable(struct bfa_s *bfa); 125static void bfa_lps_iocdisable(struct bfa_s *bfa);
126static void bfa_lps_login_rsp(struct bfa_s *bfa, 126static void bfa_lps_login_rsp(struct bfa_s *bfa,
127 struct bfi_lps_login_rsp_s *rsp); 127 struct bfi_lps_login_rsp_s *rsp);
128static void bfa_lps_no_res(struct bfa_lps_s *first_lps, u8 count);
128static void bfa_lps_logout_rsp(struct bfa_s *bfa, 129static void bfa_lps_logout_rsp(struct bfa_s *bfa,
129 struct bfi_lps_logout_rsp_s *rsp); 130 struct bfi_lps_logout_rsp_s *rsp);
130static void bfa_lps_reqq_resume(void *lps_arg); 131static void bfa_lps_reqq_resume(void *lps_arg);
@@ -475,6 +476,7 @@ claim_fcxps_mem(struct bfa_fcxp_mod_s *mod, struct bfa_meminfo_s *mi)
475 476
476 INIT_LIST_HEAD(&mod->fcxp_free_q); 477 INIT_LIST_HEAD(&mod->fcxp_free_q);
477 INIT_LIST_HEAD(&mod->fcxp_active_q); 478 INIT_LIST_HEAD(&mod->fcxp_active_q);
479 INIT_LIST_HEAD(&mod->fcxp_unused_q);
478 480
479 mod->fcxp_list = fcxp; 481 mod->fcxp_list = fcxp;
480 482
@@ -561,6 +563,9 @@ bfa_fcxp_iocdisable(struct bfa_s *bfa)
561 struct bfa_fcxp_s *fcxp; 563 struct bfa_fcxp_s *fcxp;
562 struct list_head *qe, *qen; 564 struct list_head *qe, *qen;
563 565
566 /* Enqueue unused fcxp resources to free_q */
567 list_splice_tail_init(&mod->fcxp_unused_q, &mod->fcxp_free_q);
568
564 list_for_each_safe(qe, qen, &mod->fcxp_active_q) { 569 list_for_each_safe(qe, qen, &mod->fcxp_active_q) {
565 fcxp = (struct bfa_fcxp_s *) qe; 570 fcxp = (struct bfa_fcxp_s *) qe;
566 if (fcxp->caller == NULL) { 571 if (fcxp->caller == NULL) {
@@ -829,7 +834,7 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req)
829 struct bfa_rport_s *rport = reqi->bfa_rport; 834 struct bfa_rport_s *rport = reqi->bfa_rport;
830 835
831 bfi_h2i_set(send_req->mh, BFI_MC_FCXP, BFI_FCXP_H2I_SEND_REQ, 836 bfi_h2i_set(send_req->mh, BFI_MC_FCXP, BFI_FCXP_H2I_SEND_REQ,
832 bfa_lpuid(bfa)); 837 bfa_fn_lpu(bfa));
833 838
834 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag); 839 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag);
835 if (rport) { 840 if (rport) {
@@ -843,7 +848,7 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req)
843 } 848 }
844 849
845 send_req->vf_id = cpu_to_be16(reqi->vf_id); 850 send_req->vf_id = cpu_to_be16(reqi->vf_id);
846 send_req->lp_tag = reqi->lp_tag; 851 send_req->lp_fwtag = bfa_lps_get_fwtag(bfa, reqi->lp_tag);
847 send_req->class = reqi->class; 852 send_req->class = reqi->class;
848 send_req->rsp_timeout = rspi->rsp_timeout; 853 send_req->rsp_timeout = rspi->rsp_timeout;
849 send_req->cts = reqi->cts; 854 send_req->cts = reqi->cts;
@@ -891,7 +896,7 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req)
891 896
892 hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs); 897 hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs);
893 898
894 bfa_reqq_produce(bfa, BFA_REQQ_FCXP); 899 bfa_reqq_produce(bfa, BFA_REQQ_FCXP, send_req->mh);
895 900
896 bfa_trc(bfa, bfa_reqq_pi(bfa, BFA_REQQ_FCXP)); 901 bfa_trc(bfa, bfa_reqq_pi(bfa, BFA_REQQ_FCXP));
897 bfa_trc(bfa, bfa_reqq_ci(bfa, BFA_REQQ_FCXP)); 902 bfa_trc(bfa, bfa_reqq_ci(bfa, BFA_REQQ_FCXP));
@@ -1160,6 +1165,18 @@ bfa_fcxp_get_maxrsp(struct bfa_s *bfa)
1160 return mod->rsp_pld_sz; 1165 return mod->rsp_pld_sz;
1161} 1166}
1162 1167
1168void
1169bfa_fcxp_res_recfg(struct bfa_s *bfa, u16 num_fcxp_fw)
1170{
1171 struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa);
1172 struct list_head *qe;
1173 int i;
1174
1175 for (i = 0; i < (mod->num_fcxps - num_fcxp_fw); i++) {
1176 bfa_q_deq_tail(&mod->fcxp_free_q, &qe);
1177 list_add_tail(qe, &mod->fcxp_unused_q);
1178 }
1179}
1163 1180
1164/* 1181/*
1165 * BFA LPS state machine functions 1182 * BFA LPS state machine functions
@@ -1171,7 +1188,7 @@ bfa_fcxp_get_maxrsp(struct bfa_s *bfa)
1171static void 1188static void
1172bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) 1189bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event)
1173{ 1190{
1174 bfa_trc(lps->bfa, lps->lp_tag); 1191 bfa_trc(lps->bfa, lps->bfa_tag);
1175 bfa_trc(lps->bfa, event); 1192 bfa_trc(lps->bfa, event);
1176 1193
1177 switch (event) { 1194 switch (event) {
@@ -1223,7 +1240,7 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event)
1223static void 1240static void
1224bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) 1241bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event)
1225{ 1242{
1226 bfa_trc(lps->bfa, lps->lp_tag); 1243 bfa_trc(lps->bfa, lps->bfa_tag);
1227 bfa_trc(lps->bfa, event); 1244 bfa_trc(lps->bfa, event);
1228 1245
1229 switch (event) { 1246 switch (event) {
@@ -1277,7 +1294,7 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event)
1277static void 1294static void
1278bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event) 1295bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event)
1279{ 1296{
1280 bfa_trc(lps->bfa, lps->lp_tag); 1297 bfa_trc(lps->bfa, lps->bfa_tag);
1281 bfa_trc(lps->bfa, event); 1298 bfa_trc(lps->bfa, event);
1282 1299
1283 switch (event) { 1300 switch (event) {
@@ -1310,7 +1327,7 @@ bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event)
1310static void 1327static void
1311bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) 1328bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event)
1312{ 1329{
1313 bfa_trc(lps->bfa, lps->lp_tag); 1330 bfa_trc(lps->bfa, lps->bfa_tag);
1314 bfa_trc(lps->bfa, event); 1331 bfa_trc(lps->bfa, event);
1315 1332
1316 switch (event) { 1333 switch (event) {
@@ -1359,7 +1376,7 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event)
1359static void 1376static void
1360bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, enum bfa_lps_event event) 1377bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, enum bfa_lps_event event)
1361{ 1378{
1362 bfa_trc(lps->bfa, lps->lp_tag); 1379 bfa_trc(lps->bfa, lps->bfa_tag);
1363 bfa_trc(lps->bfa, event); 1380 bfa_trc(lps->bfa, event);
1364 1381
1365 switch (event) { 1382 switch (event) {
@@ -1401,7 +1418,7 @@ bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, enum bfa_lps_event event)
1401static void 1418static void
1402bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event) 1419bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event)
1403{ 1420{
1404 bfa_trc(lps->bfa, lps->lp_tag); 1421 bfa_trc(lps->bfa, lps->bfa_tag);
1405 bfa_trc(lps->bfa, event); 1422 bfa_trc(lps->bfa, event);
1406 1423
1407 switch (event) { 1424 switch (event) {
@@ -1426,7 +1443,7 @@ bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event)
1426static void 1443static void
1427bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event event) 1444bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event event)
1428{ 1445{
1429 bfa_trc(lps->bfa, lps->lp_tag); 1446 bfa_trc(lps->bfa, lps->bfa_tag);
1430 bfa_trc(lps->bfa, event); 1447 bfa_trc(lps->bfa, event);
1431 1448
1432 switch (event) { 1449 switch (event) {
@@ -1488,10 +1505,11 @@ bfa_lps_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
1488 1505
1489 INIT_LIST_HEAD(&mod->lps_free_q); 1506 INIT_LIST_HEAD(&mod->lps_free_q);
1490 INIT_LIST_HEAD(&mod->lps_active_q); 1507 INIT_LIST_HEAD(&mod->lps_active_q);
1508 INIT_LIST_HEAD(&mod->lps_login_q);
1491 1509
1492 for (i = 0; i < mod->num_lps; i++, lps++) { 1510 for (i = 0; i < mod->num_lps; i++, lps++) {
1493 lps->bfa = bfa; 1511 lps->bfa = bfa;
1494 lps->lp_tag = (u8) i; 1512 lps->bfa_tag = (u8) i;
1495 lps->reqq = BFA_REQQ_LPS; 1513 lps->reqq = BFA_REQQ_LPS;
1496 bfa_reqq_winit(&lps->wqe, bfa_lps_reqq_resume, lps); 1514 bfa_reqq_winit(&lps->wqe, bfa_lps_reqq_resume, lps);
1497 list_add_tail(&lps->qe, &mod->lps_free_q); 1515 list_add_tail(&lps->qe, &mod->lps_free_q);
@@ -1527,6 +1545,11 @@ bfa_lps_iocdisable(struct bfa_s *bfa)
1527 lps = (struct bfa_lps_s *) qe; 1545 lps = (struct bfa_lps_s *) qe;
1528 bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE); 1546 bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE);
1529 } 1547 }
1548 list_for_each_safe(qe, qen, &mod->lps_login_q) {
1549 lps = (struct bfa_lps_s *) qe;
1550 bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE);
1551 }
1552 list_splice_tail_init(&mod->lps_login_q, &mod->lps_active_q);
1530} 1553}
1531 1554
1532/* 1555/*
@@ -1538,12 +1561,13 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp)
1538 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); 1561 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa);
1539 struct bfa_lps_s *lps; 1562 struct bfa_lps_s *lps;
1540 1563
1541 WARN_ON(rsp->lp_tag >= mod->num_lps); 1564 WARN_ON(rsp->bfa_tag >= mod->num_lps);
1542 lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); 1565 lps = BFA_LPS_FROM_TAG(mod, rsp->bfa_tag);
1543 1566
1544 lps->status = rsp->status; 1567 lps->status = rsp->status;
1545 switch (rsp->status) { 1568 switch (rsp->status) {
1546 case BFA_STATUS_OK: 1569 case BFA_STATUS_OK:
1570 lps->fw_tag = rsp->fw_tag;
1547 lps->fport = rsp->f_port; 1571 lps->fport = rsp->f_port;
1548 if (lps->fport) 1572 if (lps->fport)
1549 lps->lp_pid = rsp->lp_pid; 1573 lps->lp_pid = rsp->lp_pid;
@@ -1570,14 +1594,46 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp)
1570 1594
1571 break; 1595 break;
1572 1596
1597 case BFA_STATUS_VPORT_MAX:
1598 if (!rsp->ext_status)
1599 bfa_lps_no_res(lps, rsp->ext_status);
1600 break;
1601
1573 default: 1602 default:
1574 /* Nothing to do with other status */ 1603 /* Nothing to do with other status */
1575 break; 1604 break;
1576 } 1605 }
1577 1606
1607 list_del(&lps->qe);
1608 list_add_tail(&lps->qe, &mod->lps_active_q);
1578 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); 1609 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP);
1579} 1610}
1580 1611
1612static void
1613bfa_lps_no_res(struct bfa_lps_s *first_lps, u8 count)
1614{
1615 struct bfa_s *bfa = first_lps->bfa;
1616 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa);
1617 struct list_head *qe, *qe_next;
1618 struct bfa_lps_s *lps;
1619
1620 bfa_trc(bfa, count);
1621
1622 qe = bfa_q_next(first_lps);
1623
1624 while (count && qe) {
1625 qe_next = bfa_q_next(qe);
1626 lps = (struct bfa_lps_s *)qe;
1627 bfa_trc(bfa, lps->bfa_tag);
1628 lps->status = first_lps->status;
1629 list_del(&lps->qe);
1630 list_add_tail(&lps->qe, &mod->lps_active_q);
1631 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP);
1632 qe = qe_next;
1633 count--;
1634 }
1635}
1636
1581/* 1637/*
1582 * Firmware logout response 1638 * Firmware logout response
1583 */ 1639 */
@@ -1587,8 +1643,8 @@ bfa_lps_logout_rsp(struct bfa_s *bfa, struct bfi_lps_logout_rsp_s *rsp)
1587 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); 1643 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa);
1588 struct bfa_lps_s *lps; 1644 struct bfa_lps_s *lps;
1589 1645
1590 WARN_ON(rsp->lp_tag >= mod->num_lps); 1646 WARN_ON(rsp->bfa_tag >= mod->num_lps);
1591 lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); 1647 lps = BFA_LPS_FROM_TAG(mod, rsp->bfa_tag);
1592 1648
1593 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); 1649 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP);
1594} 1650}
@@ -1602,7 +1658,7 @@ bfa_lps_rx_cvl_event(struct bfa_s *bfa, struct bfi_lps_cvl_event_s *cvl)
1602 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); 1658 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa);
1603 struct bfa_lps_s *lps; 1659 struct bfa_lps_s *lps;
1604 1660
1605 lps = BFA_LPS_FROM_TAG(mod, cvl->lp_tag); 1661 lps = BFA_LPS_FROM_TAG(mod, cvl->bfa_tag);
1606 1662
1607 bfa_sm_send_event(lps, BFA_LPS_SM_RX_CVL); 1663 bfa_sm_send_event(lps, BFA_LPS_SM_RX_CVL);
1608} 1664}
@@ -1637,15 +1693,16 @@ bfa_lps_free(struct bfa_lps_s *lps)
1637static void 1693static void
1638bfa_lps_send_login(struct bfa_lps_s *lps) 1694bfa_lps_send_login(struct bfa_lps_s *lps)
1639{ 1695{
1696 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(lps->bfa);
1640 struct bfi_lps_login_req_s *m; 1697 struct bfi_lps_login_req_s *m;
1641 1698
1642 m = bfa_reqq_next(lps->bfa, lps->reqq); 1699 m = bfa_reqq_next(lps->bfa, lps->reqq);
1643 WARN_ON(!m); 1700 WARN_ON(!m);
1644 1701
1645 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGIN_REQ, 1702 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGIN_REQ,
1646 bfa_lpuid(lps->bfa)); 1703 bfa_fn_lpu(lps->bfa));
1647 1704
1648 m->lp_tag = lps->lp_tag; 1705 m->bfa_tag = lps->bfa_tag;
1649 m->alpa = lps->alpa; 1706 m->alpa = lps->alpa;
1650 m->pdu_size = cpu_to_be16(lps->pdusz); 1707 m->pdu_size = cpu_to_be16(lps->pdusz);
1651 m->pwwn = lps->pwwn; 1708 m->pwwn = lps->pwwn;
@@ -1654,7 +1711,9 @@ bfa_lps_send_login(struct bfa_lps_s *lps)
1654 m->auth_en = lps->auth_en; 1711 m->auth_en = lps->auth_en;
1655 m->bb_scn = lps->bb_scn; 1712 m->bb_scn = lps->bb_scn;
1656 1713
1657 bfa_reqq_produce(lps->bfa, lps->reqq); 1714 bfa_reqq_produce(lps->bfa, lps->reqq, m->mh);
1715 list_del(&lps->qe);
1716 list_add_tail(&lps->qe, &mod->lps_login_q);
1658} 1717}
1659 1718
1660/* 1719/*
@@ -1669,11 +1728,11 @@ bfa_lps_send_logout(struct bfa_lps_s *lps)
1669 WARN_ON(!m); 1728 WARN_ON(!m);
1670 1729
1671 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGOUT_REQ, 1730 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGOUT_REQ,
1672 bfa_lpuid(lps->bfa)); 1731 bfa_fn_lpu(lps->bfa));
1673 1732
1674 m->lp_tag = lps->lp_tag; 1733 m->fw_tag = lps->fw_tag;
1675 m->port_name = lps->pwwn; 1734 m->port_name = lps->pwwn;
1676 bfa_reqq_produce(lps->bfa, lps->reqq); 1735 bfa_reqq_produce(lps->bfa, lps->reqq, m->mh);
1677} 1736}
1678 1737
1679/* 1738/*
@@ -1688,11 +1747,11 @@ bfa_lps_send_set_n2n_pid(struct bfa_lps_s *lps)
1688 WARN_ON(!m); 1747 WARN_ON(!m);
1689 1748
1690 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_N2N_PID_REQ, 1749 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_N2N_PID_REQ,
1691 bfa_lpuid(lps->bfa)); 1750 bfa_fn_lpu(lps->bfa));
1692 1751
1693 m->lp_tag = lps->lp_tag; 1752 m->fw_tag = lps->fw_tag;
1694 m->lp_pid = lps->lp_pid; 1753 m->lp_pid = lps->lp_pid;
1695 bfa_reqq_produce(lps->bfa, lps->reqq); 1754 bfa_reqq_produce(lps->bfa, lps->reqq, m->mh);
1696} 1755}
1697 1756
1698/* 1757/*
@@ -1884,6 +1943,13 @@ bfa_lps_fdisclogo(struct bfa_lps_s *lps)
1884 bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); 1943 bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT);
1885} 1944}
1886 1945
1946u8
1947bfa_lps_get_fwtag(struct bfa_s *bfa, u8 lp_tag)
1948{
1949 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa);
1950
1951 return BFA_LPS_FROM_TAG(mod, lp_tag)->fw_tag;
1952}
1887 1953
1888/* 1954/*
1889 * Return lport services tag given the pid 1955 * Return lport services tag given the pid
@@ -1897,7 +1963,7 @@ bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid)
1897 1963
1898 for (i = 0, lps = mod->lps_arr; i < mod->num_lps; i++, lps++) { 1964 for (i = 0, lps = mod->lps_arr; i < mod->num_lps; i++, lps++) {
1899 if (lps->lp_pid == pid) 1965 if (lps->lp_pid == pid)
1900 return lps->lp_tag; 1966 return lps->bfa_tag;
1901 } 1967 }
1902 1968
1903 /* Return base port tag anyway */ 1969 /* Return base port tag anyway */
@@ -1922,7 +1988,7 @@ bfa_lps_get_base_pid(struct bfa_s *bfa)
1922void 1988void
1923bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, uint32_t n2n_pid) 1989bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, uint32_t n2n_pid)
1924{ 1990{
1925 bfa_trc(lps->bfa, lps->lp_tag); 1991 bfa_trc(lps->bfa, lps->bfa_tag);
1926 bfa_trc(lps->bfa, n2n_pid); 1992 bfa_trc(lps->bfa, n2n_pid);
1927 1993
1928 lps->lp_pid = n2n_pid; 1994 lps->lp_pid = n2n_pid;
@@ -2935,7 +3001,7 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
2935 } 3001 }
2936 3002
2937 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_ENABLE_REQ, 3003 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_ENABLE_REQ,
2938 bfa_lpuid(fcport->bfa)); 3004 bfa_fn_lpu(fcport->bfa));
2939 m->nwwn = fcport->nwwn; 3005 m->nwwn = fcport->nwwn;
2940 m->pwwn = fcport->pwwn; 3006 m->pwwn = fcport->pwwn;
2941 m->port_cfg = fcport->cfg; 3007 m->port_cfg = fcport->cfg;
@@ -2949,7 +3015,7 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
2949 /* 3015 /*
2950 * queue I/O message to firmware 3016 * queue I/O message to firmware
2951 */ 3017 */
2952 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3018 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
2953 return BFA_TRUE; 3019 return BFA_TRUE;
2954} 3020}
2955 3021
@@ -2978,13 +3044,13 @@ bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
2978 } 3044 }
2979 3045
2980 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_DISABLE_REQ, 3046 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_DISABLE_REQ,
2981 bfa_lpuid(fcport->bfa)); 3047 bfa_fn_lpu(fcport->bfa));
2982 m->msgtag = fcport->msgtag; 3048 m->msgtag = fcport->msgtag;
2983 3049
2984 /* 3050 /*
2985 * queue I/O message to firmware 3051 * queue I/O message to firmware
2986 */ 3052 */
2987 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3053 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
2988 3054
2989 return BFA_TRUE; 3055 return BFA_TRUE;
2990} 3056}
@@ -3016,14 +3082,14 @@ bfa_fcport_send_txcredit(void *port_cbarg)
3016 } 3082 }
3017 3083
3018 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ, 3084 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ,
3019 bfa_lpuid(fcport->bfa)); 3085 bfa_fn_lpu(fcport->bfa));
3020 m->tx_bbcredit = cpu_to_be16((u16)fcport->cfg.tx_bbcredit); 3086 m->tx_bbcredit = cpu_to_be16((u16)fcport->cfg.tx_bbcredit);
3021 m->bb_scn = fcport->cfg.bb_scn; 3087 m->bb_scn = fcport->cfg.bb_scn;
3022 3088
3023 /* 3089 /*
3024 * queue I/O message to firmware 3090 * queue I/O message to firmware
3025 */ 3091 */
3026 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3092 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
3027} 3093}
3028 3094
3029static void 3095static void
@@ -3127,8 +3193,8 @@ bfa_fcport_send_stats_get(void *cbarg)
3127 3193
3128 memset(msg, 0, sizeof(struct bfi_fcport_req_s)); 3194 memset(msg, 0, sizeof(struct bfi_fcport_req_s));
3129 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ, 3195 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ,
3130 bfa_lpuid(fcport->bfa)); 3196 bfa_fn_lpu(fcport->bfa));
3131 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3197 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh);
3132} 3198}
3133 3199
3134static void 3200static void
@@ -3189,8 +3255,8 @@ bfa_fcport_send_stats_clear(void *cbarg)
3189 3255
3190 memset(msg, 0, sizeof(struct bfi_fcport_req_s)); 3256 memset(msg, 0, sizeof(struct bfi_fcport_req_s));
3191 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ, 3257 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ,
3192 bfa_lpuid(fcport->bfa)); 3258 bfa_fn_lpu(fcport->bfa));
3193 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3259 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh);
3194} 3260}
3195 3261
3196/* 3262/*
@@ -4370,6 +4436,7 @@ bfa_rport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
4370 4436
4371 INIT_LIST_HEAD(&mod->rp_free_q); 4437 INIT_LIST_HEAD(&mod->rp_free_q);
4372 INIT_LIST_HEAD(&mod->rp_active_q); 4438 INIT_LIST_HEAD(&mod->rp_active_q);
4439 INIT_LIST_HEAD(&mod->rp_unused_q);
4373 4440
4374 rp = (struct bfa_rport_s *) bfa_meminfo_kva(meminfo); 4441 rp = (struct bfa_rport_s *) bfa_meminfo_kva(meminfo);
4375 mod->rps_list = rp; 4442 mod->rps_list = rp;
@@ -4421,6 +4488,9 @@ bfa_rport_iocdisable(struct bfa_s *bfa)
4421 struct bfa_rport_s *rport; 4488 struct bfa_rport_s *rport;
4422 struct list_head *qe, *qen; 4489 struct list_head *qe, *qen;
4423 4490
4491 /* Enqueue unused rport resources to free_q */
4492 list_splice_tail_init(&mod->rp_unused_q, &mod->rp_free_q);
4493
4424 list_for_each_safe(qe, qen, &mod->rp_active_q) { 4494 list_for_each_safe(qe, qen, &mod->rp_active_q) {
4425 rport = (struct bfa_rport_s *) qe; 4495 rport = (struct bfa_rport_s *) qe;
4426 bfa_sm_send_event(rport, BFA_RPORT_SM_HWFAIL); 4496 bfa_sm_send_event(rport, BFA_RPORT_SM_HWFAIL);
@@ -4464,11 +4534,11 @@ bfa_rport_send_fwcreate(struct bfa_rport_s *rp)
4464 } 4534 }
4465 4535
4466 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_CREATE_REQ, 4536 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_CREATE_REQ,
4467 bfa_lpuid(rp->bfa)); 4537 bfa_fn_lpu(rp->bfa));
4468 m->bfa_handle = rp->rport_tag; 4538 m->bfa_handle = rp->rport_tag;
4469 m->max_frmsz = cpu_to_be16(rp->rport_info.max_frmsz); 4539 m->max_frmsz = cpu_to_be16(rp->rport_info.max_frmsz);
4470 m->pid = rp->rport_info.pid; 4540 m->pid = rp->rport_info.pid;
4471 m->lp_tag = rp->rport_info.lp_tag; 4541 m->lp_fwtag = bfa_lps_get_fwtag(rp->bfa, (u8)rp->rport_info.lp_tag);
4472 m->local_pid = rp->rport_info.local_pid; 4542 m->local_pid = rp->rport_info.local_pid;
4473 m->fc_class = rp->rport_info.fc_class; 4543 m->fc_class = rp->rport_info.fc_class;
4474 m->vf_en = rp->rport_info.vf_en; 4544 m->vf_en = rp->rport_info.vf_en;
@@ -4478,7 +4548,7 @@ bfa_rport_send_fwcreate(struct bfa_rport_s *rp)
4478 /* 4548 /*
4479 * queue I/O message to firmware 4549 * queue I/O message to firmware
4480 */ 4550 */
4481 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); 4551 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh);
4482 return BFA_TRUE; 4552 return BFA_TRUE;
4483} 4553}
4484 4554
@@ -4497,13 +4567,13 @@ bfa_rport_send_fwdelete(struct bfa_rport_s *rp)
4497 } 4567 }
4498 4568
4499 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_DELETE_REQ, 4569 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_DELETE_REQ,
4500 bfa_lpuid(rp->bfa)); 4570 bfa_fn_lpu(rp->bfa));
4501 m->fw_handle = rp->fw_handle; 4571 m->fw_handle = rp->fw_handle;
4502 4572
4503 /* 4573 /*
4504 * queue I/O message to firmware 4574 * queue I/O message to firmware
4505 */ 4575 */
4506 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); 4576 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh);
4507 return BFA_TRUE; 4577 return BFA_TRUE;
4508} 4578}
4509 4579
@@ -4522,14 +4592,14 @@ bfa_rport_send_fwspeed(struct bfa_rport_s *rp)
4522 } 4592 }
4523 4593
4524 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_SET_SPEED_REQ, 4594 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_SET_SPEED_REQ,
4525 bfa_lpuid(rp->bfa)); 4595 bfa_fn_lpu(rp->bfa));
4526 m->fw_handle = rp->fw_handle; 4596 m->fw_handle = rp->fw_handle;
4527 m->speed = (u8)rp->rport_info.speed; 4597 m->speed = (u8)rp->rport_info.speed;
4528 4598
4529 /* 4599 /*
4530 * queue I/O message to firmware 4600 * queue I/O message to firmware
4531 */ 4601 */
4532 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); 4602 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh);
4533 return BFA_TRUE; 4603 return BFA_TRUE;
4534} 4604}
4535 4605
@@ -4579,7 +4649,18 @@ bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
4579 } 4649 }
4580} 4650}
4581 4651
4652void
4653bfa_rport_res_recfg(struct bfa_s *bfa, u16 num_rport_fw)
4654{
4655 struct bfa_rport_mod_s *mod = BFA_RPORT_MOD(bfa);
4656 struct list_head *qe;
4657 int i;
4582 4658
4659 for (i = 0; i < (mod->num_rports - num_rport_fw); i++) {
4660 bfa_q_deq_tail(&mod->rp_free_q, &qe);
4661 list_add_tail(qe, &mod->rp_unused_q);
4662 }
4663}
4583 4664
4584/* 4665/*
4585 * bfa_rport_api 4666 * bfa_rport_api
@@ -4880,7 +4961,7 @@ claim_uf_post_msgs(struct bfa_uf_mod_s *ufm, struct bfa_meminfo_s *mi)
4880 buf_len = sizeof(struct bfa_uf_buf_s); 4961 buf_len = sizeof(struct bfa_uf_buf_s);
4881 uf_bp_msg->buf_len = cpu_to_be16(buf_len); 4962 uf_bp_msg->buf_len = cpu_to_be16(buf_len);
4882 bfi_h2i_set(uf_bp_msg->mh, BFI_MC_UF, BFI_UF_H2I_BUF_POST, 4963 bfi_h2i_set(uf_bp_msg->mh, BFI_MC_UF, BFI_UF_H2I_BUF_POST,
4883 bfa_lpuid(ufm->bfa)); 4964 bfa_fn_lpu(ufm->bfa));
4884 bfa_alen_set(&uf_bp_msg->alen, buf_len, ufm_pbs_pa(ufm, i)); 4965 bfa_alen_set(&uf_bp_msg->alen, buf_len, ufm_pbs_pa(ufm, i));
4885 } 4966 }
4886 4967
@@ -4957,6 +5038,7 @@ bfa_uf_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
4957 ufm->num_ufs = cfg->fwcfg.num_uf_bufs; 5038 ufm->num_ufs = cfg->fwcfg.num_uf_bufs;
4958 INIT_LIST_HEAD(&ufm->uf_free_q); 5039 INIT_LIST_HEAD(&ufm->uf_free_q);
4959 INIT_LIST_HEAD(&ufm->uf_posted_q); 5040 INIT_LIST_HEAD(&ufm->uf_posted_q);
5041 INIT_LIST_HEAD(&ufm->uf_unused_q);
4960 5042
4961 uf_mem_claim(ufm, meminfo); 5043 uf_mem_claim(ufm, meminfo);
4962} 5044}
@@ -4992,7 +5074,7 @@ bfa_uf_post(struct bfa_uf_mod_s *ufm, struct bfa_uf_s *uf)
4992 5074
4993 memcpy(uf_post_msg, &ufm->uf_buf_posts[uf->uf_tag], 5075 memcpy(uf_post_msg, &ufm->uf_buf_posts[uf->uf_tag],
4994 sizeof(struct bfi_uf_buf_post_s)); 5076 sizeof(struct bfi_uf_buf_post_s));
4995 bfa_reqq_produce(ufm->bfa, BFA_REQQ_FCXP); 5077 bfa_reqq_produce(ufm->bfa, BFA_REQQ_FCXP, uf_post_msg->mh);
4996 5078
4997 bfa_trc(ufm->bfa, uf->uf_tag); 5079 bfa_trc(ufm->bfa, uf->uf_tag);
4998 5080
@@ -5061,6 +5143,9 @@ bfa_uf_iocdisable(struct bfa_s *bfa)
5061 struct bfa_uf_s *uf; 5143 struct bfa_uf_s *uf;
5062 struct list_head *qe, *qen; 5144 struct list_head *qe, *qen;
5063 5145
5146 /* Enqueue unused uf resources to free_q */
5147 list_splice_tail_init(&ufm->uf_unused_q, &ufm->uf_free_q);
5148
5064 list_for_each_safe(qe, qen, &ufm->uf_posted_q) { 5149 list_for_each_safe(qe, qen, &ufm->uf_posted_q) {
5065 uf = (struct bfa_uf_s *) qe; 5150 uf = (struct bfa_uf_s *) qe;
5066 list_del(&uf->qe); 5151 list_del(&uf->qe);
@@ -5125,4 +5210,15 @@ bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
5125 } 5210 }
5126} 5211}
5127 5212
5213void
5214bfa_uf_res_recfg(struct bfa_s *bfa, u16 num_uf_fw)
5215{
5216 struct bfa_uf_mod_s *mod = BFA_UF_MOD(bfa);
5217 struct list_head *qe;
5218 int i;
5128 5219
5220 for (i = 0; i < (mod->num_ufs - num_uf_fw); i++) {
5221 bfa_q_deq_tail(&mod->uf_free_q, &qe);
5222 list_add_tail(qe, &mod->uf_unused_q);
5223 }
5224}
diff --git a/drivers/scsi/bfa/bfa_svc.h b/drivers/scsi/bfa/bfa_svc.h
index acb30efc953d..6df1492089cf 100644
--- a/drivers/scsi/bfa/bfa_svc.h
+++ b/drivers/scsi/bfa/bfa_svc.h
@@ -93,6 +93,7 @@ struct bfa_fcxp_mod_s {
93 void *rsp_pld_list_kva; /* list of FCXP resp pld */ 93 void *rsp_pld_list_kva; /* list of FCXP resp pld */
94 u64 rsp_pld_list_pa; /* list of FCXP resp pld */ 94 u64 rsp_pld_list_pa; /* list of FCXP resp pld */
95 struct list_head wait_q; /* wait queue for free fcxp */ 95 struct list_head wait_q; /* wait queue for free fcxp */
96 struct list_head fcxp_unused_q; /* unused fcxps */
96 u32 req_pld_sz; 97 u32 req_pld_sz;
97 u32 rsp_pld_sz; 98 u32 rsp_pld_sz;
98}; 99};
@@ -238,6 +239,7 @@ struct bfa_rport_mod_s {
238 struct bfa_rport_s *rps_list; /* list of rports */ 239 struct bfa_rport_s *rps_list; /* list of rports */
239 struct list_head rp_free_q; /* free bfa_rports */ 240 struct list_head rp_free_q; /* free bfa_rports */
240 struct list_head rp_active_q; /* free bfa_rports */ 241 struct list_head rp_active_q; /* free bfa_rports */
242 struct list_head rp_unused_q; /* unused bfa rports */
241 u16 num_rports; /* number of rports */ 243 u16 num_rports; /* number of rports */
242}; 244};
243 245
@@ -254,6 +256,7 @@ struct bfa_rport_mod_s {
254 * protected functions 256 * protected functions
255 */ 257 */
256void bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 258void bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
259void bfa_rport_res_recfg(struct bfa_s *bfa, u16 num_rport_fw);
257 260
258/* 261/*
259 * BFA rport information. 262 * BFA rport information.
@@ -332,6 +335,7 @@ struct bfa_uf_mod_s {
332 u16 num_ufs; /* num unsolicited rx frames */ 335 u16 num_ufs; /* num unsolicited rx frames */
333 struct list_head uf_free_q; /* free UFs */ 336 struct list_head uf_free_q; /* free UFs */
334 struct list_head uf_posted_q; /* UFs posted to IOC */ 337 struct list_head uf_posted_q; /* UFs posted to IOC */
338 struct list_head uf_unused_q; /* unused UF's */
335 struct bfa_uf_buf_s *uf_pbs_kva; /* list UF bufs request pld */ 339 struct bfa_uf_buf_s *uf_pbs_kva; /* list UF bufs request pld */
336 u64 uf_pbs_pa; /* phy addr for UF bufs */ 340 u64 uf_pbs_pa; /* phy addr for UF bufs */
337 struct bfi_uf_buf_post_s *uf_buf_posts; 341 struct bfi_uf_buf_post_s *uf_buf_posts;
@@ -346,6 +350,7 @@ struct bfa_uf_mod_s {
346 ((_ufmod)->uf_pbs_pa + sizeof(struct bfa_uf_buf_s) * (_uftag)) 350 ((_ufmod)->uf_pbs_pa + sizeof(struct bfa_uf_buf_s) * (_uftag))
347 351
348void bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 352void bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
353void bfa_uf_res_recfg(struct bfa_s *bfa, u16 num_uf_fw);
349 354
350#define BFA_UF_BUFSZ (2 * 1024 + 256) 355#define BFA_UF_BUFSZ (2 * 1024 + 256)
351 356
@@ -364,7 +369,8 @@ struct bfa_lps_s {
364 struct list_head qe; /* queue element */ 369 struct list_head qe; /* queue element */
365 struct bfa_s *bfa; /* parent bfa instance */ 370 struct bfa_s *bfa; /* parent bfa instance */
366 bfa_sm_t sm; /* finite state machine */ 371 bfa_sm_t sm; /* finite state machine */
367 u8 lp_tag; /* lport tag */ 372 u8 bfa_tag; /* lport tag */
373 u8 fw_tag; /* lport fw tag */
368 u8 reqq; /* lport request queue */ 374 u8 reqq; /* lport request queue */
369 u8 alpa; /* ALPA for loop topologies */ 375 u8 alpa; /* ALPA for loop topologies */
370 u32 lp_pid; /* lport port ID */ 376 u32 lp_pid; /* lport port ID */
@@ -397,6 +403,7 @@ struct bfa_lps_s {
397struct bfa_lps_mod_s { 403struct bfa_lps_mod_s {
398 struct list_head lps_free_q; 404 struct list_head lps_free_q;
399 struct list_head lps_active_q; 405 struct list_head lps_active_q;
406 struct list_head lps_login_q;
400 struct bfa_lps_s *lps_arr; 407 struct bfa_lps_s *lps_arr;
401 int num_lps; 408 int num_lps;
402}; 409};
@@ -583,6 +590,7 @@ void bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport,
583bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp); 590bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp);
584u32 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp); 591u32 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp);
585u32 bfa_fcxp_get_maxrsp(struct bfa_s *bfa); 592u32 bfa_fcxp_get_maxrsp(struct bfa_s *bfa);
593void bfa_fcxp_res_recfg(struct bfa_s *bfa, u16 num_fcxp_fw);
586 594
587static inline void * 595static inline void *
588bfa_uf_get_frmbuf(struct bfa_uf_s *uf) 596bfa_uf_get_frmbuf(struct bfa_uf_s *uf)
@@ -617,6 +625,7 @@ void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz,
617 wwn_t pwwn, wwn_t nwwn); 625 wwn_t pwwn, wwn_t nwwn);
618void bfa_lps_fdisclogo(struct bfa_lps_s *lps); 626void bfa_lps_fdisclogo(struct bfa_lps_s *lps);
619void bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, u32 n2n_pid); 627void bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, u32 n2n_pid);
628u8 bfa_lps_get_fwtag(struct bfa_s *bfa, u8 lp_tag);
620u32 bfa_lps_get_base_pid(struct bfa_s *bfa); 629u32 bfa_lps_get_base_pid(struct bfa_s *bfa);
621u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid); 630u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid);
622void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status); 631void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status);
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h
index 3fb2e8315323..40002f4ea008 100644
--- a/drivers/scsi/bfa/bfi.h
+++ b/drivers/scsi/bfa/bfi.h
@@ -38,18 +38,20 @@ struct bfi_mhdr_s {
38 union { 38 union {
39 struct { 39 struct {
40 u8 qid; 40 u8 qid;
41 u8 lpu_id; /* msg destination */ 41 u8 fn_lpu; /* msg destination */
42 } h2i; 42 } h2i;
43 u16 i2htok; /* token in msgs to host */ 43 u16 i2htok; /* token in msgs to host */
44 } mtag; 44 } mtag;
45}; 45};
46 46
47#define bfi_mhdr_2_qid(_mh) ((_mh)->mtag.h2i.qid) 47#define bfi_fn_lpu(__fn, __lpu) ((__fn) << 1 | (__lpu))
48#define bfi_mhdr_2_fn(_mh) ((_mh)->mtag.h2i.fn_lpu >> 1)
49#define bfi_mhdr_2_qid(_m) ((_mh)->mtag.h2i.qid)
48 50
49#define bfi_h2i_set(_mh, _mc, _op, _lpuid) do { \ 51#define bfi_h2i_set(_mh, _mc, _op, _fn_lpu) do { \
50 (_mh).msg_class = (_mc); \ 52 (_mh).msg_class = (_mc); \
51 (_mh).msg_id = (_op); \ 53 (_mh).msg_id = (_op); \
52 (_mh).mtag.h2i.lpu_id = (_lpuid); \ 54 (_mh).mtag.h2i.fn_lpu = (_fn_lpu); \
53} while (0) 55} while (0)
54 56
55#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do { \ 57#define bfi_i2h_set(_mh, _mc, _op, _i2htok) do { \
diff --git a/drivers/scsi/bfa/bfi_ms.h b/drivers/scsi/bfa/bfi_ms.h
index 8c1973456410..0727c7595b1d 100644
--- a/drivers/scsi/bfa/bfi_ms.h
+++ b/drivers/scsi/bfa/bfi_ms.h
@@ -88,6 +88,7 @@ struct bfi_iocfc_qreg_s {
88 u32 rme_q_ci_off[BFI_IOC_MAX_CQS]; 88 u32 rme_q_ci_off[BFI_IOC_MAX_CQS];
89 u32 rme_q_pi_off[BFI_IOC_MAX_CQS]; 89 u32 rme_q_pi_off[BFI_IOC_MAX_CQS];
90 u32 rme_qctl_off[BFI_IOC_MAX_CQS]; 90 u32 rme_qctl_off[BFI_IOC_MAX_CQS];
91 u8 hw_qid[BFI_IOC_MAX_CQS];
91}; 92};
92 93
93struct bfi_iocfc_cfgrsp_s { 94struct bfi_iocfc_cfgrsp_s {
@@ -348,7 +349,7 @@ struct bfi_fcxp_send_req_s {
348 u8 class; /* FC class used for req/rsp */ 349 u8 class; /* FC class used for req/rsp */
349 u8 rsp_timeout; /* timeout in secs, 0-no response */ 350 u8 rsp_timeout; /* timeout in secs, 0-no response */
350 u8 cts; /* continue sequence */ 351 u8 cts; /* continue sequence */
351 u8 lp_tag; /* lport tag */ 352 u8 lp_fwtag; /* lport tag */
352 struct fchs_s fchs; /* request FC header structure */ 353 struct fchs_s fchs; /* request FC header structure */
353 __be32 req_len; /* request payload length */ 354 __be32 req_len; /* request payload length */
354 __be32 rsp_maxlen; /* max response length expected */ 355 __be32 rsp_maxlen; /* max response length expected */
@@ -408,7 +409,7 @@ enum bfi_lps_i2h_msgs {
408 409
409struct bfi_lps_login_req_s { 410struct bfi_lps_login_req_s {
410 struct bfi_mhdr_s mh; /* common msg header */ 411 struct bfi_mhdr_s mh; /* common msg header */
411 u8 lp_tag; 412 u8 bfa_tag;
412 u8 alpa; 413 u8 alpa;
413 __be16 pdu_size; 414 __be16 pdu_size;
414 wwn_t pwwn; 415 wwn_t pwwn;
@@ -421,7 +422,7 @@ struct bfi_lps_login_req_s {
421 422
422struct bfi_lps_login_rsp_s { 423struct bfi_lps_login_rsp_s {
423 struct bfi_mhdr_s mh; /* common msg header */ 424 struct bfi_mhdr_s mh; /* common msg header */
424 u8 lp_tag; 425 u8 fw_tag;
425 u8 status; 426 u8 status;
426 u8 lsrjt_rsn; 427 u8 lsrjt_rsn;
427 u8 lsrjt_expl; 428 u8 lsrjt_expl;
@@ -437,32 +438,32 @@ struct bfi_lps_login_rsp_s {
437 u8 ext_status; 438 u8 ext_status;
438 u8 brcd_switch; /* attached peer is brcd switch */ 439 u8 brcd_switch; /* attached peer is brcd switch */
439 u8 bb_scn; /* atatched port's bb_scn */ 440 u8 bb_scn; /* atatched port's bb_scn */
440 u8 resvd; 441 u8 bfa_tag;
441}; 442};
442 443
443struct bfi_lps_logout_req_s { 444struct bfi_lps_logout_req_s {
444 struct bfi_mhdr_s mh; /* common msg header */ 445 struct bfi_mhdr_s mh; /* common msg header */
445 u8 lp_tag; 446 u8 fw_tag;
446 u8 rsvd[3]; 447 u8 rsvd[3];
447 wwn_t port_name; 448 wwn_t port_name;
448}; 449};
449 450
450struct bfi_lps_logout_rsp_s { 451struct bfi_lps_logout_rsp_s {
451 struct bfi_mhdr_s mh; /* common msg header */ 452 struct bfi_mhdr_s mh; /* common msg header */
452 u8 lp_tag; 453 u8 bfa_tag;
453 u8 status; 454 u8 status;
454 u8 rsvd[2]; 455 u8 rsvd[2];
455}; 456};
456 457
457struct bfi_lps_cvl_event_s { 458struct bfi_lps_cvl_event_s {
458 struct bfi_mhdr_s mh; /* common msg header */ 459 struct bfi_mhdr_s mh; /* common msg header */
459 u8 lp_tag; 460 u8 bfa_tag;
460 u8 rsvd[3]; 461 u8 rsvd[3];
461}; 462};
462 463
463struct bfi_lps_n2n_pid_req_s { 464struct bfi_lps_n2n_pid_req_s {
464 struct bfi_mhdr_s mh; /* common msg header */ 465 struct bfi_mhdr_s mh; /* common msg header */
465 u8 lp_tag; 466 u8 fw_tag;
466 u32 lp_pid:24; 467 u32 lp_pid:24;
467}; 468};
468 469
@@ -497,7 +498,7 @@ struct bfi_rport_create_req_s {
497 u16 bfa_handle; /* host rport handle */ 498 u16 bfa_handle; /* host rport handle */
498 __be16 max_frmsz; /* max rcv pdu size */ 499 __be16 max_frmsz; /* max rcv pdu size */
499 u32 pid:24, /* remote port ID */ 500 u32 pid:24, /* remote port ID */
500 lp_tag:8; /* local port tag */ 501 lp_fwtag:8; /* local port tag */
501 u32 local_pid:24, /* local port ID */ 502 u32 local_pid:24, /* local port ID */
502 cisc:8; 503 cisc:8;
503 u8 fc_class; /* supported FC classes */ 504 u8 fc_class; /* supported FC classes */