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_SLI, 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
5964 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
5965 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
5966 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
5969 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
5970 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
5971 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
5973 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, in lpfc_sli4_async_event_proc()
5979 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
5983 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
5986 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
5990 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
5994 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
5997 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
6000 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_event_proc()
6009 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
6010 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
6012 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
6022 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
6026 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
6028 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
6030 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
6032 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
6033 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
6036 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
6038 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
6040 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fcf_redisc_event_proc()
6056 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
6061 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
6065 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
6068 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
6072 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
6076 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
6080 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
6095 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
6099 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
6103 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
6107 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
6111 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_intr_mode()
6130 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
6135 if (!phba->pcidev) in lpfc_enable_pci_dev()
6138 pdev = phba->pcidev; in lpfc_enable_pci_dev()
6159 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_enable_pci_dev()
6172 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
6177 if (!phba->pcidev) in lpfc_disable_pci_dev()
6180 pdev = phba->pcidev; in lpfc_disable_pci_dev()
6198 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
6201 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
6202 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
6205 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_reset_hba()
6206 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
6208 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
6209 lpfc_offline(phba); in lpfc_reset_hba()
6210 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
6211 lpfc_online(phba); in lpfc_reset_hba()
6212 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
6226 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
6228 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
6252 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
6254 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
6258 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
6260 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_probe_sriov_nr_virtfn()
6268 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
6273 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
6291 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
6293 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
6298 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
6299 atomic_set(&phba->dbg_log_idx, 0); in lpfc_setup_driver_resource_phase1()
6300 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_setup_driver_resource_phase1()
6301 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_setup_driver_resource_phase1()
6302 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
6305 spin_lock_init(&phba->ndlp_lock); in lpfc_setup_driver_resource_phase1()
6308 spin_lock_init(&phba->port_list_lock); in lpfc_setup_driver_resource_phase1()
6309 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
6311 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
6312 init_waitqueue_head(&phba->wait_4_mlo_m_q); in lpfc_setup_driver_resource_phase1()
6315 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
6317 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
6319 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
6321 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
6323 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
6326 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
6327 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
6328 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
6329 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
6332 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
6335 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
6338 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
6341 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
6342 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
6347 timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); in lpfc_setup_driver_resource_phase1()
6349 timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); in lpfc_setup_driver_resource_phase1()
6351 timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); in lpfc_setup_driver_resource_phase1()
6353 INIT_DELAYED_WORK(&phba->eq_delay_work, lpfc_hb_eq_delay_work); in lpfc_setup_driver_resource_phase1()
6355 INIT_DELAYED_WORK(&phba->idle_stat_delay_work, in lpfc_setup_driver_resource_phase1()
6373 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
6382 timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); in lpfc_sli_driver_resource_setup()
6385 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
6386 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
6389 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
6392 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli_driver_resource_setup()
6396 if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { in lpfc_sli_driver_resource_setup()
6397 phba->menlo_flag |= HBA_MENLO_SUPPORT; in lpfc_sli_driver_resource_setup()
6399 if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) in lpfc_sli_driver_resource_setup()
6400 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
6403 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
6404 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, in lpfc_sli_driver_resource_setup()
6407 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
6415 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_driver_resource_setup()
6421 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
6431 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
6435 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
6436 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
6439 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
6446 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
6448 ((phba->cfg_sg_seg_cnt + 2) * entry_sz); in lpfc_sli_driver_resource_setup()
6451 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
6454 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
6456 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
6457 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
6459 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
6461 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
6466 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
6467 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
6470 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
6473 phba->lpfc_sg_dma_buf_pool = in lpfc_sli_driver_resource_setup()
6475 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
6478 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli_driver_resource_setup()
6481 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli_driver_resource_setup()
6483 &phba->pcidev->dev, in lpfc_sli_driver_resource_setup()
6488 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli_driver_resource_setup()
6495 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
6496 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
6497 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
6499 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
6503 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
6504 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
6511 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli_driver_resource_setup()
6512 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli_driver_resource_setup()
6514 lpfc_mem_free(phba); in lpfc_sli_driver_resource_setup()
6526 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
6529 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
6546 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
6557 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
6558 phba->sli4_hba.num_possible_cpu = cpumask_last(cpu_possible_mask) + 1; in lpfc_sli4_driver_resource_setup()
6559 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
6562 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
6565 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
6570 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
6577 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0); in lpfc_sli4_driver_resource_setup()
6583 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
6586 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
6592 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
6594 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
6596 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
6599 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
6602 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
6603 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
6604 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
6605 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
6614 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
6615 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
6616 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
6622 spin_lock_init(&phba->sli4_hba.abts_io_buf_list_lock); in lpfc_sli4_driver_resource_setup()
6623 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_io_buf_list); in lpfc_sli4_driver_resource_setup()
6625 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
6627 spin_lock_init(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_sli4_driver_resource_setup()
6628 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
6629 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
6630 spin_lock_init(&phba->sli4_hba.t_active_list_lock); in lpfc_sli4_driver_resource_setup()
6631 INIT_LIST_HEAD(&phba->sli4_hba.t_active_ctx_list); in lpfc_sli4_driver_resource_setup()
6635 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
6636 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
6637 spin_lock_init(&phba->sli4_hba.asynce_list_lock); in lpfc_sli4_driver_resource_setup()
6638 spin_lock_init(&phba->sli4_hba.els_xri_abrt_list_lock); in lpfc_sli4_driver_resource_setup()
6645 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
6647 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
6649 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
6651 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
6653 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
6656 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
6657 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
6658 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
6659 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
6664 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
6665 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
6668 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
6671 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
6676 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
6678 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
6683 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
6687 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
6692 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
6697 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
6700 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
6705 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
6707 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
6712 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
6720 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
6724 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6725 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
6727 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
6733 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6741 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
6746 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
6752 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
6755 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
6757 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
6762 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
6769 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_driver_resource_setup()
6770 if (phba->irq_chann_mode == NHT_MODE) { in lpfc_sli4_driver_resource_setup()
6771 phba->cfg_irq_chann = in lpfc_sli4_driver_resource_setup()
6772 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
6773 phba->cfg_hdw_queue = in lpfc_sli4_driver_resource_setup()
6774 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
6775 phba->irq_chann_mode = NORMAL_MODE; in lpfc_sli4_driver_resource_setup()
6782 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
6789 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6792 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
6794 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
6795 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
6796 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
6797 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
6802 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6809 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6820 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
6834 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
6846 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
6850 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
6856 if (phba->cfg_enable_bg && in lpfc_sli4_driver_resource_setup()
6857 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
6858 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
6860 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6868 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
6870 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
6874 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
6875 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6883 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_driver_resource_setup()
6884 phba->cfg_sg_dma_buf_size = LPFC_DEFAULT_XPSGL_SIZE; in lpfc_sli4_driver_resource_setup()
6885 else if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
6886 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
6888 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
6889 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
6891 phba->border_sge_num = phba->cfg_sg_dma_buf_size / in lpfc_sli4_driver_resource_setup()
6895 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
6896 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { in lpfc_sli4_driver_resource_setup()
6897 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, in lpfc_sli4_driver_resource_setup()
6901 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_sli4_driver_resource_setup()
6903 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6906 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
6909 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
6910 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sli4_driver_resource_setup()
6911 phba->cfg_nvme_seg_cnt); in lpfc_sli4_driver_resource_setup()
6913 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_sli4_driver_resource_setup()
6914 i = phba->cfg_sg_dma_buf_size; in lpfc_sli4_driver_resource_setup()
6918 phba->lpfc_sg_dma_buf_pool = in lpfc_sli4_driver_resource_setup()
6920 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
6921 phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
6923 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli4_driver_resource_setup()
6926 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli4_driver_resource_setup()
6928 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
6932 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli4_driver_resource_setup()
6935 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6938 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
6941 lpfc_sli4_ras_init(phba); in lpfc_sli4_driver_resource_setup()
6944 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
6949 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
6954 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
6957 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
6959 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
6963 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
6965 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
6972 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
6974 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
6975 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
6982 phba->sli4_hba.hba_eq_hdl = kcalloc(phba->cfg_irq_chann, in lpfc_sli4_driver_resource_setup()
6985 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
6986 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
6993 phba->sli4_hba.cpu_map = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
6996 if (!phba->sli4_hba.cpu_map) { 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.eq_info = alloc_percpu(struct lpfc_eq_intr_info); in lpfc_sli4_driver_resource_setup()
7005 if (!phba->sli4_hba.eq_info) { in lpfc_sli4_driver_resource_setup()
7006 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7012 phba->sli4_hba.idle_stat = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
7013 sizeof(*phba->sli4_hba.idle_stat), in lpfc_sli4_driver_resource_setup()
7015 if (!phba->sli4_hba.idle_stat) { in lpfc_sli4_driver_resource_setup()
7016 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7023 phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); in lpfc_sli4_driver_resource_setup()
7024 if (!phba->sli4_hba.c_stat) { in lpfc_sli4_driver_resource_setup()
7025 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
7036 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
7037 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
7038 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
7040 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
7044 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
7045 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
7053 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_setup()
7056 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_setup()
7058 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
7060 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
7062 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
7064 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
7066 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
7068 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
7070 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool); in lpfc_sli4_driver_resource_setup()
7071 phba->lpfc_cmd_rsp_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
7073 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli4_driver_resource_setup()
7074 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
7076 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
7078 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
7080 destroy_workqueue(phba->wq); in lpfc_sli4_driver_resource_setup()
7081 phba->wq = NULL; in lpfc_sli4_driver_resource_setup()
7093 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
7097 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_unset()
7099 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_unset()
7101 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_unset()
7104 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
7105 phba->sli4_hba.num_possible_cpu = 0; in lpfc_sli4_driver_resource_unset()
7106 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
7107 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
7108 cpumask_clear(&phba->sli4_hba.irq_aff_mask); in lpfc_sli4_driver_resource_unset()
7111 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
7114 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
7115 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
7118 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
7121 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
7122 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
7123 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
7126 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
7127 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
7130 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
7133 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
7136 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
7140 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
7159 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
7161 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
7162 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
7163 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
7166 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
7167 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
7168 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
7171 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
7172 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
7173 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
7176 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_init_api_table_setup()
7197 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
7202 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
7203 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
7204 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
7205 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
7221 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
7223 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
7224 flush_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
7225 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
7226 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
7230 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
7231 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
7241 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
7245 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
7247 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
7250 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
7252 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
7270 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
7277 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
7287 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
7297 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
7298 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
7299 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
7300 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
7306 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
7319 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
7325 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
7337 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
7342 spin_lock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
7343 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
7344 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
7345 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
7346 spin_unlock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
7349 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
7359 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
7365 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
7366 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
7367 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
7368 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
7369 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
7374 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
7382 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
7393 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
7397 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
7399 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
7401 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
7415 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
7417 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
7429 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
7432 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
7433 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
7434 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
7435 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
7438 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
7441 phba->sli4_hba.io_xri_cnt = 0; in lpfc_init_sgl_list()
7459 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
7464 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
7465 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
7467 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
7470 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
7472 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_init_rpi_hdrs()
7474 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
7495 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
7506 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
7508 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
7512 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
7514 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7520 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
7521 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7535 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
7556 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7560 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
7561 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
7563 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7567 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
7584 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
7588 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
7592 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
7594 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
7601 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
7619 struct lpfc_hba *phba; in lpfc_hba_alloc() local
7622 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
7623 if (!phba) { in lpfc_hba_alloc()
7629 phba->pcidev = pdev; in lpfc_hba_alloc()
7632 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
7633 if (phba->brd_no < 0) { in lpfc_hba_alloc()
7634 kfree(phba); in lpfc_hba_alloc()
7637 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
7639 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
7640 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
7642 return phba; in lpfc_hba_alloc()
7653 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
7655 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_hba_free()
7656 kfree(phba->sli4_hba.hdwq); in lpfc_hba_free()
7659 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
7662 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
7663 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
7665 kfree(phba); in lpfc_hba_free()
7681 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
7687 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
7688 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
7689 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
7690 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
7692 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
7693 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
7698 phba->pport = vport; in lpfc_create_shost()
7700 if (phba->nvmet_support) { in lpfc_create_shost()
7702 phba->targetport = NULL; in lpfc_create_shost()
7703 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
7704 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME_DISC, in lpfc_create_shost()
7710 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
7717 if (phba->cfg_enable_SmartSAN || in lpfc_create_shost()
7718 (phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT)) { in lpfc_create_shost()
7722 if (phba->cfg_enable_SmartSAN) in lpfc_create_shost()
7738 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
7740 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
7757 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
7762 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
7763 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
7767 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
7768 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
7771 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
7774 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
7778 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
7779 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
7781 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
7782 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
7783 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
7784 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
7787 phba->cfg_prot_mask, in lpfc_setup_bg()
7788 phba->cfg_prot_guard); in lpfc_setup_bg()
7790 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
7791 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
7793 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
7808 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
7814 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
7820 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
7821 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
7825 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
7827 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
7831 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
7855 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
7857 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
7877 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
7880 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
7884 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
7885 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
7892 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
7893 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
7900 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
7901 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
7902 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
7905 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
7906 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
7908 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
7909 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
7912 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
7914 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
7916 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
7920 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
7922 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
7923 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
7927 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
7928 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
7930 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
7932 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
7933 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7934 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7935 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7936 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7942 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
7944 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
7946 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
7959 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
7964 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
7967 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
7971 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
7973 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
7976 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
7977 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
7992 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
8001 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
8006 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
8024 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
8038 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
8043 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8045 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8047 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8049 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8051 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
8053 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
8060 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
8063 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
8064 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
8065 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
8066 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
8068 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
8070 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
8071 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
8072 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
8073 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_post_status_check()
8083 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
8084 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
8091 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
8095 phba->work_status[0] = in lpfc_sli4_post_status_check()
8096 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
8098 phba->work_status[1] = in lpfc_sli4_post_status_check()
8099 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
8101 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
8108 phba->work_status[0], in lpfc_sli4_post_status_check()
8109 phba->work_status[1]); in lpfc_sli4_post_status_check()
8130 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
8134 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
8135 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
8136 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
8137 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
8138 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
8139 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
8140 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
8141 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
8142 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
8143 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
8146 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
8147 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8149 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
8150 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8152 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
8153 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8155 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
8156 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8158 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
8159 phba->sli4_hba.conf_regs_memmap_p + 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()
8163 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
8164 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8166 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8167 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8169 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8170 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8172 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8173 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
8174 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
8175 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8176 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
8177 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
8178 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
8181 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
8182 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8184 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
8185 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8187 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
8188 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8190 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
8191 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8193 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
8194 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8196 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
8197 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8199 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
8200 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
8204 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
8219 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
8223 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
8224 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8226 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8228 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8230 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8234 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8236 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8238 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8240 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8242 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8248 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
8266 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
8271 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8274 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8277 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8280 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
8281 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8283 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8304 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
8321 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
8335 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
8336 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
8338 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
8340 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
8351 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
8352 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
8357 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
8375 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
8377 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
8378 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
8379 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
8380 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
8382 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
8383 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
8410 lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) in lpfc_map_topology() argument
8418 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
8422 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
8425 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
8429 phba->hba_flag |= HBA_PERSISTENT_TOPO; in lpfc_map_topology()
8430 switch (phba->pcidev->device) { in lpfc_map_topology()
8434 phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) in lpfc_map_topology()
8438 phba->hba_flag &= ~HBA_PERSISTENT_TOPO; in lpfc_map_topology()
8444 phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : in lpfc_map_topology()
8447 phba->cfg_topology = ((pt == LINK_FLAGS_P2P) in lpfc_map_topology()
8453 if (phba->hba_flag & HBA_PERSISTENT_TOPO) { in lpfc_map_topology()
8454 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
8456 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
8458 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
8461 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
8480 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
8493 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
8495 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8501 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
8503 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
8505 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8514 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
8515 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
8517 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
8519 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8521 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
8522 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
8524 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
8528 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
8529 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
8532 phba->sli4_hba.conf_trunk = in lpfc_sli4_read_config()
8534 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
8536 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
8540 phba->sli4_hba.max_cfg_param.max_xri > 512) in lpfc_sli4_read_config()
8541 phba->sli4_hba.max_cfg_param.max_xri = 512; in lpfc_sli4_read_config()
8542 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
8544 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
8547 if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) in lpfc_sli4_read_config()
8548 phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; in lpfc_sli4_read_config()
8549 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
8551 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
8553 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
8555 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
8557 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
8559 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
8561 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
8563 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
8565 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
8567 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
8569 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
8570 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
8571 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
8572 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
8573 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
8574 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
8575 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
8576 lpfc_map_topology(phba, rd_config); in lpfc_sli4_read_config()
8577 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8584 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
8585 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
8586 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
8587 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
8588 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
8589 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
8590 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
8591 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
8592 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
8593 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
8594 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
8595 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
8596 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
8597 phba->sli4_hba.max_cfg_param.max_rq, in lpfc_sli4_read_config()
8598 phba->lmt); in lpfc_sli4_read_config()
8604 qmin = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
8605 if (phba->sli4_hba.max_cfg_param.max_cq < qmin) in lpfc_sli4_read_config()
8606 qmin = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
8607 if (phba->sli4_hba.max_cfg_param.max_eq < qmin) in lpfc_sli4_read_config()
8608 qmin = phba->sli4_hba.max_cfg_param.max_eq; in lpfc_sli4_read_config()
8618 if ((phba->cfg_irq_chann > qmin) || in lpfc_sli4_read_config()
8619 (phba->cfg_hdw_queue > qmin)) { in lpfc_sli4_read_config()
8620 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8625 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
8626 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
8627 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
8628 qmin, phba->cfg_irq_chann, in lpfc_sli4_read_config()
8629 phba->cfg_hdw_queue); in lpfc_sli4_read_config()
8631 if (phba->cfg_irq_chann > qmin) in lpfc_sli4_read_config()
8632 phba->cfg_irq_chann = qmin; in lpfc_sli4_read_config()
8633 if (phba->cfg_hdw_queue > qmin) in lpfc_sli4_read_config()
8634 phba->cfg_hdw_queue = qmin; in lpfc_sli4_read_config()
8642 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
8647 phba->hba_flag |= HBA_FORCED_LINK_SPEED; in lpfc_sli4_read_config()
8651 phba->cfg_link_speed = in lpfc_sli4_read_config()
8655 phba->cfg_link_speed = in lpfc_sli4_read_config()
8659 phba->cfg_link_speed = in lpfc_sli4_read_config()
8663 phba->cfg_link_speed = in lpfc_sli4_read_config()
8667 phba->cfg_link_speed = in lpfc_sli4_read_config()
8671 phba->cfg_link_speed = in lpfc_sli4_read_config()
8675 phba->cfg_link_speed = in lpfc_sli4_read_config()
8679 phba->cfg_link_speed = in lpfc_sli4_read_config()
8683 phba->cfg_link_speed = in lpfc_sli4_read_config()
8687 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_read_config()
8692 phba->cfg_link_speed = in lpfc_sli4_read_config()
8699 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
8700 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
8701 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
8702 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
8704 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
8705 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
8708 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
8715 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
8719 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
8725 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8748 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
8750 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
8757 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8759 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
8760 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
8762 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
8768 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
8786 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
8793 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
8796 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
8799 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
8812 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
8814 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
8820 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
8845 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
8852 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
8853 if (phba->cfg_hdw_queue < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
8854 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_sli4_queue_verify()
8855 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
8856 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
8859 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
8861 phba->cfg_hdw_queue, phba->cfg_irq_chann, in lpfc_sli4_queue_verify()
8862 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
8865 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
8866 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
8869 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
8870 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
8875 lpfc_alloc_io_wq_cq(struct lpfc_hba *phba, int idx) in lpfc_alloc_io_wq_cq() argument
8881 cpu = lpfc_find_cpu_handle(phba, idx, LPFC_FIND_BY_HDWQ); in lpfc_alloc_io_wq_cq()
8883 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_io_wq_cq()
8885 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8886 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
8890 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8891 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
8892 phba->sli4_hba.cq_ecount, cpu); in lpfc_alloc_io_wq_cq()
8894 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
8902 phba->sli4_hba.hdwq[idx].io_cq = qdesc; in lpfc_alloc_io_wq_cq()
8905 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_io_wq_cq()
8907 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_io_wq_cq()
8908 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_io_wq_cq()
8909 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8913 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8914 phba->sli4_hba.wq_esize, in lpfc_alloc_io_wq_cq()
8915 phba->sli4_hba.wq_ecount, cpu); in lpfc_alloc_io_wq_cq()
8918 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
8925 phba->sli4_hba.hdwq[idx].io_wq = qdesc; in lpfc_alloc_io_wq_cq()
8926 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_io_wq_cq()
8945 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
8958 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
8959 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
8960 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
8961 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
8962 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
8963 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
8964 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
8965 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
8966 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
8967 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
8969 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
8970 phba->sli4_hba.hdwq = kcalloc( in lpfc_sli4_queue_create()
8971 phba->cfg_hdw_queue, sizeof(struct lpfc_sli4_hdw_queue), in lpfc_sli4_queue_create()
8973 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
8974 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
8980 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
8981 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_queue_create()
8999 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
9000 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
9001 phba->sli4_hba.nvmet_cqset = kcalloc( in lpfc_sli4_queue_create()
9002 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
9005 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
9006 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9011 phba->sli4_hba.nvmet_mrq_hdr = kcalloc( in lpfc_sli4_queue_create()
9012 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
9015 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
9016 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9021 phba->sli4_hba.nvmet_mrq_data = kcalloc( in lpfc_sli4_queue_create()
9022 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
9025 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
9026 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9034 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
9042 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
9047 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
9050 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9051 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
9052 phba->sli4_hba.eq_ecount, cpu); in lpfc_sli4_queue_create()
9054 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9067 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, qdesc->last_cpu); in lpfc_sli4_queue_create()
9075 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
9082 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
9087 eqcpu = lpfc_find_cpu_handle(phba, cpup->eq, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
9088 eqcpup = &phba->sli4_hba.cpu_map[eqcpu]; in lpfc_sli4_queue_create()
9089 qp->hba_eq = phba->sli4_hba.hdwq[eqcpup->hdwq].hba_eq; in lpfc_sli4_queue_create()
9093 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9094 if (lpfc_alloc_io_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
9098 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
9099 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
9100 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
9102 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
9104 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
9105 phba->sli4_hba.cq_ecount, in lpfc_sli4_queue_create()
9108 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9116 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
9124 cpu = lpfc_find_cpu_handle(phba, 0, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
9126 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9127 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
9128 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
9130 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9135 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
9138 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9139 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
9140 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
9142 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9148 phba->sli4_hba.els_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.mq_esize, in lpfc_sli4_queue_create()
9159 phba->sli4_hba.mq_ecount, cpu); in lpfc_sli4_queue_create()
9161 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9166 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
9173 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9174 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
9175 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
9177 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9182 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
9183 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
9185 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
9187 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9188 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
9189 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
9191 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9197 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
9200 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9201 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
9202 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
9204 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9209 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
9210 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
9218 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9219 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9220 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
9222 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9226 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
9229 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
9230 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9231 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
9233 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9237 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
9239 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_sli4_queue_create()
9240 phba->nvmet_support) { in lpfc_sli4_queue_create()
9241 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
9242 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
9245 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
9247 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9251 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9257 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
9264 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9274 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
9276 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9280 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
9286 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
9291 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
9292 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9293 memset(&phba->sli4_hba.hdwq[idx].nvme_cstat, 0, in lpfc_sli4_queue_create()
9294 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); in lpfc_sli4_queue_create()
9299 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_queue_create()
9300 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9301 memset(&phba->sli4_hba.hdwq[idx].scsi_cstat, 0, in lpfc_sli4_queue_create()
9302 sizeof(phba->sli4_hba.hdwq[idx].scsi_cstat)); in lpfc_sli4_queue_create()
9309 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
9338 lpfc_sli4_release_hdwq(struct lpfc_hba *phba) in lpfc_sli4_release_hdwq() argument
9344 hdwq = phba->sli4_hba.hdwq; in lpfc_sli4_release_hdwq()
9347 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_release_hdwq()
9354 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_release_hdwq()
9355 lpfc_free_sgl_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
9356 lpfc_free_cmd_rsp_buf_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
9359 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_release_hdwq()
9361 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_sli4_release_hdwq()
9363 phba->sli4_hba.hba_eq_hdl[idx].eq = NULL; in lpfc_sli4_release_hdwq()
9380 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
9387 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9388 phba->sli.sli_flag |= LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
9389 while (phba->sli.sli_flag & LPFC_QUEUE_FREE_WAIT) { in lpfc_sli4_queue_destroy()
9390 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9392 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9394 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9396 lpfc_sli4_cleanup_poll_list(phba); in lpfc_sli4_queue_destroy()
9399 if (phba->sli4_hba.hdwq) in lpfc_sli4_queue_destroy()
9400 lpfc_sli4_release_hdwq(phba); in lpfc_sli4_queue_destroy()
9402 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
9403 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
9404 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9406 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
9407 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9408 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
9409 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9413 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
9416 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
9419 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
9422 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
9423 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
9426 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
9429 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
9432 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
9435 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
9438 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9439 phba->sli.sli_flag &= ~LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
9440 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9444 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
9456 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
9463 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
9471 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
9478 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
9481 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
9492 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
9497 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
9499 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()
9515 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
9517 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
9524 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
9526 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
9527 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
9541 lpfc_setup_cq_lookup(struct lpfc_hba *phba) in lpfc_setup_cq_lookup() argument
9546 memset(phba->sli4_hba.cq_lookup, 0, in lpfc_setup_cq_lookup()
9547 (sizeof(struct lpfc_queue *) * (phba->sli4_hba.cq_max + 1))); in lpfc_setup_cq_lookup()
9549 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_setup_cq_lookup()
9551 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_setup_cq_lookup()
9556 if (childq->queue_id > phba->sli4_hba.cq_max) in lpfc_setup_cq_lookup()
9559 phba->sli4_hba.cq_lookup[childq->queue_id] = in lpfc_setup_cq_lookup()
9578 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
9590 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
9592 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9599 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
9603 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
9610 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9614 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
9619 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
9621 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
9622 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
9623 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
9625 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9627 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
9628 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
9630 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
9635 qp = phba->sli4_hba.hdwq; in lpfc_sli4_queue_setup()
9639 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9646 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_setup()
9649 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
9660 rc = lpfc_eq_create(phba, qp[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
9661 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
9663 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9671 phba->sli4_hba.hba_eq_hdl[cpup->eq].eq = in lpfc_sli4_queue_setup()
9674 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9682 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_setup()
9683 cpu = lpfc_find_cpu_handle(phba, qidx, LPFC_FIND_BY_HDWQ); in lpfc_sli4_queue_setup()
9684 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
9687 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
9688 phba->sli4_hba.hdwq[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
9691 &phba->sli4_hba.hdwq[qidx].io_cq_map, in lpfc_sli4_queue_setup()
9695 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9709 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
9710 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9712 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
9718 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9719 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
9720 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
9723 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9728 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
9729 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
9730 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9736 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
9737 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
9738 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
9742 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9750 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
9754 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9759 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
9761 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9764 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
9770 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
9771 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9773 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
9777 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9778 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
9779 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
9782 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9787 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9789 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
9790 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
9792 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_setup()
9794 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
9795 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9797 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
9801 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9802 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
9803 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
9806 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9812 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9815 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
9816 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
9822 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
9823 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
9824 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
9825 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
9826 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9832 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
9833 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
9834 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
9835 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
9836 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
9839 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9847 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
9848 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
9849 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
9850 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
9853 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9861 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9864 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
9865 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
9866 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
9871 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
9872 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9878 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
9879 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
9881 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9887 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9890 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
9891 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
9892 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
9894 if (phba->cfg_fcp_imax) in lpfc_sli4_queue_setup()
9895 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_sli4_queue_setup()
9899 for (qidx = 0; qidx < phba->cfg_irq_chann; in lpfc_sli4_queue_setup()
9901 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
9904 if (phba->sli4_hba.cq_max) { in lpfc_sli4_queue_setup()
9905 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_setup()
9906 phba->sli4_hba.cq_lookup = kcalloc((phba->sli4_hba.cq_max + 1), in lpfc_sli4_queue_setup()
9908 if (!phba->sli4_hba.cq_lookup) { in lpfc_sli4_queue_setup()
9909 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
9911 "size 0x%x\n", phba->sli4_hba.cq_max); in lpfc_sli4_queue_setup()
9915 lpfc_setup_cq_lookup(phba); in lpfc_sli4_queue_setup()
9920 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
9938 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
9945 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
9946 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
9949 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
9950 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
9953 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
9954 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
9957 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
9958 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
9959 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
9962 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
9963 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
9966 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
9967 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
9970 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
9971 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
9973 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
9975 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
9976 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
9978 phba, in lpfc_sli4_queue_unset()
9979 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
9980 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
9984 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
9985 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
9987 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
9992 if (phba->sli4_hba.hdwq) { in lpfc_sli4_queue_unset()
9994 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_unset()
9996 qp = &phba->sli4_hba.hdwq[qidx]; in lpfc_sli4_queue_unset()
9997 lpfc_wq_destroy(phba, qp->io_wq); in lpfc_sli4_queue_unset()
9998 lpfc_cq_destroy(phba, qp->io_cq); in lpfc_sli4_queue_unset()
10001 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_unset()
10003 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_sli4_queue_unset()
10004 lpfc_eq_destroy(phba, eq); in lpfc_sli4_queue_unset()
10008 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_unset()
10009 phba->sli4_hba.cq_lookup = NULL; in lpfc_sli4_queue_unset()
10010 phba->sli4_hba.cq_max = 0; in lpfc_sli4_queue_unset()
10030 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
10035 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
10040 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
10045 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
10060 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
10065 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
10082 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
10086 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
10102 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
10107 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
10108 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
10109 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
10122 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
10125 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
10137 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
10141 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
10142 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
10143 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
10154 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
10163 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
10164 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
10166 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
10169 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
10170 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
10172 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
10177 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release_all()
10194 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
10205 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
10208 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
10211 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
10219 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
10222 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
10228 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
10230 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
10247 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
10258 phba->work_status[0] = readl( in lpfc_pci_function_reset()
10259 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
10260 phba->work_status[1] = readl( in lpfc_pci_function_reset()
10261 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
10262 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
10266 phba->work_status[0], in lpfc_pci_function_reset()
10267 phba->work_status[1]); in lpfc_pci_function_reset()
10281 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
10284 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
10304 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
10325 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
10327 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
10347 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
10352 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
10354 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_pci_mem_setup()
10357 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
10361 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
10369 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
10376 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10377 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
10378 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10384 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10386 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10388 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
10395 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10396 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
10397 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10403 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10412 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
10415 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10416 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
10418 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10425 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
10426 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10427 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10440 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
10442 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10443 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
10444 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10450 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10451 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10460 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
10463 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10464 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
10466 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10473 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
10474 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10475 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
10490 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
10492 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10493 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
10494 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10500 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10507 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
10508 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_write_eq_db; in lpfc_sli4_pci_mem_setup()
10509 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_write_cq_db; in lpfc_sli4_pci_mem_setup()
10512 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
10513 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_if6_write_eq_db; in lpfc_sli4_pci_mem_setup()
10514 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_if6_write_cq_db; in lpfc_sli4_pci_mem_setup()
10523 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10525 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10527 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10540 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
10543 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
10547 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10548 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10549 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10552 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10555 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10556 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10557 if (phba->sli4_hba.dpp_regs_memmap_p) in lpfc_sli4_pci_mem_unset()
10558 iounmap(phba->sli4_hba.dpp_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10562 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
10581 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
10587 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
10590 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
10600 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
10602 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
10604 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
10611 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
10613 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
10616 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
10625 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
10629 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_enable_msix()
10634 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
10637 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
10639 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
10647 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
10652 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
10656 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
10660 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
10664 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
10685 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
10689 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
10691 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
10694 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
10699 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
10700 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
10702 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
10703 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
10727 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
10734 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
10737 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
10740 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
10747 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
10748 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
10751 phba->intr_type = MSI; in lpfc_sli_enable_intr()
10757 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
10758 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
10759 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
10762 phba->intr_type = INTx; in lpfc_sli_enable_intr()
10779 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
10783 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
10789 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
10790 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
10793 phba->intr_type = NONE; in lpfc_sli_disable_intr()
10794 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
10806 lpfc_find_cpu_handle(struct lpfc_hba *phba, uint16_t id, int match) in lpfc_find_cpu_handle() argument
10813 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_find_cpu_handle()
10840 lpfc_find_hyper(struct lpfc_hba *phba, int cpu, in lpfc_find_hyper() argument
10847 cpup = &phba->sli4_hba.cpu_map[idx]; in lpfc_find_hyper()
10868 lpfc_assign_eq_map_info(struct lpfc_hba *phba, uint16_t eqidx, uint16_t flag, in lpfc_assign_eq_map_info() argument
10871 struct lpfc_vector_map_info *cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_assign_eq_map_info()
10877 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_assign_eq_map_info()
10889 lpfc_cpu_map_array_init(struct lpfc_hba *phba) in lpfc_cpu_map_array_init() argument
10896 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_map_array_init()
10902 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, cpu); in lpfc_cpu_map_array_init()
10915 lpfc_hba_eq_hdl_array_init(struct lpfc_hba *phba) in lpfc_hba_eq_hdl_array_init() argument
10920 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hba_eq_hdl_array_init()
10923 eqhdl->phba = phba; in lpfc_hba_eq_hdl_array_init()
10938 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
10959 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10964 if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id)) in lpfc_cpu_affinity_check()
10972 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
10996 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11009 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
11010 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
11034 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11047 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11060 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
11061 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
11071 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
11088 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11101 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11110 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11128 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11138 if (next_idx < phba->cfg_hdw_queue) { in lpfc_cpu_affinity_check()
11150 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
11151 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
11166 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
11167 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
11178 cpup->hdwq = idx % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
11188 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11201 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
11203 c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, cpu); in lpfc_cpu_affinity_check()
11209 cpup->hdwq = idx++ % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
11213 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
11233 lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu, in lpfc_cpuhp_get_eq() argument
11245 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_cpuhp_get_eq()
11246 maskp = pci_irq_get_affinity(phba->pcidev, idx); in lpfc_cpuhp_get_eq()
11271 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_cpuhp_get_eq()
11278 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba) in __lpfc_cpuhp_remove() argument
11280 if (phba->sli_rev != LPFC_SLI_REV4) in __lpfc_cpuhp_remove()
11284 &phba->cpuhp); in __lpfc_cpuhp_remove()
11290 del_timer_sync(&phba->cpuhp_poll_timer); in __lpfc_cpuhp_remove()
11293 static void lpfc_cpuhp_remove(struct lpfc_hba *phba) in lpfc_cpuhp_remove() argument
11295 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_cpuhp_remove()
11298 __lpfc_cpuhp_remove(phba); in lpfc_cpuhp_remove()
11301 static void lpfc_cpuhp_add(struct lpfc_hba *phba) in lpfc_cpuhp_add() argument
11303 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cpuhp_add()
11308 if (!list_empty(&phba->poll_list)) in lpfc_cpuhp_add()
11309 mod_timer(&phba->cpuhp_poll_timer, in lpfc_cpuhp_add()
11315 &phba->cpuhp); in lpfc_cpuhp_add()
11318 static int __lpfc_cpuhp_checks(struct lpfc_hba *phba, int *retval) in __lpfc_cpuhp_checks() argument
11320 if (phba->pport->load_flag & FC_UNLOADING) { in __lpfc_cpuhp_checks()
11325 if (phba->sli_rev != LPFC_SLI_REV4) { in __lpfc_cpuhp_checks()
11378 lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline) in lpfc_irq_rebalance() argument
11385 if (phba->irq_chann_mode == NORMAL_MODE) in lpfc_irq_rebalance()
11388 orig_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_rebalance()
11393 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_irq_rebalance()
11408 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_irq_rebalance()
11418 for (idx = 0; idx < phba->cfg_irq_chann; idx++) in lpfc_irq_rebalance()
11429 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_offline() local
11434 if (!phba) { in lpfc_cpu_offline()
11435 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_offline()
11439 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_offline()
11442 lpfc_irq_rebalance(phba, cpu, true); in lpfc_cpu_offline()
11444 retval = lpfc_cpuhp_get_eq(phba, cpu, &eqlist); in lpfc_cpu_offline()
11459 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_online() local
11464 if (!phba) { in lpfc_cpu_online()
11465 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_online()
11469 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_online()
11472 lpfc_irq_rebalance(phba, cpu, false); in lpfc_cpu_online()
11474 list_for_each_entry_safe(eq, next, &phba->poll_list, _poll_list) { in lpfc_cpu_online()
11475 n = lpfc_find_cpu_handle(phba, eq->hdwq, LPFC_FIND_BY_HDWQ); in lpfc_cpu_online()
11512 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
11524 vectors = phba->cfg_irq_chann; in lpfc_sli4_enable_msix()
11526 if (phba->irq_chann_mode != NORMAL_MODE) in lpfc_sli4_enable_msix()
11527 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_sli4_enable_msix()
11531 vectors = min(phba->cfg_irq_chann, cpu_cnt); in lpfc_sli4_enable_msix()
11542 rc = pci_alloc_irq_vectors(phba->pcidev, 1, vectors, flags); in lpfc_sli4_enable_msix()
11544 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
11559 rc = request_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_enable_msix()
11563 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
11569 eqhdl->irq = pci_irq_vector(phba->pcidev, index); in lpfc_sli4_enable_msix()
11577 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
11588 lpfc_assign_eq_map_info(phba, index, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_msix()
11591 maskp = pci_irq_get_affinity(phba->pcidev, index); in lpfc_sli4_enable_msix()
11595 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_enable_msix()
11611 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
11619 if (vectors != phba->cfg_irq_chann) { in lpfc_sli4_enable_msix()
11620 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_enable_msix()
11623 phba->cfg_irq_chann, vectors); in lpfc_sli4_enable_msix()
11624 if (phba->cfg_irq_chann > vectors) in lpfc_sli4_enable_msix()
11625 phba->cfg_irq_chann = vectors; in lpfc_sli4_enable_msix()
11640 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
11661 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
11667 rc = pci_alloc_irq_vectors(phba->pcidev, 1, 1, in lpfc_sli4_enable_msi()
11670 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
11673 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
11678 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
11679 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
11681 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
11682 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
11688 eqhdl->irq = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_msi()
11691 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); in lpfc_sli4_enable_msi()
11693 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_enable_msi()
11719 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
11729 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
11732 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
11739 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
11740 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
11743 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
11749 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
11750 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
11751 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
11757 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
11761 eqhdl->irq = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_intr()
11764 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_intr()
11766 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_enable_intr()
11785 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
11788 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
11793 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_disable_intr()
11800 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
11803 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
11806 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
11807 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
11818 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
11820 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
11827 kfree(phba->vpi_bmask); in lpfc_unset_hba()
11828 kfree(phba->vpi_ids); in lpfc_unset_hba()
11830 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
11832 phba->pport->work_port_events = 0; in lpfc_unset_hba()
11834 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
11836 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
11838 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
11857 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
11864 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
11873 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
11874 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
11877 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
11878 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
11886 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
11888 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
11894 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
11899 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
11904 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
11916 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
11917 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
11926 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
11928 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
11931 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
11947 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
11951 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
11953 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
11954 if (phba->pport) in lpfc_sli4_hba_unset()
11955 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
11963 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11964 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
11965 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11967 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
11973 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
11974 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11975 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
11977 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
11978 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
11979 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
11980 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11984 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
11987 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
11990 if (phba->pport) in lpfc_sli4_hba_unset()
11991 lpfc_cpuhp_remove(phba); in lpfc_sli4_hba_unset()
11994 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
11997 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
12001 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
12004 lpfc_ras_stop_fwlog(phba); in lpfc_sli4_hba_unset()
12009 lpfc_sli4_queue_unset(phba); in lpfc_sli4_hba_unset()
12010 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
12013 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
12016 if (phba->ras_fwlog.ras_enabled) in lpfc_sli4_hba_unset()
12017 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_hba_unset()
12020 if (phba->pport) in lpfc_sli4_hba_unset()
12021 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
12037 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
12052 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
12057 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
12060 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
12061 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
12063 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
12064 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
12068 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
12078 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
12080 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
12099 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
12100 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
12103 phba->cfg_xpsgl = bf_get(cfg_xpsgl, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
12114 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) { in lpfc_get_sli4_parameters()
12115 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
12118 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
12124 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
12125 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
12130 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
12132 phba->nvme_support = 0; in lpfc_get_sli4_parameters()
12133 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
12134 phba->cfg_nvmet_mrq = 0; in lpfc_get_sli4_parameters()
12135 phba->cfg_nvme_seg_cnt = 0; in lpfc_get_sli4_parameters()
12138 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
12140 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
12147 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_get_sli4_parameters()
12148 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_get_sli4_parameters()
12151 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_get_sli4_parameters()
12153 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
12163 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
12165 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
12167 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
12170 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
12182 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
12184 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
12186 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
12189 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
12190 phba->fcp_embed_io, phba->nvme_support, in lpfc_get_sli4_parameters()
12191 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
12193 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
12195 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
12203 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
12205 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
12210 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
12212 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
12218 phba->nsler = 1; in lpfc_get_sli4_parameters()
12220 phba->nsler = 0; in lpfc_get_sli4_parameters()
12245 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
12252 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
12253 if (!phba) in lpfc_pci_probe_one_s3()
12257 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
12262 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
12267 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
12269 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12275 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
12277 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12284 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
12286 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12292 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
12294 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12300 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
12303 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
12305 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12311 vport = phba->pport; in lpfc_pci_probe_one_s3()
12314 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
12321 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
12324 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
12326 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
12328 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
12334 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
12335 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
12345 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
12347 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
12348 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
12351 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
12356 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
12363 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
12366 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
12371 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
12375 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
12377 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
12379 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
12381 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
12383 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
12385 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
12389 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
12408 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
12411 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
12413 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
12418 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
12420 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
12425 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
12440 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
12442 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
12444 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
12446 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
12447 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
12449 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
12450 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
12452 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
12457 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
12461 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
12469 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
12470 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s3()
12472 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
12475 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
12479 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
12482 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
12483 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
12485 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
12516 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
12518 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
12522 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
12523 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
12524 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
12527 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
12559 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
12563 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
12580 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
12581 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
12582 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
12583 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
12584 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
12591 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
12593 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s3()
12597 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
12600 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
12601 lpfc_online(phba); in lpfc_pci_resume_one_s3()
12604 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
12617 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
12619 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_recover()
12626 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
12638 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
12640 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_reset()
12644 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
12647 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
12650 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_reset()
12653 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
12656 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
12657 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
12669 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
12671 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_perm_failure()
12674 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
12677 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
12680 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
12705 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
12710 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
12714 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
12718 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
12722 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s3()
12724 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
12751 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
12752 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
12773 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
12775 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
12778 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
12780 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s3()
12785 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
12788 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
12789 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
12790 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
12793 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
12812 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
12815 lpfc_online(phba); in lpfc_io_resume_s3()
12825 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
12827 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
12829 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
12855 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
12857 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
12859 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
12866 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
12879 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC && in lpfc_log_write_firmware_error()
12881 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC && in lpfc_log_write_firmware_error()
12883 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
12887 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
12891 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
12896 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
12900 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
12904 offset, phba->pcidev->device, magic_number, in lpfc_log_write_firmware_error()
12920 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
12942 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
12944 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
12955 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
12980 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
12983 rc = lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
12994 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
13002 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
13009 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
13012 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
13025 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
13032 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
13036 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
13040 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
13041 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
13044 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
13046 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
13075 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
13082 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
13083 if (!phba) in lpfc_pci_probe_one_s4()
13086 INIT_LIST_HEAD(&phba->poll_list); in lpfc_pci_probe_one_s4()
13089 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
13094 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
13099 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
13101 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13107 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
13109 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13114 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
13115 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
13118 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
13120 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13126 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
13129 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
13132 phba->pport = NULL; in lpfc_pci_probe_one_s4()
13133 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
13136 lpfc_cpu_map_array_init(phba); in lpfc_pci_probe_one_s4()
13139 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_probe_one_s4()
13142 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
13144 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
13150 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
13151 phba->cfg_irq_chann = 1; in lpfc_pci_probe_one_s4()
13152 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
13153 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
13154 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
13157 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_pci_probe_one_s4()
13160 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
13162 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13166 vport = phba->pport; in lpfc_pci_probe_one_s4()
13172 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
13178 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
13179 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
13186 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
13187 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
13190 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
13195 if (phba->nvmet_support == 0) { in lpfc_pci_probe_one_s4()
13196 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
13204 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
13213 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
13214 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
13217 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
13220 lpfc_sli4_ras_setup(phba); in lpfc_pci_probe_one_s4()
13222 timer_setup(&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer, 0); in lpfc_pci_probe_one_s4()
13223 cpuhp_state_add_instance_nocalls(lpfc_cpuhp_state, &phba->cpuhp); in lpfc_pci_probe_one_s4()
13230 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
13232 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
13234 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
13236 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
13238 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
13240 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
13244 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
13263 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
13267 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
13269 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
13275 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
13277 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
13282 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
13292 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
13296 if (phba->cfg_xri_rebalancing) in lpfc_pci_remove_one_s4()
13297 lpfc_destroy_multixri_pools(phba); in lpfc_pci_remove_one_s4()
13306 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
13307 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
13309 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
13314 lpfc_io_free(phba); in lpfc_pci_remove_one_s4()
13315 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
13316 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
13318 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
13319 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
13322 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
13326 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
13329 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
13359 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
13361 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
13365 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
13366 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
13367 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
13370 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
13371 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
13403 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
13407 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
13424 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
13425 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
13426 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
13427 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
13428 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
13435 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
13437 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s4()
13441 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
13444 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
13445 lpfc_online(phba); in lpfc_pci_resume_one_s4()
13448 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
13461 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
13463 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_recover()
13469 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
13481 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
13483 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_reset()
13487 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
13490 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_reset()
13493 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_reset()
13496 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
13499 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
13500 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
13501 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
13513 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
13515 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_perm_failure()
13519 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
13522 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
13525 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
13548 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
13553 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
13557 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
13561 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
13565 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s4()
13567 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
13594 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
13595 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
13616 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
13618 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
13621 lpfc_cpu_map_array_init(phba); in lpfc_io_slot_reset_s4()
13623 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
13625 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s4()
13630 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
13633 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
13652 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
13660 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
13662 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_resume_s4()
13663 lpfc_offline(phba); in lpfc_io_resume_s4()
13664 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
13666 lpfc_online(phba); in lpfc_io_resume_s4()
13720 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
13722 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
13730 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_remove_one()
13732 phba->pci_dev_grp); in lpfc_pci_remove_one()
13756 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
13759 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
13767 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_suspend_one()
13769 phba->pci_dev_grp); in lpfc_pci_suspend_one()
13792 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
13795 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
13803 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one()
13805 phba->pci_dev_grp); in lpfc_pci_resume_one()
13830 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
13833 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
13841 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected()
13843 phba->pci_dev_grp); in lpfc_io_error_detected()
13867 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
13870 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
13878 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset()
13880 phba->pci_dev_grp); in lpfc_io_slot_reset()
13900 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
13902 switch (phba->pci_dev_grp) { in lpfc_io_resume()
13910 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_resume()
13912 phba->pci_dev_grp); in lpfc_io_resume()
13929 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
13932 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
13935 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
13936 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
13938 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
13939 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
13940 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
13954 lpfc_sli4_ras_init(struct lpfc_hba *phba) in lpfc_sli4_ras_init() argument
13956 switch (phba->pcidev->device) { in lpfc_sli4_ras_init()
13959 phba->ras_fwlog.ras_hwsupport = true; in lpfc_sli4_ras_init()
13960 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && in lpfc_sli4_ras_init()
13961 phba->cfg_ras_fwlog_buffsize) in lpfc_sli4_ras_init()
13962 phba->ras_fwlog.ras_enabled = true; in lpfc_sli4_ras_init()
13964 phba->ras_fwlog.ras_enabled = false; in lpfc_sli4_ras_init()
13967 phba->ras_fwlog.ras_hwsupport = false; in lpfc_sli4_ras_init()
14069 void lpfc_dmp_dbg(struct lpfc_hba *phba) in lpfc_dmp_dbg() argument
14078 if (phba->cfg_log_verbose) in lpfc_dmp_dbg()
14081 if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0) in lpfc_dmp_dbg()
14084 start_idx = (unsigned int)atomic_read(&phba->dbg_log_idx) % DBG_LOG_SZ; in lpfc_dmp_dbg()
14085 dbg_cnt = (unsigned int)atomic_read(&phba->dbg_log_cnt); in lpfc_dmp_dbg()
14100 dev_info(&phba->pcidev->dev, "start %d end %d cnt %d\n", in lpfc_dmp_dbg()
14108 rem_nsec = do_div(phba->dbg_log[temp_idx].t_ns, NSEC_PER_SEC); in lpfc_dmp_dbg()
14109 dev_info(&phba->pcidev->dev, "%d: [%5lu.%06lu] %s", in lpfc_dmp_dbg()
14111 (unsigned long)phba->dbg_log[temp_idx].t_ns, in lpfc_dmp_dbg()
14113 phba->dbg_log[temp_idx].log); in lpfc_dmp_dbg()
14115 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_dmp_dbg()
14116 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_dmp_dbg()
14120 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...) in lpfc_dbg_print() argument
14124 int dbg_dmping = atomic_read(&phba->dbg_log_dmping); in lpfc_dbg_print()
14132 dev_info(&phba->pcidev->dev, "%pV", &vaf); in lpfc_dbg_print()
14136 idx = (unsigned int)atomic_fetch_add(1, &phba->dbg_log_idx) % in lpfc_dbg_print()
14139 atomic_inc(&phba->dbg_log_cnt); in lpfc_dbg_print()
14141 vscnprintf(phba->dbg_log[idx].log, in lpfc_dbg_print()
14142 sizeof(phba->dbg_log[idx].log), fmt, args); in lpfc_dbg_print()
14145 phba->dbg_log[idx].t_ns = local_clock(); in lpfc_dbg_print()