Lines Matching refs:phba
72 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba);
73 static void lpfc_cpuhp_remove(struct lpfc_hba *phba);
74 static void lpfc_cpuhp_add(struct lpfc_hba *phba);
86 static int lpfc_hba_down_post_s3(struct lpfc_hba *phba);
87 static int lpfc_hba_down_post_s4(struct lpfc_hba *phba);
93 static void lpfc_sli4_oas_verify(struct lpfc_hba *phba);
117 lpfc_config_port_prep(struct lpfc_hba *phba) in lpfc_config_port_prep() argument
119 lpfc_vpd_t *vp = &phba->vpd; in lpfc_config_port_prep()
129 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_prep()
131 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_prep()
136 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_config_port_prep()
138 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port_prep()
147 lpfc_read_nv(phba, pmb); in lpfc_config_port_prep()
153 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
156 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
161 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
164 memcpy(phba->wwnn, (char *)mb->un.varRDnvp.nodename, in lpfc_config_port_prep()
165 sizeof(phba->wwnn)); in lpfc_config_port_prep()
166 memcpy(phba->wwpn, (char *)mb->un.varRDnvp.portname, in lpfc_config_port_prep()
167 sizeof(phba->wwpn)); in lpfc_config_port_prep()
174 phba->sli3_options &= (uint32_t)LPFC_SLI3_BG_ENABLED; in lpfc_config_port_prep()
177 lpfc_read_rev(phba, pmb); in lpfc_config_port_prep()
178 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
180 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
184 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
195 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
198 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
202 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) { in lpfc_config_port_prep()
203 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
230 phba->sli3_options |= LPFC_SLI3_VPORT_TEARDOWN; in lpfc_config_port_prep()
232 if (lpfc_is_LC_HBA(phba->pcidev->device)) in lpfc_config_port_prep()
233 memcpy(phba->RandomData, (char *)&mb->un.varWords[24], in lpfc_config_port_prep()
234 sizeof (phba->RandomData)); in lpfc_config_port_prep()
241 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD); in lpfc_config_port_prep()
242 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
245 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_config_port_prep()
265 lpfc_parse_vpd(phba, lpfc_vpd_data, offset); in lpfc_config_port_prep()
269 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
284 lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_config_async_cmpl() argument
287 phba->temp_sensor_support = 1; in lpfc_config_async_cmpl()
289 phba->temp_sensor_support = 0; in lpfc_config_async_cmpl()
290 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_config_async_cmpl()
305 lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_dump_wakeup_param_cmpl() argument
314 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
328 snprintf(phba->OptionROMVersion, 32, "%d.%d%d", in lpfc_dump_wakeup_param_cmpl()
331 snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", in lpfc_dump_wakeup_param_cmpl()
334 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
354 if (vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
355 u64_to_wwn(vport->phba->cfg_soft_wwnn, in lpfc_update_vport_wwn()
357 if (vport->phba->cfg_soft_wwpn) in lpfc_update_vport_wwn()
358 u64_to_wwn(vport->phba->cfg_soft_wwpn, in lpfc_update_vport_wwn()
365 if (vport->fc_nodename.u.wwn[0] == 0 || vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
382 vport->phba->cfg_soft_wwpn || in lpfc_update_vport_wwn()
410 lpfc_config_port_post(struct lpfc_hba *phba) in lpfc_config_port_post() argument
412 struct lpfc_vport *vport = phba->pport; in lpfc_config_port_post()
417 struct lpfc_sli *psli = &phba->sli; in lpfc_config_port_post()
422 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
427 if (phba->over_temp_state == HBA_OVER_TEMP) in lpfc_config_port_post()
428 phba->over_temp_state = HBA_NORMAL_TEMP; in lpfc_config_port_post()
429 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
431 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
433 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
439 rc = lpfc_read_sparam(phba, pmb, 0); in lpfc_config_port_post()
441 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
446 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
447 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
451 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
453 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
454 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
462 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
470 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_config_port_post()
474 if (phba->SerialNumber[0] == 0) { in lpfc_config_port_post()
482 phba->SerialNumber[i] = in lpfc_config_port_post()
485 phba->SerialNumber[i] = in lpfc_config_port_post()
490 phba->SerialNumber[i] = in lpfc_config_port_post()
493 phba->SerialNumber[i] = in lpfc_config_port_post()
498 lpfc_read_config(phba, pmb); in lpfc_config_port_post()
500 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
501 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
505 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
506 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
511 lpfc_sli_read_link_ste(phba); in lpfc_config_port_post()
514 if (phba->cfg_hba_queue_depth > mb->un.varRdConfig.max_xri) { in lpfc_config_port_post()
515 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
517 phba->cfg_hba_queue_depth, in lpfc_config_port_post()
519 phba->cfg_hba_queue_depth = mb->un.varRdConfig.max_xri; in lpfc_config_port_post()
522 phba->lmt = mb->un.varRdConfig.lmt; in lpfc_config_port_post()
525 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_config_port_post()
527 phba->link_state = LPFC_LINK_DOWN; in lpfc_config_port_post()
536 if (phba->sli_rev != 3) in lpfc_config_port_post()
537 lpfc_post_rcv_buf(phba); in lpfc_config_port_post()
542 if (phba->intr_type == MSIX) { in lpfc_config_port_post()
543 rc = lpfc_config_msi(phba, pmb); in lpfc_config_port_post()
545 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
548 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_post()
550 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
555 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
560 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
562 phba->hba_flag &= ~HBA_ERATT_HANDLED; in lpfc_config_port_post()
565 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_config_port_post()
566 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
579 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && in lpfc_config_port_post()
580 (phba->cfg_poll & DISABLE_FCP_RING_INT)) in lpfc_config_port_post()
583 writel(status, phba->HCregaddr); in lpfc_config_port_post()
584 readl(phba->HCregaddr); /* flush */ in lpfc_config_port_post()
585 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
588 timeout = phba->fc_ratov * 2; in lpfc_config_port_post()
592 mod_timer(&phba->hb_tmofunc, in lpfc_config_port_post()
594 phba->hb_outstanding = 0; in lpfc_config_port_post()
595 phba->last_completion_time = jiffies; in lpfc_config_port_post()
597 mod_timer(&phba->eratt_poll, in lpfc_config_port_post()
598 jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); in lpfc_config_port_post()
600 if (phba->hba_flag & LINK_DISABLED) { in lpfc_config_port_post()
601 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
603 lpfc_down_link(phba, pmb); in lpfc_config_port_post()
605 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
607 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
611 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
614 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_config_port_post()
615 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
616 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_config_port_post()
621 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
623 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
627 lpfc_config_async(phba, pmb, LPFC_ELS_RING); in lpfc_config_port_post()
629 pmb->vport = phba->pport; in lpfc_config_port_post()
630 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
633 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
637 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
641 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
643 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
647 lpfc_dump_wakeup_param(phba, pmb); in lpfc_config_port_post()
649 pmb->vport = phba->pport; in lpfc_config_port_post()
650 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
653 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
656 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
677 lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_init_link() argument
679 return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); in lpfc_hba_init_link()
698 lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, in lpfc_hba_init_link_fc_topology() argument
701 struct lpfc_vport *vport = phba->pport; in lpfc_hba_init_link_fc_topology()
706 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_init_link_fc_topology()
708 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
714 if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || in lpfc_hba_init_link_fc_topology()
715 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && in lpfc_hba_init_link_fc_topology()
716 !(phba->lmt & LMT_1Gb)) || in lpfc_hba_init_link_fc_topology()
717 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && in lpfc_hba_init_link_fc_topology()
718 !(phba->lmt & LMT_2Gb)) || in lpfc_hba_init_link_fc_topology()
719 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && in lpfc_hba_init_link_fc_topology()
720 !(phba->lmt & LMT_4Gb)) || in lpfc_hba_init_link_fc_topology()
721 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && in lpfc_hba_init_link_fc_topology()
722 !(phba->lmt & LMT_8Gb)) || in lpfc_hba_init_link_fc_topology()
723 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && in lpfc_hba_init_link_fc_topology()
724 !(phba->lmt & LMT_10Gb)) || in lpfc_hba_init_link_fc_topology()
725 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && in lpfc_hba_init_link_fc_topology()
726 !(phba->lmt & LMT_16Gb)) || in lpfc_hba_init_link_fc_topology()
727 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && in lpfc_hba_init_link_fc_topology()
728 !(phba->lmt & LMT_32Gb)) || in lpfc_hba_init_link_fc_topology()
729 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) && in lpfc_hba_init_link_fc_topology()
730 !(phba->lmt & LMT_64Gb))) { in lpfc_hba_init_link_fc_topology()
732 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
735 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
736 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
738 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
740 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
741 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
742 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
744 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
748 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
750 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
751 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
753 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
754 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
756 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
758 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
761 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
763 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
782 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
787 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
789 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
793 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
795 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
797 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
799 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
803 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
807 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
824 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
829 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
831 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
832 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
835 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_hba_down_prep()
836 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
838 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
840 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
843 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
862 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
868 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
869 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli4_free_sp_events()
870 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
872 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli4_free_sp_events()
874 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
875 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli4_free_sp_events()
877 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
883 lpfc_sli_release_iocbq(phba, rspiocbq); in lpfc_sli4_free_sp_events()
889 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_free_sp_events()
906 lpfc_hba_free_post_buf(struct lpfc_hba *phba) in lpfc_hba_free_post_buf() argument
908 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_free_post_buf()
914 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) in lpfc_hba_free_post_buf()
915 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_free_post_buf()
919 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
921 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
927 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_hba_free_post_buf()
931 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
933 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
948 lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) in lpfc_hba_clean_txcmplq() argument
950 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_clean_txcmplq()
957 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_hba_clean_txcmplq()
960 spin_lock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
967 spin_unlock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
969 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
972 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
976 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_hba_clean_txcmplq()
987 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
990 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
1006 lpfc_hba_down_post_s3(struct lpfc_hba *phba) in lpfc_hba_down_post_s3() argument
1008 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s3()
1009 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s3()
1025 lpfc_hba_down_post_s4(struct lpfc_hba *phba) in lpfc_hba_down_post_s4() argument
1037 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_down_post_s4()
1038 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s4()
1046 spin_lock_irq(&phba->hbalock); /* required for lpfc_els_sgl_list and */ in lpfc_hba_down_post_s4()
1051 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1053 &phba->sli4_hba.lpfc_abts_els_sgl_list, list) in lpfc_hba_down_post_s4()
1056 list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, in lpfc_hba_down_post_s4()
1057 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_hba_down_post_s4()
1060 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1066 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_hba_down_post_s4()
1067 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_hba_down_post_s4()
1087 spin_unlock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1089 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_hba_down_post_s4()
1090 spin_lock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1091 list_splice_init(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list, in lpfc_hba_down_post_s4()
1093 spin_unlock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1096 lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf); in lpfc_hba_down_post_s4()
1100 lpfc_sli4_free_sp_events(phba); in lpfc_hba_down_post_s4()
1116 lpfc_hba_down_post(struct lpfc_hba *phba) in lpfc_hba_down_post() argument
1118 return (*phba->lpfc_hba_down_post)(phba); in lpfc_hba_down_post()
1136 struct lpfc_hba *phba; in lpfc_hb_timeout() local
1140 phba = from_timer(phba, t, hb_tmofunc); in lpfc_hb_timeout()
1143 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1144 tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; in lpfc_hb_timeout()
1146 phba->pport->work_port_events |= WORKER_HB_TMO; in lpfc_hb_timeout()
1147 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1151 lpfc_worker_wake_up(phba); in lpfc_hb_timeout()
1170 struct lpfc_hba *phba; in lpfc_rrq_timeout() local
1173 phba = from_timer(phba, t, rrq_tmr); in lpfc_rrq_timeout()
1174 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1175 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1176 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1178 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1179 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1181 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1182 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1202 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1206 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1207 phba->hb_outstanding = 0; in lpfc_hb_mbox_cmpl()
1208 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1211 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1212 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && in lpfc_hb_mbox_cmpl()
1213 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1214 !(phba->pport->load_flag & FC_UNLOADING)) in lpfc_hb_mbox_cmpl()
1215 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1232 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_idle_stat_delay_work() local
1241 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_idle_stat_delay_work()
1244 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_idle_stat_delay_work()
1245 phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_idle_stat_delay_work()
1249 hdwq = &phba->sli4_hba.hdwq[phba->sli4_hba.cpu_map[i].hdwq]; in lpfc_idle_stat_delay_work()
1256 idle_stat = &phba->sli4_hba.idle_stat[i]; in lpfc_idle_stat_delay_work()
1286 schedule_delayed_work(&phba->idle_stat_delay_work, in lpfc_idle_stat_delay_work()
1293 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_hb_eq_delay_work() local
1301 if (!phba->cfg_auto_imax || phba->pport->load_flag & FC_UNLOADING) in lpfc_hb_eq_delay_work()
1304 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_hb_eq_delay_work()
1305 phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_hb_eq_delay_work()
1308 ena_delay = kcalloc(phba->sli4_hba.num_possible_cpu, sizeof(*ena_delay), in lpfc_hb_eq_delay_work()
1313 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hb_eq_delay_work()
1315 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_hb_eq_delay_work()
1325 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_hb_eq_delay_work()
1338 eqi_new = per_cpu_ptr(phba->sli4_hba.eq_info, in lpfc_hb_eq_delay_work()
1344 lpfc_modify_hba_eq_delay(phba, eq->hdwq, 1, in lpfc_hb_eq_delay_work()
1352 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_hb_eq_delay_work()
1363 static void lpfc_hb_mxp_handler(struct lpfc_hba *phba) in lpfc_hb_mxp_handler() argument
1368 hwq_count = phba->cfg_hdw_queue; in lpfc_hb_mxp_handler()
1371 lpfc_adjust_pvt_pool_count(phba, i); in lpfc_hb_mxp_handler()
1374 lpfc_adjust_high_watermark(phba, i); in lpfc_hb_mxp_handler()
1378 lpfc_snapshot_mxp(phba, i); in lpfc_hb_mxp_handler()
1400 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1406 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1409 if (phba->cfg_xri_rebalancing) { in lpfc_hb_timeout_handler()
1411 lpfc_hb_mxp_handler(phba); in lpfc_hb_timeout_handler()
1414 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1416 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_hb_timeout_handler()
1420 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1422 if ((phba->link_state == LPFC_HBA_ERROR) || in lpfc_hb_timeout_handler()
1423 (phba->pport->load_flag & FC_UNLOADING) || in lpfc_hb_timeout_handler()
1424 (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_hb_timeout_handler()
1427 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1429 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1432 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1433 if (!phba->hb_outstanding) in lpfc_hb_timeout_handler()
1434 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1438 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1443 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1445 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1446 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1447 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1448 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1449 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1450 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1451 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1456 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1460 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1463 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1464 if (!phba->hb_outstanding) { in lpfc_hb_timeout_handler()
1467 pmboxq = mempool_alloc(phba->mbox_mem_pool, in lpfc_hb_timeout_handler()
1470 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1477 lpfc_heart_beat(phba, pmboxq); in lpfc_hb_timeout_handler()
1479 pmboxq->vport = phba->pport; in lpfc_hb_timeout_handler()
1480 retval = lpfc_sli_issue_mbox(phba, pmboxq, in lpfc_hb_timeout_handler()
1486 phba->mbox_mem_pool); in lpfc_hb_timeout_handler()
1487 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1493 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1494 phba->hb_outstanding = 1; in lpfc_hb_timeout_handler()
1495 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1496 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1497 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1501 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1503 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1505 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1515 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1519 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1520 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1525 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1539 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1541 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1543 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1545 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1546 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1548 lpfc_offline(phba); in lpfc_offline_eratt()
1549 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1550 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1551 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1552 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1553 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1554 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1555 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1556 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1568 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1570 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1571 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1572 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1574 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1575 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_offline_eratt()
1576 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1577 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1578 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1591 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1593 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1594 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1599 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1600 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1601 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1602 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1606 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_deferred_eratt()
1609 phba->work_hs, phba->work_status[0], in lpfc_handle_deferred_eratt()
1610 phba->work_status[1]); in lpfc_handle_deferred_eratt()
1612 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1614 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1622 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1628 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1629 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1632 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1634 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1635 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1639 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_handle_deferred_eratt()
1640 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1650 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_deferred_eratt()
1651 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1653 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1654 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1655 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1656 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1657 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1661 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1668 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1686 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1688 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1689 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1698 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1699 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1700 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_eratt_s3()
1701 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1706 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1710 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1712 if (phba->hba_flag & DEFER_ERATT) in lpfc_handle_eratt_s3()
1713 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1715 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1716 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1718 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1721 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1722 phba->work_status[1]); in lpfc_handle_eratt_s3()
1723 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1725 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1728 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1729 phba->work_status[1]); in lpfc_handle_eratt_s3()
1731 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1733 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1741 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1747 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1748 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1749 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1750 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1751 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1754 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1755 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1756 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1761 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1765 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1766 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1768 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1775 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1776 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1777 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1778 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1785 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1788 phba->work_hs, in lpfc_handle_eratt_s3()
1789 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1797 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1814 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1820 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_port_sta_fn_reset()
1826 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1833 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1836 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1837 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_port_sta_fn_reset()
1838 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1840 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1841 rc = lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1843 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1848 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1850 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1854 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1855 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1857 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1870 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1872 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
1888 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s4()
1889 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1891 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1896 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_handle_eratt_s4()
1900 phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_handle_eratt_s4()
1903 phba->sli4_hba.u.if_type0.UEMASKLOregaddr, in lpfc_handle_eratt_s4()
1908 if (!(phba->hba_flag & HBA_RECOVERABLE_UE)) { in lpfc_handle_eratt_s4()
1909 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1912 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1915 for (i = 0; i < phba->sli4_hba.ue_to_sr / 1000; i++) { in lpfc_handle_eratt_s4()
1916 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
1929 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1938 if (!lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
1943 rc = lpfc_sli4_port_sta_fn_reset(phba, in lpfc_handle_eratt_s4()
1947 lpfc_printf_log(phba, KERN_ERR, in lpfc_handle_eratt_s4()
1954 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1957 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
1963 phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_handle_eratt_s4()
1967 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1969 readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); in lpfc_handle_eratt_s4()
1970 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1973 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
1974 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
1976 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1981 phba->sfp_alarm |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_handle_eratt_s4()
1986 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
1993 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1994 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
1995 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1996 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2001 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2007 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2011 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2015 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
2019 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
2030 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2032 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
2038 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_handle_eratt_s4()
2041 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s4()
2062 lpfc_handle_eratt(struct lpfc_hba *phba) in lpfc_handle_eratt() argument
2064 (*phba->lpfc_handle_eratt)(phba); in lpfc_handle_eratt()
2075 lpfc_handle_latt(struct lpfc_hba *phba) in lpfc_handle_latt() argument
2077 struct lpfc_vport *vport = phba->pport; in lpfc_handle_latt()
2078 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_latt()
2084 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_handle_latt()
2096 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_handle_latt()
2103 lpfc_els_flush_all_cmd(phba); in lpfc_handle_latt()
2106 lpfc_read_topology(phba, pmb, mp); in lpfc_handle_latt()
2110 phba->sli.sli3_ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2111 rc = lpfc_sli_issue_mbox (phba, pmb, MBX_NOWAIT); in lpfc_handle_latt()
2118 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2119 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2120 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2121 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2126 phba->sli.sli3_ring[LPFC_ELS_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2127 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_handle_latt()
2131 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_handle_latt()
2134 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2136 control = readl(phba->HCregaddr); in lpfc_handle_latt()
2138 writel(control, phba->HCregaddr); in lpfc_handle_latt()
2139 readl(phba->HCregaddr); /* flush */ in lpfc_handle_latt()
2142 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2143 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2144 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2145 lpfc_linkdown(phba); in lpfc_handle_latt()
2146 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_latt()
2148 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_latt()
2169 lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) in lpfc_parse_vpd() argument
2181 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_parse_vpd()
2215 phba->SerialNumber[j++] = vpd[index++]; in lpfc_parse_vpd()
2219 phba->SerialNumber[j] = 0; in lpfc_parse_vpd()
2223 phba->vpd_flag |= VPD_MODEL_DESC; in lpfc_parse_vpd()
2230 phba->ModelDesc[j++] = vpd[index++]; in lpfc_parse_vpd()
2234 phba->ModelDesc[j] = 0; in lpfc_parse_vpd()
2238 phba->vpd_flag |= VPD_MODEL_NAME; in lpfc_parse_vpd()
2245 phba->ModelName[j++] = vpd[index++]; in lpfc_parse_vpd()
2249 phba->ModelName[j] = 0; in lpfc_parse_vpd()
2253 phba->vpd_flag |= VPD_PROGRAM_TYPE; in lpfc_parse_vpd()
2260 phba->ProgramType[j++] = vpd[index++]; in lpfc_parse_vpd()
2264 phba->ProgramType[j] = 0; in lpfc_parse_vpd()
2268 phba->vpd_flag |= VPD_PORT; in lpfc_parse_vpd()
2275 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_parse_vpd()
2276 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
2281 phba->Port[j++] = vpd[index++]; in lpfc_parse_vpd()
2285 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_parse_vpd()
2286 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
2288 phba->Port[j] = 0; in lpfc_parse_vpd()
2326 lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_hba_model_desc() argument
2329 uint16_t dev_id = phba->pcidev->device; in lpfc_get_hba_model_desc()
2343 if (phba->lmt & LMT_64Gb) in lpfc_get_hba_model_desc()
2345 else if (phba->lmt & LMT_32Gb) in lpfc_get_hba_model_desc()
2347 else if (phba->lmt & LMT_16Gb) in lpfc_get_hba_model_desc()
2349 else if (phba->lmt & LMT_10Gb) in lpfc_get_hba_model_desc()
2351 else if (phba->lmt & LMT_8Gb) in lpfc_get_hba_model_desc()
2353 else if (phba->lmt & LMT_4Gb) in lpfc_get_hba_model_desc()
2355 else if (phba->lmt & LMT_2Gb) in lpfc_get_hba_model_desc()
2357 else if (phba->lmt & LMT_1Gb) in lpfc_get_hba_model_desc()
2362 vp = &phba->vpd; in lpfc_get_hba_model_desc()
2568 phba->Port); in lpfc_get_hba_model_desc()
2594 lpfc_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt) in lpfc_post_buffer() argument
2605 iocb = lpfc_sli_get_iocbq(phba); in lpfc_post_buffer()
2616 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp1->phys); in lpfc_post_buffer()
2619 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2629 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, in lpfc_post_buffer()
2633 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2635 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2661 if (lpfc_sli_issue_iocb(phba, pring->ringno, iocb, 0) == in lpfc_post_buffer()
2663 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2667 lpfc_mbuf_free(phba, mp2->virt, mp2->phys); in lpfc_post_buffer()
2671 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2675 lpfc_sli_ringpostbuf_put(phba, pring, mp1); in lpfc_post_buffer()
2677 lpfc_sli_ringpostbuf_put(phba, pring, mp2); in lpfc_post_buffer()
2695 lpfc_post_rcv_buf(struct lpfc_hba *phba) in lpfc_post_rcv_buf() argument
2697 struct lpfc_sli *psli = &phba->sli; in lpfc_post_rcv_buf()
2700 lpfc_post_buffer(phba, &psli->sli3_ring[LPFC_ELS_RING], LPFC_BUF_RING0); in lpfc_post_rcv_buf()
2806 lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) in lpfc_hba_init() argument
2810 uint32_t *pwwnn = (uint32_t *) phba->wwnn; in lpfc_hba_init()
2820 lpfc_challenge_key(phba->RandomData + t, HashWorking + t); in lpfc_hba_init()
2839 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup() local
2843 if (phba->link_state > LPFC_LINK_DOWN) in lpfc_cleanup()
2852 spin_lock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2854 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2859 spin_lock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2862 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2867 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2945 __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in __lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2948 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2951 del_timer(&phba->fcf.redisc_wait); in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2964 lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2966 spin_lock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2967 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_stop_fcf_redisc_wait_timer()
2969 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2972 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2974 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2975 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2986 lpfc_stop_hba_timers(struct lpfc_hba *phba) in lpfc_stop_hba_timers() argument
2988 if (phba->pport) in lpfc_stop_hba_timers()
2989 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
2990 cancel_delayed_work_sync(&phba->eq_delay_work); in lpfc_stop_hba_timers()
2991 cancel_delayed_work_sync(&phba->idle_stat_delay_work); in lpfc_stop_hba_timers()
2992 del_timer_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
2993 del_timer_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
2994 del_timer_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
2995 del_timer_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
2996 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
2997 del_timer_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
2998 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_stop_hba_timers()
3000 phba->hb_outstanding = 0; in lpfc_stop_hba_timers()
3002 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
3005 del_timer_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
3009 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
3012 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_stop_hba_timers()
3014 phba->pci_dev_grp); in lpfc_stop_hba_timers()
3032 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
3038 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3039 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
3040 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3044 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3045 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3046 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
3050 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
3051 phba->sli.mbox_active) * 1000) + jiffies; in lpfc_block_mgmt_io()
3053 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3056 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3060 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_block_mgmt_io()
3063 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
3078 lpfc_sli4_node_prep(struct lpfc_hba *phba) in lpfc_sli4_node_prep() argument
3085 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_prep()
3088 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_prep()
3092 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_sli4_node_prep()
3101 rpi = lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_prep()
3103 spin_lock_irqsave(&phba->ndlp_lock, flags); in lpfc_sli4_node_prep()
3105 spin_unlock_irqrestore(&phba->ndlp_lock, flags); in lpfc_sli4_node_prep()
3117 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_prep()
3127 static void lpfc_create_expedite_pool(struct lpfc_hba *phba) in lpfc_create_expedite_pool() argument
3135 epd_pool = &phba->epd_pool; in lpfc_create_expedite_pool()
3136 qp = &phba->sli4_hba.hdwq[0]; in lpfc_create_expedite_pool()
3162 static void lpfc_destroy_expedite_pool(struct lpfc_hba *phba) in lpfc_destroy_expedite_pool() argument
3170 epd_pool = &phba->epd_pool; in lpfc_destroy_expedite_pool()
3171 qp = &phba->sli4_hba.hdwq[0]; in lpfc_destroy_expedite_pool()
3195 void lpfc_create_multixri_pools(struct lpfc_hba *phba) in lpfc_create_multixri_pools() argument
3208 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3210 phba->cfg_hdw_queue, phba->sli4_hba.num_present_cpu, in lpfc_create_multixri_pools()
3211 phba->sli4_hba.io_xri_cnt); in lpfc_create_multixri_pools()
3213 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3214 lpfc_create_expedite_pool(phba); in lpfc_create_multixri_pools()
3216 hwq_count = phba->cfg_hdw_queue; in lpfc_create_multixri_pools()
3217 count_per_hwq = phba->sli4_hba.io_xri_cnt / hwq_count; in lpfc_create_multixri_pools()
3223 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3227 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3228 lpfc_destroy_expedite_pool(phba); in lpfc_create_multixri_pools()
3232 qp = &phba->sli4_hba.hdwq[j]; in lpfc_create_multixri_pools()
3236 phba->cfg_xri_rebalancing = 0; in lpfc_create_multixri_pools()
3240 qp = &phba->sli4_hba.hdwq[i]; in lpfc_create_multixri_pools()
3258 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3282 static void lpfc_destroy_multixri_pools(struct lpfc_hba *phba) in lpfc_destroy_multixri_pools() argument
3294 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_destroy_multixri_pools()
3295 lpfc_destroy_expedite_pool(phba); in lpfc_destroy_multixri_pools()
3297 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_destroy_multixri_pools()
3298 lpfc_sli_flush_io_rings(phba); in lpfc_destroy_multixri_pools()
3300 hwq_count = phba->cfg_hdw_queue; in lpfc_destroy_multixri_pools()
3303 qp = &phba->sli4_hba.hdwq[i]; in lpfc_destroy_multixri_pools()
3316 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3337 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3372 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
3379 if (!phba) in lpfc_online()
3381 vport = phba->pport; in lpfc_online()
3386 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
3389 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
3391 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3392 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
3393 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3396 spin_lock_irq(&phba->hbalock); in lpfc_online()
3397 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
3399 spin_unlock_irq(&phba->hbalock); in lpfc_online()
3404 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_online()
3405 !phba->nvmet_support) { in lpfc_online()
3406 error = lpfc_nvme_create_localport(phba->pport); in lpfc_online()
3408 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_online()
3413 lpfc_sli_queue_init(phba); in lpfc_online()
3414 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
3415 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3420 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
3422 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
3427 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
3429 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3439 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
3441 if (phba->cfg_xri_rebalancing) in lpfc_online()
3442 lpfc_create_multixri_pools(phba); in lpfc_online()
3444 lpfc_cpuhp_add(phba); in lpfc_online()
3446 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3462 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
3466 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3467 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
3468 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3481 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
3483 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
3492 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
3494 lpfc_linkdown(phba); in lpfc_offline_prep()
3497 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
3499 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
3536 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_offline_prep()
3545 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); in lpfc_offline_prep()
3552 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
3554 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
3556 if (phba->wq) in lpfc_offline_prep()
3557 flush_workqueue(phba->wq); in lpfc_offline_prep()
3569 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
3575 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3579 lpfc_stop_port(phba); in lpfc_offline()
3584 lpfc_nvmet_destroy_targetport(phba); in lpfc_offline()
3585 lpfc_nvme_destroy_localport(phba->pport); in lpfc_offline()
3587 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3589 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
3591 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3592 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3596 lpfc_sli_hba_down(phba); in lpfc_offline()
3597 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3598 phba->work_ha = 0; in lpfc_offline()
3599 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3600 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3602 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3609 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3610 __lpfc_cpuhp_remove(phba); in lpfc_offline()
3612 if (phba->cfg_xri_rebalancing) in lpfc_offline()
3613 lpfc_destroy_multixri_pools(phba); in lpfc_offline()
3625 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3629 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_scsi_free()
3632 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3636 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3637 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3640 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3643 phba->total_scsi_bufs--; in lpfc_scsi_free()
3645 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3647 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3648 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3651 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3654 phba->total_scsi_bufs--; in lpfc_scsi_free()
3656 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3657 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
3669 lpfc_io_free(struct lpfc_hba *phba) in lpfc_io_free() argument
3675 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_free()
3676 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_free()
3684 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
3686 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
3687 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3688 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3700 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
3702 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
3703 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3704 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3725 lpfc_sli4_els_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_els_sgl_update() argument
3735 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_els_sgl_update()
3737 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
3739 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_els_sgl_update()
3740 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3742 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
3749 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
3757 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_els_sgl_update()
3761 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
3773 spin_lock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3774 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3776 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
3777 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3778 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3779 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
3781 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_els_sgl_update()
3782 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3784 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
3786 spin_lock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3787 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3788 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, in lpfc_sli4_els_sgl_update()
3795 __lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_els_sgl_update()
3801 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
3802 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3803 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3805 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3808 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_els_sgl_update()
3814 &phba->sli4_hba.lpfc_els_sgl_list, list) { in lpfc_sli4_els_sgl_update()
3815 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_els_sgl_update()
3817 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
3825 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_els_sgl_update()
3830 lpfc_free_els_sgl_list(phba); in lpfc_sli4_els_sgl_update()
3847 lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_nvmet_sgl_update() argument
3858 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_nvmet_sgl_update()
3861 nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3862 if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
3864 xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3865 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3867 phba->sli4_hba.nvmet_xri_cnt, nvmet_xri_cnt); in lpfc_sli4_nvmet_sgl_update()
3873 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
3881 sglq_entry->virt = lpfc_nvmet_buf_alloc(phba, 0, in lpfc_sli4_nvmet_sgl_update()
3885 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
3894 phba->cfg_sg_dma_buf_size); in lpfc_sli4_nvmet_sgl_update()
3898 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3899 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3901 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
3902 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3903 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3904 } else if (nvmet_xri_cnt < phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
3906 xri_cnt = phba->sli4_hba.nvmet_xri_cnt - nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3907 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3909 "%d to %d\n", phba->sli4_hba.nvmet_xri_cnt, in lpfc_sli4_nvmet_sgl_update()
3911 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3912 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3913 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, in lpfc_sli4_nvmet_sgl_update()
3920 lpfc_nvmet_buf_free(phba, sglq_entry->virt, in lpfc_sli4_nvmet_sgl_update()
3926 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
3927 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3928 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3930 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3933 phba->sli4_hba.nvmet_xri_cnt = nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3939 &phba->sli4_hba.lpfc_nvmet_sgl_list, list) { in lpfc_sli4_nvmet_sgl_update()
3940 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_nvmet_sgl_update()
3942 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
3950 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_nvmet_sgl_update()
3955 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_nvmet_sgl_update()
3960 lpfc_io_buf_flush(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_flush() argument
3969 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_flush()
3970 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_flush()
4022 lpfc_io_buf_replenish(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_replenish() argument
4028 qp = phba->sli4_hba.hdwq; in lpfc_io_buf_replenish()
4031 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_replenish()
4037 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_replenish()
4066 lpfc_sli4_io_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_io_sgl_update() argument
4079 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_io_sgl_update()
4080 io_xri_max = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_io_sgl_update()
4081 phba->sli4_hba.io_xri_max = io_xri_max; in lpfc_sli4_io_sgl_update()
4083 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_io_sgl_update()
4086 phba->sli4_hba.io_xri_cnt, in lpfc_sli4_io_sgl_update()
4087 phba->sli4_hba.io_xri_max); in lpfc_sli4_io_sgl_update()
4089 cnt = lpfc_io_buf_flush(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4091 if (phba->sli4_hba.io_xri_cnt > phba->sli4_hba.io_xri_max) { in lpfc_sli4_io_sgl_update()
4093 io_xri_cnt = phba->sli4_hba.io_xri_cnt - in lpfc_sli4_io_sgl_update()
4094 phba->sli4_hba.io_xri_max; in lpfc_sli4_io_sgl_update()
4100 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_sli4_io_sgl_update()
4106 phba->sli4_hba.io_xri_cnt -= io_xri_cnt; in lpfc_sli4_io_sgl_update()
4112 phba->sli4_hba.io_xri_cnt = cnt; in lpfc_sli4_io_sgl_update()
4115 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_io_sgl_update()
4117 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_io_sgl_update()
4125 lpfc_ncmd->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_io_sgl_update()
4127 cnt = lpfc_io_buf_replenish(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4131 lpfc_io_free(phba); in lpfc_sli4_io_sgl_update()
4150 lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) in lpfc_new_io_buf() argument
4160 phba->sli4_hba.io_xri_cnt = 0; in lpfc_new_io_buf()
4170 lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4178 if (phba->cfg_xpsgl && !phba->nvmet_support) { in lpfc_new_io_buf()
4185 if ((phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_new_io_buf()
4188 lpfc_printf_log(phba, KERN_ERR, in lpfc_new_io_buf()
4193 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4203 lxri = lpfc_sli4_next_xritag(phba); in lpfc_new_io_buf()
4205 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4213 iotag = lpfc_sli_next_iotag(phba, pwqeq); in lpfc_new_io_buf()
4215 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4218 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_new_io_buf()
4221 lpfc_sli4_free_xri(phba, lxri); in lpfc_new_io_buf()
4225 pwqeq->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_new_io_buf()
4236 phba->sli4_hba.io_xri_cnt++; in lpfc_new_io_buf()
4238 lpfc_printf_log(phba, KERN_INFO, LOG_NVME, in lpfc_new_io_buf()
4245 phba, &post_nblist, bcnt); in lpfc_new_io_buf()
4253 lpfc_get_wwpn(struct lpfc_hba *phba) in lpfc_get_wwpn() argument
4260 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_get_wwpn()
4266 lpfc_read_nv(phba, mboxq); in lpfc_get_wwpn()
4267 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_wwpn()
4269 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_get_wwpn()
4274 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4280 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4281 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_wwpn()
4304 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
4316 if (phba->sli_rev < LPFC_SLI_REV4 && in lpfc_create_port()
4317 dev == &phba->pcidev->dev) { in lpfc_create_port()
4319 lpfc_sli_brdrestart(phba); in lpfc_create_port()
4320 rc = lpfc_sli_chipset_init(phba); in lpfc_create_port()
4324 wwn = lpfc_get_wwpn(phba); in lpfc_create_port()
4329 lpfc_printf_log(phba, KERN_ERR, in lpfc_create_port()
4339 if (dev == &phba->pcidev->dev) { in lpfc_create_port()
4340 template = &phba->port_template; in lpfc_create_port()
4342 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_create_port()
4353 memcpy(&phba->vport_template, &lpfc_template, in lpfc_create_port()
4355 phba->vport_template.max_sectors = 0xffff; in lpfc_create_port()
4356 phba->vport_template.shost_attrs = lpfc_vport_attrs; in lpfc_create_port()
4357 phba->vport_template.eh_bus_reset_handler = NULL; in lpfc_create_port()
4358 phba->vport_template.eh_host_reset_handler = NULL; in lpfc_create_port()
4359 phba->vport_template.vendor_id = 0; in lpfc_create_port()
4362 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4363 template->sg_tablesize = phba->cfg_scsi_seg_cnt; in lpfc_create_port()
4364 phba->vport_template.sg_tablesize = in lpfc_create_port()
4365 phba->cfg_scsi_seg_cnt; in lpfc_create_port()
4367 template->sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_create_port()
4368 phba->vport_template.sg_tablesize = in lpfc_create_port()
4369 phba->cfg_sg_seg_cnt; in lpfc_create_port()
4378 template = &phba->vport_template; in lpfc_create_port()
4386 vport->phba = phba; in lpfc_create_port()
4393 vport->cfg_enable_fc4_type = phba->cfg_enable_fc4_type; in lpfc_create_port()
4401 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4402 if (!phba->cfg_fcp_mq_threshold || in lpfc_create_port()
4403 phba->cfg_fcp_mq_threshold > phba->cfg_hdw_queue) in lpfc_create_port()
4404 phba->cfg_fcp_mq_threshold = phba->cfg_hdw_queue; in lpfc_create_port()
4407 phba->cfg_fcp_mq_threshold); in lpfc_create_port()
4410 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
4412 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_create_port()
4415 shost->sg_tablesize = phba->cfg_scsi_seg_cnt; in lpfc_create_port()
4427 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
4428 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
4436 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_create_port()
4440 phba->cfg_scsi_seg_cnt, phba->cfg_sg_seg_cnt); in lpfc_create_port()
4453 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_create_port()
4454 lpfc_setup_bg(phba, shost); in lpfc_create_port()
4456 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
4460 spin_lock_irq(&phba->port_list_lock); in lpfc_create_port()
4461 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
4462 spin_unlock_irq(&phba->port_list_lock); in lpfc_create_port()
4482 struct lpfc_hba *phba = vport->phba; in destroy_port() local
4488 spin_lock_irq(&phba->port_list_lock); in destroy_port()
4490 spin_unlock_irq(&phba->port_list_lock); in destroy_port()
4533 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
4543 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4550 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
4551 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4564 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
4577 struct lpfc_hba *phba = vport->phba; in lpfc_host_supported_speeds_set() local
4584 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_host_supported_speeds_set()
4587 if (phba->lmt & LMT_128Gb) in lpfc_host_supported_speeds_set()
4589 if (phba->lmt & LMT_64Gb) in lpfc_host_supported_speeds_set()
4591 if (phba->lmt & LMT_32Gb) in lpfc_host_supported_speeds_set()
4593 if (phba->lmt & LMT_16Gb) in lpfc_host_supported_speeds_set()
4595 if (phba->lmt & LMT_10Gb) in lpfc_host_supported_speeds_set()
4597 if (phba->lmt & LMT_8Gb) in lpfc_host_supported_speeds_set()
4599 if (phba->lmt & LMT_4Gb) in lpfc_host_supported_speeds_set()
4601 if (phba->lmt & LMT_2Gb) in lpfc_host_supported_speeds_set()
4603 if (phba->lmt & LMT_1Gb) in lpfc_host_supported_speeds_set()
4617 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
4648 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
4663 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
4666 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
4667 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
4669 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
4670 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
4673 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
4674 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
4686 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
4689 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
4690 if (phba->pport) in lpfc_stop_port_s4()
4691 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
4692 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
4703 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
4705 phba->lpfc_stop_port(phba); in lpfc_stop_port()
4707 if (phba->wq) in lpfc_stop_port()
4708 flush_workqueue(phba->wq); in lpfc_stop_port()
4718 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
4723 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
4724 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
4726 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
4728 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
4729 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
4745 struct lpfc_hba *phba = from_timer(phba, t, fcf.redisc_wait); in lpfc_sli4_fcf_redisc_wait_tmo() local
4748 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4749 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
4750 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4754 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
4756 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
4757 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4758 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
4761 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
4772 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
4782 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_fault()
4800 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
4818 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_type()
4836 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
4840 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
4843 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_sli_port_speed_get()
4844 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
4867 if (phba->sli4_hba.link_state.logical_speed) in lpfc_sli_port_speed_get()
4869 phba->sli4_hba.link_state.logical_speed; in lpfc_sli_port_speed_get()
4871 link_speed = phba->sli4_hba.link_state.speed; in lpfc_sli_port_speed_get()
4888 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
4977 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
4987 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
4990 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
4991 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
4993 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
4999 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5003 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_link_evt()
5005 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5011 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
5014 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
5017 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
5020 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_link_evt()
5022 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
5025 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
5026 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
5028 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
5030 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
5032 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
5034 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
5036 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
5038 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
5041 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
5045 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
5046 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
5047 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
5048 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
5049 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
5050 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
5051 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
5056 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_async_link_evt()
5057 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
5072 lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
5090 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
5097 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_link_evt()
5112 lpfc_async_link_speed_to_read_top(struct lpfc_hba *phba, uint8_t speed_code) in lpfc_async_link_speed_to_read_top() argument
5154 ((phba->trunk_link.link##__idx.state == LPFC_LINK_UP) ?\
5162 lpfc_update_trunk_link_status(struct lpfc_hba *phba, in lpfc_update_trunk_link_status() argument
5168 phba->sli4_hba.link_state.speed = in lpfc_update_trunk_link_status()
5169 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_update_trunk_link_status()
5172 phba->sli4_hba.link_state.logical_speed = in lpfc_update_trunk_link_status()
5175 phba->fc_linkspeed = in lpfc_update_trunk_link_status()
5177 phba, in lpfc_update_trunk_link_status()
5181 phba->trunk_link.link0.state = in lpfc_update_trunk_link_status()
5184 phba->trunk_link.link0.fault = port_fault & 0x1 ? err : 0; in lpfc_update_trunk_link_status()
5187 phba->trunk_link.link1.state = in lpfc_update_trunk_link_status()
5190 phba->trunk_link.link1.fault = port_fault & 0x2 ? err : 0; in lpfc_update_trunk_link_status()
5193 phba->trunk_link.link2.state = in lpfc_update_trunk_link_status()
5196 phba->trunk_link.link2.fault = port_fault & 0x4 ? err : 0; in lpfc_update_trunk_link_status()
5199 phba->trunk_link.link3.state = in lpfc_update_trunk_link_status()
5202 phba->trunk_link.link3.fault = port_fault & 0x8 ? err : 0; in lpfc_update_trunk_link_status()
5205 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
5209 phba->sli4_hba.link_state.speed, in lpfc_update_trunk_link_status()
5210 phba->sli4_hba.link_state.logical_speed, in lpfc_update_trunk_link_status()
5215 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
5239 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
5249 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
5257 lpfc_update_trunk_link_status(phba, acqe_fc); in lpfc_sli4_async_fc_evt()
5262 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
5263 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
5265 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
5266 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
5268 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
5270 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
5272 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
5274 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
5279 phba->sli4_hba.link_state.logical_speed = 0; in lpfc_sli4_async_fc_evt()
5280 else if (!phba->sli4_hba.conf_trunk) in lpfc_sli4_async_fc_evt()
5281 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
5284 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
5288 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
5289 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
5290 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
5291 phba->sli4_hba.link_state.type, in lpfc_sli4_async_fc_evt()
5292 phba->sli4_hba.link_state.number, in lpfc_sli4_async_fc_evt()
5293 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
5294 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_fc_evt()
5295 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
5297 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
5303 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
5307 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_fc_evt()
5309 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
5315 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
5318 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
5321 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
5324 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_fc_evt()
5326 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
5328 if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) { in lpfc_sli4_async_fc_evt()
5329 phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK); in lpfc_sli4_async_fc_evt()
5331 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
5333 phba->link_flag |= LS_MDS_LINK_DOWN; in lpfc_sli4_async_fc_evt()
5336 phba->link_flag |= LS_MDS_LOOPBACK; in lpfc_sli4_async_fc_evt()
5347 lpfc_sli4_parse_latt_fault(phba, (void *)acqe_fc); in lpfc_sli4_async_fc_evt()
5353 if (phba->sli4_hba.link_state.status == in lpfc_sli4_async_fc_evt()
5362 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_fc_evt()
5367 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
5375 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_fc_evt()
5386 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
5401 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
5407 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
5417 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
5421 phba->sfp_warning |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_sli4_async_sli_evt()
5422 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
5434 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
5438 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
5450 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
5476 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_sli_evt()
5480 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_async_sli_evt()
5485 if (phba->sli4_hba.lnk_info.optic_state == status) in lpfc_sli4_async_sli_evt()
5525 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_async_sli_evt()
5527 phba->lmt = 0; in lpfc_sli4_async_sli_evt()
5528 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_sli_evt()
5533 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_sli_evt()
5535 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_sli_evt()
5541 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_sli_evt()
5543 phba->sli4_hba.lnk_info.optic_state = status; in lpfc_sli4_async_sli_evt()
5544 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
5548 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
5559 lpfc_log_msg(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
5565 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
5571 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
5593 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
5597 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
5598 if (!phba) in lpfc_sli4_perform_vport_cvl()
5616 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
5617 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
5620 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
5643 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
5648 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
5650 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
5652 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
5663 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
5675 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5676 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5681 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
5687 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
5693 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
5699 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
5704 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
5708 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5709 if (phba->hba_flag & FCF_TS_INPROG) { in lpfc_sli4_async_fip_evt()
5710 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5714 if (phba->fcf.fcf_flag & (FCF_REDISC_EVT | FCF_REDISC_PEND)) { in lpfc_sli4_async_fip_evt()
5715 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5720 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
5721 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5724 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5727 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5731 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
5734 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
5740 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
5747 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5748 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
5756 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5757 if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && in lpfc_sli4_async_fip_evt()
5758 (phba->fcf.current_rec.fcf_indx != acqe_fip->index)) { in lpfc_sli4_async_fip_evt()
5759 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5761 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
5764 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5767 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
5776 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5778 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
5779 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5781 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5785 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
5787 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
5792 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5793 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
5794 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5799 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
5802 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
5807 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
5811 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5812 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_fip_evt()
5817 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
5824 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
5826 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
5835 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
5865 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5866 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
5867 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5871 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
5872 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5873 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
5877 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
5879 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
5884 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5885 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
5886 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5891 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
5897 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
5901 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
5916 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
5919 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
5920 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_dcbx_evt()
5935 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
5940 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
5941 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
5942 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
5943 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
5945 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
5948 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
5958 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
5963 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5964 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
5965 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5967 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
5969 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5970 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
5972 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5976 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
5980 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
5983 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
5987 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
5991 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
5994 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
5997 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_event_proc()
6005 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
6016 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
6020 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
6022 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
6024 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
6026 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
6027 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
6030 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
6032 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
6034 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fcf_redisc_event_proc()
6050 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
6055 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
6059 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
6062 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
6066 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
6070 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
6074 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
6089 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
6093 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
6097 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
6101 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
6105 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_intr_mode()
6124 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
6129 if (!phba->pcidev) in lpfc_enable_pci_dev()
6132 pdev = phba->pcidev; in lpfc_enable_pci_dev()
6153 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_enable_pci_dev()
6166 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
6171 if (!phba->pcidev) in lpfc_disable_pci_dev()
6174 pdev = phba->pcidev; in lpfc_disable_pci_dev()
6192 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
6195 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
6196 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
6199 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_reset_hba()
6200 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
6202 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
6203 lpfc_offline(phba); in lpfc_reset_hba()
6204 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
6205 lpfc_online(phba); in lpfc_reset_hba()
6206 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
6220 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
6222 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
6246 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
6248 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
6252 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
6254 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_probe_sriov_nr_virtfn()
6262 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
6267 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
6285 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
6287 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
6292 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
6293 atomic_set(&phba->dbg_log_idx, 0); in lpfc_setup_driver_resource_phase1()
6294 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_setup_driver_resource_phase1()
6295 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_setup_driver_resource_phase1()
6296 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
6299 spin_lock_init(&phba->ndlp_lock); in lpfc_setup_driver_resource_phase1()
6302 spin_lock_init(&phba->port_list_lock); in lpfc_setup_driver_resource_phase1()
6303 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
6305 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
6306 init_waitqueue_head(&phba->wait_4_mlo_m_q); in lpfc_setup_driver_resource_phase1()
6309 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
6311 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
6313 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
6315 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
6317 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
6320 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
6321 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
6322 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
6323 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
6326 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
6329 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
6332 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
6335 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
6336 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
6341 timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); in lpfc_setup_driver_resource_phase1()
6343 timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); in lpfc_setup_driver_resource_phase1()
6345 timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); in lpfc_setup_driver_resource_phase1()
6347 INIT_DELAYED_WORK(&phba->eq_delay_work, lpfc_hb_eq_delay_work); in lpfc_setup_driver_resource_phase1()
6349 INIT_DELAYED_WORK(&phba->idle_stat_delay_work, in lpfc_setup_driver_resource_phase1()
6367 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
6376 timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); in lpfc_sli_driver_resource_setup()
6379 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
6380 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
6383 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
6386 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli_driver_resource_setup()
6390 if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { in lpfc_sli_driver_resource_setup()
6391 phba->menlo_flag |= HBA_MENLO_SUPPORT; in lpfc_sli_driver_resource_setup()
6393 if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) in lpfc_sli_driver_resource_setup()
6394 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
6397 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
6398 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, in lpfc_sli_driver_resource_setup()
6401 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
6409 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_driver_resource_setup()
6415 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
6425 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
6429 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
6430 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
6433 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
6440 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
6442 ((phba->cfg_sg_seg_cnt + 2) * entry_sz); in lpfc_sli_driver_resource_setup()
6445 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
6448 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
6450 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
6451 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
6453 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
6455 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
6460 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
6461 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
6464 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
6467 phba->lpfc_sg_dma_buf_pool = in lpfc_sli_driver_resource_setup()
6469 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
6472 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli_driver_resource_setup()
6475 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli_driver_resource_setup()
6477 &phba->pcidev->dev, in lpfc_sli_driver_resource_setup()
6482 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli_driver_resource_setup()
6489 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
6490 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
6491 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
6493 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
6497 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
6498 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
6505 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli_driver_resource_setup()
6506 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli_driver_resource_setup()
6508 lpfc_mem_free(phba); in lpfc_sli_driver_resource_setup()
6520 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
6523 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
6540 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
6553 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
6554 phba->sli4_hba.num_possible_cpu = cpumask_last(cpu_possible_mask) + 1; in lpfc_sli4_driver_resource_setup()
6555 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
6558 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
6561 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
6566 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
6573 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0); in lpfc_sli4_driver_resource_setup()
6579 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
6582 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
6588 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
6590 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
6592 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
6595 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
6598 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
6599 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
6600 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
6601 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
6610 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
6611 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
6612 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
6618 spin_lock_init(&phba->sli4_hba.abts_io_buf_list_lock); in lpfc_sli4_driver_resource_setup()
6619 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_io_buf_list); in lpfc_sli4_driver_resource_setup()
6621 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
6623 spin_lock_init(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_sli4_driver_resource_setup()
6624 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
6625 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
6626 spin_lock_init(&phba->sli4_hba.t_active_list_lock); in lpfc_sli4_driver_resource_setup()
6627 INIT_LIST_HEAD(&phba->sli4_hba.t_active_ctx_list); in lpfc_sli4_driver_resource_setup()
6631 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
6632 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
6639 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
6641 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
6643 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
6645 INIT_LIST_HEAD(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
6647 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
6649 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
6652 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
6653 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
6654 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
6655 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
6660 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
6661 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
6664 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
6667 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
6672 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
6674 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
6679 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
6683 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
6688 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
6693 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
6696 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
6701 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
6703 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
6708 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
6716 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
6720 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6721 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
6723 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
6729 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6737 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
6742 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
6748 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
6751 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
6753 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
6758 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
6765 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_driver_resource_setup()
6766 if (phba->irq_chann_mode == NHT_MODE) { in lpfc_sli4_driver_resource_setup()
6767 phba->cfg_irq_chann = in lpfc_sli4_driver_resource_setup()
6768 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
6769 phba->cfg_hdw_queue = in lpfc_sli4_driver_resource_setup()
6770 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
6771 phba->irq_chann_mode = NORMAL_MODE; in lpfc_sli4_driver_resource_setup()
6778 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
6782 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
6790 phba->sli4_hba.pc_sli4_params.supported = 1; in lpfc_sli4_driver_resource_setup()
6797 if (phba->sli4_hba.pc_sli4_params.supported) in lpfc_sli4_driver_resource_setup()
6798 rc = lpfc_pc_sli4_params_get(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6800 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6811 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6814 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
6816 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
6817 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
6818 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
6819 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
6824 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6831 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6842 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
6856 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
6868 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
6872 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
6878 if (phba->cfg_enable_bg && in lpfc_sli4_driver_resource_setup()
6879 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
6880 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
6882 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6890 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
6892 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
6896 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
6897 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6905 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_driver_resource_setup()
6906 phba->cfg_sg_dma_buf_size = LPFC_DEFAULT_XPSGL_SIZE; in lpfc_sli4_driver_resource_setup()
6907 else if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
6908 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
6910 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
6911 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
6913 phba->border_sge_num = phba->cfg_sg_dma_buf_size / in lpfc_sli4_driver_resource_setup()
6917 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
6918 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { in lpfc_sli4_driver_resource_setup()
6919 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, in lpfc_sli4_driver_resource_setup()
6923 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_sli4_driver_resource_setup()
6925 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6928 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
6931 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
6932 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sli4_driver_resource_setup()
6933 phba->cfg_nvme_seg_cnt); in lpfc_sli4_driver_resource_setup()
6935 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_sli4_driver_resource_setup()
6936 i = phba->cfg_sg_dma_buf_size; in lpfc_sli4_driver_resource_setup()
6940 phba->lpfc_sg_dma_buf_pool = in lpfc_sli4_driver_resource_setup()
6942 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
6943 phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
6945 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli4_driver_resource_setup()
6948 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli4_driver_resource_setup()
6950 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
6954 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli4_driver_resource_setup()
6957 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6960 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
6963 lpfc_sli4_ras_init(phba); in lpfc_sli4_driver_resource_setup()
6966 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
6971 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
6976 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
6979 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
6981 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
6985 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
6987 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
6994 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
6996 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
6997 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7004 phba->sli4_hba.hba_eq_hdl = kcalloc(phba->cfg_irq_chann, in lpfc_sli4_driver_resource_setup()
7007 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
7008 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7015 phba->sli4_hba.cpu_map = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
7018 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
7019 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7026 phba->sli4_hba.eq_info = alloc_percpu(struct lpfc_eq_intr_info); in lpfc_sli4_driver_resource_setup()
7027 if (!phba->sli4_hba.eq_info) { in lpfc_sli4_driver_resource_setup()
7028 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7034 phba->sli4_hba.idle_stat = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
7035 sizeof(*phba->sli4_hba.idle_stat), in lpfc_sli4_driver_resource_setup()
7037 if (!phba->sli4_hba.idle_stat) { in lpfc_sli4_driver_resource_setup()
7038 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7045 phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); in lpfc_sli4_driver_resource_setup()
7046 if (!phba->sli4_hba.c_stat) { in lpfc_sli4_driver_resource_setup()
7047 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7058 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
7059 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
7060 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
7062 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
7066 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
7067 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
7075 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_setup()
7078 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_setup()
7080 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
7082 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
7084 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
7086 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
7088 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
7090 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
7092 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool); in lpfc_sli4_driver_resource_setup()
7093 phba->lpfc_cmd_rsp_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
7095 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli4_driver_resource_setup()
7096 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
7098 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
7100 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
7112 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
7116 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_unset()
7118 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_unset()
7120 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_unset()
7123 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
7124 phba->sli4_hba.num_possible_cpu = 0; in lpfc_sli4_driver_resource_unset()
7125 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
7126 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
7127 cpumask_clear(&phba->sli4_hba.irq_aff_mask); in lpfc_sli4_driver_resource_unset()
7130 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
7133 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
7134 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
7137 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
7140 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
7141 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
7142 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
7145 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
7146 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
7149 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
7152 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
7155 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
7159 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
7178 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
7180 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
7181 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
7182 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
7185 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
7186 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
7187 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
7190 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
7191 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
7192 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
7195 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_init_api_table_setup()
7216 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
7221 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
7222 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
7223 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
7224 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
7240 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
7242 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
7243 flush_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
7244 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
7245 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
7249 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
7250 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
7260 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
7264 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
7266 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
7269 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
7271 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
7289 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
7296 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
7306 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
7316 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
7317 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
7318 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
7319 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
7325 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
7338 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
7344 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
7356 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
7361 spin_lock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
7362 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
7363 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
7364 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
7365 spin_unlock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
7368 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
7378 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
7384 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
7385 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
7386 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
7387 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
7388 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
7393 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
7401 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
7412 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
7416 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
7418 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
7420 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
7434 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
7436 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
7448 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
7451 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
7452 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
7453 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
7454 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
7457 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
7460 phba->sli4_hba.io_xri_cnt = 0; in lpfc_init_sgl_list()
7478 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
7483 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
7484 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
7486 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
7489 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
7491 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_init_rpi_hdrs()
7493 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
7514 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
7525 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
7527 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
7531 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
7533 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7539 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
7540 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7554 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
7575 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7579 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
7580 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
7582 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7586 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
7603 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
7607 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
7611 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
7613 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
7620 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
7638 struct lpfc_hba *phba; in lpfc_hba_alloc() local
7641 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
7642 if (!phba) { in lpfc_hba_alloc()
7648 phba->pcidev = pdev; in lpfc_hba_alloc()
7651 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
7652 if (phba->brd_no < 0) { in lpfc_hba_alloc()
7653 kfree(phba); in lpfc_hba_alloc()
7656 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
7658 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
7659 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
7661 return phba; in lpfc_hba_alloc()
7672 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
7674 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_hba_free()
7675 kfree(phba->sli4_hba.hdwq); in lpfc_hba_free()
7678 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
7681 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
7682 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
7684 kfree(phba); in lpfc_hba_free()
7700 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
7706 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
7707 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
7708 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
7709 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
7711 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
7712 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
7717 phba->pport = vport; in lpfc_create_shost()
7719 if (phba->nvmet_support) { in lpfc_create_shost()
7721 phba->targetport = NULL; in lpfc_create_shost()
7722 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
7723 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME_DISC, in lpfc_create_shost()
7729 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
7736 if (phba->cfg_enable_SmartSAN || in lpfc_create_shost()
7737 (phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT)) { in lpfc_create_shost()
7741 if (phba->cfg_enable_SmartSAN) in lpfc_create_shost()
7757 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
7759 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
7776 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
7781 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
7782 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
7786 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
7787 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
7790 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
7793 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
7797 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
7798 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
7800 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
7801 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
7802 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
7803 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
7806 phba->cfg_prot_mask, in lpfc_setup_bg()
7807 phba->cfg_prot_guard); in lpfc_setup_bg()
7809 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
7810 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
7812 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
7827 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
7833 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
7839 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
7840 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
7844 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
7846 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
7850 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
7874 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
7876 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
7896 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
7899 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
7903 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
7904 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
7911 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
7912 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
7919 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
7920 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
7921 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
7924 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
7925 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
7927 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
7928 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
7931 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
7933 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
7935 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
7939 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
7941 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
7942 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
7946 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
7947 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
7949 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
7951 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
7952 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7953 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7954 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7955 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7961 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
7963 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
7965 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
7978 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
7983 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
7986 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
7990 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
7992 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
7995 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
7996 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
8011 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
8020 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
8025 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
8043 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
8057 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
8062 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8064 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8066 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8068 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8070 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8072 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
8079 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
8082 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
8083 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
8084 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
8085 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
8087 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
8089 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
8090 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
8091 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
8092 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_post_status_check()
8102 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
8103 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
8110 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
8114 phba->work_status[0] = in lpfc_sli4_post_status_check()
8115 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
8117 phba->work_status[1] = in lpfc_sli4_post_status_check()
8118 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
8120 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
8127 phba->work_status[0], in lpfc_sli4_post_status_check()
8128 phba->work_status[1]); in lpfc_sli4_post_status_check()
8149 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
8153 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
8154 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
8155 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
8156 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
8157 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
8158 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
8159 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
8160 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
8161 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
8162 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
8165 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
8166 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8168 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
8169 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8171 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
8172 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8174 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
8175 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8177 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
8178 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8180 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
8181 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
8182 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
8183 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8185 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8186 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8188 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8189 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8191 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8192 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
8193 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
8194 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8195 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
8196 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
8197 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
8200 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
8201 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8203 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
8204 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8206 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
8207 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8209 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
8210 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8212 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
8213 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8215 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
8216 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8218 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
8219 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
8223 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
8238 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
8242 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
8243 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8245 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8247 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8249 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8253 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8255 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8257 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8259 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8261 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8267 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
8285 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
8290 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8293 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8296 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8299 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
8300 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8302 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8323 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
8340 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
8354 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
8355 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
8357 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
8359 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
8370 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
8371 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
8376 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
8394 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
8396 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
8397 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
8398 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
8399 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
8401 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
8402 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
8429 lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) in lpfc_map_topology() argument
8437 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
8441 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
8444 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
8448 phba->hba_flag |= HBA_PERSISTENT_TOPO; in lpfc_map_topology()
8449 switch (phba->pcidev->device) { in lpfc_map_topology()
8453 phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) in lpfc_map_topology()
8457 phba->hba_flag &= ~HBA_PERSISTENT_TOPO; in lpfc_map_topology()
8463 phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : in lpfc_map_topology()
8466 phba->cfg_topology = ((pt == LINK_FLAGS_P2P) in lpfc_map_topology()
8472 if (phba->hba_flag & HBA_PERSISTENT_TOPO) { in lpfc_map_topology()
8473 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
8475 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
8477 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
8480 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
8499 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
8512 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
8514 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8520 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
8522 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
8524 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8533 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
8534 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
8536 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
8538 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8540 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
8541 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
8543 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
8547 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
8548 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
8551 phba->sli4_hba.conf_trunk = in lpfc_sli4_read_config()
8553 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
8555 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
8559 phba->sli4_hba.max_cfg_param.max_xri > 512) in lpfc_sli4_read_config()
8560 phba->sli4_hba.max_cfg_param.max_xri = 512; in lpfc_sli4_read_config()
8561 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
8563 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
8566 if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) in lpfc_sli4_read_config()
8567 phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; in lpfc_sli4_read_config()
8568 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
8570 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
8572 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
8574 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
8576 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
8578 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
8580 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
8582 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
8584 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
8586 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
8588 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
8589 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
8590 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
8591 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
8592 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
8593 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
8594 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
8595 lpfc_map_topology(phba, rd_config); in lpfc_sli4_read_config()
8596 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8603 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
8604 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
8605 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
8606 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
8607 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
8608 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
8609 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
8610 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
8611 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
8612 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
8613 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
8614 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
8615 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
8616 phba->sli4_hba.max_cfg_param.max_rq, in lpfc_sli4_read_config()
8617 phba->lmt); in lpfc_sli4_read_config()
8623 qmin = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
8624 if (phba->sli4_hba.max_cfg_param.max_cq < qmin) in lpfc_sli4_read_config()
8625 qmin = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
8626 if (phba->sli4_hba.max_cfg_param.max_eq < qmin) in lpfc_sli4_read_config()
8627 qmin = phba->sli4_hba.max_cfg_param.max_eq; in lpfc_sli4_read_config()
8637 if ((phba->cfg_irq_chann > qmin) || in lpfc_sli4_read_config()
8638 (phba->cfg_hdw_queue > qmin)) { in lpfc_sli4_read_config()
8639 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8644 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
8645 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
8646 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
8647 qmin, phba->cfg_irq_chann, in lpfc_sli4_read_config()
8648 phba->cfg_hdw_queue); in lpfc_sli4_read_config()
8650 if (phba->cfg_irq_chann > qmin) in lpfc_sli4_read_config()
8651 phba->cfg_irq_chann = qmin; in lpfc_sli4_read_config()
8652 if (phba->cfg_hdw_queue > qmin) in lpfc_sli4_read_config()
8653 phba->cfg_hdw_queue = qmin; in lpfc_sli4_read_config()
8661 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
8666 phba->hba_flag |= HBA_FORCED_LINK_SPEED; in lpfc_sli4_read_config()
8670 phba->cfg_link_speed = in lpfc_sli4_read_config()
8674 phba->cfg_link_speed = in lpfc_sli4_read_config()
8678 phba->cfg_link_speed = in lpfc_sli4_read_config()
8682 phba->cfg_link_speed = in lpfc_sli4_read_config()
8686 phba->cfg_link_speed = in lpfc_sli4_read_config()
8690 phba->cfg_link_speed = in lpfc_sli4_read_config()
8694 phba->cfg_link_speed = in lpfc_sli4_read_config()
8698 phba->cfg_link_speed = in lpfc_sli4_read_config()
8702 phba->cfg_link_speed = in lpfc_sli4_read_config()
8706 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_read_config()
8711 phba->cfg_link_speed = in lpfc_sli4_read_config()
8718 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
8719 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
8720 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
8721 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
8723 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
8724 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
8727 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
8734 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
8738 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
8744 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8767 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
8769 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
8776 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8778 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
8779 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
8781 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8787 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
8805 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
8812 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
8815 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
8818 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
8831 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
8833 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
8839 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
8864 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
8871 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
8872 if (phba->cfg_hdw_queue < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
8873 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_sli4_queue_verify()
8874 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
8875 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
8878 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
8880 phba->cfg_hdw_queue, phba->cfg_irq_chann, in lpfc_sli4_queue_verify()
8881 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
8884 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
8885 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
8888 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
8889 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
8894 lpfc_alloc_io_wq_cq(struct lpfc_hba *phba, int idx) in lpfc_alloc_io_wq_cq() argument
8900 cpu = lpfc_find_cpu_handle(phba, idx, LPFC_FIND_BY_HDWQ); in lpfc_alloc_io_wq_cq()
8902 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_io_wq_cq()
8904 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8905 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
8909 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8910 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
8911 phba->sli4_hba.cq_ecount, cpu); in lpfc_alloc_io_wq_cq()
8913 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
8921 phba->sli4_hba.hdwq[idx].io_cq = qdesc; in lpfc_alloc_io_wq_cq()
8924 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_io_wq_cq()
8926 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_io_wq_cq()
8927 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_io_wq_cq()
8928 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8932 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8933 phba->sli4_hba.wq_esize, in lpfc_alloc_io_wq_cq()
8934 phba->sli4_hba.wq_ecount, cpu); in lpfc_alloc_io_wq_cq()
8937 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
8944 phba->sli4_hba.hdwq[idx].io_wq = qdesc; in lpfc_alloc_io_wq_cq()
8945 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_io_wq_cq()
8964 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
8977 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
8978 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
8979 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
8980 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
8981 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
8982 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
8983 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
8984 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
8985 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
8986 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
8988 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
8989 phba->sli4_hba.hdwq = kcalloc( in lpfc_sli4_queue_create()
8990 phba->cfg_hdw_queue, sizeof(struct lpfc_sli4_hdw_queue), in lpfc_sli4_queue_create()
8992 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
8993 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
8999 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9000 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_queue_create()
9018 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
9019 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
9020 phba->sli4_hba.nvmet_cqset = kcalloc( in lpfc_sli4_queue_create()
9021 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
9024 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
9025 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9030 phba->sli4_hba.nvmet_mrq_hdr = kcalloc( in lpfc_sli4_queue_create()
9031 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
9034 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
9035 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9040 phba->sli4_hba.nvmet_mrq_data = kcalloc( in lpfc_sli4_queue_create()
9041 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
9044 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
9045 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9053 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
9061 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
9066 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
9069 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9070 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
9071 phba->sli4_hba.eq_ecount, cpu); in lpfc_sli4_queue_create()
9073 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9086 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, qdesc->last_cpu); in lpfc_sli4_queue_create()
9094 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
9101 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
9106 eqcpu = lpfc_find_cpu_handle(phba, cpup->eq, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
9107 eqcpup = &phba->sli4_hba.cpu_map[eqcpu]; in lpfc_sli4_queue_create()
9108 qp->hba_eq = phba->sli4_hba.hdwq[eqcpup->hdwq].hba_eq; in lpfc_sli4_queue_create()
9112 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9113 if (lpfc_alloc_io_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
9117 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
9118 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
9119 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
9121 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
9123 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
9124 phba->sli4_hba.cq_ecount, in lpfc_sli4_queue_create()
9127 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9135 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
9143 cpu = lpfc_find_cpu_handle(phba, 0, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
9145 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9146 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
9147 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
9149 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9154 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
9157 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9158 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
9159 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
9161 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9167 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
9176 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9177 phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
9178 phba->sli4_hba.mq_ecount, cpu); in lpfc_sli4_queue_create()
9180 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9185 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
9192 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9193 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
9194 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
9196 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9201 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
9202 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
9204 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
9206 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9207 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
9208 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
9210 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9216 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
9219 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9220 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
9221 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
9223 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9228 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
9229 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
9237 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9238 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9239 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
9241 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9245 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
9248 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9249 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9250 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
9252 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9256 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
9258 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_sli4_queue_create()
9259 phba->nvmet_support) { in lpfc_sli4_queue_create()
9260 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
9261 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
9264 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
9266 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9270 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9276 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
9283 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9293 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
9295 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9299 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9305 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
9310 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
9311 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9312 memset(&phba->sli4_hba.hdwq[idx].nvme_cstat, 0, in lpfc_sli4_queue_create()
9313 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); in lpfc_sli4_queue_create()
9318 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_queue_create()
9319 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9320 memset(&phba->sli4_hba.hdwq[idx].scsi_cstat, 0, in lpfc_sli4_queue_create()
9321 sizeof(phba->sli4_hba.hdwq[idx].scsi_cstat)); in lpfc_sli4_queue_create()
9328 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
9357 lpfc_sli4_release_hdwq(struct lpfc_hba *phba) in lpfc_sli4_release_hdwq() argument
9363 hdwq = phba->sli4_hba.hdwq; in lpfc_sli4_release_hdwq()
9366 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_release_hdwq()
9373 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_release_hdwq()
9374 lpfc_free_sgl_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
9375 lpfc_free_cmd_rsp_buf_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
9378 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_release_hdwq()
9380 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_sli4_release_hdwq()
9382 phba->sli4_hba.hba_eq_hdl[idx].eq = NULL; in lpfc_sli4_release_hdwq()
9399 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
9406 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9407 phba->sli.sli_flag |= LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
9408 while (phba->sli.sli_flag & LPFC_QUEUE_FREE_WAIT) { in lpfc_sli4_queue_destroy()
9409 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9411 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9413 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9415 lpfc_sli4_cleanup_poll_list(phba); in lpfc_sli4_queue_destroy()
9418 if (phba->sli4_hba.hdwq) in lpfc_sli4_queue_destroy()
9419 lpfc_sli4_release_hdwq(phba); in lpfc_sli4_queue_destroy()
9421 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
9422 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
9423 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9425 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
9426 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9427 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
9428 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9432 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
9435 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
9438 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
9441 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
9442 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
9445 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
9448 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
9451 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
9454 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
9457 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9458 phba->sli.sli_flag &= ~LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
9459 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9463 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
9475 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
9482 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
9490 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
9497 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
9500 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
9511 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
9516 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
9518 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
9530 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
9534 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
9536 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
9543 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
9545 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
9546 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
9560 lpfc_setup_cq_lookup(struct lpfc_hba *phba) in lpfc_setup_cq_lookup() argument
9565 memset(phba->sli4_hba.cq_lookup, 0, in lpfc_setup_cq_lookup()
9566 (sizeof(struct lpfc_queue *) * (phba->sli4_hba.cq_max + 1))); in lpfc_setup_cq_lookup()
9568 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_setup_cq_lookup()
9570 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_setup_cq_lookup()
9575 if (childq->queue_id > phba->sli4_hba.cq_max) in lpfc_setup_cq_lookup()
9578 phba->sli4_hba.cq_lookup[childq->queue_id] = in lpfc_setup_cq_lookup()
9597 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
9609 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
9611 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9618 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
9622 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
9629 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9634 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
9639 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
9641 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
9642 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
9643 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
9645 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9647 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
9648 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
9651 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
9656 qp = phba->sli4_hba.hdwq; in lpfc_sli4_queue_setup()
9660 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9667 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_setup()
9670 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
9681 rc = lpfc_eq_create(phba, qp[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
9682 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
9684 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9692 phba->sli4_hba.hba_eq_hdl[cpup->eq].eq = in lpfc_sli4_queue_setup()
9695 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9703 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_setup()
9704 cpu = lpfc_find_cpu_handle(phba, qidx, LPFC_FIND_BY_HDWQ); in lpfc_sli4_queue_setup()
9705 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
9708 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
9709 phba->sli4_hba.hdwq[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
9712 &phba->sli4_hba.hdwq[qidx].io_cq_map, in lpfc_sli4_queue_setup()
9716 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9730 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
9731 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9733 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
9739 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9740 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
9741 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
9744 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9749 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
9750 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
9751 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9757 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
9758 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
9759 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
9763 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9771 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
9775 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9780 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
9782 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9785 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
9791 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
9792 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9794 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
9798 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9799 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
9800 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
9803 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9808 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9810 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
9811 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
9813 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_setup()
9815 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
9816 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9818 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
9822 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9823 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
9824 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
9827 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9833 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9836 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
9837 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
9843 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
9844 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
9845 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
9846 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
9847 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9853 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
9854 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
9855 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
9856 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
9857 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
9860 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9868 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
9869 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
9870 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
9871 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
9874 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9882 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9885 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
9886 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
9887 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
9892 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
9893 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9899 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
9900 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
9902 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9908 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9911 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
9912 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
9913 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
9915 if (phba->cfg_fcp_imax) in lpfc_sli4_queue_setup()
9916 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_sli4_queue_setup()
9920 for (qidx = 0; qidx < phba->cfg_irq_chann; in lpfc_sli4_queue_setup()
9922 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
9925 if (phba->sli4_hba.cq_max) { in lpfc_sli4_queue_setup()
9926 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_setup()
9927 phba->sli4_hba.cq_lookup = kcalloc((phba->sli4_hba.cq_max + 1), in lpfc_sli4_queue_setup()
9929 if (!phba->sli4_hba.cq_lookup) { in lpfc_sli4_queue_setup()
9930 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9932 "size 0x%x\n", phba->sli4_hba.cq_max); in lpfc_sli4_queue_setup()
9936 lpfc_setup_cq_lookup(phba); in lpfc_sli4_queue_setup()
9941 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
9959 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
9966 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
9967 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
9970 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
9971 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
9974 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
9975 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
9978 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
9979 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
9980 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
9983 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
9984 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
9987 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
9988 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
9991 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
9992 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
9994 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
9996 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
9997 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
9999 phba, in lpfc_sli4_queue_unset()
10000 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
10001 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
10005 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
10006 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
10008 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
10013 if (phba->sli4_hba.hdwq) { in lpfc_sli4_queue_unset()
10015 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_unset()
10017 qp = &phba->sli4_hba.hdwq[qidx]; in lpfc_sli4_queue_unset()
10018 lpfc_wq_destroy(phba, qp->io_wq); in lpfc_sli4_queue_unset()
10019 lpfc_cq_destroy(phba, qp->io_cq); in lpfc_sli4_queue_unset()
10022 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_unset()
10024 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_sli4_queue_unset()
10025 lpfc_eq_destroy(phba, eq); in lpfc_sli4_queue_unset()
10029 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_unset()
10030 phba->sli4_hba.cq_lookup = NULL; in lpfc_sli4_queue_unset()
10031 phba->sli4_hba.cq_max = 0; in lpfc_sli4_queue_unset()
10051 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
10056 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
10061 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
10066 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
10081 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
10086 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
10103 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
10107 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
10123 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
10128 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
10129 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
10130 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
10143 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
10146 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
10158 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
10162 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
10163 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
10164 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
10175 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
10182 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
10184 list_splice_init(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
10187 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
10190 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
10192 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
10196 lpfc_sli4_cq_event_release(phba, cqe); in lpfc_sli4_cq_event_release_all()
10213 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
10224 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
10227 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
10230 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
10238 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
10241 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
10248 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
10250 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
10267 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
10278 phba->work_status[0] = readl( in lpfc_pci_function_reset()
10279 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
10280 phba->work_status[1] = readl( in lpfc_pci_function_reset()
10281 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
10282 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
10286 phba->work_status[0], in lpfc_pci_function_reset()
10287 phba->work_status[1]); in lpfc_pci_function_reset()
10301 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
10304 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
10324 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
10345 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
10347 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
10367 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
10372 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
10374 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_pci_mem_setup()
10377 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
10381 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
10389 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
10396 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10397 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
10398 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10404 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10406 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10408 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
10415 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10416 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
10417 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10423 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10432 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
10435 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10436 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
10438 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10445 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
10446 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10447 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10460 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
10462 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10463 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
10464 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10470 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10471 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10480 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
10483 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10484 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
10486 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10493 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
10494 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10495 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
10510 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
10512 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10513 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
10514 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10520 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10527 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
10528 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_write_eq_db; in lpfc_sli4_pci_mem_setup()
10529 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_write_cq_db; in lpfc_sli4_pci_mem_setup()
10532 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
10533 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_if6_write_eq_db; in lpfc_sli4_pci_mem_setup()
10534 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_if6_write_cq_db; in lpfc_sli4_pci_mem_setup()
10543 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10545 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10547 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10560 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
10563 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
10567 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10568 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10569 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10572 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10575 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10576 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10577 if (phba->sli4_hba.dpp_regs_memmap_p) in lpfc_sli4_pci_mem_unset()
10578 iounmap(phba->sli4_hba.dpp_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10582 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
10601 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
10607 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
10610 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
10620 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
10622 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
10624 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
10631 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
10633 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
10636 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
10645 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
10649 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_enable_msix()
10654 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
10657 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
10659 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
10667 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
10672 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
10676 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
10680 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
10684 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
10705 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
10709 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
10711 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
10714 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
10719 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
10720 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
10722 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
10723 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
10747 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
10754 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
10757 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
10760 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
10767 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
10768 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
10771 phba->intr_type = MSI; in lpfc_sli_enable_intr()
10777 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
10778 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
10779 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
10782 phba->intr_type = INTx; in lpfc_sli_enable_intr()
10799 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
10803 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
10809 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
10810 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
10813 phba->intr_type = NONE; in lpfc_sli_disable_intr()
10814 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
10826 lpfc_find_cpu_handle(struct lpfc_hba *phba, uint16_t id, int match) in lpfc_find_cpu_handle() argument
10833 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_find_cpu_handle()
10860 lpfc_find_hyper(struct lpfc_hba *phba, int cpu, in lpfc_find_hyper() argument
10867 cpup = &phba->sli4_hba.cpu_map[idx]; in lpfc_find_hyper()
10888 lpfc_assign_eq_map_info(struct lpfc_hba *phba, uint16_t eqidx, uint16_t flag, in lpfc_assign_eq_map_info() argument
10891 struct lpfc_vector_map_info *cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_assign_eq_map_info()
10897 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_assign_eq_map_info()
10909 lpfc_cpu_map_array_init(struct lpfc_hba *phba) in lpfc_cpu_map_array_init() argument
10916 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_map_array_init()
10922 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, cpu); in lpfc_cpu_map_array_init()
10935 lpfc_hba_eq_hdl_array_init(struct lpfc_hba *phba) in lpfc_hba_eq_hdl_array_init() argument
10940 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hba_eq_hdl_array_init()
10943 eqhdl->phba = phba; in lpfc_hba_eq_hdl_array_init()
10958 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
10979 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10984 if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id)) in lpfc_cpu_affinity_check()
10992 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11016 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11029 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
11030 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
11054 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11067 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11080 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
11081 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
11091 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
11108 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11121 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11130 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11148 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11158 if (next_idx < phba->cfg_hdw_queue) { in lpfc_cpu_affinity_check()
11170 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
11171 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
11186 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
11187 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
11198 cpup->hdwq = idx % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
11208 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11221 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11223 c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, cpu); in lpfc_cpu_affinity_check()
11229 cpup->hdwq = idx++ % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
11233 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11253 lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu, in lpfc_cpuhp_get_eq() argument
11265 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_cpuhp_get_eq()
11266 maskp = pci_irq_get_affinity(phba->pcidev, idx); in lpfc_cpuhp_get_eq()
11291 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_cpuhp_get_eq()
11298 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba) in __lpfc_cpuhp_remove() argument
11300 if (phba->sli_rev != LPFC_SLI_REV4) in __lpfc_cpuhp_remove()
11304 &phba->cpuhp); in __lpfc_cpuhp_remove()
11310 del_timer_sync(&phba->cpuhp_poll_timer); in __lpfc_cpuhp_remove()
11313 static void lpfc_cpuhp_remove(struct lpfc_hba *phba) in lpfc_cpuhp_remove() argument
11315 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_cpuhp_remove()
11318 __lpfc_cpuhp_remove(phba); in lpfc_cpuhp_remove()
11321 static void lpfc_cpuhp_add(struct lpfc_hba *phba) in lpfc_cpuhp_add() argument
11323 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cpuhp_add()
11328 if (!list_empty(&phba->poll_list)) in lpfc_cpuhp_add()
11329 mod_timer(&phba->cpuhp_poll_timer, in lpfc_cpuhp_add()
11335 &phba->cpuhp); in lpfc_cpuhp_add()
11338 static int __lpfc_cpuhp_checks(struct lpfc_hba *phba, int *retval) in __lpfc_cpuhp_checks() argument
11340 if (phba->pport->load_flag & FC_UNLOADING) { in __lpfc_cpuhp_checks()
11345 if (phba->sli_rev != LPFC_SLI_REV4) { in __lpfc_cpuhp_checks()
11398 lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline) in lpfc_irq_rebalance() argument
11405 if (phba->irq_chann_mode == NORMAL_MODE) in lpfc_irq_rebalance()
11408 orig_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_rebalance()
11413 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_irq_rebalance()
11428 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_irq_rebalance()
11438 for (idx = 0; idx < phba->cfg_irq_chann; idx++) in lpfc_irq_rebalance()
11449 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_offline() local
11454 if (!phba) { in lpfc_cpu_offline()
11455 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_offline()
11459 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_offline()
11462 lpfc_irq_rebalance(phba, cpu, true); in lpfc_cpu_offline()
11464 retval = lpfc_cpuhp_get_eq(phba, cpu, &eqlist); in lpfc_cpu_offline()
11479 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_online() local
11484 if (!phba) { in lpfc_cpu_online()
11485 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_online()
11489 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_online()
11492 lpfc_irq_rebalance(phba, cpu, false); in lpfc_cpu_online()
11494 list_for_each_entry_safe(eq, next, &phba->poll_list, _poll_list) { in lpfc_cpu_online()
11495 n = lpfc_find_cpu_handle(phba, eq->hdwq, LPFC_FIND_BY_HDWQ); in lpfc_cpu_online()
11532 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
11544 vectors = phba->cfg_irq_chann; in lpfc_sli4_enable_msix()
11546 if (phba->irq_chann_mode != NORMAL_MODE) in lpfc_sli4_enable_msix()
11547 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_sli4_enable_msix()
11551 vectors = min(phba->cfg_irq_chann, cpu_cnt); in lpfc_sli4_enable_msix()
11562 rc = pci_alloc_irq_vectors(phba->pcidev, 1, vectors, flags); in lpfc_sli4_enable_msix()
11564 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
11579 rc = request_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_enable_msix()
11583 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
11589 eqhdl->irq = pci_irq_vector(phba->pcidev, index); in lpfc_sli4_enable_msix()
11597 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
11608 lpfc_assign_eq_map_info(phba, index, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_msix()
11611 maskp = pci_irq_get_affinity(phba->pcidev, index); in lpfc_sli4_enable_msix()
11615 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_enable_msix()
11631 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
11639 if (vectors != phba->cfg_irq_chann) { in lpfc_sli4_enable_msix()
11640 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_enable_msix()
11643 phba->cfg_irq_chann, vectors); in lpfc_sli4_enable_msix()
11644 if (phba->cfg_irq_chann > vectors) in lpfc_sli4_enable_msix()
11645 phba->cfg_irq_chann = vectors; in lpfc_sli4_enable_msix()
11660 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
11681 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
11687 rc = pci_alloc_irq_vectors(phba->pcidev, 1, 1, in lpfc_sli4_enable_msi()
11690 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
11693 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
11698 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
11699 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
11701 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
11702 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
11708 eqhdl->irq = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_msi()
11711 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); in lpfc_sli4_enable_msi()
11713 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_enable_msi()
11739 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
11749 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
11752 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
11759 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
11760 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
11763 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
11769 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
11770 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
11771 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
11777 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
11781 eqhdl->irq = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_intr()
11784 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_intr()
11786 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_enable_intr()
11805 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
11808 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
11813 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_disable_intr()
11820 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
11823 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
11826 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
11827 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
11838 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
11840 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
11847 kfree(phba->vpi_bmask); in lpfc_unset_hba()
11848 kfree(phba->vpi_ids); in lpfc_unset_hba()
11850 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
11852 phba->pport->work_port_events = 0; in lpfc_unset_hba()
11854 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
11856 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
11858 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
11877 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
11884 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
11893 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
11894 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
11897 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
11898 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
11906 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
11908 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
11914 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
11919 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
11924 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
11936 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
11937 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
11946 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
11948 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
11951 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
11967 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
11971 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
11973 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
11974 if (phba->pport) in lpfc_sli4_hba_unset()
11975 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
11983 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11984 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
11985 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11987 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
11993 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
11994 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11995 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
11997 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
11998 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
11999 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
12000 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
12004 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
12007 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
12010 if (phba->pport) in lpfc_sli4_hba_unset()
12011 lpfc_cpuhp_remove(phba); in lpfc_sli4_hba_unset()
12014 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
12017 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
12021 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
12024 lpfc_ras_stop_fwlog(phba); in lpfc_sli4_hba_unset()
12029 lpfc_sli4_queue_unset(phba); in lpfc_sli4_hba_unset()
12030 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
12033 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
12036 if (phba->ras_fwlog.ras_enabled) in lpfc_sli4_hba_unset()
12037 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_hba_unset()
12040 if (phba->pport) in lpfc_sli4_hba_unset()
12041 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
12057 lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_pc_sli4_params_get() argument
12069 if (!phba->sli4_hba.intr_enable) in lpfc_pc_sli4_params_get()
12070 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pc_sli4_params_get()
12072 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_pc_sli4_params_get()
12073 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_pc_sli4_params_get()
12079 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_pc_sli4_params_get()
12129 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
12144 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
12149 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
12152 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
12153 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
12155 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
12156 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
12160 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
12170 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
12172 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
12190 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
12191 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
12194 phba->cfg_xpsgl = bf_get(cfg_xpsgl, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
12205 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) { in lpfc_get_sli4_parameters()
12206 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
12209 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
12215 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
12216 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
12221 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
12223 phba->nvme_support = 0; in lpfc_get_sli4_parameters()
12224 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
12225 phba->cfg_nvmet_mrq = 0; in lpfc_get_sli4_parameters()
12226 phba->cfg_nvme_seg_cnt = 0; in lpfc_get_sli4_parameters()
12229 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
12231 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
12238 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_get_sli4_parameters()
12239 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_get_sli4_parameters()
12242 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_get_sli4_parameters()
12244 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
12254 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
12256 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
12258 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
12261 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
12273 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
12275 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
12277 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
12280 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
12281 phba->fcp_embed_io, phba->nvme_support, in lpfc_get_sli4_parameters()
12282 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
12284 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
12286 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
12294 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
12296 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
12301 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
12303 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
12309 phba->nsler = 1; in lpfc_get_sli4_parameters()
12311 phba->nsler = 0; in lpfc_get_sli4_parameters()
12336 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
12343 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
12344 if (!phba) in lpfc_pci_probe_one_s3()
12348 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
12353 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
12358 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
12360 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12366 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
12368 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12375 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
12377 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12383 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
12385 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12391 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
12394 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
12396 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12402 vport = phba->pport; in lpfc_pci_probe_one_s3()
12405 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12412 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
12415 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
12417 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
12419 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
12425 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
12426 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
12436 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
12438 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
12439 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
12442 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
12447 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
12454 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
12457 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
12462 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
12466 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
12468 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
12470 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
12472 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
12474 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
12476 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
12480 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
12499 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
12502 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
12504 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
12509 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
12511 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
12516 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
12531 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
12533 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
12535 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
12537 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
12538 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
12540 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
12541 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
12543 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
12548 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
12552 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
12560 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
12561 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s3()
12563 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
12566 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
12570 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
12573 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
12574 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
12576 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
12607 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
12609 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
12613 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
12614 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
12615 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
12618 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
12650 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
12654 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
12671 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
12672 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
12673 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
12674 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
12675 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
12682 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
12684 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s3()
12688 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
12691 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
12692 lpfc_online(phba); in lpfc_pci_resume_one_s3()
12695 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
12708 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
12710 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_recover()
12717 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
12729 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
12731 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_reset()
12735 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
12738 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
12741 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_reset()
12744 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
12747 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
12748 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
12760 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
12762 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_perm_failure()
12765 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
12768 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
12771 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
12796 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
12801 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
12805 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
12809 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
12813 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s3()
12815 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
12842 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
12843 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
12864 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
12866 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
12869 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
12871 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s3()
12876 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
12879 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
12880 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
12881 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
12884 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
12903 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
12906 lpfc_online(phba); in lpfc_io_resume_s3()
12916 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
12918 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
12920 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
12946 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
12948 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
12950 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
12957 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
12970 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC && in lpfc_log_write_firmware_error()
12972 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC && in lpfc_log_write_firmware_error()
12974 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
12978 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
12982 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
12987 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
12991 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
12995 offset, phba->pcidev->device, magic_number, in lpfc_log_write_firmware_error()
13011 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
13033 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
13035 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
13046 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
13071 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
13074 rc = lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
13085 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
13093 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
13100 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
13103 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
13116 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
13123 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
13127 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
13131 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
13132 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
13135 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
13137 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
13166 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
13173 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
13174 if (!phba) in lpfc_pci_probe_one_s4()
13178 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
13183 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
13188 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
13190 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13196 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
13198 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13203 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
13204 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
13207 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
13209 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13215 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
13218 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
13221 phba->pport = NULL; in lpfc_pci_probe_one_s4()
13222 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
13225 lpfc_cpu_map_array_init(phba); in lpfc_pci_probe_one_s4()
13228 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_probe_one_s4()
13231 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
13233 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
13239 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
13240 phba->cfg_irq_chann = 1; in lpfc_pci_probe_one_s4()
13241 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
13242 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
13243 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
13246 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_pci_probe_one_s4()
13249 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
13251 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13255 vport = phba->pport; in lpfc_pci_probe_one_s4()
13261 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13267 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
13268 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
13275 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
13276 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
13279 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
13284 if (phba->nvmet_support == 0) { in lpfc_pci_probe_one_s4()
13285 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
13293 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
13302 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
13303 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
13306 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
13309 lpfc_sli4_ras_setup(phba); in lpfc_pci_probe_one_s4()
13311 INIT_LIST_HEAD(&phba->poll_list); in lpfc_pci_probe_one_s4()
13312 timer_setup(&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer, 0); in lpfc_pci_probe_one_s4()
13313 cpuhp_state_add_instance_nocalls(lpfc_cpuhp_state, &phba->cpuhp); in lpfc_pci_probe_one_s4()
13320 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
13322 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
13324 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
13326 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
13328 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
13330 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
13334 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
13353 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
13357 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
13359 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
13365 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
13367 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
13372 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
13382 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
13386 if (phba->cfg_xri_rebalancing) in lpfc_pci_remove_one_s4()
13387 lpfc_destroy_multixri_pools(phba); in lpfc_pci_remove_one_s4()
13396 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
13397 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
13399 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
13404 lpfc_io_free(phba); in lpfc_pci_remove_one_s4()
13405 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
13406 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
13408 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
13409 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
13412 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
13416 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
13419 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
13449 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
13451 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
13455 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
13456 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
13457 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
13460 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
13461 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
13493 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
13497 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
13514 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
13515 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
13516 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
13517 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
13518 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
13525 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
13527 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s4()
13531 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
13534 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
13535 lpfc_online(phba); in lpfc_pci_resume_one_s4()
13538 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
13551 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
13553 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_recover()
13559 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
13571 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
13573 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_reset()
13577 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
13580 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_reset()
13583 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_reset()
13586 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
13589 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
13590 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
13591 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
13603 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
13605 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_perm_failure()
13609 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
13612 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
13615 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
13638 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
13643 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
13647 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
13651 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
13655 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s4()
13657 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
13684 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
13685 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
13706 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
13708 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
13711 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
13713 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s4()
13718 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
13721 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
13740 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
13748 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
13750 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_resume_s4()
13751 lpfc_offline(phba); in lpfc_io_resume_s4()
13752 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
13754 lpfc_online(phba); in lpfc_io_resume_s4()
13808 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
13810 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
13818 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_remove_one()
13820 phba->pci_dev_grp); in lpfc_pci_remove_one()
13844 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
13847 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
13855 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_suspend_one()
13857 phba->pci_dev_grp); in lpfc_pci_suspend_one()
13880 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
13883 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
13891 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one()
13893 phba->pci_dev_grp); in lpfc_pci_resume_one()
13918 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
13921 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
13929 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected()
13931 phba->pci_dev_grp); in lpfc_io_error_detected()
13955 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
13958 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
13966 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset()
13968 phba->pci_dev_grp); in lpfc_io_slot_reset()
13988 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
13990 switch (phba->pci_dev_grp) { in lpfc_io_resume()
13998 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_resume()
14000 phba->pci_dev_grp); in lpfc_io_resume()
14017 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
14020 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
14023 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
14024 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
14026 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
14027 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
14028 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
14042 lpfc_sli4_ras_init(struct lpfc_hba *phba) in lpfc_sli4_ras_init() argument
14044 switch (phba->pcidev->device) { in lpfc_sli4_ras_init()
14047 phba->ras_fwlog.ras_hwsupport = true; in lpfc_sli4_ras_init()
14048 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && in lpfc_sli4_ras_init()
14049 phba->cfg_ras_fwlog_buffsize) in lpfc_sli4_ras_init()
14050 phba->ras_fwlog.ras_enabled = true; in lpfc_sli4_ras_init()
14052 phba->ras_fwlog.ras_enabled = false; in lpfc_sli4_ras_init()
14055 phba->ras_fwlog.ras_hwsupport = false; in lpfc_sli4_ras_init()
14157 void lpfc_dmp_dbg(struct lpfc_hba *phba) in lpfc_dmp_dbg() argument
14166 if (phba->cfg_log_verbose) in lpfc_dmp_dbg()
14169 if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0) in lpfc_dmp_dbg()
14172 start_idx = (unsigned int)atomic_read(&phba->dbg_log_idx) % DBG_LOG_SZ; in lpfc_dmp_dbg()
14173 dbg_cnt = (unsigned int)atomic_read(&phba->dbg_log_cnt); in lpfc_dmp_dbg()
14188 dev_info(&phba->pcidev->dev, "start %d end %d cnt %d\n", in lpfc_dmp_dbg()
14196 rem_nsec = do_div(phba->dbg_log[temp_idx].t_ns, NSEC_PER_SEC); in lpfc_dmp_dbg()
14197 dev_info(&phba->pcidev->dev, "%d: [%5lu.%06lu] %s", in lpfc_dmp_dbg()
14199 (unsigned long)phba->dbg_log[temp_idx].t_ns, in lpfc_dmp_dbg()
14201 phba->dbg_log[temp_idx].log); in lpfc_dmp_dbg()
14203 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_dmp_dbg()
14204 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_dmp_dbg()
14208 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...) in lpfc_dbg_print() argument
14212 int dbg_dmping = atomic_read(&phba->dbg_log_dmping); in lpfc_dbg_print()
14220 dev_info(&phba->pcidev->dev, "%pV", &vaf); in lpfc_dbg_print()
14224 idx = (unsigned int)atomic_fetch_add(1, &phba->dbg_log_idx) % in lpfc_dbg_print()
14227 atomic_inc(&phba->dbg_log_cnt); in lpfc_dbg_print()
14229 vscnprintf(phba->dbg_log[idx].log, in lpfc_dbg_print()
14230 sizeof(phba->dbg_log[idx].log), fmt, args); in lpfc_dbg_print()
14233 phba->dbg_log[idx].t_ns = local_clock(); in lpfc_dbg_print()