diff options
Diffstat (limited to 'drivers/scsi/bfa/bfa_iocfc.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_iocfc.c | 107 |
1 files changed, 74 insertions, 33 deletions
diff --git a/drivers/scsi/bfa/bfa_iocfc.c b/drivers/scsi/bfa/bfa_iocfc.c index a76de2669bfc..90820be99864 100644 --- a/drivers/scsi/bfa/bfa_iocfc.c +++ b/drivers/scsi/bfa/bfa_iocfc.c | |||
@@ -113,7 +113,6 @@ bfa_iocfc_send_cfg(void *bfa_arg) | |||
113 | bfa_assert(cfg->fwcfg.num_cqs <= BFI_IOC_MAX_CQS); | 113 | bfa_assert(cfg->fwcfg.num_cqs <= BFI_IOC_MAX_CQS); |
114 | bfa_trc(bfa, cfg->fwcfg.num_cqs); | 114 | bfa_trc(bfa, cfg->fwcfg.num_cqs); |
115 | 115 | ||
116 | iocfc->cfgdone = BFA_FALSE; | ||
117 | bfa_iocfc_reset_queues(bfa); | 116 | bfa_iocfc_reset_queues(bfa); |
118 | 117 | ||
119 | /** | 118 | /** |
@@ -145,6 +144,15 @@ bfa_iocfc_send_cfg(void *bfa_arg) | |||
145 | } | 144 | } |
146 | 145 | ||
147 | /** | 146 | /** |
147 | * Enable interrupt coalescing if it is driver init path | ||
148 | * and not ioc disable/enable path. | ||
149 | */ | ||
150 | if (!iocfc->cfgdone) | ||
151 | cfg_info->intr_attr.coalesce = BFA_TRUE; | ||
152 | |||
153 | iocfc->cfgdone = BFA_FALSE; | ||
154 | |||
155 | /** | ||
148 | * dma map IOC configuration itself | 156 | * dma map IOC configuration itself |
149 | */ | 157 | */ |
150 | bfi_h2i_set(cfg_req.mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_CFG_REQ, | 158 | bfi_h2i_set(cfg_req.mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_CFG_REQ, |
@@ -170,7 +178,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
170 | /** | 178 | /** |
171 | * Initialize chip specific handlers. | 179 | * Initialize chip specific handlers. |
172 | */ | 180 | */ |
173 | if (bfa_ioc_devid(&bfa->ioc) == BFA_PCI_DEVICE_ID_CT) { | 181 | if (bfa_asic_id_ct(bfa_ioc_devid(&bfa->ioc))) { |
174 | iocfc->hwif.hw_reginit = bfa_hwct_reginit; | 182 | iocfc->hwif.hw_reginit = bfa_hwct_reginit; |
175 | iocfc->hwif.hw_reqq_ack = bfa_hwct_reqq_ack; | 183 | iocfc->hwif.hw_reqq_ack = bfa_hwct_reqq_ack; |
176 | iocfc->hwif.hw_rspq_ack = bfa_hwct_rspq_ack; | 184 | iocfc->hwif.hw_rspq_ack = bfa_hwct_rspq_ack; |
@@ -179,6 +187,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
179 | iocfc->hwif.hw_msix_uninstall = bfa_hwct_msix_uninstall; | 187 | iocfc->hwif.hw_msix_uninstall = bfa_hwct_msix_uninstall; |
180 | iocfc->hwif.hw_isr_mode_set = bfa_hwct_isr_mode_set; | 188 | iocfc->hwif.hw_isr_mode_set = bfa_hwct_isr_mode_set; |
181 | iocfc->hwif.hw_msix_getvecs = bfa_hwct_msix_getvecs; | 189 | iocfc->hwif.hw_msix_getvecs = bfa_hwct_msix_getvecs; |
190 | iocfc->hwif.hw_msix_get_rme_range = bfa_hwct_msix_get_rme_range; | ||
182 | } else { | 191 | } else { |
183 | iocfc->hwif.hw_reginit = bfa_hwcb_reginit; | 192 | iocfc->hwif.hw_reginit = bfa_hwcb_reginit; |
184 | iocfc->hwif.hw_reqq_ack = bfa_hwcb_reqq_ack; | 193 | iocfc->hwif.hw_reqq_ack = bfa_hwcb_reqq_ack; |
@@ -188,6 +197,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
188 | iocfc->hwif.hw_msix_uninstall = bfa_hwcb_msix_uninstall; | 197 | iocfc->hwif.hw_msix_uninstall = bfa_hwcb_msix_uninstall; |
189 | iocfc->hwif.hw_isr_mode_set = bfa_hwcb_isr_mode_set; | 198 | iocfc->hwif.hw_isr_mode_set = bfa_hwcb_isr_mode_set; |
190 | iocfc->hwif.hw_msix_getvecs = bfa_hwcb_msix_getvecs; | 199 | iocfc->hwif.hw_msix_getvecs = bfa_hwcb_msix_getvecs; |
200 | iocfc->hwif.hw_msix_get_rme_range = bfa_hwcb_msix_get_rme_range; | ||
191 | } | 201 | } |
192 | 202 | ||
193 | iocfc->hwif.hw_reginit(bfa); | 203 | iocfc->hwif.hw_reginit(bfa); |
@@ -291,18 +301,6 @@ bfa_iocfc_mem_claim(struct bfa_s *bfa, struct bfa_iocfc_cfg_s *cfg, | |||
291 | } | 301 | } |
292 | 302 | ||
293 | /** | 303 | /** |
294 | * BFA submodules initialization completion notification. | ||
295 | */ | ||
296 | static void | ||
297 | bfa_iocfc_initdone_submod(struct bfa_s *bfa) | ||
298 | { | ||
299 | int i; | ||
300 | |||
301 | for (i = 0; hal_mods[i]; i++) | ||
302 | hal_mods[i]->initdone(bfa); | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * Start BFA submodules. | 304 | * Start BFA submodules. |
307 | */ | 305 | */ |
308 | static void | 306 | static void |
@@ -376,7 +374,6 @@ bfa_iocfc_cfgrsp(struct bfa_s *bfa) | |||
376 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; | 374 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; |
377 | struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; | 375 | struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; |
378 | struct bfa_iocfc_fwcfg_s *fwcfg = &cfgrsp->fwcfg; | 376 | struct bfa_iocfc_fwcfg_s *fwcfg = &cfgrsp->fwcfg; |
379 | struct bfi_iocfc_cfg_s *cfginfo = iocfc->cfginfo; | ||
380 | 377 | ||
381 | fwcfg->num_cqs = fwcfg->num_cqs; | 378 | fwcfg->num_cqs = fwcfg->num_cqs; |
382 | fwcfg->num_ioim_reqs = bfa_os_ntohs(fwcfg->num_ioim_reqs); | 379 | fwcfg->num_ioim_reqs = bfa_os_ntohs(fwcfg->num_ioim_reqs); |
@@ -385,15 +382,13 @@ bfa_iocfc_cfgrsp(struct bfa_s *bfa) | |||
385 | fwcfg->num_uf_bufs = bfa_os_ntohs(fwcfg->num_uf_bufs); | 382 | fwcfg->num_uf_bufs = bfa_os_ntohs(fwcfg->num_uf_bufs); |
386 | fwcfg->num_rports = bfa_os_ntohs(fwcfg->num_rports); | 383 | fwcfg->num_rports = bfa_os_ntohs(fwcfg->num_rports); |
387 | 384 | ||
388 | cfginfo->intr_attr.coalesce = cfgrsp->intr_attr.coalesce; | ||
389 | cfginfo->intr_attr.delay = bfa_os_ntohs(cfgrsp->intr_attr.delay); | ||
390 | cfginfo->intr_attr.latency = bfa_os_ntohs(cfgrsp->intr_attr.latency); | ||
391 | |||
392 | iocfc->cfgdone = BFA_TRUE; | 385 | iocfc->cfgdone = BFA_TRUE; |
393 | 386 | ||
394 | /** | 387 | /** |
395 | * Configuration is complete - initialize/start submodules | 388 | * Configuration is complete - initialize/start submodules |
396 | */ | 389 | */ |
390 | bfa_fcport_init(bfa); | ||
391 | |||
397 | if (iocfc->action == BFA_IOCFC_ACT_INIT) | 392 | if (iocfc->action == BFA_IOCFC_ACT_INIT) |
398 | bfa_cb_queue(bfa, &iocfc->init_hcb_qe, bfa_iocfc_init_cb, bfa); | 393 | bfa_cb_queue(bfa, &iocfc->init_hcb_qe, bfa_iocfc_init_cb, bfa); |
399 | else | 394 | else |
@@ -531,7 +526,6 @@ bfa_iocfc_enable_cbfn(void *bfa_arg, enum bfa_status status) | |||
531 | return; | 526 | return; |
532 | } | 527 | } |
533 | 528 | ||
534 | bfa_iocfc_initdone_submod(bfa); | ||
535 | bfa_iocfc_send_cfg(bfa); | 529 | bfa_iocfc_send_cfg(bfa); |
536 | } | 530 | } |
537 | 531 | ||
@@ -625,9 +619,9 @@ bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
625 | bfa->trcmod, bfa->aen, bfa->logm); | 619 | bfa->trcmod, bfa->aen, bfa->logm); |
626 | 620 | ||
627 | /** | 621 | /** |
628 | * Choose FC (ssid: 0x1C) v/s FCoE (ssid: 0x14) mode. | 622 | * Set FC mode for BFA_PCI_DEVICE_ID_CT_FC. |
629 | */ | 623 | */ |
630 | if (0) | 624 | if (pcidev->device_id == BFA_PCI_DEVICE_ID_CT_FC) |
631 | bfa_ioc_set_fcmode(&bfa->ioc); | 625 | bfa_ioc_set_fcmode(&bfa->ioc); |
632 | 626 | ||
633 | bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_MC_IOCFC); | 627 | bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_MC_IOCFC); |
@@ -748,10 +742,20 @@ bfa_adapter_get_id(struct bfa_s *bfa) | |||
748 | void | 742 | void |
749 | bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr) | 743 | bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr) |
750 | { | 744 | { |
751 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; | 745 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; |
746 | |||
747 | attr->intr_attr.coalesce = iocfc->cfginfo->intr_attr.coalesce; | ||
748 | |||
749 | attr->intr_attr.delay = iocfc->cfginfo->intr_attr.delay ? | ||
750 | bfa_os_ntohs(iocfc->cfginfo->intr_attr.delay) : | ||
751 | bfa_os_ntohs(iocfc->cfgrsp->intr_attr.delay); | ||
752 | |||
753 | attr->intr_attr.latency = iocfc->cfginfo->intr_attr.latency ? | ||
754 | bfa_os_ntohs(iocfc->cfginfo->intr_attr.latency) : | ||
755 | bfa_os_ntohs(iocfc->cfgrsp->intr_attr.latency); | ||
756 | |||
757 | attr->config = iocfc->cfg; | ||
752 | 758 | ||
753 | attr->intr_attr = iocfc->cfginfo->intr_attr; | ||
754 | attr->config = iocfc->cfg; | ||
755 | } | 759 | } |
756 | 760 | ||
757 | bfa_status_t | 761 | bfa_status_t |
@@ -760,7 +764,10 @@ bfa_iocfc_israttr_set(struct bfa_s *bfa, struct bfa_iocfc_intr_attr_s *attr) | |||
760 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; | 764 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; |
761 | struct bfi_iocfc_set_intr_req_s *m; | 765 | struct bfi_iocfc_set_intr_req_s *m; |
762 | 766 | ||
763 | iocfc->cfginfo->intr_attr = *attr; | 767 | iocfc->cfginfo->intr_attr.coalesce = attr->coalesce; |
768 | iocfc->cfginfo->intr_attr.delay = bfa_os_htons(attr->delay); | ||
769 | iocfc->cfginfo->intr_attr.latency = bfa_os_htons(attr->latency); | ||
770 | |||
764 | if (!bfa_iocfc_is_operational(bfa)) | 771 | if (!bfa_iocfc_is_operational(bfa)) |
765 | return BFA_STATUS_OK; | 772 | return BFA_STATUS_OK; |
766 | 773 | ||
@@ -770,9 +777,10 @@ bfa_iocfc_israttr_set(struct bfa_s *bfa, struct bfa_iocfc_intr_attr_s *attr) | |||
770 | 777 | ||
771 | bfi_h2i_set(m->mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_SET_INTR_REQ, | 778 | bfi_h2i_set(m->mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_SET_INTR_REQ, |
772 | bfa_lpuid(bfa)); | 779 | bfa_lpuid(bfa)); |
773 | m->coalesce = attr->coalesce; | 780 | m->coalesce = iocfc->cfginfo->intr_attr.coalesce; |
774 | m->delay = bfa_os_htons(attr->delay); | 781 | m->delay = iocfc->cfginfo->intr_attr.delay; |
775 | m->latency = bfa_os_htons(attr->latency); | 782 | m->latency = iocfc->cfginfo->intr_attr.latency; |
783 | |||
776 | 784 | ||
777 | bfa_trc(bfa, attr->delay); | 785 | bfa_trc(bfa, attr->delay); |
778 | bfa_trc(bfa, attr->latency); | 786 | bfa_trc(bfa, attr->latency); |
@@ -872,15 +880,48 @@ bfa_iocfc_is_operational(struct bfa_s *bfa) | |||
872 | * Return boot target port wwns -- read from boot information in flash. | 880 | * Return boot target port wwns -- read from boot information in flash. |
873 | */ | 881 | */ |
874 | void | 882 | void |
875 | bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t **wwns) | 883 | bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns) |
876 | { | 884 | { |
877 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; | 885 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; |
878 | struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; | 886 | struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; |
887 | int i; | ||
888 | |||
889 | if (cfgrsp->pbc_cfg.boot_enabled && cfgrsp->pbc_cfg.nbluns) { | ||
890 | bfa_trc(bfa, cfgrsp->pbc_cfg.nbluns); | ||
891 | *nwwns = cfgrsp->pbc_cfg.nbluns; | ||
892 | for (i = 0; i < cfgrsp->pbc_cfg.nbluns; i++) | ||
893 | wwns[i] = cfgrsp->pbc_cfg.blun[i].tgt_pwwn; | ||
894 | |||
895 | return; | ||
896 | } | ||
879 | 897 | ||
880 | *nwwns = cfgrsp->bootwwns.nwwns; | 898 | *nwwns = cfgrsp->bootwwns.nwwns; |
881 | *wwns = cfgrsp->bootwwns.wwn; | 899 | memcpy(wwns, cfgrsp->bootwwns.wwn, sizeof(cfgrsp->bootwwns.wwn)); |
900 | } | ||
901 | |||
902 | void | ||
903 | bfa_iocfc_get_pbc_boot_cfg(struct bfa_s *bfa, struct bfa_boot_pbc_s *pbcfg) | ||
904 | { | ||
905 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; | ||
906 | struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; | ||
907 | |||
908 | pbcfg->enable = cfgrsp->pbc_cfg.boot_enabled; | ||
909 | pbcfg->nbluns = cfgrsp->pbc_cfg.nbluns; | ||
910 | pbcfg->speed = cfgrsp->pbc_cfg.port_speed; | ||
911 | memcpy(pbcfg->pblun, cfgrsp->pbc_cfg.blun, sizeof(pbcfg->pblun)); | ||
882 | } | 912 | } |
883 | 913 | ||
914 | int | ||
915 | bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, struct bfi_pbc_vport_s *pbc_vport) | ||
916 | { | ||
917 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; | ||
918 | struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; | ||
919 | |||
920 | memcpy(pbc_vport, cfgrsp->pbc_cfg.vport, sizeof(cfgrsp->pbc_cfg.vport)); | ||
921 | return cfgrsp->pbc_cfg.nvports; | ||
922 | } | ||
923 | |||
924 | |||
884 | #endif | 925 | #endif |
885 | 926 | ||
886 | 927 | ||