Lines Matching refs:phba
73 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba);
74 static void lpfc_cpuhp_remove(struct lpfc_hba *phba);
75 static void lpfc_cpuhp_add(struct lpfc_hba *phba);
87 static int lpfc_hba_down_post_s3(struct lpfc_hba *phba);
88 static int lpfc_hba_down_post_s4(struct lpfc_hba *phba);
94 static void lpfc_sli4_oas_verify(struct lpfc_hba *phba);
98 static void lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba);
104 static int lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport);
121 lpfc_config_port_prep(struct lpfc_hba *phba) in lpfc_config_port_prep() argument
123 lpfc_vpd_t *vp = &phba->vpd; in lpfc_config_port_prep()
133 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_prep()
135 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_prep()
140 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_config_port_prep()
142 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port_prep()
151 lpfc_read_nv(phba, pmb); in lpfc_config_port_prep()
157 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
160 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
165 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
168 memcpy(phba->wwnn, (char *)mb->un.varRDnvp.nodename, in lpfc_config_port_prep()
169 sizeof(phba->wwnn)); in lpfc_config_port_prep()
170 memcpy(phba->wwpn, (char *)mb->un.varRDnvp.portname, in lpfc_config_port_prep()
171 sizeof(phba->wwpn)); in lpfc_config_port_prep()
178 phba->sli3_options &= (uint32_t)LPFC_SLI3_BG_ENABLED; in lpfc_config_port_prep()
181 lpfc_read_rev(phba, pmb); in lpfc_config_port_prep()
182 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
184 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
188 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
199 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
202 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
206 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) { in lpfc_config_port_prep()
207 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
234 phba->sli3_options |= LPFC_SLI3_VPORT_TEARDOWN; in lpfc_config_port_prep()
236 if (lpfc_is_LC_HBA(phba->pcidev->device)) in lpfc_config_port_prep()
237 memcpy(phba->RandomData, (char *)&mb->un.varWords[24], in lpfc_config_port_prep()
238 sizeof (phba->RandomData)); in lpfc_config_port_prep()
245 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD); in lpfc_config_port_prep()
246 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
249 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_config_port_prep()
269 lpfc_parse_vpd(phba, lpfc_vpd_data, offset); in lpfc_config_port_prep()
273 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
288 lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_config_async_cmpl() argument
291 phba->temp_sensor_support = 1; in lpfc_config_async_cmpl()
293 phba->temp_sensor_support = 0; in lpfc_config_async_cmpl()
294 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_config_async_cmpl()
309 lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_dump_wakeup_param_cmpl() argument
318 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
331 snprintf(phba->OptionROMVersion, 32, "%d.%d%d", in lpfc_dump_wakeup_param_cmpl()
334 snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", in lpfc_dump_wakeup_param_cmpl()
337 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
352 struct lpfc_hba *phba = vport->phba; in lpfc_update_vport_wwn() local
374 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_update_vport_wwn()
376 phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_FABRIC) { in lpfc_update_vport_wwn()
377 if (!(phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG)) in lpfc_update_vport_wwn()
378 phba->sli4_hba.fawwpn_flag &= in lpfc_update_vport_wwn()
380 lpfc_printf_log(phba, KERN_INFO, in lpfc_update_vport_wwn()
388 phba->sli4_hba.fawwpn_flag); in lpfc_update_vport_wwn()
416 lpfc_config_port_post(struct lpfc_hba *phba) in lpfc_config_port_post() argument
418 struct lpfc_vport *vport = phba->pport; in lpfc_config_port_post()
423 struct lpfc_sli *psli = &phba->sli; in lpfc_config_port_post()
428 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
433 if (phba->over_temp_state == HBA_OVER_TEMP) in lpfc_config_port_post()
434 phba->over_temp_state = HBA_NORMAL_TEMP; in lpfc_config_port_post()
435 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
437 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
439 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
445 rc = lpfc_read_sparam(phba, pmb, 0); in lpfc_config_port_post()
447 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
452 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
453 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
457 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
458 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_config_port_post()
469 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
477 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_config_port_post()
481 if (phba->SerialNumber[0] == 0) { in lpfc_config_port_post()
489 phba->SerialNumber[i] = in lpfc_config_port_post()
492 phba->SerialNumber[i] = in lpfc_config_port_post()
497 phba->SerialNumber[i] = in lpfc_config_port_post()
500 phba->SerialNumber[i] = in lpfc_config_port_post()
505 lpfc_read_config(phba, pmb); in lpfc_config_port_post()
507 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
508 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
512 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
513 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
518 lpfc_sli_read_link_ste(phba); in lpfc_config_port_post()
521 if (phba->cfg_hba_queue_depth > mb->un.varRdConfig.max_xri) { in lpfc_config_port_post()
522 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
524 phba->cfg_hba_queue_depth, in lpfc_config_port_post()
526 phba->cfg_hba_queue_depth = mb->un.varRdConfig.max_xri; in lpfc_config_port_post()
529 phba->lmt = mb->un.varRdConfig.lmt; in lpfc_config_port_post()
532 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_config_port_post()
534 phba->link_state = LPFC_LINK_DOWN; in lpfc_config_port_post()
543 if (phba->sli_rev != 3) in lpfc_config_port_post()
544 lpfc_post_rcv_buf(phba); in lpfc_config_port_post()
549 if (phba->intr_type == MSIX) { in lpfc_config_port_post()
550 rc = lpfc_config_msi(phba, pmb); in lpfc_config_port_post()
552 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
555 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_post()
557 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
562 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
567 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
569 phba->hba_flag &= ~HBA_ERATT_HANDLED; in lpfc_config_port_post()
572 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_config_port_post()
573 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
586 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && in lpfc_config_port_post()
587 (phba->cfg_poll & DISABLE_FCP_RING_INT)) in lpfc_config_port_post()
590 writel(status, phba->HCregaddr); in lpfc_config_port_post()
591 readl(phba->HCregaddr); /* flush */ in lpfc_config_port_post()
592 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
595 timeout = phba->fc_ratov * 2; in lpfc_config_port_post()
599 mod_timer(&phba->hb_tmofunc, in lpfc_config_port_post()
601 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_config_port_post()
602 phba->last_completion_time = jiffies; in lpfc_config_port_post()
604 mod_timer(&phba->eratt_poll, in lpfc_config_port_post()
605 jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); in lpfc_config_port_post()
607 if (phba->hba_flag & LINK_DISABLED) { in lpfc_config_port_post()
608 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
610 lpfc_down_link(phba, pmb); in lpfc_config_port_post()
612 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
614 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
618 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
621 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_config_port_post()
622 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
623 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_config_port_post()
628 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
630 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
634 lpfc_config_async(phba, pmb, LPFC_ELS_RING); in lpfc_config_port_post()
636 pmb->vport = phba->pport; in lpfc_config_port_post()
637 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
640 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
644 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
648 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
650 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
654 lpfc_dump_wakeup_param(phba, pmb); in lpfc_config_port_post()
656 pmb->vport = phba->pport; in lpfc_config_port_post()
657 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
660 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
663 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
677 lpfc_sli4_refresh_params(struct lpfc_hba *phba) in lpfc_sli4_refresh_params() argument
684 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_refresh_params()
692 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_refresh_params()
696 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_refresh_params()
698 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_refresh_params()
704 if (phba->cfg_enable_mi) in lpfc_sli4_refresh_params()
705 phba->sli4_hba.pc_sli4_params.mi_ver = in lpfc_sli4_refresh_params()
708 phba->sli4_hba.pc_sli4_params.mi_ver = 0; in lpfc_sli4_refresh_params()
710 phba->sli4_hba.pc_sli4_params.cmf = in lpfc_sli4_refresh_params()
712 phba->sli4_hba.pc_sli4_params.pls = in lpfc_sli4_refresh_params()
715 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_refresh_params()
734 lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_init_link() argument
736 return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); in lpfc_hba_init_link()
755 lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, in lpfc_hba_init_link_fc_topology() argument
758 struct lpfc_vport *vport = phba->pport; in lpfc_hba_init_link_fc_topology()
763 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_init_link_fc_topology()
765 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
771 if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || in lpfc_hba_init_link_fc_topology()
772 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && in lpfc_hba_init_link_fc_topology()
773 !(phba->lmt & LMT_1Gb)) || in lpfc_hba_init_link_fc_topology()
774 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && in lpfc_hba_init_link_fc_topology()
775 !(phba->lmt & LMT_2Gb)) || in lpfc_hba_init_link_fc_topology()
776 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && in lpfc_hba_init_link_fc_topology()
777 !(phba->lmt & LMT_4Gb)) || in lpfc_hba_init_link_fc_topology()
778 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && in lpfc_hba_init_link_fc_topology()
779 !(phba->lmt & LMT_8Gb)) || in lpfc_hba_init_link_fc_topology()
780 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && in lpfc_hba_init_link_fc_topology()
781 !(phba->lmt & LMT_10Gb)) || in lpfc_hba_init_link_fc_topology()
782 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && in lpfc_hba_init_link_fc_topology()
783 !(phba->lmt & LMT_16Gb)) || in lpfc_hba_init_link_fc_topology()
784 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && in lpfc_hba_init_link_fc_topology()
785 !(phba->lmt & LMT_32Gb)) || in lpfc_hba_init_link_fc_topology()
786 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) && in lpfc_hba_init_link_fc_topology()
787 !(phba->lmt & LMT_64Gb))) { in lpfc_hba_init_link_fc_topology()
789 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
792 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
793 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
795 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
797 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
798 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
799 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
801 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
805 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
807 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
808 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
810 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
811 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
813 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
815 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
818 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
820 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
839 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
844 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
846 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
850 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
852 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
854 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
856 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
860 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
864 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
881 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
886 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
888 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
889 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
892 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_hba_down_prep()
893 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
895 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
897 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
900 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
919 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
925 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
926 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli4_free_sp_events()
927 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
929 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli4_free_sp_events()
931 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
932 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli4_free_sp_events()
934 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
940 lpfc_sli_release_iocbq(phba, rspiocbq); in lpfc_sli4_free_sp_events()
946 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_free_sp_events()
963 lpfc_hba_free_post_buf(struct lpfc_hba *phba) in lpfc_hba_free_post_buf() argument
965 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_free_post_buf()
971 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) in lpfc_hba_free_post_buf()
972 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_free_post_buf()
976 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
978 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
984 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_hba_free_post_buf()
988 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
990 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
1005 lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) in lpfc_hba_clean_txcmplq() argument
1007 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_clean_txcmplq()
1014 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_hba_clean_txcmplq()
1017 spin_lock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
1024 spin_unlock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
1026 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
1029 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
1033 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_hba_clean_txcmplq()
1044 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
1047 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
1063 lpfc_hba_down_post_s3(struct lpfc_hba *phba) in lpfc_hba_down_post_s3() argument
1065 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s3()
1066 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s3()
1082 lpfc_hba_down_post_s4(struct lpfc_hba *phba) in lpfc_hba_down_post_s4() argument
1094 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_down_post_s4()
1095 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s4()
1107 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1109 &phba->sli4_hba.lpfc_abts_els_sgl_list, list) in lpfc_hba_down_post_s4()
1112 list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, in lpfc_hba_down_post_s4()
1113 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_hba_down_post_s4()
1116 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1121 spin_lock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1123 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_hba_down_post_s4()
1124 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_hba_down_post_s4()
1144 spin_unlock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1146 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_hba_down_post_s4()
1147 spin_lock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1148 list_splice_init(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list, in lpfc_hba_down_post_s4()
1150 spin_unlock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1153 lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf); in lpfc_hba_down_post_s4()
1157 lpfc_sli4_free_sp_events(phba); in lpfc_hba_down_post_s4()
1173 lpfc_hba_down_post(struct lpfc_hba *phba) in lpfc_hba_down_post() argument
1175 return (*phba->lpfc_hba_down_post)(phba); in lpfc_hba_down_post()
1193 struct lpfc_hba *phba; in lpfc_hb_timeout() local
1197 phba = from_timer(phba, t, hb_tmofunc); in lpfc_hb_timeout()
1200 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1201 tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; in lpfc_hb_timeout()
1203 phba->pport->work_port_events |= WORKER_HB_TMO; in lpfc_hb_timeout()
1204 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1208 lpfc_worker_wake_up(phba); in lpfc_hb_timeout()
1227 struct lpfc_hba *phba; in lpfc_rrq_timeout() local
1230 phba = from_timer(phba, t, rrq_tmr); in lpfc_rrq_timeout()
1231 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1232 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1233 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1235 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1236 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1238 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1239 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1259 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1263 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1264 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_hb_mbox_cmpl()
1265 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1268 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1269 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && in lpfc_hb_mbox_cmpl()
1270 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1271 !(phba->pport->load_flag & FC_UNLOADING)) in lpfc_hb_mbox_cmpl()
1272 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1289 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_idle_stat_delay_work() local
1298 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_idle_stat_delay_work()
1301 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_idle_stat_delay_work()
1302 phba->pport->fc_flag & FC_OFFLINE_MODE || in lpfc_idle_stat_delay_work()
1303 phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_idle_stat_delay_work()
1307 hdwq = &phba->sli4_hba.hdwq[phba->sli4_hba.cpu_map[i].hdwq]; in lpfc_idle_stat_delay_work()
1314 idle_stat = &phba->sli4_hba.idle_stat[i]; in lpfc_idle_stat_delay_work()
1344 schedule_delayed_work(&phba->idle_stat_delay_work, in lpfc_idle_stat_delay_work()
1351 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_hb_eq_delay_work() local
1359 if (!phba->cfg_auto_imax || phba->pport->load_flag & FC_UNLOADING) in lpfc_hb_eq_delay_work()
1362 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_hb_eq_delay_work()
1363 phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_hb_eq_delay_work()
1366 ena_delay = kcalloc(phba->sli4_hba.num_possible_cpu, sizeof(*ena_delay), in lpfc_hb_eq_delay_work()
1371 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hb_eq_delay_work()
1373 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_hb_eq_delay_work()
1383 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_hb_eq_delay_work()
1396 eqi_new = per_cpu_ptr(phba->sli4_hba.eq_info, in lpfc_hb_eq_delay_work()
1402 lpfc_modify_hba_eq_delay(phba, eq->hdwq, 1, in lpfc_hb_eq_delay_work()
1410 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_hb_eq_delay_work()
1421 static void lpfc_hb_mxp_handler(struct lpfc_hba *phba) in lpfc_hb_mxp_handler() argument
1426 hwq_count = phba->cfg_hdw_queue; in lpfc_hb_mxp_handler()
1429 lpfc_adjust_pvt_pool_count(phba, i); in lpfc_hb_mxp_handler()
1432 lpfc_adjust_high_watermark(phba, i); in lpfc_hb_mxp_handler()
1436 lpfc_snapshot_mxp(phba, i); in lpfc_hb_mxp_handler()
1450 lpfc_issue_hb_mbox(struct lpfc_hba *phba) in lpfc_issue_hb_mbox() argument
1456 if (phba->hba_flag & HBA_HBEAT_INP) in lpfc_issue_hb_mbox()
1459 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_issue_hb_mbox()
1463 lpfc_heart_beat(phba, pmboxq); in lpfc_issue_hb_mbox()
1465 pmboxq->vport = phba->pport; in lpfc_issue_hb_mbox()
1466 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); in lpfc_issue_hb_mbox()
1469 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_hb_mbox()
1472 phba->hba_flag |= HBA_HBEAT_INP; in lpfc_issue_hb_mbox()
1488 lpfc_issue_hb_tmo(struct lpfc_hba *phba) in lpfc_issue_hb_tmo() argument
1490 if (phba->cfg_enable_hba_heartbeat) in lpfc_issue_hb_tmo()
1492 phba->hba_flag |= HBA_HBEAT_TMO; in lpfc_issue_hb_tmo()
1512 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1518 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1521 if (phba->cfg_xri_rebalancing) { in lpfc_hb_timeout_handler()
1523 lpfc_hb_mxp_handler(phba); in lpfc_hb_timeout_handler()
1526 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1528 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_hb_timeout_handler()
1532 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1534 if ((phba->link_state == LPFC_HBA_ERROR) || in lpfc_hb_timeout_handler()
1535 (phba->pport->load_flag & FC_UNLOADING) || in lpfc_hb_timeout_handler()
1536 (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_hb_timeout_handler()
1539 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1540 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1541 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1542 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1543 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1544 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1545 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1550 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1554 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1557 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1559 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1560 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1563 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1564 if (phba->hba_flag & HBA_HBEAT_INP) in lpfc_hb_timeout_handler()
1570 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1573 if (phba->hba_flag & HBA_HBEAT_INP) { in lpfc_hb_timeout_handler()
1579 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1583 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1589 retval = lpfc_issue_hb_mbox(phba); in lpfc_hb_timeout_handler()
1594 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1595 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1596 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1597 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1601 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1603 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1610 if (phba->hba_flag & HBA_HBEAT_TMO) { in lpfc_hb_timeout_handler()
1611 retval = lpfc_issue_hb_mbox(phba); in lpfc_hb_timeout_handler()
1621 mod_timer(&phba->hb_tmofunc, jiffies + msecs_to_jiffies(tmo)); in lpfc_hb_timeout_handler()
1632 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1634 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1636 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1638 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1639 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1641 lpfc_offline(phba); in lpfc_offline_eratt()
1642 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1643 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1644 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1645 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1646 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1647 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1648 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1649 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1661 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1663 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1664 if (phba->link_state == LPFC_HBA_ERROR && in lpfc_sli4_offline_eratt()
1665 test_bit(HBA_PCI_ERR, &phba->bit_flags)) { in lpfc_sli4_offline_eratt()
1666 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1669 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1670 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1672 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1673 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_offline_eratt()
1674 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1675 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1676 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1689 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1691 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1692 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1697 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1698 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1699 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1700 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1704 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_deferred_eratt()
1707 phba->work_hs, phba->work_status[0], in lpfc_handle_deferred_eratt()
1708 phba->work_status[1]); in lpfc_handle_deferred_eratt()
1710 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1712 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1720 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1726 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1727 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1730 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1732 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1733 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1737 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_handle_deferred_eratt()
1738 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1748 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_deferred_eratt()
1749 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1751 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1752 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1753 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1754 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1755 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1759 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1766 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1784 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1786 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1787 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1796 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1797 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1798 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_eratt_s3()
1799 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1804 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1808 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1810 if (phba->hba_flag & DEFER_ERATT) in lpfc_handle_eratt_s3()
1811 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1813 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1814 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1816 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1819 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1820 phba->work_status[1]); in lpfc_handle_eratt_s3()
1821 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1823 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1826 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1827 phba->work_status[1]); in lpfc_handle_eratt_s3()
1829 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1831 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1839 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1845 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1846 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1847 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1848 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1849 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1852 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1853 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1854 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1859 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1863 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1864 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1866 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1873 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1874 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1875 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1876 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1883 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1886 phba->work_hs, in lpfc_handle_eratt_s3()
1887 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1895 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1912 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1919 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_port_sta_fn_reset()
1925 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1932 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_port_sta_fn_reset()
1941 spin_lock_irq(&phba->hbalock); in lpfc_sli4_port_sta_fn_reset()
1942 phba->sli.sli_flag &= ~LPFC_SLI_ACTIVE; in lpfc_sli4_port_sta_fn_reset()
1943 if (phba->sli.mbox_active) { in lpfc_sli4_port_sta_fn_reset()
1944 mboxq = phba->sli.mbox_active; in lpfc_sli4_port_sta_fn_reset()
1946 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_port_sta_fn_reset()
1947 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_port_sta_fn_reset()
1948 phba->sli.mbox_active = NULL; in lpfc_sli4_port_sta_fn_reset()
1950 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_port_sta_fn_reset()
1953 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1954 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_port_sta_fn_reset()
1955 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1957 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1958 rc = lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1960 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1965 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1967 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1971 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1972 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1974 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1987 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1989 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
2005 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s4()
2006 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2008 lpfc_sli_flush_io_rings(phba); in lpfc_handle_eratt_s4()
2013 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_handle_eratt_s4()
2017 phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_handle_eratt_s4()
2020 phba->sli4_hba.u.if_type0.UEMASKLOregaddr, in lpfc_handle_eratt_s4()
2025 if (!(phba->hba_flag & HBA_RECOVERABLE_UE)) { in lpfc_handle_eratt_s4()
2026 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2029 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2032 for (i = 0; i < phba->sli4_hba.ue_to_sr / 1000; i++) { in lpfc_handle_eratt_s4()
2033 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
2046 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2055 if (!lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
2060 rc = lpfc_sli4_port_sta_fn_reset(phba, in lpfc_handle_eratt_s4()
2064 lpfc_printf_log(phba, KERN_ERR, in lpfc_handle_eratt_s4()
2071 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2074 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
2080 phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_handle_eratt_s4()
2084 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2086 readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); in lpfc_handle_eratt_s4()
2087 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2090 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
2091 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
2093 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2098 phba->sfp_alarm |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_handle_eratt_s4()
2103 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
2110 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
2111 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
2112 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
2113 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2118 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_handle_eratt_s4()
2124 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2128 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2132 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
2136 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
2147 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2149 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
2155 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_handle_eratt_s4()
2158 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s4()
2179 lpfc_handle_eratt(struct lpfc_hba *phba) in lpfc_handle_eratt() argument
2181 (*phba->lpfc_handle_eratt)(phba); in lpfc_handle_eratt()
2192 lpfc_handle_latt(struct lpfc_hba *phba) in lpfc_handle_latt() argument
2194 struct lpfc_vport *vport = phba->pport; in lpfc_handle_latt()
2195 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_latt()
2200 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_handle_latt()
2206 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_handle_latt()
2209 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_handle_latt()
2214 lpfc_els_flush_all_cmd(phba); in lpfc_handle_latt()
2216 lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); in lpfc_handle_latt()
2220 phba->sli.sli3_ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2221 rc = lpfc_sli_issue_mbox (phba, pmb, MBX_NOWAIT); in lpfc_handle_latt()
2228 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2229 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2230 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2231 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2236 phba->sli.sli3_ring[LPFC_ELS_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2237 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_handle_latt()
2240 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2242 control = readl(phba->HCregaddr); in lpfc_handle_latt()
2244 writel(control, phba->HCregaddr); in lpfc_handle_latt()
2245 readl(phba->HCregaddr); /* flush */ in lpfc_handle_latt()
2248 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2249 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2250 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2251 lpfc_linkdown(phba); in lpfc_handle_latt()
2252 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_latt()
2254 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_latt()
2261 lpfc_fill_vpd(struct lpfc_hba *phba, uint8_t *vpd, int length, int *pindex) in lpfc_fill_vpd() argument
2274 phba->SerialNumber[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2278 phba->SerialNumber[j] = 0; in lpfc_fill_vpd()
2281 phba->vpd_flag |= VPD_MODEL_DESC; in lpfc_fill_vpd()
2288 phba->ModelDesc[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2292 phba->ModelDesc[j] = 0; in lpfc_fill_vpd()
2295 phba->vpd_flag |= VPD_MODEL_NAME; in lpfc_fill_vpd()
2302 phba->ModelName[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2306 phba->ModelName[j] = 0; in lpfc_fill_vpd()
2309 phba->vpd_flag |= VPD_PROGRAM_TYPE; in lpfc_fill_vpd()
2316 phba->ProgramType[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2320 phba->ProgramType[j] = 0; in lpfc_fill_vpd()
2323 phba->vpd_flag |= VPD_PORT; in lpfc_fill_vpd()
2330 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_fill_vpd()
2331 (phba->sli4_hba.pport_name_sta == in lpfc_fill_vpd()
2336 phba->Port[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2340 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fill_vpd()
2341 (phba->sli4_hba.pport_name_sta == in lpfc_fill_vpd()
2343 phba->Port[j] = 0; in lpfc_fill_vpd()
2370 lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) in lpfc_parse_vpd() argument
2382 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_parse_vpd()
2408 lpfc_fill_vpd(phba, vpd, Length, &index); in lpfc_parse_vpd()
2436 lpfc_get_atto_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_atto_model_desc() argument
2438 uint16_t sub_dev_id = phba->pcidev->subsystem_device; in lpfc_get_atto_model_desc()
2504 phba->Port); in lpfc_get_atto_model_desc()
2520 lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_hba_model_desc() argument
2523 uint16_t dev_id = phba->pcidev->device; in lpfc_get_hba_model_desc()
2537 if (phba->pcidev->vendor == PCI_VENDOR_ID_ATTO) { in lpfc_get_hba_model_desc()
2538 lpfc_get_atto_model_desc(phba, mdp, descp); in lpfc_get_hba_model_desc()
2542 if (phba->lmt & LMT_64Gb) in lpfc_get_hba_model_desc()
2544 else if (phba->lmt & LMT_32Gb) in lpfc_get_hba_model_desc()
2546 else if (phba->lmt & LMT_16Gb) in lpfc_get_hba_model_desc()
2548 else if (phba->lmt & LMT_10Gb) in lpfc_get_hba_model_desc()
2550 else if (phba->lmt & LMT_8Gb) in lpfc_get_hba_model_desc()
2552 else if (phba->lmt & LMT_4Gb) in lpfc_get_hba_model_desc()
2554 else if (phba->lmt & LMT_2Gb) in lpfc_get_hba_model_desc()
2556 else if (phba->lmt & LMT_1Gb) in lpfc_get_hba_model_desc()
2561 vp = &phba->vpd; in lpfc_get_hba_model_desc()
2765 phba->Port); in lpfc_get_hba_model_desc()
2791 lpfc_sli3_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt) in lpfc_sli3_post_buffer() argument
2802 iocb = lpfc_sli_get_iocbq(phba); in lpfc_sli3_post_buffer()
2813 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp1->phys); in lpfc_sli3_post_buffer()
2816 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2826 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, in lpfc_sli3_post_buffer()
2830 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_sli3_post_buffer()
2832 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2858 if (lpfc_sli_issue_iocb(phba, pring->ringno, iocb, 0) == in lpfc_sli3_post_buffer()
2860 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_sli3_post_buffer()
2864 lpfc_mbuf_free(phba, mp2->virt, mp2->phys); in lpfc_sli3_post_buffer()
2868 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2872 lpfc_sli_ringpostbuf_put(phba, pring, mp1); in lpfc_sli3_post_buffer()
2874 lpfc_sli_ringpostbuf_put(phba, pring, mp2); in lpfc_sli3_post_buffer()
2892 lpfc_post_rcv_buf(struct lpfc_hba *phba) in lpfc_post_rcv_buf() argument
2894 struct lpfc_sli *psli = &phba->sli; in lpfc_post_rcv_buf()
2897 lpfc_sli3_post_buffer(phba, &psli->sli3_ring[LPFC_ELS_RING], LPFC_BUF_RING0); in lpfc_post_rcv_buf()
3003 lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) in lpfc_hba_init() argument
3007 uint32_t *pwwnn = (uint32_t *) phba->wwnn; in lpfc_hba_init()
3017 lpfc_challenge_key(phba->RandomData + t, HashWorking + t); in lpfc_hba_init()
3036 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup() local
3040 if (phba->link_state > LPFC_LINK_DOWN) in lpfc_cleanup()
3044 if (lpfc_is_vmid_enabled(phba)) in lpfc_cleanup()
3087 pci_channel_offline(phba->pcidev)) in lpfc_cleanup()
3088 lpfc_sli_flush_io_rings(vport->phba); in lpfc_cleanup()
3144 __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in __lpfc_sli4_stop_fcf_redisc_wait_timer() argument
3147 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in __lpfc_sli4_stop_fcf_redisc_wait_timer()
3150 del_timer(&phba->fcf.redisc_wait); in __lpfc_sli4_stop_fcf_redisc_wait_timer()
3163 lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in lpfc_sli4_stop_fcf_redisc_wait_timer() argument
3165 spin_lock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3166 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_stop_fcf_redisc_wait_timer()
3168 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3171 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3173 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3174 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3186 lpfc_cmf_stop(struct lpfc_hba *phba) in lpfc_cmf_stop() argument
3192 if (!phba->sli4_hba.pc_sli4_params.cmf) in lpfc_cmf_stop()
3195 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stop()
3199 hrtimer_cancel(&phba->cmf_timer); in lpfc_cmf_stop()
3202 atomic_set(&phba->cmf_busy, 0); in lpfc_cmf_stop()
3204 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_stop()
3210 atomic_set(&phba->cmf_bw_wait, 0); in lpfc_cmf_stop()
3213 queue_work(phba->wq, &phba->unblock_request_work); in lpfc_cmf_stop()
3217 lpfc_get_max_line_rate(struct lpfc_hba *phba) in lpfc_get_max_line_rate() argument
3219 uint64_t rate = lpfc_sli_port_speed_get(phba); in lpfc_get_max_line_rate()
3225 lpfc_cmf_signal_init(struct lpfc_hba *phba) in lpfc_cmf_signal_init() argument
3227 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_signal_init()
3231 phba->cmf_interval_rate = LPFC_CMF_INTERVAL; in lpfc_cmf_signal_init()
3232 phba->cmf_max_line_rate = lpfc_get_max_line_rate(phba); in lpfc_cmf_signal_init()
3233 phba->cmf_link_byte_count = div_u64(phba->cmf_max_line_rate * in lpfc_cmf_signal_init()
3234 phba->cmf_interval_rate, 1000); in lpfc_cmf_signal_init()
3235 phba->cmf_max_bytes_per_interval = phba->cmf_link_byte_count; in lpfc_cmf_signal_init()
3238 lpfc_issue_cmf_sync_wqe(phba, 0, 0); in lpfc_cmf_signal_init()
3249 lpfc_cmf_start(struct lpfc_hba *phba) in lpfc_cmf_start() argument
3255 if (!phba->sli4_hba.pc_sli4_params.cmf || in lpfc_cmf_start()
3256 phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_cmf_start()
3260 lpfc_init_congestion_buf(phba); in lpfc_cmf_start()
3262 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_cmf_start()
3263 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_cmf_start()
3264 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_cmf_start()
3265 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_cmf_start()
3267 atomic_set(&phba->cmf_busy, 0); in lpfc_cmf_start()
3269 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_start()
3275 phba->cmf_latency.tv_sec = 0; in lpfc_cmf_start()
3276 phba->cmf_latency.tv_nsec = 0; in lpfc_cmf_start()
3278 lpfc_cmf_signal_init(phba); in lpfc_cmf_start()
3280 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_start()
3283 phba->cmf_timer_cnt = 0; in lpfc_cmf_start()
3284 hrtimer_start(&phba->cmf_timer, in lpfc_cmf_start()
3288 ktime_get_real_ts64(&phba->cmf_latency); in lpfc_cmf_start()
3290 atomic_set(&phba->cmf_bw_wait, 0); in lpfc_cmf_start()
3291 atomic_set(&phba->cmf_stop_io, 0); in lpfc_cmf_start()
3302 lpfc_stop_hba_timers(struct lpfc_hba *phba) in lpfc_stop_hba_timers() argument
3304 if (phba->pport) in lpfc_stop_hba_timers()
3305 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
3306 cancel_delayed_work_sync(&phba->eq_delay_work); in lpfc_stop_hba_timers()
3307 cancel_delayed_work_sync(&phba->idle_stat_delay_work); in lpfc_stop_hba_timers()
3308 del_timer_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
3309 del_timer_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
3310 del_timer_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
3311 del_timer_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
3312 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
3313 del_timer_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
3314 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_stop_hba_timers()
3316 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_stop_hba_timers()
3318 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
3321 del_timer_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
3325 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
3328 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_stop_hba_timers()
3330 phba->pci_dev_grp); in lpfc_stop_hba_timers()
3348 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
3354 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3355 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
3356 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3360 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3361 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3362 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
3366 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
3367 phba->sli.mbox_active) * 1000) + jiffies; in lpfc_block_mgmt_io()
3369 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3372 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3376 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_block_mgmt_io()
3379 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
3394 lpfc_sli4_node_prep(struct lpfc_hba *phba) in lpfc_sli4_node_prep() argument
3400 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_prep()
3403 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_prep()
3407 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_sli4_node_prep()
3414 rpi = lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_prep()
3428 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_prep()
3438 static void lpfc_create_expedite_pool(struct lpfc_hba *phba) in lpfc_create_expedite_pool() argument
3446 epd_pool = &phba->epd_pool; in lpfc_create_expedite_pool()
3447 qp = &phba->sli4_hba.hdwq[0]; in lpfc_create_expedite_pool()
3473 static void lpfc_destroy_expedite_pool(struct lpfc_hba *phba) in lpfc_destroy_expedite_pool() argument
3481 epd_pool = &phba->epd_pool; in lpfc_destroy_expedite_pool()
3482 qp = &phba->sli4_hba.hdwq[0]; in lpfc_destroy_expedite_pool()
3506 void lpfc_create_multixri_pools(struct lpfc_hba *phba) in lpfc_create_multixri_pools() argument
3519 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3521 phba->cfg_hdw_queue, phba->sli4_hba.num_present_cpu, in lpfc_create_multixri_pools()
3522 phba->sli4_hba.io_xri_cnt); in lpfc_create_multixri_pools()
3524 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3525 lpfc_create_expedite_pool(phba); in lpfc_create_multixri_pools()
3527 hwq_count = phba->cfg_hdw_queue; in lpfc_create_multixri_pools()
3528 count_per_hwq = phba->sli4_hba.io_xri_cnt / hwq_count; in lpfc_create_multixri_pools()
3534 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3538 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3539 lpfc_destroy_expedite_pool(phba); in lpfc_create_multixri_pools()
3543 qp = &phba->sli4_hba.hdwq[j]; in lpfc_create_multixri_pools()
3547 phba->cfg_xri_rebalancing = 0; in lpfc_create_multixri_pools()
3551 qp = &phba->sli4_hba.hdwq[i]; in lpfc_create_multixri_pools()
3569 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3593 static void lpfc_destroy_multixri_pools(struct lpfc_hba *phba) in lpfc_destroy_multixri_pools() argument
3605 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_destroy_multixri_pools()
3606 lpfc_destroy_expedite_pool(phba); in lpfc_destroy_multixri_pools()
3608 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_destroy_multixri_pools()
3609 lpfc_sli_flush_io_rings(phba); in lpfc_destroy_multixri_pools()
3611 hwq_count = phba->cfg_hdw_queue; in lpfc_destroy_multixri_pools()
3614 qp = &phba->sli4_hba.hdwq[i]; in lpfc_destroy_multixri_pools()
3627 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3648 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3683 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
3690 if (!phba) in lpfc_online()
3692 vport = phba->pport; in lpfc_online()
3697 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
3700 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
3702 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3703 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
3704 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3707 spin_lock_irq(&phba->hbalock); in lpfc_online()
3708 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
3710 spin_unlock_irq(&phba->hbalock); in lpfc_online()
3715 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_online()
3716 !phba->nvmet_support) { in lpfc_online()
3717 error = lpfc_nvme_create_localport(phba->pport); in lpfc_online()
3719 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_online()
3724 lpfc_sli_queue_init(phba); in lpfc_online()
3725 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
3726 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3731 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
3733 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
3738 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
3740 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3750 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
3752 if (phba->cfg_xri_rebalancing) in lpfc_online()
3753 lpfc_create_multixri_pools(phba); in lpfc_online()
3755 lpfc_cpuhp_add(phba); in lpfc_online()
3757 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3773 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
3777 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3778 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
3779 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3792 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
3794 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
3805 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
3807 lpfc_linkdown(phba); in lpfc_offline_prep()
3809 offline = pci_channel_offline(phba->pcidev); in lpfc_offline_prep()
3810 hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_offline_prep()
3813 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
3815 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
3839 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_offline_prep()
3850 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_offline_prep()
3857 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); in lpfc_offline_prep()
3884 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
3886 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
3888 if (phba->wq) in lpfc_offline_prep()
3889 flush_workqueue(phba->wq); in lpfc_offline_prep()
3901 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
3907 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3911 lpfc_stop_port(phba); in lpfc_offline()
3916 lpfc_nvmet_destroy_targetport(phba); in lpfc_offline()
3917 lpfc_nvme_destroy_localport(phba->pport); in lpfc_offline()
3919 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3921 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
3923 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3924 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3928 lpfc_sli_hba_down(phba); in lpfc_offline()
3929 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3930 phba->work_ha = 0; in lpfc_offline()
3931 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3932 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3934 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3941 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3945 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3946 __lpfc_cpuhp_remove(phba); in lpfc_offline()
3948 if (phba->cfg_xri_rebalancing) in lpfc_offline()
3949 lpfc_destroy_multixri_pools(phba); in lpfc_offline()
3961 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3965 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_scsi_free()
3968 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3972 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3973 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3976 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3979 phba->total_scsi_bufs--; in lpfc_scsi_free()
3981 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3983 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3984 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3987 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3990 phba->total_scsi_bufs--; in lpfc_scsi_free()
3992 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3993 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
4005 lpfc_io_free(struct lpfc_hba *phba) in lpfc_io_free() argument
4011 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_free()
4012 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_free()
4020 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
4022 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
4023 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4024 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4036 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
4038 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
4039 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4040 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4061 lpfc_sli4_els_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_els_sgl_update() argument
4071 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_els_sgl_update()
4073 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
4075 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_els_sgl_update()
4076 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4078 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
4085 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4093 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_els_sgl_update()
4097 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4109 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4111 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
4112 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4113 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
4115 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_els_sgl_update()
4116 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4118 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
4120 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4121 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, in lpfc_sli4_els_sgl_update()
4128 __lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_els_sgl_update()
4134 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
4135 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4137 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4140 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_els_sgl_update()
4146 &phba->sli4_hba.lpfc_els_sgl_list, list) { in lpfc_sli4_els_sgl_update()
4147 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_els_sgl_update()
4149 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4157 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_els_sgl_update()
4162 lpfc_free_els_sgl_list(phba); in lpfc_sli4_els_sgl_update()
4179 lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_nvmet_sgl_update() argument
4190 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_nvmet_sgl_update()
4193 nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4194 if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
4196 xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4197 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4199 phba->sli4_hba.nvmet_xri_cnt, nvmet_xri_cnt); in lpfc_sli4_nvmet_sgl_update()
4205 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4213 sglq_entry->virt = lpfc_nvmet_buf_alloc(phba, 0, in lpfc_sli4_nvmet_sgl_update()
4217 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4226 phba->cfg_sg_dma_buf_size); in lpfc_sli4_nvmet_sgl_update()
4230 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4231 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4233 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
4234 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4235 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4236 } else if (nvmet_xri_cnt < phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
4238 xri_cnt = phba->sli4_hba.nvmet_xri_cnt - nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4239 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4241 "%d to %d\n", phba->sli4_hba.nvmet_xri_cnt, in lpfc_sli4_nvmet_sgl_update()
4243 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4244 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4245 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, in lpfc_sli4_nvmet_sgl_update()
4252 lpfc_nvmet_buf_free(phba, sglq_entry->virt, in lpfc_sli4_nvmet_sgl_update()
4258 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
4259 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4260 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4262 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4265 phba->sli4_hba.nvmet_xri_cnt = nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4271 &phba->sli4_hba.lpfc_nvmet_sgl_list, list) { in lpfc_sli4_nvmet_sgl_update()
4272 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_nvmet_sgl_update()
4274 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4282 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_nvmet_sgl_update()
4287 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_nvmet_sgl_update()
4292 lpfc_io_buf_flush(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_flush() argument
4301 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_flush()
4302 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_flush()
4354 lpfc_io_buf_replenish(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_replenish() argument
4360 qp = phba->sli4_hba.hdwq; in lpfc_io_buf_replenish()
4363 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_replenish()
4369 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_replenish()
4397 lpfc_sli4_io_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_io_sgl_update() argument
4410 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_io_sgl_update()
4411 io_xri_max = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_io_sgl_update()
4412 phba->sli4_hba.io_xri_max = io_xri_max; in lpfc_sli4_io_sgl_update()
4414 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_io_sgl_update()
4417 phba->sli4_hba.io_xri_cnt, in lpfc_sli4_io_sgl_update()
4418 phba->sli4_hba.io_xri_max, in lpfc_sli4_io_sgl_update()
4421 cnt = lpfc_io_buf_flush(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4423 if (phba->sli4_hba.io_xri_cnt > phba->sli4_hba.io_xri_max) { in lpfc_sli4_io_sgl_update()
4425 io_xri_cnt = phba->sli4_hba.io_xri_cnt - in lpfc_sli4_io_sgl_update()
4426 phba->sli4_hba.io_xri_max; in lpfc_sli4_io_sgl_update()
4432 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_sli4_io_sgl_update()
4438 phba->sli4_hba.io_xri_cnt -= io_xri_cnt; in lpfc_sli4_io_sgl_update()
4444 phba->sli4_hba.io_xri_cnt = cnt; in lpfc_sli4_io_sgl_update()
4447 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_io_sgl_update()
4449 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_io_sgl_update()
4457 lpfc_ncmd->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_io_sgl_update()
4459 cnt = lpfc_io_buf_replenish(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4463 lpfc_io_free(phba); in lpfc_sli4_io_sgl_update()
4482 lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) in lpfc_new_io_buf() argument
4492 phba->sli4_hba.io_xri_cnt = 0; in lpfc_new_io_buf()
4502 lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4510 if (phba->cfg_xpsgl && !phba->nvmet_support) { in lpfc_new_io_buf()
4517 if ((phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_new_io_buf()
4520 lpfc_printf_log(phba, KERN_ERR, in lpfc_new_io_buf()
4525 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4535 lxri = lpfc_sli4_next_xritag(phba); in lpfc_new_io_buf()
4537 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4545 iotag = lpfc_sli_next_iotag(phba, pwqeq); in lpfc_new_io_buf()
4547 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4550 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_new_io_buf()
4553 lpfc_sli4_free_xri(phba, lxri); in lpfc_new_io_buf()
4557 pwqeq->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_new_io_buf()
4567 phba->sli4_hba.io_xri_cnt++; in lpfc_new_io_buf()
4569 lpfc_printf_log(phba, KERN_INFO, LOG_NVME, in lpfc_new_io_buf()
4578 phba, &post_nblist, bcnt); in lpfc_new_io_buf()
4586 lpfc_get_wwpn(struct lpfc_hba *phba) in lpfc_get_wwpn() argument
4593 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_get_wwpn()
4599 lpfc_read_nv(phba, mboxq); in lpfc_get_wwpn()
4600 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_wwpn()
4602 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_get_wwpn()
4607 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4613 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4614 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_wwpn()
4620 static unsigned short lpfc_get_sg_tablesize(struct lpfc_hba *phba) in lpfc_get_sg_tablesize() argument
4622 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_sg_tablesize()
4623 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_get_sg_tablesize()
4626 return phba->cfg_scsi_seg_cnt; in lpfc_get_sg_tablesize()
4628 return phba->cfg_sg_seg_cnt; in lpfc_get_sg_tablesize()
4643 lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport) in lpfc_vmid_res_alloc() argument
4646 if (phba->sli_rev == LPFC_SLI_REV3) { in lpfc_vmid_res_alloc()
4647 phba->cfg_vmid_app_header = 0; in lpfc_vmid_res_alloc()
4648 phba->cfg_vmid_priority_tagging = 0; in lpfc_vmid_res_alloc()
4651 if (lpfc_is_vmid_enabled(phba)) { in lpfc_vmid_res_alloc()
4653 kcalloc(phba->cfg_max_vmid, sizeof(struct lpfc_vmid), in lpfc_vmid_res_alloc()
4661 vport->vmid_priority_tagging = phba->cfg_vmid_priority_tagging; in lpfc_vmid_res_alloc()
4663 phba->cfg_vmid_inactivity_timeout; in lpfc_vmid_res_alloc()
4664 vport->max_vmid = phba->cfg_max_vmid; in lpfc_vmid_res_alloc()
4697 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
4709 if (phba->sli_rev < LPFC_SLI_REV4 && in lpfc_create_port()
4710 dev == &phba->pcidev->dev) { in lpfc_create_port()
4712 lpfc_sli_brdrestart(phba); in lpfc_create_port()
4713 rc = lpfc_sli_chipset_init(phba); in lpfc_create_port()
4717 wwn = lpfc_get_wwpn(phba); in lpfc_create_port()
4722 lpfc_printf_log(phba, KERN_ERR, in lpfc_create_port()
4732 if (dev == &phba->pcidev->dev) { in lpfc_create_port()
4733 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_create_port()
4742 template->sg_tablesize = lpfc_get_sg_tablesize(phba); in lpfc_create_port()
4752 template->sg_tablesize = lpfc_get_sg_tablesize(phba); in lpfc_create_port()
4760 vport->phba = phba; in lpfc_create_port()
4767 vport->cfg_enable_fc4_type = phba->cfg_enable_fc4_type; in lpfc_create_port()
4775 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4776 if (!phba->cfg_fcp_mq_threshold || in lpfc_create_port()
4777 phba->cfg_fcp_mq_threshold > phba->cfg_hdw_queue) in lpfc_create_port()
4778 phba->cfg_fcp_mq_threshold = phba->cfg_hdw_queue; in lpfc_create_port()
4781 phba->cfg_fcp_mq_threshold); in lpfc_create_port()
4784 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
4796 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
4797 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
4805 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_create_port()
4809 phba->cfg_scsi_seg_cnt, phba->cfg_sg_seg_cnt); in lpfc_create_port()
4812 rc = lpfc_vmid_res_alloc(phba, vport); in lpfc_create_port()
4828 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_create_port()
4829 lpfc_setup_bg(phba, shost); in lpfc_create_port()
4831 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
4835 spin_lock_irq(&phba->port_list_lock); in lpfc_create_port()
4836 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
4837 spin_unlock_irq(&phba->port_list_lock); in lpfc_create_port()
4860 struct lpfc_hba *phba = vport->phba; in destroy_port() local
4866 spin_lock_irq(&phba->port_list_lock); in destroy_port()
4868 spin_unlock_irq(&phba->port_list_lock); in destroy_port()
4911 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
4921 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4928 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
4929 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4942 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
4955 struct lpfc_hba *phba = vport->phba; in lpfc_host_supported_speeds_set() local
4962 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_host_supported_speeds_set()
4965 if (phba->lmt & LMT_256Gb) in lpfc_host_supported_speeds_set()
4967 if (phba->lmt & LMT_128Gb) in lpfc_host_supported_speeds_set()
4969 if (phba->lmt & LMT_64Gb) in lpfc_host_supported_speeds_set()
4971 if (phba->lmt & LMT_32Gb) in lpfc_host_supported_speeds_set()
4973 if (phba->lmt & LMT_16Gb) in lpfc_host_supported_speeds_set()
4975 if (phba->lmt & LMT_10Gb) in lpfc_host_supported_speeds_set()
4977 if (phba->lmt & LMT_8Gb) in lpfc_host_supported_speeds_set()
4979 if (phba->lmt & LMT_4Gb) in lpfc_host_supported_speeds_set()
4981 if (phba->lmt & LMT_2Gb) in lpfc_host_supported_speeds_set()
4983 if (phba->lmt & LMT_1Gb) in lpfc_host_supported_speeds_set()
4997 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
5028 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
5043 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
5046 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
5047 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
5049 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
5050 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
5053 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
5054 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
5066 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
5069 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
5070 if (phba->pport) in lpfc_stop_port_s4()
5071 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
5072 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
5083 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
5085 phba->lpfc_stop_port(phba); in lpfc_stop_port()
5087 if (phba->wq) in lpfc_stop_port()
5088 flush_workqueue(phba->wq); in lpfc_stop_port()
5098 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
5103 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
5104 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
5106 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
5108 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
5109 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
5125 struct lpfc_hba *phba = from_timer(phba, t, fcf.redisc_wait); in lpfc_sli4_fcf_redisc_wait_tmo() local
5128 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5129 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
5130 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5134 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
5136 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
5137 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5138 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
5141 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
5156 struct lpfc_hba *phba = from_timer(phba, t, inactive_vmid_poll); in lpfc_vmid_poll() local
5160 if (phba->pport->vmid_priority_tagging) { in lpfc_vmid_poll()
5162 phba->pport->work_port_events |= WORKER_CHECK_VMID_ISSUE_QFPA; in lpfc_vmid_poll()
5166 if (phba->pport->vmid_inactivity_timeout || in lpfc_vmid_poll()
5167 phba->pport->load_flag & FC_DEREGISTER_ALL_APP_ID) { in lpfc_vmid_poll()
5169 phba->pport->work_port_events |= WORKER_CHECK_INACTIVE_VMID; in lpfc_vmid_poll()
5173 lpfc_worker_wake_up(phba); in lpfc_vmid_poll()
5176 mod_timer(&phba->inactive_vmid_poll, jiffies + msecs_to_jiffies(1000 * in lpfc_vmid_poll()
5188 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
5198 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_fault()
5216 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
5234 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_type()
5252 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
5256 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
5259 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_sli_port_speed_get()
5260 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
5283 if (phba->sli4_hba.link_state.logical_speed) in lpfc_sli_port_speed_get()
5285 phba->sli4_hba.link_state.logical_speed; in lpfc_sli_port_speed_get()
5287 link_speed = phba->sli4_hba.link_state.speed; in lpfc_sli_port_speed_get()
5304 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
5396 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
5405 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
5408 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
5409 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
5411 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5416 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_sli4_async_link_evt()
5418 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5424 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
5427 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
5430 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
5433 lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); in lpfc_sli4_async_link_evt()
5435 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
5438 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
5439 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
5441 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
5443 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
5445 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
5447 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
5449 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
5451 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
5454 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
5458 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
5459 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
5460 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
5461 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
5462 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
5463 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
5464 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
5469 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_async_link_evt()
5470 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
5485 lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
5503 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
5508 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_sli4_async_link_evt()
5523 lpfc_async_link_speed_to_read_top(struct lpfc_hba *phba, uint8_t speed_code) in lpfc_async_link_speed_to_read_top() argument
5564 lpfc_cgn_dump_rxmonitor(struct lpfc_hba *phba) in lpfc_cgn_dump_rxmonitor() argument
5566 if (!phba->rx_monitor) { in lpfc_cgn_dump_rxmonitor()
5567 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_dump_rxmonitor()
5570 lpfc_rx_monitor_report(phba, phba->rx_monitor, NULL, 0, in lpfc_cgn_dump_rxmonitor()
5583 lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag) in lpfc_cgn_update_stat() argument
5592 if (!phba->cgn_i) in lpfc_cgn_update_stat()
5594 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_update_stat()
5648 if (phba->cgn_fpin_frequency && in lpfc_cgn_update_stat()
5649 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { in lpfc_cgn_update_stat()
5650 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; in lpfc_cgn_update_stat()
5669 lpfc_cgn_save_evt_cnt(struct lpfc_hba *phba) in lpfc_cgn_save_evt_cnt() argument
5685 if (!phba->cgn_i) in lpfc_cgn_save_evt_cnt()
5687 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_save_evt_cnt()
5689 if (time_before(jiffies, phba->cgn_evt_timestamp)) in lpfc_cgn_save_evt_cnt()
5691 phba->cgn_evt_timestamp = jiffies + in lpfc_cgn_save_evt_cnt()
5693 phba->cgn_evt_minute++; in lpfc_cgn_save_evt_cnt()
5700 if (phba->cgn_fpin_frequency && in lpfc_cgn_save_evt_cnt()
5701 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { in lpfc_cgn_save_evt_cnt()
5702 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; in lpfc_cgn_save_evt_cnt()
5707 lvalue = atomic_read(&phba->cgn_latency_evt_cnt); in lpfc_cgn_save_evt_cnt()
5708 latsum = atomic64_read(&phba->cgn_latency_evt); in lpfc_cgn_save_evt_cnt()
5709 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_cgn_save_evt_cnt()
5710 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_cgn_save_evt_cnt()
5716 bps = div_u64(phba->rx_block_cnt, LPFC_SEC_MIN) * 512; in lpfc_cgn_save_evt_cnt()
5717 phba->rx_block_cnt = 0; in lpfc_cgn_save_evt_cnt()
5722 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_save_evt_cnt()
5723 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_cgn_save_evt_cnt()
5724 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_cgn_save_evt_cnt()
5725 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_cgn_save_evt_cnt()
5728 value = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_cgn_save_evt_cnt()
5744 dvalue = atomic_read(&phba->cgn_driver_evt_cnt); in lpfc_cgn_save_evt_cnt()
5745 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_cgn_save_evt_cnt()
5749 if ((phba->cgn_reg_fpin & LPFC_CGN_FPIN_WARN) || in lpfc_cgn_save_evt_cnt()
5750 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_cgn_save_evt_cnt()
5751 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cgn_save_evt_cnt()
5752 wvalue = atomic_read(&phba->cgn_fabric_warn_cnt); in lpfc_cgn_save_evt_cnt()
5753 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_cgn_save_evt_cnt()
5757 if ((phba->cgn_reg_fpin & LPFC_CGN_FPIN_ALARM) || in lpfc_cgn_save_evt_cnt()
5758 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cgn_save_evt_cnt()
5759 avalue = atomic_read(&phba->cgn_fabric_alarm_cnt); in lpfc_cgn_save_evt_cnt()
5760 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_cgn_save_evt_cnt()
5789 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_save_evt_cnt()
5794 if ((phba->cgn_evt_minute % LPFC_MIN_HOUR) == 0) { in lpfc_cgn_save_evt_cnt()
5833 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_save_evt_cnt()
5840 if ((phba->cgn_evt_minute % LPFC_MIN_DAY) == 0) { in lpfc_cgn_save_evt_cnt()
5857 if ((phba->hba_flag & HBA_CGN_DAY_WRAP) && index == 0) { in lpfc_cgn_save_evt_cnt()
5858 time64_to_tm(phba->cgn_daily_ts.tv_sec, 0, &broken); in lpfc_cgn_save_evt_cnt()
5868 (phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_save_evt_cnt()
5905 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_save_evt_cnt()
5915 phba->hba_flag |= HBA_CGN_DAY_WRAP; in lpfc_cgn_save_evt_cnt()
5916 ktime_get_real_ts64(&phba->cgn_daily_ts); in lpfc_cgn_save_evt_cnt()
5921 value = phba->cgn_fpin_frequency; in lpfc_cgn_save_evt_cnt()
5939 lpfc_calc_cmf_latency(struct lpfc_hba *phba) in lpfc_calc_cmf_latency() argument
5949 if (cmpl_time.tv_sec == phba->cmf_latency.tv_sec) { in lpfc_calc_cmf_latency()
5950 msec = (cmpl_time.tv_nsec - phba->cmf_latency.tv_nsec) / in lpfc_calc_cmf_latency()
5953 if (cmpl_time.tv_nsec >= phba->cmf_latency.tv_nsec) { in lpfc_calc_cmf_latency()
5955 phba->cmf_latency.tv_sec) * MSEC_PER_SEC; in lpfc_calc_cmf_latency()
5957 phba->cmf_latency.tv_nsec) / NSEC_PER_MSEC); in lpfc_calc_cmf_latency()
5959 msec = (cmpl_time.tv_sec - phba->cmf_latency.tv_sec - in lpfc_calc_cmf_latency()
5961 msec += (((NSEC_PER_SEC - phba->cmf_latency.tv_nsec) + in lpfc_calc_cmf_latency()
5976 struct lpfc_hba *phba = container_of(timer, struct lpfc_hba, in lpfc_cmf_timer() local
5988 if (phba->cmf_active_mode == LPFC_CFG_OFF || in lpfc_cmf_timer()
5989 !phba->cmf_latency.tv_sec) { in lpfc_cmf_timer()
5990 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_timer()
5992 phba->cmf_active_mode, in lpfc_cmf_timer()
5993 (uint64_t)phba->cmf_latency.tv_sec); in lpfc_cmf_timer()
6000 if (!phba->pport) in lpfc_cmf_timer()
6006 atomic_set(&phba->cmf_stop_io, 1); in lpfc_cmf_timer()
6013 ms = lpfc_calc_cmf_latency(phba); in lpfc_cmf_timer()
6020 ktime_get_real_ts64(&phba->cmf_latency); in lpfc_cmf_timer()
6022 phba->cmf_link_byte_count = in lpfc_cmf_timer()
6023 div_u64(phba->cmf_max_line_rate * LPFC_CMF_INTERVAL, 1000); in lpfc_cmf_timer()
6031 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_timer()
6043 if (phba->cmf_active_mode == LPFC_CFG_MANAGED && in lpfc_cmf_timer()
6044 phba->link_state != LPFC_LINK_DOWN && in lpfc_cmf_timer()
6045 phba->hba_flag & HBA_SETUP) { in lpfc_cmf_timer()
6046 mbpi = phba->cmf_last_sync_bw; in lpfc_cmf_timer()
6047 phba->cmf_last_sync_bw = 0; in lpfc_cmf_timer()
6062 if ((phba->hba_flag & HBA_SHORT_CMF) && cnt > mbpi) in lpfc_cmf_timer()
6067 lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); in lpfc_cmf_timer()
6072 mbpi = phba->cmf_link_byte_count; in lpfc_cmf_timer()
6075 phba->cmf_timer_cnt++; in lpfc_cmf_timer()
6079 atomic_add(io_cnt, &phba->cgn_latency_evt_cnt); in lpfc_cmf_timer()
6080 atomic64_add(lat, &phba->cgn_latency_evt); in lpfc_cmf_timer()
6082 busy = atomic_xchg(&phba->cmf_busy, 0); in lpfc_cmf_timer()
6083 max_read = atomic_xchg(&phba->rx_max_read_cnt, 0); in lpfc_cmf_timer()
6087 if (mbpi > phba->cmf_link_byte_count || in lpfc_cmf_timer()
6088 phba->cmf_active_mode == LPFC_CFG_MONITOR) in lpfc_cmf_timer()
6089 mbpi = phba->cmf_link_byte_count; in lpfc_cmf_timer()
6094 if (mbpi != phba->cmf_max_bytes_per_interval) in lpfc_cmf_timer()
6095 phba->cmf_max_bytes_per_interval = mbpi; in lpfc_cmf_timer()
6099 if (phba->rx_monitor) { in lpfc_cmf_timer()
6104 entry.cmf_info = phba->cmf_active_info; in lpfc_cmf_timer()
6115 if (phba->cmf_active_mode == LPFC_CFG_MANAGED) in lpfc_cmf_timer()
6116 entry.timer_utilization = phba->cmf_last_ts; in lpfc_cmf_timer()
6120 phba->cmf_last_ts = 0; in lpfc_cmf_timer()
6122 lpfc_rx_monitor_record(phba->rx_monitor, &entry); in lpfc_cmf_timer()
6125 if (phba->cmf_active_mode == LPFC_CFG_MONITOR) { in lpfc_cmf_timer()
6130 atomic_inc(&phba->cgn_driver_evt_cnt); in lpfc_cmf_timer()
6132 phba->rx_block_cnt += div_u64(rcv, 512); /* save 512 byte block cnt */ in lpfc_cmf_timer()
6135 lpfc_cgn_save_evt_cnt(phba); in lpfc_cmf_timer()
6137 phba->hba_flag &= ~HBA_SHORT_CMF; in lpfc_cmf_timer()
6144 phba->cgn_evt_timestamp)) { in lpfc_cmf_timer()
6145 timer_interval = jiffies_to_msecs(phba->cgn_evt_timestamp - in lpfc_cmf_timer()
6150 phba->hba_flag |= HBA_SHORT_CMF; in lpfc_cmf_timer()
6155 phba->cmf_link_byte_count = div_u64(phba->cmf_max_line_rate * in lpfc_cmf_timer()
6157 if (phba->cmf_active_mode == LPFC_CFG_MONITOR) in lpfc_cmf_timer()
6158 phba->cmf_max_bytes_per_interval = in lpfc_cmf_timer()
6159 phba->cmf_link_byte_count; in lpfc_cmf_timer()
6165 if (atomic_xchg(&phba->cmf_bw_wait, 0)) in lpfc_cmf_timer()
6166 queue_work(phba->wq, &phba->unblock_request_work); in lpfc_cmf_timer()
6169 atomic_set(&phba->cmf_stop_io, 0); in lpfc_cmf_timer()
6179 ((phba->trunk_link.link##__idx.state == LPFC_LINK_UP) ?\
6187 lpfc_update_trunk_link_status(struct lpfc_hba *phba, in lpfc_update_trunk_link_status() argument
6194 phba->sli4_hba.link_state.speed = in lpfc_update_trunk_link_status()
6195 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_update_trunk_link_status()
6198 phba->sli4_hba.link_state.logical_speed = in lpfc_update_trunk_link_status()
6201 phba->fc_linkspeed = in lpfc_update_trunk_link_status()
6203 phba, in lpfc_update_trunk_link_status()
6207 phba->trunk_link.link0.state = in lpfc_update_trunk_link_status()
6210 phba->trunk_link.link0.fault = port_fault & 0x1 ? err : 0; in lpfc_update_trunk_link_status()
6214 phba->trunk_link.link1.state = in lpfc_update_trunk_link_status()
6217 phba->trunk_link.link1.fault = port_fault & 0x2 ? err : 0; in lpfc_update_trunk_link_status()
6221 phba->trunk_link.link2.state = in lpfc_update_trunk_link_status()
6224 phba->trunk_link.link2.fault = port_fault & 0x4 ? err : 0; in lpfc_update_trunk_link_status()
6228 phba->trunk_link.link3.state = in lpfc_update_trunk_link_status()
6231 phba->trunk_link.link3.fault = port_fault & 0x8 ? err : 0; in lpfc_update_trunk_link_status()
6236 phba->trunk_link.phy_lnk_speed = in lpfc_update_trunk_link_status()
6237 phba->sli4_hba.link_state.logical_speed / (cnt * 1000); in lpfc_update_trunk_link_status()
6239 phba->trunk_link.phy_lnk_speed = LPFC_LINK_SPEED_UNKNOWN; in lpfc_update_trunk_link_status()
6241 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
6245 phba->sli4_hba.link_state.speed, in lpfc_update_trunk_link_status()
6246 phba->sli4_hba.link_state.logical_speed, in lpfc_update_trunk_link_status()
6250 if (phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_update_trunk_link_status()
6251 lpfc_cmf_signal_init(phba); in lpfc_update_trunk_link_status()
6254 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
6278 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
6287 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6295 lpfc_update_trunk_link_status(phba, acqe_fc); in lpfc_sli4_async_fc_evt()
6300 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
6301 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
6303 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
6304 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
6306 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
6308 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
6310 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
6312 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
6317 phba->sli4_hba.link_state.logical_speed = 0; in lpfc_sli4_async_fc_evt()
6318 else if (!phba->sli4_hba.conf_trunk) in lpfc_sli4_async_fc_evt()
6319 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
6322 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
6326 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
6327 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
6328 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
6329 phba->sli4_hba.link_state.type, in lpfc_sli4_async_fc_evt()
6330 phba->sli4_hba.link_state.number, in lpfc_sli4_async_fc_evt()
6331 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
6332 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_fc_evt()
6333 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
6335 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6339 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_sli4_async_fc_evt()
6341 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6347 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
6350 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
6353 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
6356 lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); in lpfc_sli4_async_fc_evt()
6358 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
6360 if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) { in lpfc_sli4_async_fc_evt()
6361 phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK); in lpfc_sli4_async_fc_evt()
6363 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
6365 phba->link_flag |= LS_MDS_LINK_DOWN; in lpfc_sli4_async_fc_evt()
6368 phba->link_flag |= LS_MDS_LOOPBACK; in lpfc_sli4_async_fc_evt()
6379 lpfc_sli4_parse_latt_fault(phba, (void *)acqe_fc); in lpfc_sli4_async_fc_evt()
6385 if (phba->sli4_hba.link_state.status == in lpfc_sli4_async_fc_evt()
6394 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_fc_evt()
6399 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
6405 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_sli4_async_fc_evt()
6416 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
6432 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6438 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
6448 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6452 phba->sfp_warning |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_sli4_async_sli_evt()
6453 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
6465 lpfc_printf_log(phba, KERN_INFO, LOG_SLI | LOG_LDS_EVENT, in lpfc_sli4_async_sli_evt()
6469 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
6481 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
6507 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_sli_evt()
6511 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_async_sli_evt()
6516 if (phba->sli4_hba.lnk_info.optic_state == status) in lpfc_sli4_async_sli_evt()
6556 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_async_sli_evt()
6558 phba->lmt = 0; in lpfc_sli4_async_sli_evt()
6559 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_sli_evt()
6564 rc = lpfc_sli4_refresh_params(phba); in lpfc_sli4_async_sli_evt()
6566 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
6570 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_sli_evt()
6572 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_sli_evt()
6578 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_sli_evt()
6580 phba->sli4_hba.lnk_info.optic_state = status; in lpfc_sli4_async_sli_evt()
6581 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
6585 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6592 lpfc_sli4_cgn_parm_chg_evt(phba); in lpfc_sli4_async_sli_evt()
6600 lpfc_log_msg(phba, KERN_WARNING, LOG_SLI | LOG_DISCOVERY, in lpfc_sli4_async_sli_evt()
6603 phba->sli4_hba.fawwpn_flag &= ~LPFC_FAWWPN_FABRIC; in lpfc_sli4_async_sli_evt()
6604 memset(phba->pport->fc_portname.u.wwn, 0, in lpfc_sli4_async_sli_evt()
6609 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6615 if (phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_sli4_async_sli_evt()
6619 phba->cgn_acqe_cnt++; in lpfc_sli4_async_sli_evt()
6622 atomic64_add(cnt, &phba->cgn_acqe_stat.warn); in lpfc_sli4_async_sli_evt()
6623 atomic64_add(cgn_signal->alarm_cnt, &phba->cgn_acqe_stat.alarm); in lpfc_sli4_async_sli_evt()
6629 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { in lpfc_sli4_async_sli_evt()
6632 &phba->cgn_sync_alarm_cnt); in lpfc_sli4_async_sli_evt()
6636 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_sli4_async_sli_evt()
6637 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { in lpfc_sli4_async_sli_evt()
6639 atomic_add(cnt, &phba->cgn_sync_warn_cnt); in lpfc_sli4_async_sli_evt()
6645 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_async_sli_evt()
6653 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6675 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
6679 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
6680 if (!phba) in lpfc_sli4_perform_vport_cvl()
6693 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
6694 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
6697 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
6720 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
6725 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
6727 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
6729 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
6740 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
6751 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6752 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6757 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6763 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
6769 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
6775 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
6780 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
6784 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6785 if (phba->hba_flag & FCF_TS_INPROG) { in lpfc_sli4_async_fip_evt()
6786 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6790 if (phba->fcf.fcf_flag & (FCF_REDISC_EVT | FCF_REDISC_PEND)) { in lpfc_sli4_async_fip_evt()
6791 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6796 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
6797 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6800 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6803 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
6807 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
6810 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6816 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6823 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6824 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6832 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6833 if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && in lpfc_sli4_async_fip_evt()
6834 (phba->fcf.current_rec.fcf_indx != acqe_fip->index)) { in lpfc_sli4_async_fip_evt()
6835 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6837 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
6840 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6843 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
6852 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6854 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
6855 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6857 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
6861 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
6863 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
6868 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6869 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
6870 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6875 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
6878 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
6883 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
6887 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6888 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_fip_evt()
6893 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
6900 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
6902 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
6911 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
6940 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6941 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
6942 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6946 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
6947 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6948 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
6952 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
6954 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
6959 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6960 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
6961 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6966 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
6972 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
6976 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6991 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
6994 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
6995 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_dcbx_evt()
7010 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
7015 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
7016 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
7017 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
7018 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
7020 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
7023 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
7034 lpfc_sli4_async_cmstat_evt(struct lpfc_hba *phba) in lpfc_sli4_async_cmstat_evt() argument
7036 if (!phba->cgn_i) in lpfc_sli4_async_cmstat_evt()
7038 lpfc_init_congestion_stat(phba); in lpfc_sli4_async_cmstat_evt()
7050 lpfc_cgn_params_val(struct lpfc_hba *phba, struct lpfc_cgn_param *p_cfg_param) in lpfc_cgn_params_val() argument
7052 spin_lock_irq(&phba->hbalock); in lpfc_cgn_params_val()
7056 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, in lpfc_cgn_params_val()
7062 spin_unlock_irq(&phba->hbalock); in lpfc_cgn_params_val()
7085 lpfc_cgn_params_parse(struct lpfc_hba *phba, in lpfc_cgn_params_parse() argument
7096 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_cgn_params_parse()
7114 phba->cmf_active_mode); in lpfc_cgn_params_parse()
7116 oldmode = phba->cmf_active_mode; in lpfc_cgn_params_parse()
7121 lpfc_cgn_params_val(phba, p_cgn_param); in lpfc_cgn_params_parse()
7124 spin_lock_irq(&phba->hbalock); in lpfc_cgn_params_parse()
7125 memcpy(&phba->cgn_p, p_cgn_param, in lpfc_cgn_params_parse()
7129 if (phba->cgn_i) { in lpfc_cgn_params_parse()
7130 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_params_parse()
7131 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_params_parse()
7132 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_cgn_params_parse()
7133 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_cgn_params_parse()
7134 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_cgn_params_parse()
7139 spin_unlock_irq(&phba->hbalock); in lpfc_cgn_params_parse()
7141 phba->cmf_active_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_params_parse()
7145 if (phba->cgn_p.cgn_param_mode != LPFC_CFG_OFF) { in lpfc_cgn_params_parse()
7147 lpfc_cmf_start(phba); in lpfc_cgn_params_parse()
7149 if (phba->link_state >= LPFC_LINK_UP) { in lpfc_cgn_params_parse()
7150 phba->cgn_reg_fpin = in lpfc_cgn_params_parse()
7151 phba->cgn_init_reg_fpin; in lpfc_cgn_params_parse()
7152 phba->cgn_reg_signal = in lpfc_cgn_params_parse()
7153 phba->cgn_init_reg_signal; in lpfc_cgn_params_parse()
7154 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7159 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7162 lpfc_cmf_stop(phba); in lpfc_cgn_params_parse()
7163 if (phba->link_state >= LPFC_LINK_UP) in lpfc_cgn_params_parse()
7164 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7167 phba->cmf_max_bytes_per_interval = in lpfc_cgn_params_parse()
7168 phba->cmf_link_byte_count; in lpfc_cgn_params_parse()
7171 queue_work(phba->wq, in lpfc_cgn_params_parse()
7172 &phba->unblock_request_work); in lpfc_cgn_params_parse()
7177 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7180 lpfc_cmf_stop(phba); in lpfc_cgn_params_parse()
7181 if (phba->link_state >= LPFC_LINK_UP) in lpfc_cgn_params_parse()
7182 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7185 lpfc_cmf_signal_init(phba); in lpfc_cgn_params_parse()
7191 oldmode != phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7192 if (phba->cgn_p.cgn_param_mode == LPFC_CFG_MANAGED) in lpfc_cgn_params_parse()
7194 phba->cgn_p.cgn_param_level0); in lpfc_cgn_params_parse()
7198 dev_info(&phba->pcidev->dev, "%d: " in lpfc_cgn_params_parse()
7200 phba->brd_no, in lpfc_cgn_params_parse()
7202 [phba->cgn_p.cgn_param_mode], in lpfc_cgn_params_parse()
7206 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_cgn_params_parse()
7227 lpfc_sli4_cgn_params_read(struct lpfc_hba *phba) in lpfc_sli4_cgn_params_read() argument
7239 ret = lpfc_read_object(phba, (char *)LPFC_PORT_CFG_NAME, in lpfc_sli4_cgn_params_read()
7246 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7254 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7262 lpfc_cgn_params_parse(phba, p_cgn_param, len); in lpfc_sli4_cgn_params_read()
7288 lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *phba) in lpfc_sli4_cgn_parm_chg_evt() argument
7292 if (!phba->sli4_hba.pc_sli4_params.cmf) { in lpfc_sli4_cgn_parm_chg_evt()
7293 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7302 ret = lpfc_sli4_cgn_params_read(phba); in lpfc_sli4_cgn_parm_chg_evt()
7304 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7308 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7321 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
7327 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
7328 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
7329 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
7332 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7333 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
7334 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
7336 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, in lpfc_sli4_async_event_proc()
7342 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
7346 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
7349 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
7353 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
7357 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
7360 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
7363 lpfc_sli4_async_cmstat_evt(phba); in lpfc_sli4_async_event_proc()
7366 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_event_proc()
7375 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
7376 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7378 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7388 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
7392 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7394 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
7396 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
7398 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
7399 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7402 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
7404 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
7406 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fcf_redisc_event_proc()
7422 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
7427 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
7431 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
7434 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7438 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7442 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7446 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7461 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
7465 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7469 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7473 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7477 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_intr_mode()
7496 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
7501 if (!phba->pcidev) in lpfc_enable_pci_dev()
7504 pdev = phba->pcidev; in lpfc_enable_pci_dev()
7525 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_enable_pci_dev()
7538 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
7543 if (!phba->pcidev) in lpfc_disable_pci_dev()
7546 pdev = phba->pcidev; in lpfc_disable_pci_dev()
7564 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
7569 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
7570 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
7575 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) { in lpfc_reset_hba()
7576 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
7578 if (test_bit(MBX_TMO_ERR, &phba->bit_flags)) { in lpfc_reset_hba()
7580 rc = lpfc_pci_function_reset(phba); in lpfc_reset_hba()
7581 lpfc_els_flush_all_cmd(phba); in lpfc_reset_hba()
7583 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
7584 lpfc_sli_flush_io_rings(phba); in lpfc_reset_hba()
7586 lpfc_offline(phba); in lpfc_reset_hba()
7587 clear_bit(MBX_TMO_ERR, &phba->bit_flags); in lpfc_reset_hba()
7589 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_reset_hba()
7593 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
7594 lpfc_online(phba); in lpfc_reset_hba()
7595 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
7610 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
7612 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
7636 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
7638 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
7642 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
7644 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_probe_sriov_nr_virtfn()
7652 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7657 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7666 struct lpfc_hba *phba = container_of(work, struct lpfc_hba, in lpfc_unblock_requests_work() local
7669 lpfc_unblock_requests(phba); in lpfc_unblock_requests_work()
7684 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
7686 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
7691 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
7692 atomic_set(&phba->dbg_log_idx, 0); in lpfc_setup_driver_resource_phase1()
7693 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_setup_driver_resource_phase1()
7694 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_setup_driver_resource_phase1()
7695 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
7698 spin_lock_init(&phba->port_list_lock); in lpfc_setup_driver_resource_phase1()
7699 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
7701 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
7704 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
7706 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
7708 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
7710 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
7712 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
7715 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
7716 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
7717 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
7718 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
7721 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
7724 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
7727 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
7730 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
7731 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
7736 timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); in lpfc_setup_driver_resource_phase1()
7738 timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); in lpfc_setup_driver_resource_phase1()
7740 timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); in lpfc_setup_driver_resource_phase1()
7742 INIT_DELAYED_WORK(&phba->eq_delay_work, lpfc_hb_eq_delay_work); in lpfc_setup_driver_resource_phase1()
7744 INIT_DELAYED_WORK(&phba->idle_stat_delay_work, in lpfc_setup_driver_resource_phase1()
7746 INIT_WORK(&phba->unblock_request_work, lpfc_unblock_requests_work); in lpfc_setup_driver_resource_phase1()
7762 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
7771 timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); in lpfc_sli_driver_resource_setup()
7774 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
7775 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
7778 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
7781 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli_driver_resource_setup()
7785 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7786 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, in lpfc_sli_driver_resource_setup()
7789 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7797 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_driver_resource_setup()
7803 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
7813 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7817 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
7818 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
7821 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
7828 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7830 ((phba->cfg_sg_seg_cnt + 2) * entry_sz); in lpfc_sli_driver_resource_setup()
7833 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
7836 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
7838 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7839 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
7841 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
7843 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
7848 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
7849 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
7852 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
7855 phba->lpfc_sg_dma_buf_pool = in lpfc_sli_driver_resource_setup()
7857 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7860 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli_driver_resource_setup()
7863 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli_driver_resource_setup()
7865 &phba->pcidev->dev, in lpfc_sli_driver_resource_setup()
7870 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli_driver_resource_setup()
7877 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
7878 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
7879 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7881 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
7885 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7886 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
7893 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli_driver_resource_setup()
7894 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli_driver_resource_setup()
7896 lpfc_mem_free(phba); in lpfc_sli_driver_resource_setup()
7908 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
7911 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
7928 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
7939 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
7940 phba->sli4_hba.num_possible_cpu = cpumask_last(cpu_possible_mask) + 1; in lpfc_sli4_driver_resource_setup()
7941 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
7944 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
7947 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
7952 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
7959 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0); in lpfc_sli4_driver_resource_setup()
7960 if (!phba->wq) in lpfc_sli4_driver_resource_setup()
7967 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
7970 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
7973 hrtimer_init(&phba->cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in lpfc_sli4_driver_resource_setup()
7974 phba->cmf_timer.function = lpfc_cmf_timer; in lpfc_sli4_driver_resource_setup()
7980 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
7982 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
7984 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
7987 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
7990 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
7991 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
7992 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
7993 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
8002 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
8003 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
8004 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
8007 if (lpfc_is_vmid_enabled(phba)) in lpfc_sli4_driver_resource_setup()
8008 timer_setup(&phba->inactive_vmid_poll, lpfc_vmid_poll, 0); in lpfc_sli4_driver_resource_setup()
8014 spin_lock_init(&phba->sli4_hba.abts_io_buf_list_lock); in lpfc_sli4_driver_resource_setup()
8015 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_io_buf_list); in lpfc_sli4_driver_resource_setup()
8017 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8019 spin_lock_init(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_sli4_driver_resource_setup()
8020 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
8021 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
8022 spin_lock_init(&phba->sli4_hba.t_active_list_lock); in lpfc_sli4_driver_resource_setup()
8023 INIT_LIST_HEAD(&phba->sli4_hba.t_active_ctx_list); in lpfc_sli4_driver_resource_setup()
8027 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
8028 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
8029 spin_lock_init(&phba->sli4_hba.asynce_list_lock); in lpfc_sli4_driver_resource_setup()
8030 spin_lock_init(&phba->sli4_hba.els_xri_abrt_list_lock); in lpfc_sli4_driver_resource_setup()
8037 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
8039 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
8041 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
8043 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
8045 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
8048 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
8049 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
8050 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
8051 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
8056 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
8057 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
8060 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
8063 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
8068 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
8070 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
8075 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
8079 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8084 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
8089 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
8093 if (phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG) { in lpfc_sli4_driver_resource_setup()
8101 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_FABRIC; in lpfc_sli4_driver_resource_setup()
8104 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
8109 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
8111 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
8116 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
8124 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
8128 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8129 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
8131 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8137 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8145 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
8150 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
8156 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
8159 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
8161 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8166 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8173 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_driver_resource_setup()
8174 if (phba->irq_chann_mode == NHT_MODE) { in lpfc_sli4_driver_resource_setup()
8175 phba->cfg_irq_chann = in lpfc_sli4_driver_resource_setup()
8176 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
8177 phba->cfg_hdw_queue = in lpfc_sli4_driver_resource_setup()
8178 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
8179 phba->irq_chann_mode = NORMAL_MODE; in lpfc_sli4_driver_resource_setup()
8186 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
8193 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8196 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
8198 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
8199 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
8200 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
8201 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8206 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8213 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8224 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
8238 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
8250 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
8254 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8260 if (phba->cfg_enable_bg && in lpfc_sli4_driver_resource_setup()
8261 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
8262 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
8264 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8272 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
8274 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
8278 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
8279 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8287 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_driver_resource_setup()
8288 phba->cfg_sg_dma_buf_size = LPFC_DEFAULT_XPSGL_SIZE; in lpfc_sli4_driver_resource_setup()
8289 else if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
8290 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
8292 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
8293 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
8295 phba->border_sge_num = phba->cfg_sg_dma_buf_size / in lpfc_sli4_driver_resource_setup()
8299 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8300 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { in lpfc_sli4_driver_resource_setup()
8301 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, in lpfc_sli4_driver_resource_setup()
8305 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8307 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8310 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
8313 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8314 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sli4_driver_resource_setup()
8315 phba->cfg_nvme_seg_cnt); in lpfc_sli4_driver_resource_setup()
8317 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_sli4_driver_resource_setup()
8318 i = phba->cfg_sg_dma_buf_size; in lpfc_sli4_driver_resource_setup()
8322 phba->lpfc_sg_dma_buf_pool = in lpfc_sli4_driver_resource_setup()
8324 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8325 phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8327 if (!phba->lpfc_sg_dma_buf_pool) { in lpfc_sli4_driver_resource_setup()
8332 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli4_driver_resource_setup()
8334 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8338 if (!phba->lpfc_cmd_rsp_buf_pool) { in lpfc_sli4_driver_resource_setup()
8343 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8346 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
8349 lpfc_sli4_ras_init(phba); in lpfc_sli4_driver_resource_setup()
8352 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
8357 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
8362 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
8365 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
8367 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8371 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8373 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8380 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
8382 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
8383 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8390 phba->sli4_hba.hba_eq_hdl = kcalloc(phba->cfg_irq_chann, in lpfc_sli4_driver_resource_setup()
8393 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
8394 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8401 phba->sli4_hba.cpu_map = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
8404 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
8405 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8412 phba->sli4_hba.eq_info = alloc_percpu(struct lpfc_eq_intr_info); in lpfc_sli4_driver_resource_setup()
8413 if (!phba->sli4_hba.eq_info) { in lpfc_sli4_driver_resource_setup()
8414 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8420 phba->sli4_hba.idle_stat = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
8421 sizeof(*phba->sli4_hba.idle_stat), in lpfc_sli4_driver_resource_setup()
8423 if (!phba->sli4_hba.idle_stat) { in lpfc_sli4_driver_resource_setup()
8424 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8431 phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); in lpfc_sli4_driver_resource_setup()
8432 if (!phba->sli4_hba.c_stat) { in lpfc_sli4_driver_resource_setup()
8433 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8440 phba->cmf_stat = alloc_percpu(struct lpfc_cgn_stat); in lpfc_sli4_driver_resource_setup()
8441 if (!phba->cmf_stat) { in lpfc_sli4_driver_resource_setup()
8442 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8452 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
8453 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
8454 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8456 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
8460 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8461 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
8469 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_setup()
8472 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_setup()
8474 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_setup()
8476 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
8478 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
8480 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
8482 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8484 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
8486 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
8488 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool); in lpfc_sli4_driver_resource_setup()
8489 phba->lpfc_cmd_rsp_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8491 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli4_driver_resource_setup()
8492 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8494 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8496 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
8498 destroy_workqueue(phba->wq); in lpfc_sli4_driver_resource_setup()
8499 phba->wq = NULL; in lpfc_sli4_driver_resource_setup()
8511 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
8515 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_unset()
8517 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_unset()
8519 free_percpu(phba->cmf_stat); in lpfc_sli4_driver_resource_unset()
8520 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_unset()
8523 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
8524 phba->sli4_hba.num_possible_cpu = 0; in lpfc_sli4_driver_resource_unset()
8525 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
8526 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
8527 cpumask_clear(&phba->sli4_hba.irq_aff_mask); in lpfc_sli4_driver_resource_unset()
8530 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
8533 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
8534 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
8537 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
8540 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
8541 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8542 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8545 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
8546 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
8549 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
8552 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
8555 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
8559 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
8578 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
8580 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
8581 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
8582 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
8585 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
8586 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
8587 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
8590 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
8591 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
8592 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
8595 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_init_api_table_setup()
8615 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
8620 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
8621 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
8622 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
8623 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
8639 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
8641 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
8642 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
8643 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
8647 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
8648 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
8658 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
8662 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8664 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
8667 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
8669 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8687 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
8694 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8704 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
8714 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8715 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8716 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
8717 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8723 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
8736 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
8742 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
8754 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
8759 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8760 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
8761 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8764 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
8774 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
8780 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8781 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8782 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
8783 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8784 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8789 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
8797 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
8808 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
8812 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
8814 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
8816 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
8830 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
8832 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
8844 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
8847 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
8848 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
8849 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
8850 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
8853 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
8856 phba->sli4_hba.io_xri_cnt = 0; in lpfc_init_sgl_list()
8874 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
8879 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
8880 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
8882 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
8885 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
8887 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_init_rpi_hdrs()
8889 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
8910 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
8921 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
8923 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
8927 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
8929 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8935 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
8936 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8950 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
8971 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8975 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
8976 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
8978 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8982 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
8999 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
9003 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
9007 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
9009 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
9016 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
9034 struct lpfc_hba *phba; in lpfc_hba_alloc() local
9037 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
9038 if (!phba) { in lpfc_hba_alloc()
9044 phba->pcidev = pdev; in lpfc_hba_alloc()
9047 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
9048 if (phba->brd_no < 0) { in lpfc_hba_alloc()
9049 kfree(phba); in lpfc_hba_alloc()
9052 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
9054 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
9055 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
9057 return phba; in lpfc_hba_alloc()
9068 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
9070 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_hba_free()
9071 kfree(phba->sli4_hba.hdwq); in lpfc_hba_free()
9074 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
9077 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
9078 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
9080 kfree(phba); in lpfc_hba_free()
9096 struct lpfc_hba *phba = vport->phba; in lpfc_setup_fdmi_mask() local
9099 if (phba->cfg_enable_SmartSAN || in lpfc_setup_fdmi_mask()
9100 phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT) { in lpfc_setup_fdmi_mask()
9103 if (phba->cfg_enable_SmartSAN) in lpfc_setup_fdmi_mask()
9109 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, in lpfc_setup_fdmi_mask()
9126 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
9132 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
9133 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
9134 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
9135 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
9137 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
9138 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
9143 phba->pport = vport; in lpfc_create_shost()
9145 if (phba->nvmet_support) { in lpfc_create_shost()
9147 phba->targetport = NULL; in lpfc_create_shost()
9148 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
9149 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME_DISC, in lpfc_create_shost()
9155 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
9174 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
9176 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
9193 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
9198 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9199 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
9203 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
9204 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
9207 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
9210 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
9214 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
9215 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
9217 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9218 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
9219 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
9220 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9223 phba->cfg_prot_mask, in lpfc_setup_bg()
9224 phba->cfg_prot_guard); in lpfc_setup_bg()
9226 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
9227 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
9229 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9244 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
9250 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
9256 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
9257 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
9261 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
9263 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
9267 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
9291 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
9293 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
9313 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
9316 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
9320 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
9321 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
9328 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
9329 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
9336 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
9337 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
9338 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
9341 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
9342 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9344 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
9345 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9348 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
9350 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
9352 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
9356 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
9358 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
9359 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
9363 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
9364 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
9366 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
9368 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
9369 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9370 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9371 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9372 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9378 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
9380 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
9382 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
9395 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
9400 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
9403 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
9407 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
9409 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
9412 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
9413 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
9428 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
9437 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
9442 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
9460 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9474 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
9479 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9481 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9483 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9485 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9487 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9489 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
9496 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
9499 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
9500 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
9501 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
9502 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
9504 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
9506 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
9507 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
9508 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
9509 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_post_status_check()
9519 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
9520 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
9527 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
9531 phba->work_status[0] = in lpfc_sli4_post_status_check()
9532 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9534 phba->work_status[1] = in lpfc_sli4_post_status_check()
9535 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9537 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9544 phba->work_status[0], in lpfc_sli4_post_status_check()
9545 phba->work_status[1]); in lpfc_sli4_post_status_check()
9552 &phba->sli4_hba.sli_intf) == in lpfc_sli4_post_status_check()
9554 pci_write_config_byte(phba->pcidev, in lpfc_sli4_post_status_check()
9574 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
9578 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
9579 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
9580 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
9581 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
9582 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
9583 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
9584 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
9585 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
9586 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9587 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9590 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9591 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9593 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9594 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9596 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9597 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9599 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9600 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9602 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9603 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9605 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9606 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9607 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9608 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9610 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9611 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9613 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9614 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9616 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9617 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9618 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
9619 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9620 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9621 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9622 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9625 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9626 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9628 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9629 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9631 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9632 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9634 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9635 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9637 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9638 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9640 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9641 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9643 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9644 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9648 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
9663 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
9667 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
9668 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9670 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9672 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9674 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9678 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9680 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9682 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9684 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9686 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9692 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
9710 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
9715 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9718 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9721 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9724 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
9725 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9727 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9748 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
9765 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
9779 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
9780 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
9782 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
9784 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
9795 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
9796 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
9801 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
9819 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
9821 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
9822 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
9823 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
9824 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
9826 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
9827 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
9854 lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) in lpfc_map_topology() argument
9862 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9866 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9869 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9873 phba->hba_flag |= HBA_PERSISTENT_TOPO; in lpfc_map_topology()
9876 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9878 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9881 phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) in lpfc_map_topology()
9885 phba->hba_flag &= ~HBA_PERSISTENT_TOPO; in lpfc_map_topology()
9890 phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : in lpfc_map_topology()
9893 phba->cfg_topology = ((pt == LINK_FLAGS_P2P) in lpfc_map_topology()
9898 if (phba->hba_flag & HBA_PERSISTENT_TOPO) { in lpfc_map_topology()
9899 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9901 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9903 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9906 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9925 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
9938 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
9940 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9946 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
9948 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
9950 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9959 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
9960 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
9962 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
9964 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
9966 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
9967 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
9969 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
9973 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
9974 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
9980 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_read_config()
9984 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_CONFIG; in lpfc_sli4_read_config()
9987 phba->sli4_hba.fawwpn_flag &= ~LPFC_FAWWPN_CONFIG; in lpfc_sli4_read_config()
9990 phba->sli4_hba.conf_trunk = in lpfc_sli4_read_config()
9992 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
9995 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
9999 phba->sli4_hba.max_cfg_param.max_xri > 512) in lpfc_sli4_read_config()
10000 phba->sli4_hba.max_cfg_param.max_xri = 512; in lpfc_sli4_read_config()
10001 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
10003 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
10006 if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) in lpfc_sli4_read_config()
10007 phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; in lpfc_sli4_read_config()
10008 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
10010 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
10012 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
10014 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
10016 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
10018 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
10020 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
10022 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
10024 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
10026 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
10028 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
10029 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
10030 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
10031 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
10032 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
10033 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
10034 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
10045 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
10046 phba->cgn_reg_signal = EDC_CG_SIG_NOTSUPPORTED; in lpfc_sli4_read_config()
10047 phba->cgn_sig_freq = lpfc_fabric_cgn_frequency; in lpfc_sli4_read_config()
10051 phba->cgn_reg_signal = EDC_CG_SIG_WARN_ONLY; in lpfc_sli4_read_config()
10052 phba->cgn_reg_fpin &= ~LPFC_CGN_FPIN_WARN; in lpfc_sli4_read_config()
10058 if (phba->cgn_reg_signal != in lpfc_sli4_read_config()
10061 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
10062 phba->cgn_reg_signal = in lpfc_sli4_read_config()
10065 phba->cgn_reg_signal = in lpfc_sli4_read_config()
10067 phba->cgn_reg_fpin = in lpfc_sli4_read_config()
10074 phba->cgn_init_reg_fpin = phba->cgn_reg_fpin; in lpfc_sli4_read_config()
10075 phba->cgn_init_reg_signal = phba->cgn_reg_signal; in lpfc_sli4_read_config()
10077 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_sli4_read_config()
10079 phba->cgn_reg_signal, phba->cgn_reg_fpin); in lpfc_sli4_read_config()
10081 lpfc_map_topology(phba, rd_config); in lpfc_sli4_read_config()
10082 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10089 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
10090 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
10091 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
10092 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
10093 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
10094 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
10095 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
10096 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
10097 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
10098 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
10099 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
10100 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
10101 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
10102 phba->sli4_hba.max_cfg_param.max_rq, in lpfc_sli4_read_config()
10103 phba->lmt); in lpfc_sli4_read_config()
10109 qmin = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
10110 if (phba->sli4_hba.max_cfg_param.max_cq < qmin) in lpfc_sli4_read_config()
10111 qmin = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
10112 if (phba->sli4_hba.max_cfg_param.max_eq < qmin) in lpfc_sli4_read_config()
10113 qmin = phba->sli4_hba.max_cfg_param.max_eq; in lpfc_sli4_read_config()
10123 if ((phba->cfg_irq_chann > qmin) || in lpfc_sli4_read_config()
10124 (phba->cfg_hdw_queue > qmin)) { in lpfc_sli4_read_config()
10125 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10130 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
10131 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
10132 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
10133 qmin, phba->cfg_irq_chann, in lpfc_sli4_read_config()
10134 phba->cfg_hdw_queue); in lpfc_sli4_read_config()
10136 if (phba->cfg_irq_chann > qmin) in lpfc_sli4_read_config()
10137 phba->cfg_irq_chann = qmin; in lpfc_sli4_read_config()
10138 if (phba->cfg_hdw_queue > qmin) in lpfc_sli4_read_config()
10139 phba->cfg_hdw_queue = qmin; in lpfc_sli4_read_config()
10147 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
10152 phba->hba_flag |= HBA_FORCED_LINK_SPEED; in lpfc_sli4_read_config()
10156 phba->cfg_link_speed = in lpfc_sli4_read_config()
10160 phba->cfg_link_speed = in lpfc_sli4_read_config()
10164 phba->cfg_link_speed = in lpfc_sli4_read_config()
10168 phba->cfg_link_speed = in lpfc_sli4_read_config()
10172 phba->cfg_link_speed = in lpfc_sli4_read_config()
10176 phba->cfg_link_speed = in lpfc_sli4_read_config()
10180 phba->cfg_link_speed = in lpfc_sli4_read_config()
10184 phba->cfg_link_speed = in lpfc_sli4_read_config()
10188 phba->cfg_link_speed = in lpfc_sli4_read_config()
10192 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_read_config()
10197 phba->cfg_link_speed = in lpfc_sli4_read_config()
10204 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
10205 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
10206 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
10207 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
10209 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
10210 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
10213 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
10220 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
10224 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
10230 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10253 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
10255 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
10262 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10264 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
10265 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
10267 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10273 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
10291 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
10298 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
10301 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
10304 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10317 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
10319 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10325 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
10350 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
10357 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
10358 if (phba->cfg_hdw_queue < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
10359 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_sli4_queue_verify()
10360 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
10361 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
10364 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
10366 phba->cfg_hdw_queue, phba->cfg_irq_chann, in lpfc_sli4_queue_verify()
10367 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
10370 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
10371 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10374 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
10375 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10380 lpfc_alloc_io_wq_cq(struct lpfc_hba *phba, int idx) in lpfc_alloc_io_wq_cq() argument
10386 cpu = lpfc_find_cpu_handle(phba, idx, LPFC_FIND_BY_HDWQ); in lpfc_alloc_io_wq_cq()
10388 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_io_wq_cq()
10390 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10391 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10395 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10396 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10397 phba->sli4_hba.cq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10399 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10407 phba->sli4_hba.hdwq[idx].io_cq = qdesc; in lpfc_alloc_io_wq_cq()
10410 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_io_wq_cq()
10412 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_io_wq_cq()
10413 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_io_wq_cq()
10414 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10418 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10419 phba->sli4_hba.wq_esize, in lpfc_alloc_io_wq_cq()
10420 phba->sli4_hba.wq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10423 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10430 phba->sli4_hba.hdwq[idx].io_wq = qdesc; in lpfc_alloc_io_wq_cq()
10431 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_io_wq_cq()
10450 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
10463 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
10464 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
10465 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
10466 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
10467 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
10468 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
10469 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
10470 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
10471 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
10472 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
10474 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10475 phba->sli4_hba.hdwq = kcalloc( in lpfc_sli4_queue_create()
10476 phba->cfg_hdw_queue, sizeof(struct lpfc_sli4_hdw_queue), in lpfc_sli4_queue_create()
10478 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10479 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10485 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10486 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_queue_create()
10504 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10505 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10506 phba->sli4_hba.nvmet_cqset = kcalloc( in lpfc_sli4_queue_create()
10507 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10510 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
10511 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10516 phba->sli4_hba.nvmet_mrq_hdr = kcalloc( in lpfc_sli4_queue_create()
10517 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10520 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
10521 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10526 phba->sli4_hba.nvmet_mrq_data = kcalloc( in lpfc_sli4_queue_create()
10527 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10530 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
10531 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10539 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10547 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10552 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10555 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10556 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
10557 phba->sli4_hba.eq_ecount, cpu); in lpfc_sli4_queue_create()
10559 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10572 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, qdesc->last_cpu); in lpfc_sli4_queue_create()
10580 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10587 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10592 eqcpu = lpfc_find_cpu_handle(phba, cpup->eq, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10593 eqcpup = &phba->sli4_hba.cpu_map[eqcpu]; in lpfc_sli4_queue_create()
10594 qp->hba_eq = phba->sli4_hba.hdwq[eqcpup->hdwq].hba_eq; in lpfc_sli4_queue_create()
10598 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10599 if (lpfc_alloc_io_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
10603 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10604 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10605 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10607 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10609 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10610 phba->sli4_hba.cq_ecount, in lpfc_sli4_queue_create()
10613 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10621 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
10629 cpu = lpfc_find_cpu_handle(phba, 0, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10631 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10632 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10633 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10635 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10640 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
10643 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10644 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10645 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10647 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10653 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
10662 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10663 phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
10664 phba->sli4_hba.mq_ecount, cpu); in lpfc_sli4_queue_create()
10666 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10671 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
10678 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10679 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
10680 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10682 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10687 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
10688 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10690 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10692 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10693 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10694 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10696 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10702 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
10705 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10706 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
10707 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10709 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10714 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
10715 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10723 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10724 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10725 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10727 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10731 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
10734 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10735 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10736 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10738 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10742 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
10744 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_sli4_queue_create()
10745 phba->nvmet_support) { in lpfc_sli4_queue_create()
10746 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10747 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10750 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10752 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10756 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10762 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
10769 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10779 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10781 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10785 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10791 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
10796 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10797 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10798 memset(&phba->sli4_hba.hdwq[idx].nvme_cstat, 0, in lpfc_sli4_queue_create()
10799 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); in lpfc_sli4_queue_create()
10804 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_queue_create()
10805 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10806 memset(&phba->sli4_hba.hdwq[idx].scsi_cstat, 0, in lpfc_sli4_queue_create()
10807 sizeof(phba->sli4_hba.hdwq[idx].scsi_cstat)); in lpfc_sli4_queue_create()
10814 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
10843 lpfc_sli4_release_hdwq(struct lpfc_hba *phba) in lpfc_sli4_release_hdwq() argument
10849 hdwq = phba->sli4_hba.hdwq; in lpfc_sli4_release_hdwq()
10852 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_release_hdwq()
10859 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_release_hdwq()
10860 lpfc_free_sgl_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10861 lpfc_free_cmd_rsp_buf_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10864 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_release_hdwq()
10866 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_sli4_release_hdwq()
10868 phba->sli4_hba.hba_eq_hdl[idx].eq = NULL; in lpfc_sli4_release_hdwq()
10885 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
10892 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10893 phba->sli.sli_flag |= LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10894 while (phba->sli.sli_flag & LPFC_QUEUE_FREE_WAIT) { in lpfc_sli4_queue_destroy()
10895 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10897 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10899 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10901 lpfc_sli4_cleanup_poll_list(phba); in lpfc_sli4_queue_destroy()
10904 if (phba->sli4_hba.hdwq) in lpfc_sli4_queue_destroy()
10905 lpfc_sli4_release_hdwq(phba); in lpfc_sli4_queue_destroy()
10907 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
10908 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
10909 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10911 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
10912 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10913 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
10914 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10918 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
10921 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
10924 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
10927 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
10928 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
10931 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
10934 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
10937 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
10940 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
10943 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10944 phba->sli.sli_flag &= ~LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10945 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10949 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
10961 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
10968 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
10976 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10983 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
10986 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10997 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
11002 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
11004 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
11016 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
11020 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
11022 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
11029 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
11031 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
11032 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
11046 lpfc_setup_cq_lookup(struct lpfc_hba *phba) in lpfc_setup_cq_lookup() argument
11051 memset(phba->sli4_hba.cq_lookup, 0, in lpfc_setup_cq_lookup()
11052 (sizeof(struct lpfc_queue *) * (phba->sli4_hba.cq_max + 1))); in lpfc_setup_cq_lookup()
11054 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_setup_cq_lookup()
11056 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_setup_cq_lookup()
11061 if (childq->queue_id > phba->sli4_hba.cq_max) in lpfc_setup_cq_lookup()
11064 phba->sli4_hba.cq_lookup[childq->queue_id] = in lpfc_setup_cq_lookup()
11083 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
11095 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
11097 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11104 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
11108 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
11115 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11119 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
11124 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
11126 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
11127 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
11128 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
11130 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11132 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
11133 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
11135 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
11140 qp = phba->sli4_hba.hdwq; in lpfc_sli4_queue_setup()
11144 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11151 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_setup()
11154 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
11165 rc = lpfc_eq_create(phba, qp[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
11166 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
11168 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11176 phba->sli4_hba.hba_eq_hdl[cpup->eq].eq = in lpfc_sli4_queue_setup()
11179 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11187 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_setup()
11188 cpu = lpfc_find_cpu_handle(phba, qidx, LPFC_FIND_BY_HDWQ); in lpfc_sli4_queue_setup()
11189 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
11192 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
11193 phba->sli4_hba.hdwq[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
11196 &phba->sli4_hba.hdwq[qidx].io_cq_map, in lpfc_sli4_queue_setup()
11200 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11214 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
11215 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11217 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
11223 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11224 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
11225 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
11228 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11233 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11234 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
11235 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11241 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11242 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
11243 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11247 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11255 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11259 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11264 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
11266 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11269 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
11275 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
11276 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11278 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11282 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11283 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
11284 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
11287 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11292 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11294 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
11295 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11297 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_setup()
11299 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
11300 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11302 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11306 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11307 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
11308 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
11311 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11317 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11320 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
11321 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
11327 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11328 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
11329 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
11330 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
11331 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11337 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11338 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
11339 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
11340 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
11341 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11344 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11352 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
11353 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
11354 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
11355 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11358 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11366 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11369 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
11370 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
11371 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
11376 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
11377 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11383 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
11384 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
11386 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11392 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11395 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
11396 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
11397 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11399 if (phba->cfg_fcp_imax) in lpfc_sli4_queue_setup()
11400 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_sli4_queue_setup()
11404 for (qidx = 0; qidx < phba->cfg_irq_chann; in lpfc_sli4_queue_setup()
11406 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
11409 if (phba->sli4_hba.cq_max) { in lpfc_sli4_queue_setup()
11410 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_setup()
11411 phba->sli4_hba.cq_lookup = kcalloc((phba->sli4_hba.cq_max + 1), in lpfc_sli4_queue_setup()
11413 if (!phba->sli4_hba.cq_lookup) { in lpfc_sli4_queue_setup()
11414 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11416 "size 0x%x\n", phba->sli4_hba.cq_max); in lpfc_sli4_queue_setup()
11420 lpfc_setup_cq_lookup(phba); in lpfc_sli4_queue_setup()
11425 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
11443 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
11450 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
11451 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
11454 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
11455 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
11458 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
11459 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
11462 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
11463 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
11464 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
11467 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
11468 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
11471 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
11472 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
11475 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
11476 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
11478 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
11480 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
11481 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11483 phba, in lpfc_sli4_queue_unset()
11484 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
11485 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
11489 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
11490 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11492 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
11497 if (phba->sli4_hba.hdwq) { in lpfc_sli4_queue_unset()
11499 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_unset()
11501 qp = &phba->sli4_hba.hdwq[qidx]; in lpfc_sli4_queue_unset()
11502 lpfc_wq_destroy(phba, qp->io_wq); in lpfc_sli4_queue_unset()
11503 lpfc_cq_destroy(phba, qp->io_cq); in lpfc_sli4_queue_unset()
11506 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_unset()
11508 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_sli4_queue_unset()
11509 lpfc_eq_destroy(phba, eq); in lpfc_sli4_queue_unset()
11513 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_unset()
11514 phba->sli4_hba.cq_lookup = NULL; in lpfc_sli4_queue_unset()
11515 phba->sli4_hba.cq_max = 0; in lpfc_sli4_queue_unset()
11535 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
11540 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
11545 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
11550 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
11565 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
11570 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
11587 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
11591 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
11607 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
11612 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11613 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
11614 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11627 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
11630 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
11642 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
11646 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11647 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
11648 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11659 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
11668 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11669 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
11671 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11674 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11675 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
11677 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11682 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release_all()
11699 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
11710 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
11713 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
11716 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11724 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
11727 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
11733 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
11735 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11752 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11763 phba->work_status[0] = readl( in lpfc_pci_function_reset()
11764 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
11765 phba->work_status[1] = readl( in lpfc_pci_function_reset()
11766 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
11767 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11771 phba->work_status[0], in lpfc_pci_function_reset()
11772 phba->work_status[1]); in lpfc_pci_function_reset()
11789 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11792 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
11812 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11833 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
11835 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
11855 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
11860 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
11862 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_pci_mem_setup()
11865 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
11869 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
11877 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
11884 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11885 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11886 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11892 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11894 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11896 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
11903 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11904 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11905 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11911 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11920 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11923 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11924 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
11926 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11933 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
11934 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11935 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11948 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
11950 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11951 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
11952 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11958 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11959 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11968 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11971 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11972 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
11974 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11981 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
11982 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11983 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
11998 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
12000 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
12001 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
12002 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
12008 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
12015 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
12016 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_write_eq_db; in lpfc_sli4_pci_mem_setup()
12017 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_write_cq_db; in lpfc_sli4_pci_mem_setup()
12020 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
12021 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_if6_write_eq_db; in lpfc_sli4_pci_mem_setup()
12022 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_if6_write_cq_db; in lpfc_sli4_pci_mem_setup()
12031 if (phba->sli4_hba.drbl_regs_memmap_p) in lpfc_sli4_pci_mem_setup()
12032 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12034 if (phba->sli4_hba.ctrl_regs_memmap_p) in lpfc_sli4_pci_mem_setup()
12035 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12037 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12050 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
12053 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
12057 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12058 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12059 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12062 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12065 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12066 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12067 if (phba->sli4_hba.dpp_regs_memmap_p) in lpfc_sli4_pci_mem_unset()
12068 iounmap(phba->sli4_hba.dpp_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12072 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
12091 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
12097 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
12100 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
12110 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
12112 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
12114 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
12121 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
12123 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
12126 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
12135 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
12139 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_enable_msix()
12144 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
12147 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
12149 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
12157 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
12162 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
12166 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
12170 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
12174 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
12195 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
12199 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
12201 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
12204 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
12209 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
12210 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
12212 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
12213 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
12237 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
12243 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
12246 phba->hba_flag &= ~HBA_NEEDS_CFG_PORT; in lpfc_sli_enable_intr()
12250 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
12253 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
12259 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12260 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
12263 phba->intr_type = MSI; in lpfc_sli_enable_intr()
12269 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12270 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
12271 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
12274 phba->intr_type = INTx; in lpfc_sli_enable_intr()
12291 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
12295 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
12301 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
12302 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
12305 phba->intr_type = NONE; in lpfc_sli_disable_intr()
12306 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
12318 lpfc_find_cpu_handle(struct lpfc_hba *phba, uint16_t id, int match) in lpfc_find_cpu_handle() argument
12325 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_find_cpu_handle()
12352 lpfc_find_hyper(struct lpfc_hba *phba, int cpu, in lpfc_find_hyper() argument
12359 cpup = &phba->sli4_hba.cpu_map[idx]; in lpfc_find_hyper()
12380 lpfc_assign_eq_map_info(struct lpfc_hba *phba, uint16_t eqidx, uint16_t flag, in lpfc_assign_eq_map_info() argument
12383 struct lpfc_vector_map_info *cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_assign_eq_map_info()
12389 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_assign_eq_map_info()
12401 lpfc_cpu_map_array_init(struct lpfc_hba *phba) in lpfc_cpu_map_array_init() argument
12408 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_map_array_init()
12414 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, cpu); in lpfc_cpu_map_array_init()
12427 lpfc_hba_eq_hdl_array_init(struct lpfc_hba *phba) in lpfc_hba_eq_hdl_array_init() argument
12432 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hba_eq_hdl_array_init()
12435 eqhdl->phba = phba; in lpfc_hba_eq_hdl_array_init()
12450 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
12471 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12476 if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id)) in lpfc_cpu_affinity_check()
12484 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12508 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12521 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12522 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12546 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12559 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12572 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12573 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12583 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
12600 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12613 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12622 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12640 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12650 if (next_idx < phba->cfg_hdw_queue) { in lpfc_cpu_affinity_check()
12662 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12663 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12678 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12679 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12690 cpup->hdwq = idx % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12700 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12713 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12715 c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, cpu); in lpfc_cpu_affinity_check()
12721 cpup->hdwq = idx++ % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12725 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12745 lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu, in lpfc_cpuhp_get_eq() argument
12757 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_cpuhp_get_eq()
12758 maskp = pci_irq_get_affinity(phba->pcidev, idx); in lpfc_cpuhp_get_eq()
12783 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_cpuhp_get_eq()
12790 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba) in __lpfc_cpuhp_remove() argument
12792 if (phba->sli_rev != LPFC_SLI_REV4) in __lpfc_cpuhp_remove()
12796 &phba->cpuhp); in __lpfc_cpuhp_remove()
12802 del_timer_sync(&phba->cpuhp_poll_timer); in __lpfc_cpuhp_remove()
12805 static void lpfc_cpuhp_remove(struct lpfc_hba *phba) in lpfc_cpuhp_remove() argument
12807 if (phba->pport && (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_cpuhp_remove()
12810 __lpfc_cpuhp_remove(phba); in lpfc_cpuhp_remove()
12813 static void lpfc_cpuhp_add(struct lpfc_hba *phba) in lpfc_cpuhp_add() argument
12815 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cpuhp_add()
12820 if (!list_empty(&phba->poll_list)) in lpfc_cpuhp_add()
12821 mod_timer(&phba->cpuhp_poll_timer, in lpfc_cpuhp_add()
12827 &phba->cpuhp); in lpfc_cpuhp_add()
12830 static int __lpfc_cpuhp_checks(struct lpfc_hba *phba, int *retval) in __lpfc_cpuhp_checks() argument
12832 if (phba->pport->load_flag & FC_UNLOADING) { in __lpfc_cpuhp_checks()
12837 if (phba->sli_rev != LPFC_SLI_REV4) { in __lpfc_cpuhp_checks()
12890 lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline) in lpfc_irq_rebalance() argument
12897 if (phba->irq_chann_mode == NORMAL_MODE) in lpfc_irq_rebalance()
12900 orig_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_rebalance()
12905 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_irq_rebalance()
12920 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_irq_rebalance()
12930 for (idx = 0; idx < phba->cfg_irq_chann; idx++) in lpfc_irq_rebalance()
12941 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_offline() local
12946 if (!phba) { in lpfc_cpu_offline()
12947 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_offline()
12951 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_offline()
12954 lpfc_irq_rebalance(phba, cpu, true); in lpfc_cpu_offline()
12956 retval = lpfc_cpuhp_get_eq(phba, cpu, &eqlist); in lpfc_cpu_offline()
12971 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_online() local
12976 if (!phba) { in lpfc_cpu_online()
12977 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_online()
12981 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_online()
12984 lpfc_irq_rebalance(phba, cpu, false); in lpfc_cpu_online()
12986 list_for_each_entry_safe(eq, next, &phba->poll_list, _poll_list) { in lpfc_cpu_online()
12987 n = lpfc_find_cpu_handle(phba, eq->hdwq, LPFC_FIND_BY_HDWQ); in lpfc_cpu_online()
13024 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
13036 vectors = phba->cfg_irq_chann; in lpfc_sli4_enable_msix()
13038 if (phba->irq_chann_mode != NORMAL_MODE) in lpfc_sli4_enable_msix()
13039 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_sli4_enable_msix()
13043 vectors = min(phba->cfg_irq_chann, cpu_cnt); in lpfc_sli4_enable_msix()
13054 rc = pci_alloc_irq_vectors(phba->pcidev, 1, vectors, flags); in lpfc_sli4_enable_msix()
13056 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
13071 rc = pci_irq_vector(phba->pcidev, index); in lpfc_sli4_enable_msix()
13073 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
13083 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
13095 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
13106 lpfc_assign_eq_map_info(phba, index, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_msix()
13109 maskp = pci_irq_get_affinity(phba->pcidev, index); in lpfc_sli4_enable_msix()
13113 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_enable_msix()
13129 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
13137 if (vectors != phba->cfg_irq_chann) { in lpfc_sli4_enable_msix()
13138 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_enable_msix()
13141 phba->cfg_irq_chann, vectors); in lpfc_sli4_enable_msix()
13142 if (phba->cfg_irq_chann > vectors) in lpfc_sli4_enable_msix()
13143 phba->cfg_irq_chann = vectors; in lpfc_sli4_enable_msix()
13157 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
13178 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
13184 rc = pci_alloc_irq_vectors(phba->pcidev, 1, 1, in lpfc_sli4_enable_msi()
13187 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
13190 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
13195 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
13196 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
13198 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
13199 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
13205 rc = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_msi()
13207 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
13208 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
13215 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); in lpfc_sli4_enable_msi()
13217 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_enable_msi()
13243 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
13253 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
13256 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
13263 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13264 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
13267 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
13273 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13274 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
13275 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
13281 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
13285 retval = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_intr()
13287 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_intr()
13295 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_intr()
13297 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_enable_intr()
13316 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
13319 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
13324 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_disable_intr()
13330 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
13333 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
13336 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
13337 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
13348 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
13350 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
13357 kfree(phba->vpi_bmask); in lpfc_unset_hba()
13358 kfree(phba->vpi_ids); in lpfc_unset_hba()
13360 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
13362 phba->pport->work_port_events = 0; in lpfc_unset_hba()
13364 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
13366 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
13368 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
13387 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
13394 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13403 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
13404 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
13407 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13408 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13416 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13418 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13424 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13429 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13434 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13446 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13447 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13456 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13458 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13461 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13477 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
13481 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
13483 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
13484 hrtimer_cancel(&phba->cmf_timer); in lpfc_sli4_hba_unset()
13486 if (phba->pport) in lpfc_sli4_hba_unset()
13487 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
13495 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13496 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
13497 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13499 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13505 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13506 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13507 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
13509 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
13510 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
13511 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
13512 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13516 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
13518 if (!pci_channel_offline(phba->pcidev)) in lpfc_sli4_hba_unset()
13520 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
13523 if (phba->pport) in lpfc_sli4_hba_unset()
13524 lpfc_cpuhp_remove(phba); in lpfc_sli4_hba_unset()
13527 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
13530 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
13534 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
13537 lpfc_ras_stop_fwlog(phba); in lpfc_sli4_hba_unset()
13540 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
13543 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
13546 if (phba->ras_fwlog.ras_enabled) in lpfc_sli4_hba_unset()
13547 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_hba_unset()
13550 if (phba->pport) in lpfc_sli4_hba_unset()
13551 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
13605 lpfc_init_congestion_buf(struct lpfc_hba *phba) in lpfc_init_congestion_buf() argument
13613 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_buf()
13614 "6235 INIT Congestion Buffer %p\n", phba->cgn_i); in lpfc_init_congestion_buf()
13616 if (!phba->cgn_i) in lpfc_init_congestion_buf()
13618 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_buf()
13620 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_init_congestion_buf()
13621 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_init_congestion_buf()
13622 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_init_congestion_buf()
13623 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_init_congestion_buf()
13625 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_init_congestion_buf()
13626 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_init_congestion_buf()
13627 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_init_congestion_buf()
13628 phba->cgn_evt_minute = 0; in lpfc_init_congestion_buf()
13629 phba->hba_flag &= ~HBA_CGN_DAY_WRAP; in lpfc_init_congestion_buf()
13636 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_init_congestion_buf()
13637 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_init_congestion_buf()
13638 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_init_congestion_buf()
13639 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_init_congestion_buf()
13651 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_init_congestion_buf()
13659 if (phba->pport) { in lpfc_init_congestion_buf()
13660 size = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_init_congestion_buf()
13671 phba->cgn_evt_timestamp = jiffies + in lpfc_init_congestion_buf()
13676 lpfc_init_congestion_stat(struct lpfc_hba *phba) in lpfc_init_congestion_stat() argument
13683 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_stat()
13684 "6236 INIT Congestion Stat %p\n", phba->cgn_i); in lpfc_init_congestion_stat()
13686 if (!phba->cgn_i) in lpfc_init_congestion_stat()
13689 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_stat()
13701 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_init_congestion_stat()
13718 __lpfc_reg_congestion_buf(struct lpfc_hba *phba, int reg) in __lpfc_reg_congestion_buf() argument
13726 if (!phba->cgn_i) in __lpfc_reg_congestion_buf()
13729 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in __lpfc_reg_congestion_buf()
13731 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in __lpfc_reg_congestion_buf()
13734 phba->pport->port_state, reg); in __lpfc_reg_congestion_buf()
13740 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in __lpfc_reg_congestion_buf()
13751 putPaddrLow(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13753 putPaddrHigh(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13755 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in __lpfc_reg_congestion_buf()
13761 mempool_free(mboxq, phba->mbox_mem_pool); in __lpfc_reg_congestion_buf()
13763 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in __lpfc_reg_congestion_buf()
13774 lpfc_unreg_congestion_buf(struct lpfc_hba *phba) in lpfc_unreg_congestion_buf() argument
13776 lpfc_cmf_stop(phba); in lpfc_unreg_congestion_buf()
13777 return __lpfc_reg_congestion_buf(phba, 0); in lpfc_unreg_congestion_buf()
13781 lpfc_reg_congestion_buf(struct lpfc_hba *phba) in lpfc_reg_congestion_buf() argument
13783 return __lpfc_reg_congestion_buf(phba, 1); in lpfc_reg_congestion_buf()
13799 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
13814 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
13819 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
13822 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
13823 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
13825 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
13826 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
13830 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
13840 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13842 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13861 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13862 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13865 phba->cfg_xpsgl = bf_get(cfg_xpsgl, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13876 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) { in lpfc_get_sli4_parameters()
13877 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13880 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13886 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
13887 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13892 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13894 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
13895 phba->cfg_nvmet_mrq = 0; in lpfc_get_sli4_parameters()
13896 phba->cfg_nvme_seg_cnt = 0; in lpfc_get_sli4_parameters()
13899 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
13901 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
13908 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_get_sli4_parameters()
13909 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_get_sli4_parameters()
13913 phba->cfg_enable_pbde = 1; in lpfc_get_sli4_parameters()
13915 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
13925 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
13927 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
13929 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
13932 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
13944 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
13946 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
13948 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13951 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
13952 phba->fcp_embed_io, sli4_params->nvme, in lpfc_get_sli4_parameters()
13953 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
13955 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13957 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13965 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
13967 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
13972 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
13974 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
13980 phba->nsler = 1; in lpfc_get_sli4_parameters()
13982 phba->nsler = 0; in lpfc_get_sli4_parameters()
14007 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
14014 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
14015 if (!phba) in lpfc_pci_probe_one_s3()
14019 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
14024 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
14029 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
14031 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14037 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
14039 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14046 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
14048 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14054 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
14056 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14062 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
14065 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
14067 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14073 vport = phba->pport; in lpfc_pci_probe_one_s3()
14076 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14083 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
14086 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
14088 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
14090 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
14096 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
14097 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
14107 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
14109 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
14110 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
14113 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
14118 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
14125 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
14128 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
14133 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
14137 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
14139 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
14141 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
14143 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
14145 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
14147 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
14151 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
14170 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
14173 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
14175 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
14180 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
14182 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
14187 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
14203 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
14205 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
14207 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
14209 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
14210 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
14212 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
14213 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
14215 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
14220 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
14224 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
14232 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
14233 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s3()
14235 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
14238 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
14242 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
14245 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
14246 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
14248 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
14278 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
14280 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
14284 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
14285 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
14286 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
14289 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
14317 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
14321 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
14325 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
14326 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
14327 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
14328 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
14329 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
14336 lpfc_cpu_map_array_init(phba); in lpfc_pci_resume_one_s3()
14338 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_resume_one_s3()
14340 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14342 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s3()
14346 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
14349 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
14350 lpfc_online(phba); in lpfc_pci_resume_one_s3()
14353 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14366 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
14368 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_recover()
14375 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
14387 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
14389 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_reset()
14393 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
14396 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
14399 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_reset()
14402 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
14405 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
14406 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
14418 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
14420 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_perm_failure()
14423 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
14424 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_sli_prep_dev_for_perm_failure()
14427 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
14430 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
14455 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
14460 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
14464 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14468 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
14472 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s3()
14474 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14501 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
14502 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
14523 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14525 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14528 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14530 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s3()
14535 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
14538 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
14539 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
14540 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
14543 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14562 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
14565 lpfc_online(phba); in lpfc_io_resume_s3()
14575 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
14577 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
14579 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
14605 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
14607 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
14609 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
14616 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
14623 sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf); in lpfc_log_write_firmware_error()
14637 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14641 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14645 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14650 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14654 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14658 offset, phba->pcidev->device, magic_number, in lpfc_log_write_firmware_error()
14674 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
14696 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
14698 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14709 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
14734 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
14737 rc = lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
14748 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14756 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
14763 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14766 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14779 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
14786 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
14790 scnprintf(file_name, sizeof(file_name), "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
14794 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
14795 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
14798 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
14800 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
14829 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
14836 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
14837 if (!phba) in lpfc_pci_probe_one_s4()
14840 INIT_LIST_HEAD(&phba->poll_list); in lpfc_pci_probe_one_s4()
14843 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14848 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
14853 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
14855 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14861 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
14863 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14868 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
14869 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
14872 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14874 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14880 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
14883 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
14886 phba->pport = NULL; in lpfc_pci_probe_one_s4()
14887 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
14890 lpfc_cpu_map_array_init(phba); in lpfc_pci_probe_one_s4()
14893 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_probe_one_s4()
14896 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
14898 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14904 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
14905 phba->cfg_irq_chann = 1; in lpfc_pci_probe_one_s4()
14906 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14907 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
14908 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
14911 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_pci_probe_one_s4()
14914 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
14916 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14920 vport = phba->pport; in lpfc_pci_probe_one_s4()
14926 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14932 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
14933 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14940 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
14941 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
14944 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
14949 if (phba->nvmet_support == 0) { in lpfc_pci_probe_one_s4()
14950 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14958 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14967 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
14968 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
14971 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
14973 timer_setup(&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer, 0); in lpfc_pci_probe_one_s4()
14974 cpuhp_state_add_instance_nocalls(lpfc_cpuhp_state, &phba->cpuhp); in lpfc_pci_probe_one_s4()
14981 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
14983 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
14985 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14987 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
14989 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
14991 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14995 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
15014 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
15018 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
15020 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
15021 if (phba->cgn_i) in lpfc_pci_remove_one_s4()
15022 lpfc_unreg_congestion_buf(phba); in lpfc_pci_remove_one_s4()
15027 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
15029 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
15034 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
15044 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
15048 if (phba->cfg_xri_rebalancing) in lpfc_pci_remove_one_s4()
15049 lpfc_destroy_multixri_pools(phba); in lpfc_pci_remove_one_s4()
15058 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
15059 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
15061 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
15066 lpfc_io_free(phba); in lpfc_pci_remove_one_s4()
15067 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
15068 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
15070 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
15071 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
15074 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
15078 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
15081 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
15110 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
15112 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
15116 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
15117 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
15118 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
15121 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
15122 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
15150 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
15154 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
15158 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
15159 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
15160 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
15161 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
15162 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
15169 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
15171 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s4()
15175 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
15178 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
15179 lpfc_online(phba); in lpfc_pci_resume_one_s4()
15182 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
15195 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
15197 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_recover()
15203 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
15215 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
15217 int offline = pci_channel_offline(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
15219 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_reset()
15224 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
15228 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
15230 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_reset()
15231 lpfc_offline(phba); in lpfc_sli4_prep_dev_for_reset()
15234 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
15236 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
15238 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
15239 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
15251 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
15253 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_perm_failure()
15257 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15260 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15263 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15286 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
15292 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
15295 hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15298 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15300 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s4()
15305 set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15307 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
15310 hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15312 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15314 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s4()
15316 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15343 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
15344 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
15357 hba_pci_err = test_and_clear_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_slot_reset_s4()
15370 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15372 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15375 lpfc_cpu_map_array_init(phba); in lpfc_io_slot_reset_s4()
15377 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15379 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s4()
15384 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
15385 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_io_slot_reset_s4()
15388 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15407 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
15415 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
15417 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
15419 lpfc_online(phba); in lpfc_io_resume_s4()
15473 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
15475 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
15483 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_remove_one()
15485 phba->pci_dev_grp); in lpfc_pci_remove_one()
15508 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
15511 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
15519 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_suspend_one()
15521 phba->pci_dev_grp); in lpfc_pci_suspend_one()
15544 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
15547 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
15555 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one()
15557 phba->pci_dev_grp); in lpfc_pci_resume_one()
15582 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
15585 if (phba->link_state == LPFC_HBA_ERROR && in lpfc_io_error_detected()
15586 phba->hba_flag & HBA_IOQ_FLUSH) in lpfc_io_error_detected()
15589 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
15597 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected()
15599 phba->pci_dev_grp); in lpfc_io_error_detected()
15623 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
15626 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
15634 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset()
15636 phba->pci_dev_grp); in lpfc_io_slot_reset()
15656 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
15658 switch (phba->pci_dev_grp) { in lpfc_io_resume()
15666 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_resume()
15668 phba->pci_dev_grp); in lpfc_io_resume()
15685 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
15688 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
15691 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
15692 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
15694 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
15695 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
15696 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
15710 lpfc_sli4_ras_init(struct lpfc_hba *phba) in lpfc_sli4_ras_init() argument
15713 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15715 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15717 phba->ras_fwlog.ras_hwsupport = true; in lpfc_sli4_ras_init()
15718 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && in lpfc_sli4_ras_init()
15719 phba->cfg_ras_fwlog_buffsize) in lpfc_sli4_ras_init()
15720 phba->ras_fwlog.ras_enabled = true; in lpfc_sli4_ras_init()
15722 phba->ras_fwlog.ras_enabled = false; in lpfc_sli4_ras_init()
15724 phba->ras_fwlog.ras_hwsupport = false; in lpfc_sli4_ras_init()
15831 void lpfc_dmp_dbg(struct lpfc_hba *phba) in lpfc_dmp_dbg() argument
15840 if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0) in lpfc_dmp_dbg()
15843 start_idx = (unsigned int)atomic_read(&phba->dbg_log_idx) % DBG_LOG_SZ; in lpfc_dmp_dbg()
15844 dbg_cnt = (unsigned int)atomic_read(&phba->dbg_log_cnt); in lpfc_dmp_dbg()
15861 dev_info(&phba->pcidev->dev, "start %d end %d cnt %d\n", in lpfc_dmp_dbg()
15869 rem_nsec = do_div(phba->dbg_log[temp_idx].t_ns, NSEC_PER_SEC); in lpfc_dmp_dbg()
15870 dev_info(&phba->pcidev->dev, "%d: [%5lu.%06lu] %s", in lpfc_dmp_dbg()
15872 (unsigned long)phba->dbg_log[temp_idx].t_ns, in lpfc_dmp_dbg()
15874 phba->dbg_log[temp_idx].log); in lpfc_dmp_dbg()
15877 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_dmp_dbg()
15878 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_dmp_dbg()
15882 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...) in lpfc_dbg_print() argument
15886 int dbg_dmping = atomic_read(&phba->dbg_log_dmping); in lpfc_dbg_print()
15894 dev_info(&phba->pcidev->dev, "%pV", &vaf); in lpfc_dbg_print()
15898 idx = (unsigned int)atomic_fetch_add(1, &phba->dbg_log_idx) % in lpfc_dbg_print()
15901 atomic_inc(&phba->dbg_log_cnt); in lpfc_dbg_print()
15903 vscnprintf(phba->dbg_log[idx].log, in lpfc_dbg_print()
15904 sizeof(phba->dbg_log[idx].log), fmt, args); in lpfc_dbg_print()
15907 phba->dbg_log[idx].t_ns = local_clock(); in lpfc_dbg_print()