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
7237 ret = lpfc_read_object(phba, (char *)LPFC_PORT_CFG_NAME, in lpfc_sli4_cgn_params_read()
7244 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7252 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7260 lpfc_cgn_params_parse(phba, p_cgn_param, len); in lpfc_sli4_cgn_params_read()
7286 lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *phba) in lpfc_sli4_cgn_parm_chg_evt() argument
7290 if (!phba->sli4_hba.pc_sli4_params.cmf) { in lpfc_sli4_cgn_parm_chg_evt()
7291 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7300 ret = lpfc_sli4_cgn_params_read(phba); in lpfc_sli4_cgn_parm_chg_evt()
7302 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7306 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7319 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
7325 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
7326 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
7327 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
7330 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7331 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
7332 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
7334 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, in lpfc_sli4_async_event_proc()
7340 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
7344 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
7347 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
7351 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
7355 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
7358 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
7361 lpfc_sli4_async_cmstat_evt(phba); in lpfc_sli4_async_event_proc()
7364 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_event_proc()
7373 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
7374 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7376 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7386 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
7390 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7392 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
7394 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
7396 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
7397 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7400 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
7402 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
7404 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fcf_redisc_event_proc()
7420 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
7425 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
7429 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
7432 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7436 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7440 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7444 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7459 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
7463 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7467 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7471 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7475 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_intr_mode()
7494 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
7499 if (!phba->pcidev) in lpfc_enable_pci_dev()
7502 pdev = phba->pcidev; in lpfc_enable_pci_dev()
7523 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_enable_pci_dev()
7536 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
7541 if (!phba->pcidev) in lpfc_disable_pci_dev()
7544 pdev = phba->pcidev; in lpfc_disable_pci_dev()
7562 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
7565 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
7566 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
7571 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) { in lpfc_reset_hba()
7572 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
7574 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
7575 lpfc_sli_flush_io_rings(phba); in lpfc_reset_hba()
7577 lpfc_offline(phba); in lpfc_reset_hba()
7578 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
7579 lpfc_online(phba); in lpfc_reset_hba()
7580 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
7594 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
7596 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
7620 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
7622 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
7626 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
7628 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_probe_sriov_nr_virtfn()
7636 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7641 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7650 struct lpfc_hba *phba = container_of(work, struct lpfc_hba, in lpfc_unblock_requests_work() local
7653 lpfc_unblock_requests(phba); in lpfc_unblock_requests_work()
7668 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
7670 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
7675 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
7676 atomic_set(&phba->dbg_log_idx, 0); in lpfc_setup_driver_resource_phase1()
7677 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_setup_driver_resource_phase1()
7678 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_setup_driver_resource_phase1()
7679 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
7682 spin_lock_init(&phba->port_list_lock); in lpfc_setup_driver_resource_phase1()
7683 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
7685 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
7688 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
7690 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
7692 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
7694 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
7696 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
7699 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
7700 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
7701 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
7702 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
7705 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
7708 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
7711 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
7714 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
7715 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
7720 timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); in lpfc_setup_driver_resource_phase1()
7722 timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); in lpfc_setup_driver_resource_phase1()
7724 timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); in lpfc_setup_driver_resource_phase1()
7726 INIT_DELAYED_WORK(&phba->eq_delay_work, lpfc_hb_eq_delay_work); in lpfc_setup_driver_resource_phase1()
7728 INIT_DELAYED_WORK(&phba->idle_stat_delay_work, in lpfc_setup_driver_resource_phase1()
7730 INIT_WORK(&phba->unblock_request_work, lpfc_unblock_requests_work); in lpfc_setup_driver_resource_phase1()
7746 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
7755 timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); in lpfc_sli_driver_resource_setup()
7758 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
7759 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
7762 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
7765 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli_driver_resource_setup()
7769 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7770 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, in lpfc_sli_driver_resource_setup()
7773 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7781 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_driver_resource_setup()
7787 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
7797 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7801 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
7802 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
7805 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
7812 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7814 ((phba->cfg_sg_seg_cnt + 2) * entry_sz); in lpfc_sli_driver_resource_setup()
7817 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
7820 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
7822 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7823 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
7825 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
7827 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
7832 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
7833 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
7836 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
7839 phba->lpfc_sg_dma_buf_pool = in lpfc_sli_driver_resource_setup()
7841 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7844 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli_driver_resource_setup()
7847 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli_driver_resource_setup()
7849 &phba->pcidev->dev, in lpfc_sli_driver_resource_setup()
7854 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli_driver_resource_setup()
7861 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
7862 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
7863 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7865 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
7869 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7870 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
7877 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli_driver_resource_setup()
7878 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli_driver_resource_setup()
7880 lpfc_mem_free(phba); in lpfc_sli_driver_resource_setup()
7892 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
7895 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
7912 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
7923 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
7924 phba->sli4_hba.num_possible_cpu = cpumask_last(cpu_possible_mask) + 1; in lpfc_sli4_driver_resource_setup()
7925 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
7928 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
7931 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
7936 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
7943 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0); in lpfc_sli4_driver_resource_setup()
7944 if (!phba->wq) in lpfc_sli4_driver_resource_setup()
7951 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
7954 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
7957 hrtimer_init(&phba->cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in lpfc_sli4_driver_resource_setup()
7958 phba->cmf_timer.function = lpfc_cmf_timer; in lpfc_sli4_driver_resource_setup()
7964 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
7966 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
7968 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
7971 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
7974 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
7975 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
7976 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
7977 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
7986 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
7987 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
7988 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
7991 if (lpfc_is_vmid_enabled(phba)) in lpfc_sli4_driver_resource_setup()
7992 timer_setup(&phba->inactive_vmid_poll, lpfc_vmid_poll, 0); in lpfc_sli4_driver_resource_setup()
7998 spin_lock_init(&phba->sli4_hba.abts_io_buf_list_lock); in lpfc_sli4_driver_resource_setup()
7999 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_io_buf_list); in lpfc_sli4_driver_resource_setup()
8001 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8003 spin_lock_init(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_sli4_driver_resource_setup()
8004 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
8005 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
8006 spin_lock_init(&phba->sli4_hba.t_active_list_lock); in lpfc_sli4_driver_resource_setup()
8007 INIT_LIST_HEAD(&phba->sli4_hba.t_active_ctx_list); in lpfc_sli4_driver_resource_setup()
8011 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
8012 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
8013 spin_lock_init(&phba->sli4_hba.asynce_list_lock); in lpfc_sli4_driver_resource_setup()
8014 spin_lock_init(&phba->sli4_hba.els_xri_abrt_list_lock); in lpfc_sli4_driver_resource_setup()
8021 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
8023 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
8025 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
8027 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
8029 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
8032 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
8033 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
8034 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
8035 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
8040 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
8041 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
8044 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
8047 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
8052 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
8054 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
8059 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
8063 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8068 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
8073 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
8077 if (phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG) { in lpfc_sli4_driver_resource_setup()
8085 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_FABRIC; in lpfc_sli4_driver_resource_setup()
8088 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
8093 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
8095 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
8100 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
8108 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
8112 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8113 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
8115 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8121 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8129 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
8134 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
8140 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
8143 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
8145 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8150 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8157 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_driver_resource_setup()
8158 if (phba->irq_chann_mode == NHT_MODE) { in lpfc_sli4_driver_resource_setup()
8159 phba->cfg_irq_chann = in lpfc_sli4_driver_resource_setup()
8160 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
8161 phba->cfg_hdw_queue = in lpfc_sli4_driver_resource_setup()
8162 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
8163 phba->irq_chann_mode = NORMAL_MODE; in lpfc_sli4_driver_resource_setup()
8170 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
8177 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8180 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
8182 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
8183 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
8184 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
8185 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8190 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8197 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8208 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
8222 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
8234 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
8238 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8244 if (phba->cfg_enable_bg && in lpfc_sli4_driver_resource_setup()
8245 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
8246 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
8248 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8256 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
8258 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
8262 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
8263 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8271 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_driver_resource_setup()
8272 phba->cfg_sg_dma_buf_size = LPFC_DEFAULT_XPSGL_SIZE; in lpfc_sli4_driver_resource_setup()
8273 else if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
8274 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
8276 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
8277 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
8279 phba->border_sge_num = phba->cfg_sg_dma_buf_size / in lpfc_sli4_driver_resource_setup()
8283 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8284 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { in lpfc_sli4_driver_resource_setup()
8285 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, in lpfc_sli4_driver_resource_setup()
8289 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8291 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8294 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
8297 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8298 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sli4_driver_resource_setup()
8299 phba->cfg_nvme_seg_cnt); in lpfc_sli4_driver_resource_setup()
8301 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_sli4_driver_resource_setup()
8302 i = phba->cfg_sg_dma_buf_size; in lpfc_sli4_driver_resource_setup()
8306 phba->lpfc_sg_dma_buf_pool = in lpfc_sli4_driver_resource_setup()
8308 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8309 phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8311 if (!phba->lpfc_sg_dma_buf_pool) { in lpfc_sli4_driver_resource_setup()
8316 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli4_driver_resource_setup()
8318 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8322 if (!phba->lpfc_cmd_rsp_buf_pool) { in lpfc_sli4_driver_resource_setup()
8327 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8330 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
8333 lpfc_sli4_ras_init(phba); in lpfc_sli4_driver_resource_setup()
8336 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
8341 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
8346 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
8349 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
8351 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8355 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8357 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8364 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
8366 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
8367 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8374 phba->sli4_hba.hba_eq_hdl = kcalloc(phba->cfg_irq_chann, in lpfc_sli4_driver_resource_setup()
8377 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
8378 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8385 phba->sli4_hba.cpu_map = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
8388 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
8389 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8396 phba->sli4_hba.eq_info = alloc_percpu(struct lpfc_eq_intr_info); in lpfc_sli4_driver_resource_setup()
8397 if (!phba->sli4_hba.eq_info) { in lpfc_sli4_driver_resource_setup()
8398 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8404 phba->sli4_hba.idle_stat = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
8405 sizeof(*phba->sli4_hba.idle_stat), in lpfc_sli4_driver_resource_setup()
8407 if (!phba->sli4_hba.idle_stat) { in lpfc_sli4_driver_resource_setup()
8408 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8415 phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); in lpfc_sli4_driver_resource_setup()
8416 if (!phba->sli4_hba.c_stat) { in lpfc_sli4_driver_resource_setup()
8417 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8424 phba->cmf_stat = alloc_percpu(struct lpfc_cgn_stat); in lpfc_sli4_driver_resource_setup()
8425 if (!phba->cmf_stat) { in lpfc_sli4_driver_resource_setup()
8426 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8436 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
8437 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
8438 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8440 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
8444 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8445 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
8453 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_setup()
8456 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_setup()
8458 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_setup()
8460 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
8462 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
8464 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
8466 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8468 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
8470 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
8472 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool); in lpfc_sli4_driver_resource_setup()
8473 phba->lpfc_cmd_rsp_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8475 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli4_driver_resource_setup()
8476 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8478 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8480 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
8482 destroy_workqueue(phba->wq); in lpfc_sli4_driver_resource_setup()
8483 phba->wq = NULL; in lpfc_sli4_driver_resource_setup()
8495 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
8499 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_unset()
8501 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_unset()
8503 free_percpu(phba->cmf_stat); in lpfc_sli4_driver_resource_unset()
8504 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_unset()
8507 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
8508 phba->sli4_hba.num_possible_cpu = 0; in lpfc_sli4_driver_resource_unset()
8509 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
8510 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
8511 cpumask_clear(&phba->sli4_hba.irq_aff_mask); in lpfc_sli4_driver_resource_unset()
8514 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
8517 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
8518 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
8521 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
8524 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
8525 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8526 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8529 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
8530 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
8533 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
8536 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
8539 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
8543 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
8562 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
8564 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
8565 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
8566 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
8569 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
8570 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
8571 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
8574 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
8575 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
8576 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
8579 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_init_api_table_setup()
8599 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
8604 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
8605 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
8606 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
8607 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
8623 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
8625 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
8626 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
8627 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
8631 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
8632 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
8642 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
8646 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8648 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
8651 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
8653 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8671 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
8678 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8688 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
8698 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8699 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8700 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
8701 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8707 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
8720 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
8726 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
8738 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
8743 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8744 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
8745 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8748 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
8758 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
8764 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8765 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8766 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
8767 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8768 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8773 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
8781 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
8792 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
8796 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
8798 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
8800 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
8814 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
8816 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
8828 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
8831 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
8832 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
8833 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
8834 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
8837 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
8840 phba->sli4_hba.io_xri_cnt = 0; in lpfc_init_sgl_list()
8858 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
8863 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
8864 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
8866 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
8869 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
8871 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_init_rpi_hdrs()
8873 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
8894 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
8905 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
8907 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
8911 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
8913 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8919 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
8920 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8934 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
8955 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8959 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
8960 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
8962 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8966 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
8983 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
8987 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
8991 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
8993 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
9000 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
9018 struct lpfc_hba *phba; in lpfc_hba_alloc() local
9021 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
9022 if (!phba) { in lpfc_hba_alloc()
9028 phba->pcidev = pdev; in lpfc_hba_alloc()
9031 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
9032 if (phba->brd_no < 0) { in lpfc_hba_alloc()
9033 kfree(phba); in lpfc_hba_alloc()
9036 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
9038 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
9039 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
9041 return phba; in lpfc_hba_alloc()
9052 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
9054 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_hba_free()
9055 kfree(phba->sli4_hba.hdwq); in lpfc_hba_free()
9058 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
9061 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
9062 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
9064 kfree(phba); in lpfc_hba_free()
9080 struct lpfc_hba *phba = vport->phba; in lpfc_setup_fdmi_mask() local
9083 if (phba->cfg_enable_SmartSAN || in lpfc_setup_fdmi_mask()
9084 phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT) { in lpfc_setup_fdmi_mask()
9087 if (phba->cfg_enable_SmartSAN) in lpfc_setup_fdmi_mask()
9093 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, in lpfc_setup_fdmi_mask()
9110 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
9116 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
9117 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
9118 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
9119 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
9121 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
9122 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
9127 phba->pport = vport; in lpfc_create_shost()
9129 if (phba->nvmet_support) { in lpfc_create_shost()
9131 phba->targetport = NULL; in lpfc_create_shost()
9132 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
9133 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME_DISC, in lpfc_create_shost()
9139 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
9158 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
9160 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
9177 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
9182 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9183 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
9187 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
9188 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
9191 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
9194 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
9198 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
9199 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
9201 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9202 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
9203 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
9204 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9207 phba->cfg_prot_mask, in lpfc_setup_bg()
9208 phba->cfg_prot_guard); in lpfc_setup_bg()
9210 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
9211 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
9213 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9228 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
9234 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
9240 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
9241 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
9245 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
9247 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
9251 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
9275 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
9277 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
9297 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
9300 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
9304 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
9305 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
9312 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
9313 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
9320 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
9321 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
9322 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
9325 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
9326 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9328 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
9329 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9332 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
9334 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
9336 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
9340 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
9342 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
9343 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
9347 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
9348 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
9350 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
9352 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
9353 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9354 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9355 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9356 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9362 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
9364 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
9366 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
9379 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
9384 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
9387 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
9391 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
9393 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
9396 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
9397 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
9412 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
9421 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
9426 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
9444 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9458 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
9463 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9465 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9467 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9469 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9471 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9473 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
9480 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
9483 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
9484 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
9485 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
9486 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
9488 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
9490 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
9491 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
9492 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
9493 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_post_status_check()
9503 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
9504 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
9511 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
9515 phba->work_status[0] = in lpfc_sli4_post_status_check()
9516 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9518 phba->work_status[1] = in lpfc_sli4_post_status_check()
9519 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9521 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9528 phba->work_status[0], in lpfc_sli4_post_status_check()
9529 phba->work_status[1]); in lpfc_sli4_post_status_check()
9536 &phba->sli4_hba.sli_intf) == in lpfc_sli4_post_status_check()
9538 pci_write_config_byte(phba->pcidev, in lpfc_sli4_post_status_check()
9558 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
9562 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
9563 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
9564 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
9565 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
9566 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
9567 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
9568 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
9569 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
9570 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9571 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9574 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9575 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9577 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9578 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9580 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9581 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9583 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9584 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9586 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9587 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9589 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9590 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9591 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9592 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9594 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9595 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9597 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9598 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9600 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9601 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9602 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
9603 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9604 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9605 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9606 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9609 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9610 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9612 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9613 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9615 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9616 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9618 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9619 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9621 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9622 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9624 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9625 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9627 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9628 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9632 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
9647 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
9651 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
9652 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9654 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9656 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9658 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9662 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9664 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9666 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9668 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9670 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9676 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
9694 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
9699 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9702 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9705 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9708 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
9709 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9711 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9732 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
9749 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
9763 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
9764 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
9766 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
9768 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
9779 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
9780 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
9785 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
9803 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
9805 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
9806 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
9807 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
9808 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
9810 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
9811 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
9838 lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) in lpfc_map_topology() argument
9846 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9850 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9853 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9857 phba->hba_flag |= HBA_PERSISTENT_TOPO; in lpfc_map_topology()
9860 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9862 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9865 phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) in lpfc_map_topology()
9869 phba->hba_flag &= ~HBA_PERSISTENT_TOPO; in lpfc_map_topology()
9874 phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : in lpfc_map_topology()
9877 phba->cfg_topology = ((pt == LINK_FLAGS_P2P) in lpfc_map_topology()
9882 if (phba->hba_flag & HBA_PERSISTENT_TOPO) { in lpfc_map_topology()
9883 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9885 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9887 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9890 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9909 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
9922 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
9924 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9930 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
9932 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
9934 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9943 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
9944 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
9946 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
9948 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
9950 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
9951 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
9953 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
9957 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
9958 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
9964 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_read_config()
9968 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_CONFIG; in lpfc_sli4_read_config()
9971 phba->sli4_hba.fawwpn_flag &= ~LPFC_FAWWPN_CONFIG; in lpfc_sli4_read_config()
9974 phba->sli4_hba.conf_trunk = in lpfc_sli4_read_config()
9976 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
9979 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
9983 phba->sli4_hba.max_cfg_param.max_xri > 512) in lpfc_sli4_read_config()
9984 phba->sli4_hba.max_cfg_param.max_xri = 512; in lpfc_sli4_read_config()
9985 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
9987 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
9990 if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) in lpfc_sli4_read_config()
9991 phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; in lpfc_sli4_read_config()
9992 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
9994 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
9996 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
9998 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
10000 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
10002 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
10004 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
10006 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
10008 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
10010 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
10012 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
10013 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
10014 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
10015 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
10016 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
10017 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
10018 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
10029 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
10030 phba->cgn_reg_signal = EDC_CG_SIG_NOTSUPPORTED; in lpfc_sli4_read_config()
10031 phba->cgn_sig_freq = lpfc_fabric_cgn_frequency; in lpfc_sli4_read_config()
10035 phba->cgn_reg_signal = EDC_CG_SIG_WARN_ONLY; in lpfc_sli4_read_config()
10036 phba->cgn_reg_fpin &= ~LPFC_CGN_FPIN_WARN; in lpfc_sli4_read_config()
10042 if (phba->cgn_reg_signal != in lpfc_sli4_read_config()
10045 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
10046 phba->cgn_reg_signal = in lpfc_sli4_read_config()
10049 phba->cgn_reg_signal = in lpfc_sli4_read_config()
10051 phba->cgn_reg_fpin = in lpfc_sli4_read_config()
10058 phba->cgn_init_reg_fpin = phba->cgn_reg_fpin; in lpfc_sli4_read_config()
10059 phba->cgn_init_reg_signal = phba->cgn_reg_signal; in lpfc_sli4_read_config()
10061 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_sli4_read_config()
10063 phba->cgn_reg_signal, phba->cgn_reg_fpin); in lpfc_sli4_read_config()
10065 lpfc_map_topology(phba, rd_config); in lpfc_sli4_read_config()
10066 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10073 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
10074 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
10075 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
10076 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
10077 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
10078 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
10079 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
10080 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
10081 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
10082 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
10083 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
10084 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
10085 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
10086 phba->sli4_hba.max_cfg_param.max_rq, in lpfc_sli4_read_config()
10087 phba->lmt); in lpfc_sli4_read_config()
10093 qmin = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
10094 if (phba->sli4_hba.max_cfg_param.max_cq < qmin) in lpfc_sli4_read_config()
10095 qmin = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
10096 if (phba->sli4_hba.max_cfg_param.max_eq < qmin) in lpfc_sli4_read_config()
10097 qmin = phba->sli4_hba.max_cfg_param.max_eq; in lpfc_sli4_read_config()
10107 if ((phba->cfg_irq_chann > qmin) || in lpfc_sli4_read_config()
10108 (phba->cfg_hdw_queue > qmin)) { in lpfc_sli4_read_config()
10109 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10114 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
10115 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
10116 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
10117 qmin, phba->cfg_irq_chann, in lpfc_sli4_read_config()
10118 phba->cfg_hdw_queue); in lpfc_sli4_read_config()
10120 if (phba->cfg_irq_chann > qmin) in lpfc_sli4_read_config()
10121 phba->cfg_irq_chann = qmin; in lpfc_sli4_read_config()
10122 if (phba->cfg_hdw_queue > qmin) in lpfc_sli4_read_config()
10123 phba->cfg_hdw_queue = qmin; in lpfc_sli4_read_config()
10131 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
10136 phba->hba_flag |= HBA_FORCED_LINK_SPEED; in lpfc_sli4_read_config()
10140 phba->cfg_link_speed = in lpfc_sli4_read_config()
10144 phba->cfg_link_speed = in lpfc_sli4_read_config()
10148 phba->cfg_link_speed = in lpfc_sli4_read_config()
10152 phba->cfg_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 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_read_config()
10181 phba->cfg_link_speed = in lpfc_sli4_read_config()
10188 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
10189 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
10190 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
10191 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
10193 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
10194 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
10197 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
10204 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
10208 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
10214 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10237 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
10239 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
10246 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10248 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
10249 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
10251 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10257 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
10275 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
10282 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
10285 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
10288 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10301 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
10303 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10309 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
10334 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
10341 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
10342 if (phba->cfg_hdw_queue < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
10343 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_sli4_queue_verify()
10344 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
10345 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
10348 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
10350 phba->cfg_hdw_queue, phba->cfg_irq_chann, in lpfc_sli4_queue_verify()
10351 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
10354 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
10355 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10358 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
10359 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10364 lpfc_alloc_io_wq_cq(struct lpfc_hba *phba, int idx) in lpfc_alloc_io_wq_cq() argument
10370 cpu = lpfc_find_cpu_handle(phba, idx, LPFC_FIND_BY_HDWQ); in lpfc_alloc_io_wq_cq()
10372 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_io_wq_cq()
10374 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10375 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10379 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10380 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10381 phba->sli4_hba.cq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10383 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10391 phba->sli4_hba.hdwq[idx].io_cq = qdesc; in lpfc_alloc_io_wq_cq()
10394 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_io_wq_cq()
10396 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_io_wq_cq()
10397 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_io_wq_cq()
10398 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10402 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10403 phba->sli4_hba.wq_esize, in lpfc_alloc_io_wq_cq()
10404 phba->sli4_hba.wq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10407 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10414 phba->sli4_hba.hdwq[idx].io_wq = qdesc; in lpfc_alloc_io_wq_cq()
10415 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_io_wq_cq()
10434 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
10447 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
10448 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
10449 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
10450 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
10451 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
10452 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
10453 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
10454 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
10455 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
10456 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
10458 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10459 phba->sli4_hba.hdwq = kcalloc( in lpfc_sli4_queue_create()
10460 phba->cfg_hdw_queue, sizeof(struct lpfc_sli4_hdw_queue), in lpfc_sli4_queue_create()
10462 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10463 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10469 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10470 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_queue_create()
10488 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10489 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10490 phba->sli4_hba.nvmet_cqset = kcalloc( in lpfc_sli4_queue_create()
10491 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10494 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
10495 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10500 phba->sli4_hba.nvmet_mrq_hdr = kcalloc( in lpfc_sli4_queue_create()
10501 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10504 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
10505 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10510 phba->sli4_hba.nvmet_mrq_data = kcalloc( in lpfc_sli4_queue_create()
10511 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10514 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
10515 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10523 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10531 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10536 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10539 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10540 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
10541 phba->sli4_hba.eq_ecount, cpu); in lpfc_sli4_queue_create()
10543 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10556 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, qdesc->last_cpu); in lpfc_sli4_queue_create()
10564 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10571 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10576 eqcpu = lpfc_find_cpu_handle(phba, cpup->eq, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10577 eqcpup = &phba->sli4_hba.cpu_map[eqcpu]; in lpfc_sli4_queue_create()
10578 qp->hba_eq = phba->sli4_hba.hdwq[eqcpup->hdwq].hba_eq; in lpfc_sli4_queue_create()
10582 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10583 if (lpfc_alloc_io_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
10587 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10588 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10589 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10591 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10593 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10594 phba->sli4_hba.cq_ecount, in lpfc_sli4_queue_create()
10597 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10605 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
10613 cpu = lpfc_find_cpu_handle(phba, 0, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10615 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10616 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10617 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10619 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10624 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
10627 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10628 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10629 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10631 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10637 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
10646 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10647 phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
10648 phba->sli4_hba.mq_ecount, cpu); in lpfc_sli4_queue_create()
10650 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10655 phba->sli4_hba.mbx_wq = 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.wq_esize, in lpfc_sli4_queue_create()
10664 phba->sli4_hba.wq_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.els_wq = qdesc; in lpfc_sli4_queue_create()
10672 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10674 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10676 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10677 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10678 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10680 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10686 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
10689 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10690 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
10691 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10693 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10698 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
10699 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10707 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10708 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10709 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10711 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10715 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
10718 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10719 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10720 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10722 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10726 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
10728 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_sli4_queue_create()
10729 phba->nvmet_support) { in lpfc_sli4_queue_create()
10730 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10731 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10734 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10736 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10740 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10746 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
10753 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10763 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10765 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10769 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10775 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
10780 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10781 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10782 memset(&phba->sli4_hba.hdwq[idx].nvme_cstat, 0, in lpfc_sli4_queue_create()
10783 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); in lpfc_sli4_queue_create()
10788 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_queue_create()
10789 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10790 memset(&phba->sli4_hba.hdwq[idx].scsi_cstat, 0, in lpfc_sli4_queue_create()
10791 sizeof(phba->sli4_hba.hdwq[idx].scsi_cstat)); in lpfc_sli4_queue_create()
10798 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
10827 lpfc_sli4_release_hdwq(struct lpfc_hba *phba) in lpfc_sli4_release_hdwq() argument
10833 hdwq = phba->sli4_hba.hdwq; in lpfc_sli4_release_hdwq()
10836 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_release_hdwq()
10843 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_release_hdwq()
10844 lpfc_free_sgl_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10845 lpfc_free_cmd_rsp_buf_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10848 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_release_hdwq()
10850 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_sli4_release_hdwq()
10852 phba->sli4_hba.hba_eq_hdl[idx].eq = NULL; in lpfc_sli4_release_hdwq()
10869 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
10876 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10877 phba->sli.sli_flag |= LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10878 while (phba->sli.sli_flag & LPFC_QUEUE_FREE_WAIT) { in lpfc_sli4_queue_destroy()
10879 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10881 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10883 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10885 lpfc_sli4_cleanup_poll_list(phba); in lpfc_sli4_queue_destroy()
10888 if (phba->sli4_hba.hdwq) in lpfc_sli4_queue_destroy()
10889 lpfc_sli4_release_hdwq(phba); in lpfc_sli4_queue_destroy()
10891 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
10892 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
10893 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10895 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
10896 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10897 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
10898 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10902 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
10905 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
10908 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
10911 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
10912 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
10915 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
10918 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
10921 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
10924 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
10927 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10928 phba->sli.sli_flag &= ~LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10929 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10933 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
10945 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
10952 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
10960 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10967 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
10970 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10981 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
10986 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
10988 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
11000 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
11004 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
11006 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
11013 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
11015 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
11016 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
11030 lpfc_setup_cq_lookup(struct lpfc_hba *phba) in lpfc_setup_cq_lookup() argument
11035 memset(phba->sli4_hba.cq_lookup, 0, in lpfc_setup_cq_lookup()
11036 (sizeof(struct lpfc_queue *) * (phba->sli4_hba.cq_max + 1))); in lpfc_setup_cq_lookup()
11038 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_setup_cq_lookup()
11040 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_setup_cq_lookup()
11045 if (childq->queue_id > phba->sli4_hba.cq_max) in lpfc_setup_cq_lookup()
11048 phba->sli4_hba.cq_lookup[childq->queue_id] = in lpfc_setup_cq_lookup()
11067 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
11079 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
11081 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11088 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
11092 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
11099 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11103 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
11108 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
11110 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
11111 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
11112 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
11114 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11116 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
11117 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
11119 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
11124 qp = phba->sli4_hba.hdwq; in lpfc_sli4_queue_setup()
11128 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11135 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_setup()
11138 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
11149 rc = lpfc_eq_create(phba, qp[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
11150 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
11152 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11160 phba->sli4_hba.hba_eq_hdl[cpup->eq].eq = in lpfc_sli4_queue_setup()
11163 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11171 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_setup()
11172 cpu = lpfc_find_cpu_handle(phba, qidx, LPFC_FIND_BY_HDWQ); in lpfc_sli4_queue_setup()
11173 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
11176 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
11177 phba->sli4_hba.hdwq[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
11180 &phba->sli4_hba.hdwq[qidx].io_cq_map, in lpfc_sli4_queue_setup()
11184 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11198 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
11199 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11201 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
11207 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11208 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
11209 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
11212 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11217 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11218 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
11219 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11225 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11226 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
11227 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11231 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11239 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11243 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11248 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
11250 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11253 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
11259 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
11260 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11262 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11266 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11267 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
11268 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
11271 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11276 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11278 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
11279 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11281 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_setup()
11283 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
11284 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11286 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11290 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11291 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
11292 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
11295 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11301 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11304 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
11305 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
11311 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11312 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
11313 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
11314 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
11315 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11321 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11322 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
11323 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
11324 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
11325 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11328 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11336 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
11337 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
11338 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
11339 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11342 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11350 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11353 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
11354 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
11355 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
11360 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
11361 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11367 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
11368 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
11370 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11376 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11379 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
11380 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
11381 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11383 if (phba->cfg_fcp_imax) in lpfc_sli4_queue_setup()
11384 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_sli4_queue_setup()
11388 for (qidx = 0; qidx < phba->cfg_irq_chann; in lpfc_sli4_queue_setup()
11390 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
11393 if (phba->sli4_hba.cq_max) { in lpfc_sli4_queue_setup()
11394 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_setup()
11395 phba->sli4_hba.cq_lookup = kcalloc((phba->sli4_hba.cq_max + 1), in lpfc_sli4_queue_setup()
11397 if (!phba->sli4_hba.cq_lookup) { in lpfc_sli4_queue_setup()
11398 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11400 "size 0x%x\n", phba->sli4_hba.cq_max); in lpfc_sli4_queue_setup()
11404 lpfc_setup_cq_lookup(phba); in lpfc_sli4_queue_setup()
11409 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
11427 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
11434 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
11435 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
11438 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
11439 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
11442 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
11443 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
11446 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
11447 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
11448 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
11451 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
11452 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
11455 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
11456 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
11459 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
11460 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
11462 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
11464 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
11465 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11467 phba, in lpfc_sli4_queue_unset()
11468 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
11469 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
11473 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
11474 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11476 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
11481 if (phba->sli4_hba.hdwq) { in lpfc_sli4_queue_unset()
11483 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_unset()
11485 qp = &phba->sli4_hba.hdwq[qidx]; in lpfc_sli4_queue_unset()
11486 lpfc_wq_destroy(phba, qp->io_wq); in lpfc_sli4_queue_unset()
11487 lpfc_cq_destroy(phba, qp->io_cq); in lpfc_sli4_queue_unset()
11490 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_unset()
11492 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_sli4_queue_unset()
11493 lpfc_eq_destroy(phba, eq); in lpfc_sli4_queue_unset()
11497 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_unset()
11498 phba->sli4_hba.cq_lookup = NULL; in lpfc_sli4_queue_unset()
11499 phba->sli4_hba.cq_max = 0; in lpfc_sli4_queue_unset()
11519 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
11524 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
11529 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
11534 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
11549 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
11554 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
11571 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
11575 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
11591 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
11596 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11597 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
11598 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11611 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
11614 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
11626 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
11630 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11631 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
11632 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11643 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
11652 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11653 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
11655 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11658 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11659 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
11661 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11666 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release_all()
11683 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
11694 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
11697 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
11700 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11708 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
11711 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
11717 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
11719 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11736 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11747 phba->work_status[0] = readl( in lpfc_pci_function_reset()
11748 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
11749 phba->work_status[1] = readl( in lpfc_pci_function_reset()
11750 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
11751 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11755 phba->work_status[0], in lpfc_pci_function_reset()
11756 phba->work_status[1]); in lpfc_pci_function_reset()
11773 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11776 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
11796 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11817 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
11819 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
11839 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
11844 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
11846 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_pci_mem_setup()
11849 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
11853 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
11861 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
11868 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11869 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11870 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11876 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11878 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11880 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
11887 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11888 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11889 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11895 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11904 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11907 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11908 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
11910 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11917 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
11918 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11919 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11932 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
11934 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11935 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
11936 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11942 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11943 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11952 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11955 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11956 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
11958 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11965 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
11966 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11967 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
11982 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
11984 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11985 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
11986 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11992 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11999 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
12000 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_write_eq_db; in lpfc_sli4_pci_mem_setup()
12001 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_write_cq_db; in lpfc_sli4_pci_mem_setup()
12004 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
12005 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_if6_write_eq_db; in lpfc_sli4_pci_mem_setup()
12006 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_if6_write_cq_db; in lpfc_sli4_pci_mem_setup()
12015 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12017 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12019 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12032 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
12035 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
12039 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12040 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12041 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12044 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12047 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12048 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12049 if (phba->sli4_hba.dpp_regs_memmap_p) in lpfc_sli4_pci_mem_unset()
12050 iounmap(phba->sli4_hba.dpp_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12054 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
12073 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
12079 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
12082 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
12092 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
12094 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
12096 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
12103 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
12105 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
12108 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
12117 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
12121 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_enable_msix()
12126 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
12129 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
12131 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
12139 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
12144 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
12148 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
12152 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
12156 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
12177 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
12181 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
12183 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
12186 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
12191 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
12192 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
12194 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
12195 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
12219 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
12225 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
12228 phba->hba_flag &= ~HBA_NEEDS_CFG_PORT; in lpfc_sli_enable_intr()
12232 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
12235 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
12241 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12242 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
12245 phba->intr_type = MSI; in lpfc_sli_enable_intr()
12251 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12252 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
12253 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
12256 phba->intr_type = INTx; in lpfc_sli_enable_intr()
12273 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
12277 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
12283 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
12284 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
12287 phba->intr_type = NONE; in lpfc_sli_disable_intr()
12288 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
12300 lpfc_find_cpu_handle(struct lpfc_hba *phba, uint16_t id, int match) in lpfc_find_cpu_handle() argument
12307 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_find_cpu_handle()
12334 lpfc_find_hyper(struct lpfc_hba *phba, int cpu, in lpfc_find_hyper() argument
12341 cpup = &phba->sli4_hba.cpu_map[idx]; in lpfc_find_hyper()
12362 lpfc_assign_eq_map_info(struct lpfc_hba *phba, uint16_t eqidx, uint16_t flag, in lpfc_assign_eq_map_info() argument
12365 struct lpfc_vector_map_info *cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_assign_eq_map_info()
12371 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_assign_eq_map_info()
12383 lpfc_cpu_map_array_init(struct lpfc_hba *phba) in lpfc_cpu_map_array_init() argument
12390 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_map_array_init()
12396 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, cpu); in lpfc_cpu_map_array_init()
12409 lpfc_hba_eq_hdl_array_init(struct lpfc_hba *phba) in lpfc_hba_eq_hdl_array_init() argument
12414 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hba_eq_hdl_array_init()
12417 eqhdl->phba = phba; in lpfc_hba_eq_hdl_array_init()
12432 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
12453 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12458 if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id)) in lpfc_cpu_affinity_check()
12466 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12490 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12503 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12504 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12528 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12541 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12554 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12555 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12565 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
12582 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12595 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12604 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12622 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12632 if (next_idx < phba->cfg_hdw_queue) { in lpfc_cpu_affinity_check()
12644 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12645 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12660 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12661 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12672 cpup->hdwq = idx % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12682 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12695 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12697 c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, cpu); in lpfc_cpu_affinity_check()
12703 cpup->hdwq = idx++ % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12707 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12727 lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu, in lpfc_cpuhp_get_eq() argument
12739 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_cpuhp_get_eq()
12740 maskp = pci_irq_get_affinity(phba->pcidev, idx); in lpfc_cpuhp_get_eq()
12765 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_cpuhp_get_eq()
12772 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba) in __lpfc_cpuhp_remove() argument
12774 if (phba->sli_rev != LPFC_SLI_REV4) in __lpfc_cpuhp_remove()
12778 &phba->cpuhp); in __lpfc_cpuhp_remove()
12784 del_timer_sync(&phba->cpuhp_poll_timer); in __lpfc_cpuhp_remove()
12787 static void lpfc_cpuhp_remove(struct lpfc_hba *phba) in lpfc_cpuhp_remove() argument
12789 if (phba->pport && (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_cpuhp_remove()
12792 __lpfc_cpuhp_remove(phba); in lpfc_cpuhp_remove()
12795 static void lpfc_cpuhp_add(struct lpfc_hba *phba) in lpfc_cpuhp_add() argument
12797 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cpuhp_add()
12802 if (!list_empty(&phba->poll_list)) in lpfc_cpuhp_add()
12803 mod_timer(&phba->cpuhp_poll_timer, in lpfc_cpuhp_add()
12809 &phba->cpuhp); in lpfc_cpuhp_add()
12812 static int __lpfc_cpuhp_checks(struct lpfc_hba *phba, int *retval) in __lpfc_cpuhp_checks() argument
12814 if (phba->pport->load_flag & FC_UNLOADING) { in __lpfc_cpuhp_checks()
12819 if (phba->sli_rev != LPFC_SLI_REV4) { in __lpfc_cpuhp_checks()
12872 lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline) in lpfc_irq_rebalance() argument
12879 if (phba->irq_chann_mode == NORMAL_MODE) in lpfc_irq_rebalance()
12882 orig_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_rebalance()
12887 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_irq_rebalance()
12902 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_irq_rebalance()
12912 for (idx = 0; idx < phba->cfg_irq_chann; idx++) in lpfc_irq_rebalance()
12923 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_offline() local
12928 if (!phba) { in lpfc_cpu_offline()
12929 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_offline()
12933 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_offline()
12936 lpfc_irq_rebalance(phba, cpu, true); in lpfc_cpu_offline()
12938 retval = lpfc_cpuhp_get_eq(phba, cpu, &eqlist); in lpfc_cpu_offline()
12953 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_online() local
12958 if (!phba) { in lpfc_cpu_online()
12959 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_online()
12963 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_online()
12966 lpfc_irq_rebalance(phba, cpu, false); in lpfc_cpu_online()
12968 list_for_each_entry_safe(eq, next, &phba->poll_list, _poll_list) { in lpfc_cpu_online()
12969 n = lpfc_find_cpu_handle(phba, eq->hdwq, LPFC_FIND_BY_HDWQ); in lpfc_cpu_online()
13006 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
13018 vectors = phba->cfg_irq_chann; in lpfc_sli4_enable_msix()
13020 if (phba->irq_chann_mode != NORMAL_MODE) in lpfc_sli4_enable_msix()
13021 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_sli4_enable_msix()
13025 vectors = min(phba->cfg_irq_chann, cpu_cnt); in lpfc_sli4_enable_msix()
13036 rc = pci_alloc_irq_vectors(phba->pcidev, 1, vectors, flags); in lpfc_sli4_enable_msix()
13038 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
13053 rc = pci_irq_vector(phba->pcidev, index); in lpfc_sli4_enable_msix()
13055 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
13065 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
13077 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
13088 lpfc_assign_eq_map_info(phba, index, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_msix()
13091 maskp = pci_irq_get_affinity(phba->pcidev, index); in lpfc_sli4_enable_msix()
13095 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_enable_msix()
13111 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
13119 if (vectors != phba->cfg_irq_chann) { in lpfc_sli4_enable_msix()
13120 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_enable_msix()
13123 phba->cfg_irq_chann, vectors); in lpfc_sli4_enable_msix()
13124 if (phba->cfg_irq_chann > vectors) in lpfc_sli4_enable_msix()
13125 phba->cfg_irq_chann = vectors; in lpfc_sli4_enable_msix()
13139 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
13160 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
13166 rc = pci_alloc_irq_vectors(phba->pcidev, 1, 1, in lpfc_sli4_enable_msi()
13169 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
13172 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
13177 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
13178 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
13180 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
13181 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
13187 rc = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_msi()
13189 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
13190 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
13197 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); in lpfc_sli4_enable_msi()
13199 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_enable_msi()
13225 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
13235 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
13238 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
13245 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13246 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
13249 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
13255 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13256 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
13257 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
13263 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
13267 retval = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_intr()
13269 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_intr()
13277 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_intr()
13279 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_enable_intr()
13298 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
13301 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
13306 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_disable_intr()
13312 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
13315 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
13318 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
13319 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
13330 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
13332 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
13339 kfree(phba->vpi_bmask); in lpfc_unset_hba()
13340 kfree(phba->vpi_ids); in lpfc_unset_hba()
13342 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
13344 phba->pport->work_port_events = 0; in lpfc_unset_hba()
13346 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
13348 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
13350 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
13369 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
13376 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13385 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
13386 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
13389 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13390 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13398 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13400 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13406 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13411 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13416 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13428 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13429 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13438 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13440 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13443 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13459 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
13463 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
13465 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
13466 hrtimer_cancel(&phba->cmf_timer); in lpfc_sli4_hba_unset()
13468 if (phba->pport) in lpfc_sli4_hba_unset()
13469 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
13477 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13478 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
13479 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13481 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13487 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13488 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13489 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
13491 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
13492 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
13493 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
13494 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13498 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
13500 if (!pci_channel_offline(phba->pcidev)) in lpfc_sli4_hba_unset()
13502 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
13505 if (phba->pport) in lpfc_sli4_hba_unset()
13506 lpfc_cpuhp_remove(phba); in lpfc_sli4_hba_unset()
13509 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
13512 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
13516 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
13519 lpfc_ras_stop_fwlog(phba); in lpfc_sli4_hba_unset()
13522 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
13525 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
13528 if (phba->ras_fwlog.ras_enabled) in lpfc_sli4_hba_unset()
13529 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_hba_unset()
13532 if (phba->pport) in lpfc_sli4_hba_unset()
13533 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
13587 lpfc_init_congestion_buf(struct lpfc_hba *phba) in lpfc_init_congestion_buf() argument
13595 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_buf()
13596 "6235 INIT Congestion Buffer %p\n", phba->cgn_i); in lpfc_init_congestion_buf()
13598 if (!phba->cgn_i) in lpfc_init_congestion_buf()
13600 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_buf()
13602 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_init_congestion_buf()
13603 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_init_congestion_buf()
13604 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_init_congestion_buf()
13605 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_init_congestion_buf()
13607 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_init_congestion_buf()
13608 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_init_congestion_buf()
13609 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_init_congestion_buf()
13610 phba->cgn_evt_minute = 0; in lpfc_init_congestion_buf()
13611 phba->hba_flag &= ~HBA_CGN_DAY_WRAP; in lpfc_init_congestion_buf()
13618 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_init_congestion_buf()
13619 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_init_congestion_buf()
13620 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_init_congestion_buf()
13621 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_init_congestion_buf()
13633 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_init_congestion_buf()
13641 if (phba->pport) { in lpfc_init_congestion_buf()
13642 size = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_init_congestion_buf()
13653 phba->cgn_evt_timestamp = jiffies + in lpfc_init_congestion_buf()
13658 lpfc_init_congestion_stat(struct lpfc_hba *phba) in lpfc_init_congestion_stat() argument
13665 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_stat()
13666 "6236 INIT Congestion Stat %p\n", phba->cgn_i); in lpfc_init_congestion_stat()
13668 if (!phba->cgn_i) in lpfc_init_congestion_stat()
13671 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_stat()
13683 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_init_congestion_stat()
13700 __lpfc_reg_congestion_buf(struct lpfc_hba *phba, int reg) in __lpfc_reg_congestion_buf() argument
13708 if (!phba->cgn_i) in __lpfc_reg_congestion_buf()
13711 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in __lpfc_reg_congestion_buf()
13713 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in __lpfc_reg_congestion_buf()
13716 phba->pport->port_state, reg); in __lpfc_reg_congestion_buf()
13722 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in __lpfc_reg_congestion_buf()
13733 putPaddrLow(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13735 putPaddrHigh(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13737 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in __lpfc_reg_congestion_buf()
13743 mempool_free(mboxq, phba->mbox_mem_pool); in __lpfc_reg_congestion_buf()
13745 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in __lpfc_reg_congestion_buf()
13756 lpfc_unreg_congestion_buf(struct lpfc_hba *phba) in lpfc_unreg_congestion_buf() argument
13758 lpfc_cmf_stop(phba); in lpfc_unreg_congestion_buf()
13759 return __lpfc_reg_congestion_buf(phba, 0); in lpfc_unreg_congestion_buf()
13763 lpfc_reg_congestion_buf(struct lpfc_hba *phba) in lpfc_reg_congestion_buf() argument
13765 return __lpfc_reg_congestion_buf(phba, 1); in lpfc_reg_congestion_buf()
13781 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
13796 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
13801 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
13804 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
13805 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
13807 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
13808 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
13812 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
13822 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13824 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13843 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13844 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13847 phba->cfg_xpsgl = bf_get(cfg_xpsgl, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13858 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) { in lpfc_get_sli4_parameters()
13859 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13862 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13868 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
13869 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13874 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13876 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
13877 phba->cfg_nvmet_mrq = 0; in lpfc_get_sli4_parameters()
13878 phba->cfg_nvme_seg_cnt = 0; in lpfc_get_sli4_parameters()
13881 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
13883 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
13890 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_get_sli4_parameters()
13891 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_get_sli4_parameters()
13895 phba->cfg_enable_pbde = 1; in lpfc_get_sli4_parameters()
13897 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
13907 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
13909 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
13911 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
13914 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
13926 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
13928 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
13930 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13933 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
13934 phba->fcp_embed_io, sli4_params->nvme, in lpfc_get_sli4_parameters()
13935 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
13937 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13939 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13947 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
13949 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
13954 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
13956 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
13962 phba->nsler = 1; in lpfc_get_sli4_parameters()
13964 phba->nsler = 0; in lpfc_get_sli4_parameters()
13989 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
13996 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
13997 if (!phba) in lpfc_pci_probe_one_s3()
14001 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
14006 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
14011 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
14013 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14019 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
14021 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14028 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
14030 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14036 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
14038 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14044 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
14047 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
14049 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14055 vport = phba->pport; in lpfc_pci_probe_one_s3()
14058 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14065 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
14068 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
14070 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
14072 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
14078 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
14079 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
14089 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
14091 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
14092 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
14095 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
14100 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
14107 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
14110 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
14115 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
14119 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
14121 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
14123 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
14125 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
14127 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
14129 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
14133 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
14152 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
14155 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
14157 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
14162 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
14164 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
14169 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
14185 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
14187 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
14189 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
14191 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
14192 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
14194 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
14195 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
14197 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
14202 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
14206 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
14214 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
14215 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s3()
14217 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
14220 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
14224 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
14227 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
14228 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
14230 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
14260 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
14262 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
14266 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
14267 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
14268 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
14271 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
14299 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
14303 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
14307 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
14308 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
14309 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
14310 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
14311 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
14318 lpfc_cpu_map_array_init(phba); in lpfc_pci_resume_one_s3()
14320 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_resume_one_s3()
14322 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14324 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s3()
14328 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
14331 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
14332 lpfc_online(phba); in lpfc_pci_resume_one_s3()
14335 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14348 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
14350 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_recover()
14357 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
14369 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
14371 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_reset()
14375 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
14378 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
14381 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_reset()
14384 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
14387 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
14388 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
14400 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
14402 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_perm_failure()
14405 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
14406 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_sli_prep_dev_for_perm_failure()
14409 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
14412 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
14437 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
14442 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
14446 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14450 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
14454 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s3()
14456 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14483 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
14484 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
14505 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14507 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14510 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14512 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s3()
14517 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
14520 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
14521 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
14522 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
14525 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14544 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
14547 lpfc_online(phba); in lpfc_io_resume_s3()
14557 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
14559 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
14561 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
14587 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
14589 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
14591 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
14598 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
14605 sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf); in lpfc_log_write_firmware_error()
14619 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14623 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14627 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14632 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14636 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14640 offset, phba->pcidev->device, magic_number, in lpfc_log_write_firmware_error()
14656 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
14678 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
14680 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14691 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
14716 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
14719 rc = lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
14730 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14738 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
14745 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14748 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14761 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
14768 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
14772 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
14776 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
14777 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
14780 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
14782 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
14811 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
14818 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
14819 if (!phba) in lpfc_pci_probe_one_s4()
14822 INIT_LIST_HEAD(&phba->poll_list); in lpfc_pci_probe_one_s4()
14825 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14830 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
14835 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
14837 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14843 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
14845 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14850 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
14851 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
14854 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14856 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14862 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
14865 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
14868 phba->pport = NULL; in lpfc_pci_probe_one_s4()
14869 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
14872 lpfc_cpu_map_array_init(phba); in lpfc_pci_probe_one_s4()
14875 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_probe_one_s4()
14878 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
14880 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14886 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
14887 phba->cfg_irq_chann = 1; in lpfc_pci_probe_one_s4()
14888 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14889 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
14890 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
14893 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_pci_probe_one_s4()
14896 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
14898 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14902 vport = phba->pport; in lpfc_pci_probe_one_s4()
14908 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14914 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
14915 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14922 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
14923 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
14926 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
14931 if (phba->nvmet_support == 0) { in lpfc_pci_probe_one_s4()
14932 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14940 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14949 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
14950 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
14953 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
14955 timer_setup(&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer, 0); in lpfc_pci_probe_one_s4()
14956 cpuhp_state_add_instance_nocalls(lpfc_cpuhp_state, &phba->cpuhp); in lpfc_pci_probe_one_s4()
14963 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
14965 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
14967 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14969 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
14971 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
14973 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14977 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
14996 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
15000 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
15002 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
15003 if (phba->cgn_i) in lpfc_pci_remove_one_s4()
15004 lpfc_unreg_congestion_buf(phba); in lpfc_pci_remove_one_s4()
15009 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
15011 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
15016 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
15026 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
15030 if (phba->cfg_xri_rebalancing) in lpfc_pci_remove_one_s4()
15031 lpfc_destroy_multixri_pools(phba); in lpfc_pci_remove_one_s4()
15040 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
15041 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
15043 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
15048 lpfc_io_free(phba); in lpfc_pci_remove_one_s4()
15049 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
15050 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
15052 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
15053 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
15056 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
15060 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
15063 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
15092 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
15094 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
15098 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
15099 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
15100 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
15103 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
15104 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
15132 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
15136 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
15140 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
15141 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
15142 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
15143 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
15144 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
15151 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
15153 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s4()
15157 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
15160 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
15161 lpfc_online(phba); in lpfc_pci_resume_one_s4()
15164 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
15177 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
15179 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_recover()
15185 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
15197 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
15199 int offline = pci_channel_offline(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
15201 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_reset()
15206 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
15210 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
15212 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_reset()
15213 lpfc_offline(phba); in lpfc_sli4_prep_dev_for_reset()
15216 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
15218 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
15220 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
15221 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
15233 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
15235 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_perm_failure()
15239 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15242 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15245 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15268 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
15274 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
15277 hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15280 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15282 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s4()
15287 set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15289 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
15292 hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15294 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15296 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s4()
15298 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15325 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
15326 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
15339 hba_pci_err = test_and_clear_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_slot_reset_s4()
15352 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15354 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15357 lpfc_cpu_map_array_init(phba); in lpfc_io_slot_reset_s4()
15359 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15361 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s4()
15366 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
15367 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_io_slot_reset_s4()
15370 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15389 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
15397 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
15399 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
15401 lpfc_online(phba); in lpfc_io_resume_s4()
15455 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
15457 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
15465 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_remove_one()
15467 phba->pci_dev_grp); in lpfc_pci_remove_one()
15490 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
15493 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
15501 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_suspend_one()
15503 phba->pci_dev_grp); in lpfc_pci_suspend_one()
15526 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
15529 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
15537 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one()
15539 phba->pci_dev_grp); in lpfc_pci_resume_one()
15564 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
15567 if (phba->link_state == LPFC_HBA_ERROR && in lpfc_io_error_detected()
15568 phba->hba_flag & HBA_IOQ_FLUSH) in lpfc_io_error_detected()
15571 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
15579 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected()
15581 phba->pci_dev_grp); in lpfc_io_error_detected()
15605 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
15608 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
15616 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset()
15618 phba->pci_dev_grp); in lpfc_io_slot_reset()
15638 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
15640 switch (phba->pci_dev_grp) { in lpfc_io_resume()
15648 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_resume()
15650 phba->pci_dev_grp); in lpfc_io_resume()
15667 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
15670 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
15673 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
15674 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
15676 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
15677 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
15678 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
15692 lpfc_sli4_ras_init(struct lpfc_hba *phba) in lpfc_sli4_ras_init() argument
15695 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15697 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15699 phba->ras_fwlog.ras_hwsupport = true; in lpfc_sli4_ras_init()
15700 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && in lpfc_sli4_ras_init()
15701 phba->cfg_ras_fwlog_buffsize) in lpfc_sli4_ras_init()
15702 phba->ras_fwlog.ras_enabled = true; in lpfc_sli4_ras_init()
15704 phba->ras_fwlog.ras_enabled = false; in lpfc_sli4_ras_init()
15706 phba->ras_fwlog.ras_hwsupport = false; in lpfc_sli4_ras_init()
15813 void lpfc_dmp_dbg(struct lpfc_hba *phba) in lpfc_dmp_dbg() argument
15822 if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0) in lpfc_dmp_dbg()
15825 start_idx = (unsigned int)atomic_read(&phba->dbg_log_idx) % DBG_LOG_SZ; in lpfc_dmp_dbg()
15826 dbg_cnt = (unsigned int)atomic_read(&phba->dbg_log_cnt); in lpfc_dmp_dbg()
15843 dev_info(&phba->pcidev->dev, "start %d end %d cnt %d\n", in lpfc_dmp_dbg()
15851 rem_nsec = do_div(phba->dbg_log[temp_idx].t_ns, NSEC_PER_SEC); in lpfc_dmp_dbg()
15852 dev_info(&phba->pcidev->dev, "%d: [%5lu.%06lu] %s", in lpfc_dmp_dbg()
15854 (unsigned long)phba->dbg_log[temp_idx].t_ns, in lpfc_dmp_dbg()
15856 phba->dbg_log[temp_idx].log); in lpfc_dmp_dbg()
15859 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_dmp_dbg()
15860 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_dmp_dbg()
15864 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...) in lpfc_dbg_print() argument
15868 int dbg_dmping = atomic_read(&phba->dbg_log_dmping); in lpfc_dbg_print()
15876 dev_info(&phba->pcidev->dev, "%pV", &vaf); in lpfc_dbg_print()
15880 idx = (unsigned int)atomic_fetch_add(1, &phba->dbg_log_idx) % in lpfc_dbg_print()
15883 atomic_inc(&phba->dbg_log_cnt); in lpfc_dbg_print()
15885 vscnprintf(phba->dbg_log[idx].log, in lpfc_dbg_print()
15886 sizeof(phba->dbg_log[idx].log), fmt, args); in lpfc_dbg_print()
15889 phba->dbg_log[idx].t_ns = local_clock(); in lpfc_dbg_print()