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);
97 static void lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba);
103 static int lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport);
104 static void lpfc_cgn_update_tstamp(struct lpfc_hba *phba, struct lpfc_cgn_ts *ts);
121 lpfc_config_port_prep(struct lpfc_hba *phba) in lpfc_config_port_prep() argument
123 lpfc_vpd_t *vp = &phba->vpd; in lpfc_config_port_prep()
133 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_prep()
135 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_prep()
140 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_config_port_prep()
142 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port_prep()
151 lpfc_read_nv(phba, pmb); in lpfc_config_port_prep()
157 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
160 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
165 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
168 memcpy(phba->wwnn, (char *)mb->un.varRDnvp.nodename, in lpfc_config_port_prep()
169 sizeof(phba->wwnn)); in lpfc_config_port_prep()
170 memcpy(phba->wwpn, (char *)mb->un.varRDnvp.portname, in lpfc_config_port_prep()
171 sizeof(phba->wwpn)); in lpfc_config_port_prep()
178 phba->sli3_options &= (uint32_t)LPFC_SLI3_BG_ENABLED; in lpfc_config_port_prep()
181 lpfc_read_rev(phba, pmb); in lpfc_config_port_prep()
182 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
184 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
188 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
199 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
202 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
206 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) { in lpfc_config_port_prep()
207 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
234 phba->sli3_options |= LPFC_SLI3_VPORT_TEARDOWN; in lpfc_config_port_prep()
236 if (lpfc_is_LC_HBA(phba->pcidev->device)) in lpfc_config_port_prep()
237 memcpy(phba->RandomData, (char *)&mb->un.varWords[24], in lpfc_config_port_prep()
238 sizeof (phba->RandomData)); in lpfc_config_port_prep()
245 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD); in lpfc_config_port_prep()
246 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
249 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_config_port_prep()
269 lpfc_parse_vpd(phba, lpfc_vpd_data, offset); in lpfc_config_port_prep()
273 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
288 lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_config_async_cmpl() argument
291 phba->temp_sensor_support = 1; in lpfc_config_async_cmpl()
293 phba->temp_sensor_support = 0; in lpfc_config_async_cmpl()
294 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_config_async_cmpl()
309 lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_dump_wakeup_param_cmpl() argument
318 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
331 snprintf(phba->OptionROMVersion, 32, "%d.%d%d", in lpfc_dump_wakeup_param_cmpl()
334 snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", in lpfc_dump_wakeup_param_cmpl()
337 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
352 struct lpfc_hba *phba = vport->phba; in lpfc_update_vport_wwn() local
374 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_update_vport_wwn()
376 phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_FABRIC) { in lpfc_update_vport_wwn()
377 if (!(phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG)) in lpfc_update_vport_wwn()
378 phba->sli4_hba.fawwpn_flag &= in lpfc_update_vport_wwn()
380 lpfc_printf_log(phba, KERN_INFO, in lpfc_update_vport_wwn()
388 phba->sli4_hba.fawwpn_flag); in lpfc_update_vport_wwn()
416 lpfc_config_port_post(struct lpfc_hba *phba) in lpfc_config_port_post() argument
418 struct lpfc_vport *vport = phba->pport; in lpfc_config_port_post()
423 struct lpfc_sli *psli = &phba->sli; in lpfc_config_port_post()
428 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
433 if (phba->over_temp_state == HBA_OVER_TEMP) in lpfc_config_port_post()
434 phba->over_temp_state = HBA_NORMAL_TEMP; in lpfc_config_port_post()
435 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
437 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
439 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
445 rc = lpfc_read_sparam(phba, pmb, 0); in lpfc_config_port_post()
447 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
452 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
453 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
457 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
458 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_config_port_post()
469 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
477 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_config_port_post()
481 if (phba->SerialNumber[0] == 0) { in lpfc_config_port_post()
489 phba->SerialNumber[i] = in lpfc_config_port_post()
492 phba->SerialNumber[i] = in lpfc_config_port_post()
497 phba->SerialNumber[i] = in lpfc_config_port_post()
500 phba->SerialNumber[i] = in lpfc_config_port_post()
505 lpfc_read_config(phba, pmb); in lpfc_config_port_post()
507 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
508 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
512 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
513 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
518 lpfc_sli_read_link_ste(phba); in lpfc_config_port_post()
521 if (phba->cfg_hba_queue_depth > mb->un.varRdConfig.max_xri) { in lpfc_config_port_post()
522 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
524 phba->cfg_hba_queue_depth, in lpfc_config_port_post()
526 phba->cfg_hba_queue_depth = mb->un.varRdConfig.max_xri; in lpfc_config_port_post()
529 phba->lmt = mb->un.varRdConfig.lmt; in lpfc_config_port_post()
532 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_config_port_post()
534 phba->link_state = LPFC_LINK_DOWN; in lpfc_config_port_post()
543 if (phba->sli_rev != 3) in lpfc_config_port_post()
544 lpfc_post_rcv_buf(phba); in lpfc_config_port_post()
549 if (phba->intr_type == MSIX) { in lpfc_config_port_post()
550 rc = lpfc_config_msi(phba, pmb); in lpfc_config_port_post()
552 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
555 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_post()
557 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
562 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
567 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
569 phba->hba_flag &= ~HBA_ERATT_HANDLED; in lpfc_config_port_post()
572 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_config_port_post()
573 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
586 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && in lpfc_config_port_post()
587 (phba->cfg_poll & DISABLE_FCP_RING_INT)) in lpfc_config_port_post()
590 writel(status, phba->HCregaddr); in lpfc_config_port_post()
591 readl(phba->HCregaddr); /* flush */ in lpfc_config_port_post()
592 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
595 timeout = phba->fc_ratov * 2; in lpfc_config_port_post()
599 mod_timer(&phba->hb_tmofunc, in lpfc_config_port_post()
601 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_config_port_post()
602 phba->last_completion_time = jiffies; in lpfc_config_port_post()
604 mod_timer(&phba->eratt_poll, in lpfc_config_port_post()
605 jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); in lpfc_config_port_post()
607 if (phba->hba_flag & LINK_DISABLED) { in lpfc_config_port_post()
608 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
610 lpfc_down_link(phba, pmb); in lpfc_config_port_post()
612 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
614 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
618 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
621 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_config_port_post()
622 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
623 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_config_port_post()
628 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
630 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
634 lpfc_config_async(phba, pmb, LPFC_ELS_RING); in lpfc_config_port_post()
636 pmb->vport = phba->pport; in lpfc_config_port_post()
637 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
640 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
644 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
648 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
650 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
654 lpfc_dump_wakeup_param(phba, pmb); in lpfc_config_port_post()
656 pmb->vport = phba->pport; in lpfc_config_port_post()
657 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
660 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
663 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
677 lpfc_sli4_refresh_params(struct lpfc_hba *phba) in lpfc_sli4_refresh_params() argument
684 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_refresh_params()
692 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_refresh_params()
696 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_refresh_params()
698 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_refresh_params()
702 phba->sli4_hba.pc_sli4_params.mi_cap = in lpfc_sli4_refresh_params()
706 if (phba->cfg_enable_mi) in lpfc_sli4_refresh_params()
707 phba->sli4_hba.pc_sli4_params.mi_ver = in lpfc_sli4_refresh_params()
710 phba->sli4_hba.pc_sli4_params.mi_ver = 0; in lpfc_sli4_refresh_params()
712 phba->sli4_hba.pc_sli4_params.cmf = in lpfc_sli4_refresh_params()
714 phba->sli4_hba.pc_sli4_params.pls = in lpfc_sli4_refresh_params()
717 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_refresh_params()
736 lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_init_link() argument
738 return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); in lpfc_hba_init_link()
757 lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, in lpfc_hba_init_link_fc_topology() argument
760 struct lpfc_vport *vport = phba->pport; in lpfc_hba_init_link_fc_topology()
765 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_init_link_fc_topology()
767 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
773 if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || in lpfc_hba_init_link_fc_topology()
774 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && in lpfc_hba_init_link_fc_topology()
775 !(phba->lmt & LMT_1Gb)) || in lpfc_hba_init_link_fc_topology()
776 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && in lpfc_hba_init_link_fc_topology()
777 !(phba->lmt & LMT_2Gb)) || in lpfc_hba_init_link_fc_topology()
778 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && in lpfc_hba_init_link_fc_topology()
779 !(phba->lmt & LMT_4Gb)) || in lpfc_hba_init_link_fc_topology()
780 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && in lpfc_hba_init_link_fc_topology()
781 !(phba->lmt & LMT_8Gb)) || in lpfc_hba_init_link_fc_topology()
782 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && in lpfc_hba_init_link_fc_topology()
783 !(phba->lmt & LMT_10Gb)) || in lpfc_hba_init_link_fc_topology()
784 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && in lpfc_hba_init_link_fc_topology()
785 !(phba->lmt & LMT_16Gb)) || in lpfc_hba_init_link_fc_topology()
786 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && in lpfc_hba_init_link_fc_topology()
787 !(phba->lmt & LMT_32Gb)) || in lpfc_hba_init_link_fc_topology()
788 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) && in lpfc_hba_init_link_fc_topology()
789 !(phba->lmt & LMT_64Gb))) { in lpfc_hba_init_link_fc_topology()
791 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
794 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
795 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
797 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
799 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
800 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
801 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
803 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
807 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
809 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
810 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
812 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
813 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
815 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
817 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
820 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
822 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
841 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
846 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
848 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
852 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
854 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
856 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
858 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
862 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
866 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
883 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
888 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
890 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
891 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
894 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_hba_down_prep()
895 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
897 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
899 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
902 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
921 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
927 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
928 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli4_free_sp_events()
929 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
931 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli4_free_sp_events()
933 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
934 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli4_free_sp_events()
936 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
942 lpfc_sli_release_iocbq(phba, rspiocbq); in lpfc_sli4_free_sp_events()
948 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_free_sp_events()
965 lpfc_hba_free_post_buf(struct lpfc_hba *phba) in lpfc_hba_free_post_buf() argument
967 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_free_post_buf()
973 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) in lpfc_hba_free_post_buf()
974 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_free_post_buf()
978 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
980 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
986 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_hba_free_post_buf()
990 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
992 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
1007 lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) in lpfc_hba_clean_txcmplq() argument
1009 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_clean_txcmplq()
1016 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_hba_clean_txcmplq()
1019 spin_lock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
1026 spin_unlock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
1028 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
1031 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
1035 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_hba_clean_txcmplq()
1046 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
1049 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
1065 lpfc_hba_down_post_s3(struct lpfc_hba *phba) in lpfc_hba_down_post_s3() argument
1067 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s3()
1068 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s3()
1084 lpfc_hba_down_post_s4(struct lpfc_hba *phba) in lpfc_hba_down_post_s4() argument
1096 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_down_post_s4()
1097 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s4()
1109 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1111 &phba->sli4_hba.lpfc_abts_els_sgl_list, list) in lpfc_hba_down_post_s4()
1114 list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, in lpfc_hba_down_post_s4()
1115 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_hba_down_post_s4()
1118 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1123 spin_lock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1125 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_hba_down_post_s4()
1126 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_hba_down_post_s4()
1146 spin_unlock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1148 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_hba_down_post_s4()
1149 spin_lock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1150 list_splice_init(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list, in lpfc_hba_down_post_s4()
1152 spin_unlock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1155 lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf); in lpfc_hba_down_post_s4()
1159 lpfc_sli4_free_sp_events(phba); in lpfc_hba_down_post_s4()
1175 lpfc_hba_down_post(struct lpfc_hba *phba) in lpfc_hba_down_post() argument
1177 return (*phba->lpfc_hba_down_post)(phba); in lpfc_hba_down_post()
1195 struct lpfc_hba *phba; in lpfc_hb_timeout() local
1199 phba = from_timer(phba, t, hb_tmofunc); in lpfc_hb_timeout()
1202 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1203 tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; in lpfc_hb_timeout()
1205 phba->pport->work_port_events |= WORKER_HB_TMO; in lpfc_hb_timeout()
1206 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1210 lpfc_worker_wake_up(phba); in lpfc_hb_timeout()
1229 struct lpfc_hba *phba; in lpfc_rrq_timeout() local
1232 phba = from_timer(phba, t, rrq_tmr); in lpfc_rrq_timeout()
1233 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1234 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1235 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1237 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1238 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1240 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1241 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1261 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1265 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1266 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_hb_mbox_cmpl()
1267 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1270 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1271 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && in lpfc_hb_mbox_cmpl()
1272 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1273 !(phba->pport->load_flag & FC_UNLOADING)) in lpfc_hb_mbox_cmpl()
1274 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1291 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_idle_stat_delay_work() local
1300 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_idle_stat_delay_work()
1303 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_idle_stat_delay_work()
1304 phba->pport->fc_flag & FC_OFFLINE_MODE || in lpfc_idle_stat_delay_work()
1305 phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_idle_stat_delay_work()
1309 hdwq = &phba->sli4_hba.hdwq[phba->sli4_hba.cpu_map[i].hdwq]; in lpfc_idle_stat_delay_work()
1316 idle_stat = &phba->sli4_hba.idle_stat[i]; in lpfc_idle_stat_delay_work()
1346 schedule_delayed_work(&phba->idle_stat_delay_work, in lpfc_idle_stat_delay_work()
1353 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_hb_eq_delay_work() local
1361 if (!phba->cfg_auto_imax || phba->pport->load_flag & FC_UNLOADING) in lpfc_hb_eq_delay_work()
1364 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_hb_eq_delay_work()
1365 phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_hb_eq_delay_work()
1368 ena_delay = kcalloc(phba->sli4_hba.num_possible_cpu, sizeof(*ena_delay), in lpfc_hb_eq_delay_work()
1373 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hb_eq_delay_work()
1375 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_hb_eq_delay_work()
1385 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_hb_eq_delay_work()
1398 eqi_new = per_cpu_ptr(phba->sli4_hba.eq_info, in lpfc_hb_eq_delay_work()
1404 lpfc_modify_hba_eq_delay(phba, eq->hdwq, 1, in lpfc_hb_eq_delay_work()
1412 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_hb_eq_delay_work()
1423 static void lpfc_hb_mxp_handler(struct lpfc_hba *phba) in lpfc_hb_mxp_handler() argument
1428 hwq_count = phba->cfg_hdw_queue; in lpfc_hb_mxp_handler()
1431 lpfc_adjust_pvt_pool_count(phba, i); in lpfc_hb_mxp_handler()
1434 lpfc_adjust_high_watermark(phba, i); in lpfc_hb_mxp_handler()
1438 lpfc_snapshot_mxp(phba, i); in lpfc_hb_mxp_handler()
1452 lpfc_issue_hb_mbox(struct lpfc_hba *phba) in lpfc_issue_hb_mbox() argument
1458 if (phba->hba_flag & HBA_HBEAT_INP) in lpfc_issue_hb_mbox()
1461 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_issue_hb_mbox()
1465 lpfc_heart_beat(phba, pmboxq); in lpfc_issue_hb_mbox()
1467 pmboxq->vport = phba->pport; in lpfc_issue_hb_mbox()
1468 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); in lpfc_issue_hb_mbox()
1471 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_hb_mbox()
1474 phba->hba_flag |= HBA_HBEAT_INP; in lpfc_issue_hb_mbox()
1490 lpfc_issue_hb_tmo(struct lpfc_hba *phba) in lpfc_issue_hb_tmo() argument
1492 if (phba->cfg_enable_hba_heartbeat) in lpfc_issue_hb_tmo()
1494 phba->hba_flag |= HBA_HBEAT_TMO; in lpfc_issue_hb_tmo()
1514 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1520 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1523 if (phba->cfg_xri_rebalancing) { in lpfc_hb_timeout_handler()
1525 lpfc_hb_mxp_handler(phba); in lpfc_hb_timeout_handler()
1528 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1530 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_hb_timeout_handler()
1534 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1536 if ((phba->link_state == LPFC_HBA_ERROR) || in lpfc_hb_timeout_handler()
1537 (phba->pport->load_flag & FC_UNLOADING) || in lpfc_hb_timeout_handler()
1538 (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_hb_timeout_handler()
1541 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1542 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1543 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1544 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1545 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1546 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1547 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1552 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1556 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1559 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1561 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1562 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1565 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1566 if (phba->hba_flag & HBA_HBEAT_INP) in lpfc_hb_timeout_handler()
1572 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1575 if (phba->hba_flag & HBA_HBEAT_INP) { in lpfc_hb_timeout_handler()
1581 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1585 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1591 retval = lpfc_issue_hb_mbox(phba); in lpfc_hb_timeout_handler()
1596 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1597 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1598 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1599 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1603 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1605 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1612 if (phba->hba_flag & HBA_HBEAT_TMO) { in lpfc_hb_timeout_handler()
1613 retval = lpfc_issue_hb_mbox(phba); in lpfc_hb_timeout_handler()
1623 mod_timer(&phba->hb_tmofunc, jiffies + msecs_to_jiffies(tmo)); in lpfc_hb_timeout_handler()
1634 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1636 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1638 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1640 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1641 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1643 lpfc_offline(phba); in lpfc_offline_eratt()
1644 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1645 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1646 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1647 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1648 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1649 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1650 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1651 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1663 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1665 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1666 if (phba->link_state == LPFC_HBA_ERROR && in lpfc_sli4_offline_eratt()
1667 test_bit(HBA_PCI_ERR, &phba->bit_flags)) { in lpfc_sli4_offline_eratt()
1668 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1671 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1672 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1674 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1675 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_offline_eratt()
1676 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1677 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1678 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1691 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1693 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1694 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1699 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1700 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1701 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1702 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1706 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_deferred_eratt()
1709 phba->work_hs, phba->work_status[0], in lpfc_handle_deferred_eratt()
1710 phba->work_status[1]); in lpfc_handle_deferred_eratt()
1712 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1714 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1722 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1728 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1729 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1732 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1734 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1735 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1739 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_handle_deferred_eratt()
1740 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1750 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_deferred_eratt()
1751 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1753 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1754 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1755 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1756 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1757 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1761 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1768 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1786 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1788 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1789 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1798 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1799 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1800 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_eratt_s3()
1801 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1806 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1810 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1812 if (phba->hba_flag & DEFER_ERATT) in lpfc_handle_eratt_s3()
1813 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1815 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1816 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1818 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1821 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1822 phba->work_status[1]); in lpfc_handle_eratt_s3()
1823 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1825 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1828 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1829 phba->work_status[1]); in lpfc_handle_eratt_s3()
1831 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1833 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1841 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1847 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1848 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1849 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1850 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1851 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1854 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1855 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1856 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1861 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1865 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1866 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1868 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1875 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1876 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1877 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1878 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1885 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1888 phba->work_hs, in lpfc_handle_eratt_s3()
1889 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1897 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1914 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1921 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_port_sta_fn_reset()
1927 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1934 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_port_sta_fn_reset()
1943 spin_lock_irq(&phba->hbalock); in lpfc_sli4_port_sta_fn_reset()
1944 phba->sli.sli_flag &= ~LPFC_SLI_ACTIVE; in lpfc_sli4_port_sta_fn_reset()
1945 if (phba->sli.mbox_active) { in lpfc_sli4_port_sta_fn_reset()
1946 mboxq = phba->sli.mbox_active; in lpfc_sli4_port_sta_fn_reset()
1948 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_port_sta_fn_reset()
1949 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_port_sta_fn_reset()
1950 phba->sli.mbox_active = NULL; in lpfc_sli4_port_sta_fn_reset()
1952 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_port_sta_fn_reset()
1955 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1956 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_port_sta_fn_reset()
1957 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1959 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1960 rc = lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1962 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1967 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1969 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1973 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1974 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1976 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1989 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1991 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
2007 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s4()
2008 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2010 lpfc_sli_flush_io_rings(phba); in lpfc_handle_eratt_s4()
2015 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_handle_eratt_s4()
2019 phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_handle_eratt_s4()
2022 phba->sli4_hba.u.if_type0.UEMASKLOregaddr, in lpfc_handle_eratt_s4()
2027 if (!(phba->hba_flag & HBA_RECOVERABLE_UE)) { in lpfc_handle_eratt_s4()
2028 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2031 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2034 for (i = 0; i < phba->sli4_hba.ue_to_sr / 1000; i++) { in lpfc_handle_eratt_s4()
2035 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
2048 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2057 if (!lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
2062 rc = lpfc_sli4_port_sta_fn_reset(phba, in lpfc_handle_eratt_s4()
2066 lpfc_printf_log(phba, KERN_ERR, in lpfc_handle_eratt_s4()
2073 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2076 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
2082 phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_handle_eratt_s4()
2086 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2088 readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); in lpfc_handle_eratt_s4()
2089 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2092 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
2093 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
2095 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2100 phba->sfp_alarm |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_handle_eratt_s4()
2105 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
2112 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
2113 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
2114 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
2115 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2120 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_handle_eratt_s4()
2126 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_handle_eratt_s4()
2130 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2134 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
2138 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
2149 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2151 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2157 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_handle_eratt_s4()
2160 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s4()
2181 lpfc_handle_eratt(struct lpfc_hba *phba) in lpfc_handle_eratt() argument
2183 (*phba->lpfc_handle_eratt)(phba); in lpfc_handle_eratt()
2194 lpfc_handle_latt(struct lpfc_hba *phba) in lpfc_handle_latt() argument
2196 struct lpfc_vport *vport = phba->pport; in lpfc_handle_latt()
2197 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_latt()
2202 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_handle_latt()
2208 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_handle_latt()
2211 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_handle_latt()
2216 lpfc_els_flush_all_cmd(phba); in lpfc_handle_latt()
2218 lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); in lpfc_handle_latt()
2222 phba->sli.sli3_ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2223 rc = lpfc_sli_issue_mbox (phba, pmb, MBX_NOWAIT); in lpfc_handle_latt()
2230 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2231 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2232 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2233 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2238 phba->sli.sli3_ring[LPFC_ELS_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2239 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_handle_latt()
2242 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2244 control = readl(phba->HCregaddr); in lpfc_handle_latt()
2246 writel(control, phba->HCregaddr); in lpfc_handle_latt()
2247 readl(phba->HCregaddr); /* flush */ in lpfc_handle_latt()
2250 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2251 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2252 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2253 lpfc_linkdown(phba); in lpfc_handle_latt()
2254 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_latt()
2256 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_latt()
2263 lpfc_fill_vpd(struct lpfc_hba *phba, uint8_t *vpd, int length, int *pindex) in lpfc_fill_vpd() argument
2276 phba->SerialNumber[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2280 phba->SerialNumber[j] = 0; in lpfc_fill_vpd()
2283 phba->vpd_flag |= VPD_MODEL_DESC; in lpfc_fill_vpd()
2290 phba->ModelDesc[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2294 phba->ModelDesc[j] = 0; in lpfc_fill_vpd()
2297 phba->vpd_flag |= VPD_MODEL_NAME; in lpfc_fill_vpd()
2304 phba->ModelName[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2308 phba->ModelName[j] = 0; in lpfc_fill_vpd()
2311 phba->vpd_flag |= VPD_PROGRAM_TYPE; in lpfc_fill_vpd()
2318 phba->ProgramType[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2322 phba->ProgramType[j] = 0; in lpfc_fill_vpd()
2325 phba->vpd_flag |= VPD_PORT; in lpfc_fill_vpd()
2332 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_fill_vpd()
2333 (phba->sli4_hba.pport_name_sta == in lpfc_fill_vpd()
2338 phba->Port[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2342 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fill_vpd()
2343 (phba->sli4_hba.pport_name_sta == in lpfc_fill_vpd()
2345 phba->Port[j] = 0; in lpfc_fill_vpd()
2372 lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) in lpfc_parse_vpd() argument
2384 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_parse_vpd()
2410 lpfc_fill_vpd(phba, vpd, Length, &index); in lpfc_parse_vpd()
2438 lpfc_get_atto_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_atto_model_desc() argument
2440 uint16_t sub_dev_id = phba->pcidev->subsystem_device; in lpfc_get_atto_model_desc()
2506 phba->Port); in lpfc_get_atto_model_desc()
2522 lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_hba_model_desc() argument
2525 uint16_t dev_id = phba->pcidev->device; in lpfc_get_hba_model_desc()
2539 if (phba->pcidev->vendor == PCI_VENDOR_ID_ATTO) { in lpfc_get_hba_model_desc()
2540 lpfc_get_atto_model_desc(phba, mdp, descp); in lpfc_get_hba_model_desc()
2544 if (phba->lmt & LMT_64Gb) in lpfc_get_hba_model_desc()
2546 else if (phba->lmt & LMT_32Gb) in lpfc_get_hba_model_desc()
2548 else if (phba->lmt & LMT_16Gb) in lpfc_get_hba_model_desc()
2550 else if (phba->lmt & LMT_10Gb) in lpfc_get_hba_model_desc()
2552 else if (phba->lmt & LMT_8Gb) in lpfc_get_hba_model_desc()
2554 else if (phba->lmt & LMT_4Gb) in lpfc_get_hba_model_desc()
2556 else if (phba->lmt & LMT_2Gb) in lpfc_get_hba_model_desc()
2558 else if (phba->lmt & LMT_1Gb) in lpfc_get_hba_model_desc()
2563 vp = &phba->vpd; in lpfc_get_hba_model_desc()
2767 phba->Port); in lpfc_get_hba_model_desc()
2793 lpfc_sli3_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt) in lpfc_sli3_post_buffer() argument
2804 iocb = lpfc_sli_get_iocbq(phba); in lpfc_sli3_post_buffer()
2815 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp1->phys); in lpfc_sli3_post_buffer()
2818 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2828 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, in lpfc_sli3_post_buffer()
2832 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_sli3_post_buffer()
2834 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2860 if (lpfc_sli_issue_iocb(phba, pring->ringno, iocb, 0) == in lpfc_sli3_post_buffer()
2862 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_sli3_post_buffer()
2866 lpfc_mbuf_free(phba, mp2->virt, mp2->phys); in lpfc_sli3_post_buffer()
2870 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2874 lpfc_sli_ringpostbuf_put(phba, pring, mp1); in lpfc_sli3_post_buffer()
2876 lpfc_sli_ringpostbuf_put(phba, pring, mp2); in lpfc_sli3_post_buffer()
2894 lpfc_post_rcv_buf(struct lpfc_hba *phba) in lpfc_post_rcv_buf() argument
2896 struct lpfc_sli *psli = &phba->sli; in lpfc_post_rcv_buf()
2899 lpfc_sli3_post_buffer(phba, &psli->sli3_ring[LPFC_ELS_RING], LPFC_BUF_RING0); in lpfc_post_rcv_buf()
3005 lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) in lpfc_hba_init() argument
3009 uint32_t *pwwnn = (uint32_t *) phba->wwnn; in lpfc_hba_init()
3019 lpfc_challenge_key(phba->RandomData + t, HashWorking + t); in lpfc_hba_init()
3038 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup() local
3042 if (phba->link_state > LPFC_LINK_DOWN) in lpfc_cleanup()
3046 if (lpfc_is_vmid_enabled(phba)) in lpfc_cleanup()
3089 pci_channel_offline(phba->pcidev)) in lpfc_cleanup()
3090 lpfc_sli_flush_io_rings(vport->phba); in lpfc_cleanup()
3146 __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in __lpfc_sli4_stop_fcf_redisc_wait_timer() argument
3149 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in __lpfc_sli4_stop_fcf_redisc_wait_timer()
3152 del_timer(&phba->fcf.redisc_wait); in __lpfc_sli4_stop_fcf_redisc_wait_timer()
3165 lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in lpfc_sli4_stop_fcf_redisc_wait_timer() argument
3167 spin_lock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3168 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_stop_fcf_redisc_wait_timer()
3170 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3173 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3175 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3176 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3188 lpfc_cmf_stop(struct lpfc_hba *phba) in lpfc_cmf_stop() argument
3194 if (!phba->sli4_hba.pc_sli4_params.cmf) in lpfc_cmf_stop()
3197 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stop()
3201 hrtimer_cancel(&phba->cmf_stats_timer); in lpfc_cmf_stop()
3202 hrtimer_cancel(&phba->cmf_timer); in lpfc_cmf_stop()
3205 atomic_set(&phba->cmf_busy, 0); in lpfc_cmf_stop()
3207 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_stop()
3213 atomic_set(&phba->cmf_bw_wait, 0); in lpfc_cmf_stop()
3216 queue_work(phba->wq, &phba->unblock_request_work); in lpfc_cmf_stop()
3220 lpfc_get_max_line_rate(struct lpfc_hba *phba) in lpfc_get_max_line_rate() argument
3222 uint64_t rate = lpfc_sli_port_speed_get(phba); in lpfc_get_max_line_rate()
3228 lpfc_cmf_signal_init(struct lpfc_hba *phba) in lpfc_cmf_signal_init() argument
3230 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_signal_init()
3234 phba->cmf_interval_rate = LPFC_CMF_INTERVAL; in lpfc_cmf_signal_init()
3235 phba->cmf_max_line_rate = lpfc_get_max_line_rate(phba); in lpfc_cmf_signal_init()
3236 phba->cmf_link_byte_count = div_u64(phba->cmf_max_line_rate * in lpfc_cmf_signal_init()
3237 phba->cmf_interval_rate, 1000); in lpfc_cmf_signal_init()
3238 phba->cmf_max_bytes_per_interval = phba->cmf_link_byte_count; in lpfc_cmf_signal_init()
3241 lpfc_issue_cmf_sync_wqe(phba, 0, 0); in lpfc_cmf_signal_init()
3252 lpfc_cmf_start(struct lpfc_hba *phba) in lpfc_cmf_start() argument
3258 if (!phba->sli4_hba.pc_sli4_params.cmf || in lpfc_cmf_start()
3259 phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_cmf_start()
3263 lpfc_init_congestion_buf(phba); in lpfc_cmf_start()
3265 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_cmf_start()
3266 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_cmf_start()
3267 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_cmf_start()
3268 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_cmf_start()
3270 atomic_set(&phba->cmf_busy, 0); in lpfc_cmf_start()
3272 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_start()
3278 phba->cmf_latency.tv_sec = 0; in lpfc_cmf_start()
3279 phba->cmf_latency.tv_nsec = 0; in lpfc_cmf_start()
3281 lpfc_cmf_signal_init(phba); in lpfc_cmf_start()
3283 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_start()
3286 phba->cmf_timer_cnt = 0; in lpfc_cmf_start()
3287 hrtimer_start(&phba->cmf_timer, in lpfc_cmf_start()
3290 hrtimer_start(&phba->cmf_stats_timer, in lpfc_cmf_start()
3294 ktime_get_real_ts64(&phba->cmf_latency); in lpfc_cmf_start()
3296 atomic_set(&phba->cmf_bw_wait, 0); in lpfc_cmf_start()
3297 atomic_set(&phba->cmf_stop_io, 0); in lpfc_cmf_start()
3308 lpfc_stop_hba_timers(struct lpfc_hba *phba) in lpfc_stop_hba_timers() argument
3310 if (phba->pport) in lpfc_stop_hba_timers()
3311 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
3312 cancel_delayed_work_sync(&phba->eq_delay_work); in lpfc_stop_hba_timers()
3313 cancel_delayed_work_sync(&phba->idle_stat_delay_work); in lpfc_stop_hba_timers()
3314 del_timer_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
3315 del_timer_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
3316 del_timer_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
3317 del_timer_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
3318 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
3319 del_timer_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
3320 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_stop_hba_timers()
3322 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_stop_hba_timers()
3324 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
3327 del_timer_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
3331 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
3334 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_stop_hba_timers()
3336 phba->pci_dev_grp); in lpfc_stop_hba_timers()
3354 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
3360 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3361 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
3362 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3366 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3367 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3368 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
3372 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
3373 phba->sli.mbox_active) * 1000) + jiffies; in lpfc_block_mgmt_io()
3375 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3378 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3382 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_block_mgmt_io()
3385 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
3400 lpfc_sli4_node_prep(struct lpfc_hba *phba) in lpfc_sli4_node_prep() argument
3406 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_prep()
3409 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_prep()
3413 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_sli4_node_prep()
3420 rpi = lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_prep()
3434 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_prep()
3444 static void lpfc_create_expedite_pool(struct lpfc_hba *phba) in lpfc_create_expedite_pool() argument
3452 epd_pool = &phba->epd_pool; in lpfc_create_expedite_pool()
3453 qp = &phba->sli4_hba.hdwq[0]; in lpfc_create_expedite_pool()
3479 static void lpfc_destroy_expedite_pool(struct lpfc_hba *phba) in lpfc_destroy_expedite_pool() argument
3487 epd_pool = &phba->epd_pool; in lpfc_destroy_expedite_pool()
3488 qp = &phba->sli4_hba.hdwq[0]; in lpfc_destroy_expedite_pool()
3512 void lpfc_create_multixri_pools(struct lpfc_hba *phba) in lpfc_create_multixri_pools() argument
3525 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3527 phba->cfg_hdw_queue, phba->sli4_hba.num_present_cpu, in lpfc_create_multixri_pools()
3528 phba->sli4_hba.io_xri_cnt); in lpfc_create_multixri_pools()
3530 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3531 lpfc_create_expedite_pool(phba); in lpfc_create_multixri_pools()
3533 hwq_count = phba->cfg_hdw_queue; in lpfc_create_multixri_pools()
3534 count_per_hwq = phba->sli4_hba.io_xri_cnt / hwq_count; in lpfc_create_multixri_pools()
3540 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3544 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3545 lpfc_destroy_expedite_pool(phba); in lpfc_create_multixri_pools()
3549 qp = &phba->sli4_hba.hdwq[j]; in lpfc_create_multixri_pools()
3553 phba->cfg_xri_rebalancing = 0; in lpfc_create_multixri_pools()
3557 qp = &phba->sli4_hba.hdwq[i]; in lpfc_create_multixri_pools()
3575 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3599 static void lpfc_destroy_multixri_pools(struct lpfc_hba *phba) in lpfc_destroy_multixri_pools() argument
3611 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_destroy_multixri_pools()
3612 lpfc_destroy_expedite_pool(phba); in lpfc_destroy_multixri_pools()
3614 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_destroy_multixri_pools()
3615 lpfc_sli_flush_io_rings(phba); in lpfc_destroy_multixri_pools()
3617 hwq_count = phba->cfg_hdw_queue; in lpfc_destroy_multixri_pools()
3620 qp = &phba->sli4_hba.hdwq[i]; in lpfc_destroy_multixri_pools()
3633 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3654 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3689 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
3696 if (!phba) in lpfc_online()
3698 vport = phba->pport; in lpfc_online()
3703 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
3706 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
3708 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3709 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
3710 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3713 spin_lock_irq(&phba->hbalock); in lpfc_online()
3714 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
3716 spin_unlock_irq(&phba->hbalock); in lpfc_online()
3721 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_online()
3722 !phba->nvmet_support) { in lpfc_online()
3723 error = lpfc_nvme_create_localport(phba->pport); in lpfc_online()
3725 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_online()
3730 lpfc_sli_queue_init(phba); in lpfc_online()
3731 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
3732 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3737 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
3739 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
3744 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
3746 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3756 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
3758 if (phba->cfg_xri_rebalancing) in lpfc_online()
3759 lpfc_create_multixri_pools(phba); in lpfc_online()
3761 lpfc_cpuhp_add(phba); in lpfc_online()
3763 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3779 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
3783 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3784 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
3785 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3798 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
3800 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
3811 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
3813 lpfc_linkdown(phba); in lpfc_offline_prep()
3815 offline = pci_channel_offline(phba->pcidev); in lpfc_offline_prep()
3816 hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_offline_prep()
3819 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
3821 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
3845 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_offline_prep()
3856 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_offline_prep()
3863 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); in lpfc_offline_prep()
3890 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
3892 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
3894 if (phba->wq) in lpfc_offline_prep()
3895 flush_workqueue(phba->wq); in lpfc_offline_prep()
3907 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
3913 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3917 lpfc_stop_port(phba); in lpfc_offline()
3922 lpfc_nvmet_destroy_targetport(phba); in lpfc_offline()
3923 lpfc_nvme_destroy_localport(phba->pport); in lpfc_offline()
3925 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3927 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
3929 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3930 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3934 lpfc_sli_hba_down(phba); in lpfc_offline()
3935 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3936 phba->work_ha = 0; in lpfc_offline()
3937 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3938 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3940 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3947 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3951 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3952 __lpfc_cpuhp_remove(phba); in lpfc_offline()
3954 if (phba->cfg_xri_rebalancing) in lpfc_offline()
3955 lpfc_destroy_multixri_pools(phba); in lpfc_offline()
3967 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3971 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_scsi_free()
3974 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3978 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3979 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3982 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3985 phba->total_scsi_bufs--; in lpfc_scsi_free()
3987 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3989 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3990 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3993 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3996 phba->total_scsi_bufs--; in lpfc_scsi_free()
3998 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3999 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
4011 lpfc_io_free(struct lpfc_hba *phba) in lpfc_io_free() argument
4017 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_free()
4018 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_free()
4026 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
4028 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
4029 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4030 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4042 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
4044 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
4045 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4046 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4067 lpfc_sli4_els_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_els_sgl_update() argument
4077 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_els_sgl_update()
4079 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
4081 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_els_sgl_update()
4082 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4084 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
4091 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4099 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_els_sgl_update()
4103 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4115 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4117 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
4118 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4119 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
4121 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_els_sgl_update()
4122 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4124 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
4126 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4127 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, in lpfc_sli4_els_sgl_update()
4134 __lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_els_sgl_update()
4140 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
4141 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4143 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4146 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_els_sgl_update()
4152 &phba->sli4_hba.lpfc_els_sgl_list, list) { in lpfc_sli4_els_sgl_update()
4153 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_els_sgl_update()
4155 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4163 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_els_sgl_update()
4168 lpfc_free_els_sgl_list(phba); in lpfc_sli4_els_sgl_update()
4185 lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_nvmet_sgl_update() argument
4196 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_nvmet_sgl_update()
4199 nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4200 if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
4202 xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4203 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4205 phba->sli4_hba.nvmet_xri_cnt, nvmet_xri_cnt); in lpfc_sli4_nvmet_sgl_update()
4211 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4219 sglq_entry->virt = lpfc_nvmet_buf_alloc(phba, 0, in lpfc_sli4_nvmet_sgl_update()
4223 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4232 phba->cfg_sg_dma_buf_size); in lpfc_sli4_nvmet_sgl_update()
4236 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4237 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4239 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
4240 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4241 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4242 } else if (nvmet_xri_cnt < phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
4244 xri_cnt = phba->sli4_hba.nvmet_xri_cnt - nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4245 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4247 "%d to %d\n", phba->sli4_hba.nvmet_xri_cnt, in lpfc_sli4_nvmet_sgl_update()
4249 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4250 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4251 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, in lpfc_sli4_nvmet_sgl_update()
4258 lpfc_nvmet_buf_free(phba, sglq_entry->virt, in lpfc_sli4_nvmet_sgl_update()
4264 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
4265 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4266 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4268 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4271 phba->sli4_hba.nvmet_xri_cnt = nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4277 &phba->sli4_hba.lpfc_nvmet_sgl_list, list) { in lpfc_sli4_nvmet_sgl_update()
4278 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_nvmet_sgl_update()
4280 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4288 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_nvmet_sgl_update()
4293 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_nvmet_sgl_update()
4298 lpfc_io_buf_flush(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_flush() argument
4307 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_flush()
4308 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_flush()
4360 lpfc_io_buf_replenish(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_replenish() argument
4367 qp = phba->sli4_hba.hdwq; in lpfc_io_buf_replenish()
4370 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_replenish()
4376 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_replenish()
4405 lpfc_sli4_io_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_io_sgl_update() argument
4418 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_io_sgl_update()
4419 io_xri_max = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_io_sgl_update()
4420 phba->sli4_hba.io_xri_max = io_xri_max; in lpfc_sli4_io_sgl_update()
4422 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_io_sgl_update()
4425 phba->sli4_hba.io_xri_cnt, in lpfc_sli4_io_sgl_update()
4426 phba->sli4_hba.io_xri_max, in lpfc_sli4_io_sgl_update()
4429 cnt = lpfc_io_buf_flush(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4431 if (phba->sli4_hba.io_xri_cnt > phba->sli4_hba.io_xri_max) { in lpfc_sli4_io_sgl_update()
4433 io_xri_cnt = phba->sli4_hba.io_xri_cnt - in lpfc_sli4_io_sgl_update()
4434 phba->sli4_hba.io_xri_max; in lpfc_sli4_io_sgl_update()
4440 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_sli4_io_sgl_update()
4446 phba->sli4_hba.io_xri_cnt -= io_xri_cnt; in lpfc_sli4_io_sgl_update()
4452 phba->sli4_hba.io_xri_cnt = cnt; in lpfc_sli4_io_sgl_update()
4455 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_io_sgl_update()
4457 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_io_sgl_update()
4465 lpfc_ncmd->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_io_sgl_update()
4467 cnt = lpfc_io_buf_replenish(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4471 lpfc_io_free(phba); in lpfc_sli4_io_sgl_update()
4490 lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) in lpfc_new_io_buf() argument
4500 phba->sli4_hba.io_xri_cnt = 0; in lpfc_new_io_buf()
4510 lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4518 if (phba->cfg_xpsgl && !phba->nvmet_support) { in lpfc_new_io_buf()
4525 if ((phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_new_io_buf()
4528 lpfc_printf_log(phba, KERN_ERR, in lpfc_new_io_buf()
4533 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4543 lxri = lpfc_sli4_next_xritag(phba); in lpfc_new_io_buf()
4545 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4553 iotag = lpfc_sli_next_iotag(phba, pwqeq); in lpfc_new_io_buf()
4555 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4558 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_new_io_buf()
4561 lpfc_sli4_free_xri(phba, lxri); in lpfc_new_io_buf()
4565 pwqeq->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_new_io_buf()
4575 phba->sli4_hba.io_xri_cnt++; in lpfc_new_io_buf()
4577 lpfc_printf_log(phba, KERN_INFO, LOG_NVME, in lpfc_new_io_buf()
4586 phba, &post_nblist, bcnt); in lpfc_new_io_buf()
4594 lpfc_get_wwpn(struct lpfc_hba *phba) in lpfc_get_wwpn() argument
4601 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_get_wwpn()
4607 lpfc_read_nv(phba, mboxq); in lpfc_get_wwpn()
4608 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_wwpn()
4610 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_get_wwpn()
4615 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4621 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4622 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_wwpn()
4628 static unsigned short lpfc_get_sg_tablesize(struct lpfc_hba *phba) in lpfc_get_sg_tablesize() argument
4630 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_sg_tablesize()
4631 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_get_sg_tablesize()
4634 return phba->cfg_scsi_seg_cnt; in lpfc_get_sg_tablesize()
4636 return phba->cfg_sg_seg_cnt; in lpfc_get_sg_tablesize()
4651 lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport) in lpfc_vmid_res_alloc() argument
4654 if (phba->sli_rev == LPFC_SLI_REV3) { in lpfc_vmid_res_alloc()
4655 phba->cfg_vmid_app_header = 0; in lpfc_vmid_res_alloc()
4656 phba->cfg_vmid_priority_tagging = 0; in lpfc_vmid_res_alloc()
4659 if (lpfc_is_vmid_enabled(phba)) { in lpfc_vmid_res_alloc()
4661 kcalloc(phba->cfg_max_vmid, sizeof(struct lpfc_vmid), in lpfc_vmid_res_alloc()
4669 vport->vmid_priority_tagging = phba->cfg_vmid_priority_tagging; in lpfc_vmid_res_alloc()
4671 phba->cfg_vmid_inactivity_timeout; in lpfc_vmid_res_alloc()
4672 vport->max_vmid = phba->cfg_max_vmid; in lpfc_vmid_res_alloc()
4705 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
4717 if (phba->sli_rev < LPFC_SLI_REV4 && in lpfc_create_port()
4718 dev == &phba->pcidev->dev) { in lpfc_create_port()
4720 lpfc_sli_brdrestart(phba); in lpfc_create_port()
4721 rc = lpfc_sli_chipset_init(phba); in lpfc_create_port()
4725 wwn = lpfc_get_wwpn(phba); in lpfc_create_port()
4730 lpfc_printf_log(phba, KERN_ERR, in lpfc_create_port()
4740 if (dev == &phba->pcidev->dev) { in lpfc_create_port()
4741 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_create_port()
4750 template->sg_tablesize = lpfc_get_sg_tablesize(phba); in lpfc_create_port()
4760 template->sg_tablesize = lpfc_get_sg_tablesize(phba); in lpfc_create_port()
4768 vport->phba = phba; in lpfc_create_port()
4775 vport->cfg_enable_fc4_type = phba->cfg_enable_fc4_type; in lpfc_create_port()
4783 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4784 if (!phba->cfg_fcp_mq_threshold || in lpfc_create_port()
4785 phba->cfg_fcp_mq_threshold > phba->cfg_hdw_queue) in lpfc_create_port()
4786 phba->cfg_fcp_mq_threshold = phba->cfg_hdw_queue; in lpfc_create_port()
4789 phba->cfg_fcp_mq_threshold); in lpfc_create_port()
4792 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
4804 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
4805 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
4813 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_create_port()
4817 phba->cfg_scsi_seg_cnt, phba->cfg_sg_seg_cnt); in lpfc_create_port()
4820 rc = lpfc_vmid_res_alloc(phba, vport); in lpfc_create_port()
4836 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_create_port()
4837 lpfc_setup_bg(phba, shost); in lpfc_create_port()
4839 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
4843 spin_lock_irq(&phba->port_list_lock); in lpfc_create_port()
4844 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
4845 spin_unlock_irq(&phba->port_list_lock); in lpfc_create_port()
4868 struct lpfc_hba *phba = vport->phba; in destroy_port() local
4874 spin_lock_irq(&phba->port_list_lock); in destroy_port()
4876 spin_unlock_irq(&phba->port_list_lock); in destroy_port()
4919 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
4929 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4936 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
4937 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4950 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
4963 struct lpfc_hba *phba = vport->phba; in lpfc_host_supported_speeds_set() local
4970 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_host_supported_speeds_set()
4973 if (phba->lmt & LMT_256Gb) in lpfc_host_supported_speeds_set()
4975 if (phba->lmt & LMT_128Gb) in lpfc_host_supported_speeds_set()
4977 if (phba->lmt & LMT_64Gb) in lpfc_host_supported_speeds_set()
4979 if (phba->lmt & LMT_32Gb) in lpfc_host_supported_speeds_set()
4981 if (phba->lmt & LMT_16Gb) in lpfc_host_supported_speeds_set()
4983 if (phba->lmt & LMT_10Gb) in lpfc_host_supported_speeds_set()
4985 if (phba->lmt & LMT_8Gb) in lpfc_host_supported_speeds_set()
4987 if (phba->lmt & LMT_4Gb) in lpfc_host_supported_speeds_set()
4989 if (phba->lmt & LMT_2Gb) in lpfc_host_supported_speeds_set()
4991 if (phba->lmt & LMT_1Gb) in lpfc_host_supported_speeds_set()
5005 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
5036 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
5051 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
5054 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
5055 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
5057 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
5058 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
5061 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
5062 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
5074 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
5077 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
5078 if (phba->pport) in lpfc_stop_port_s4()
5079 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
5080 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
5091 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
5093 phba->lpfc_stop_port(phba); in lpfc_stop_port()
5095 if (phba->wq) in lpfc_stop_port()
5096 flush_workqueue(phba->wq); in lpfc_stop_port()
5106 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
5111 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
5112 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
5114 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
5116 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
5117 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
5133 struct lpfc_hba *phba = from_timer(phba, t, fcf.redisc_wait); in lpfc_sli4_fcf_redisc_wait_tmo() local
5136 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5137 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
5138 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5142 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
5144 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
5145 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5146 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
5149 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
5164 struct lpfc_hba *phba = from_timer(phba, t, inactive_vmid_poll); in lpfc_vmid_poll() local
5168 if (phba->pport->vmid_priority_tagging) { in lpfc_vmid_poll()
5170 phba->pport->work_port_events |= WORKER_CHECK_VMID_ISSUE_QFPA; in lpfc_vmid_poll()
5174 if (phba->pport->vmid_inactivity_timeout || in lpfc_vmid_poll()
5175 phba->pport->load_flag & FC_DEREGISTER_ALL_APP_ID) { in lpfc_vmid_poll()
5177 phba->pport->work_port_events |= WORKER_CHECK_INACTIVE_VMID; in lpfc_vmid_poll()
5181 lpfc_worker_wake_up(phba); in lpfc_vmid_poll()
5184 mod_timer(&phba->inactive_vmid_poll, jiffies + msecs_to_jiffies(1000 * in lpfc_vmid_poll()
5196 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
5213 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_fault()
5233 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
5251 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_type()
5269 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
5273 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
5276 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_sli_port_speed_get()
5277 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
5300 if (phba->sli4_hba.link_state.logical_speed) in lpfc_sli_port_speed_get()
5302 phba->sli4_hba.link_state.logical_speed; in lpfc_sli_port_speed_get()
5304 link_speed = phba->sli4_hba.link_state.speed; in lpfc_sli_port_speed_get()
5321 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
5413 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
5422 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
5425 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
5426 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
5428 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5433 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_sli4_async_link_evt()
5435 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5441 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
5444 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
5447 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
5450 lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); in lpfc_sli4_async_link_evt()
5452 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
5455 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
5456 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
5458 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
5460 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
5462 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
5464 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
5466 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
5468 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
5471 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
5475 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
5476 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
5477 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
5478 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
5479 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
5480 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
5481 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
5486 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_async_link_evt()
5487 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
5502 lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
5520 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
5525 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_sli4_async_link_evt()
5540 lpfc_async_link_speed_to_read_top(struct lpfc_hba *phba, uint8_t speed_code) in lpfc_async_link_speed_to_read_top() argument
5581 lpfc_cgn_dump_rxmonitor(struct lpfc_hba *phba) in lpfc_cgn_dump_rxmonitor() argument
5583 if (!phba->rx_monitor) { in lpfc_cgn_dump_rxmonitor()
5584 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_dump_rxmonitor()
5587 lpfc_rx_monitor_report(phba, phba->rx_monitor, NULL, 0, in lpfc_cgn_dump_rxmonitor()
5600 lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag) in lpfc_cgn_update_stat() argument
5606 if (!phba->cgn_i) in lpfc_cgn_update_stat()
5608 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_update_stat()
5614 lpfc_cgn_update_tstamp(phba, &cp->stat_lnk); in lpfc_cgn_update_stat()
5618 lpfc_cgn_update_tstamp(phba, &cp->stat_delivery); in lpfc_cgn_update_stat()
5622 lpfc_cgn_update_tstamp(phba, &cp->stat_peer); in lpfc_cgn_update_stat()
5626 lpfc_cgn_update_tstamp(phba, &cp->stat_fpin); in lpfc_cgn_update_stat()
5628 if (phba->cgn_fpin_frequency && in lpfc_cgn_update_stat()
5629 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { in lpfc_cgn_update_stat()
5630 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; in lpfc_cgn_update_stat()
5645 lpfc_cgn_update_tstamp(struct lpfc_hba *phba, struct lpfc_cgn_ts *ts) in lpfc_cgn_update_tstamp() argument
5660 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_update_tstamp()
5681 struct lpfc_hba *phba; in lpfc_cmf_stats_timer() local
5693 phba = container_of(timer, struct lpfc_hba, cmf_stats_timer); in lpfc_cmf_stats_timer()
5695 if (!phba->cgn_i) in lpfc_cmf_stats_timer()
5697 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cmf_stats_timer()
5699 phba->cgn_evt_timestamp = jiffies + in lpfc_cmf_stats_timer()
5701 phba->cgn_evt_minute++; in lpfc_cmf_stats_timer()
5704 lpfc_cgn_update_tstamp(phba, &cp->base_time); in lpfc_cmf_stats_timer()
5706 if (phba->cgn_fpin_frequency && in lpfc_cmf_stats_timer()
5707 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { in lpfc_cmf_stats_timer()
5708 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; in lpfc_cmf_stats_timer()
5713 lvalue = atomic_read(&phba->cgn_latency_evt_cnt); in lpfc_cmf_stats_timer()
5714 latsum = atomic64_read(&phba->cgn_latency_evt); in lpfc_cmf_stats_timer()
5715 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_cmf_stats_timer()
5716 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_cmf_stats_timer()
5722 bps = div_u64(phba->rx_block_cnt, LPFC_SEC_MIN) * 512; in lpfc_cmf_stats_timer()
5723 phba->rx_block_cnt = 0; in lpfc_cmf_stats_timer()
5728 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_cmf_stats_timer()
5729 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_cmf_stats_timer()
5730 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_cmf_stats_timer()
5731 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_cmf_stats_timer()
5734 value = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_cmf_stats_timer()
5750 dvalue = atomic_read(&phba->cgn_driver_evt_cnt); in lpfc_cmf_stats_timer()
5751 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_cmf_stats_timer()
5755 if ((phba->cgn_reg_fpin & LPFC_CGN_FPIN_WARN) || in lpfc_cmf_stats_timer()
5756 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_cmf_stats_timer()
5757 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cmf_stats_timer()
5758 wvalue = atomic_read(&phba->cgn_fabric_warn_cnt); in lpfc_cmf_stats_timer()
5759 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_cmf_stats_timer()
5763 if ((phba->cgn_reg_fpin & LPFC_CGN_FPIN_ALARM) || in lpfc_cmf_stats_timer()
5764 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cmf_stats_timer()
5765 avalue = atomic_read(&phba->cgn_fabric_alarm_cnt); in lpfc_cmf_stats_timer()
5766 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_cmf_stats_timer()
5795 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stats_timer()
5800 if ((phba->cgn_evt_minute % LPFC_MIN_HOUR) == 0) { in lpfc_cmf_stats_timer()
5839 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stats_timer()
5846 if ((phba->cgn_evt_minute % LPFC_MIN_DAY) == 0) { in lpfc_cmf_stats_timer()
5886 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stats_timer()
5893 value = phba->cgn_fpin_frequency; in lpfc_cmf_stats_timer()
5915 lpfc_calc_cmf_latency(struct lpfc_hba *phba) in lpfc_calc_cmf_latency() argument
5925 if (cmpl_time.tv_sec == phba->cmf_latency.tv_sec) { in lpfc_calc_cmf_latency()
5926 msec = (cmpl_time.tv_nsec - phba->cmf_latency.tv_nsec) / in lpfc_calc_cmf_latency()
5929 if (cmpl_time.tv_nsec >= phba->cmf_latency.tv_nsec) { in lpfc_calc_cmf_latency()
5931 phba->cmf_latency.tv_sec) * MSEC_PER_SEC; in lpfc_calc_cmf_latency()
5933 phba->cmf_latency.tv_nsec) / NSEC_PER_MSEC); in lpfc_calc_cmf_latency()
5935 msec = (cmpl_time.tv_sec - phba->cmf_latency.tv_sec - in lpfc_calc_cmf_latency()
5937 msec += (((NSEC_PER_SEC - phba->cmf_latency.tv_nsec) + in lpfc_calc_cmf_latency()
5952 struct lpfc_hba *phba = container_of(timer, struct lpfc_hba, in lpfc_cmf_timer() local
5964 if (phba->cmf_active_mode == LPFC_CFG_OFF || in lpfc_cmf_timer()
5965 !phba->cmf_latency.tv_sec) { in lpfc_cmf_timer()
5966 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_timer()
5968 phba->cmf_active_mode, in lpfc_cmf_timer()
5969 (uint64_t)phba->cmf_latency.tv_sec); in lpfc_cmf_timer()
5976 if (!phba->pport) in lpfc_cmf_timer()
5982 atomic_set(&phba->cmf_stop_io, 1); in lpfc_cmf_timer()
5989 ms = lpfc_calc_cmf_latency(phba); in lpfc_cmf_timer()
5996 ktime_get_real_ts64(&phba->cmf_latency); in lpfc_cmf_timer()
5998 phba->cmf_link_byte_count = in lpfc_cmf_timer()
5999 div_u64(phba->cmf_max_line_rate * LPFC_CMF_INTERVAL, 1000); in lpfc_cmf_timer()
6007 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_timer()
6019 if (phba->cmf_active_mode == LPFC_CFG_MANAGED && in lpfc_cmf_timer()
6020 phba->link_state != LPFC_LINK_DOWN && in lpfc_cmf_timer()
6021 phba->hba_flag & HBA_SETUP) { in lpfc_cmf_timer()
6022 mbpi = phba->cmf_last_sync_bw; in lpfc_cmf_timer()
6023 phba->cmf_last_sync_bw = 0; in lpfc_cmf_timer()
6036 lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); in lpfc_cmf_timer()
6041 mbpi = phba->cmf_link_byte_count; in lpfc_cmf_timer()
6044 phba->cmf_timer_cnt++; in lpfc_cmf_timer()
6048 atomic_add(io_cnt, &phba->cgn_latency_evt_cnt); in lpfc_cmf_timer()
6049 atomic64_add(lat, &phba->cgn_latency_evt); in lpfc_cmf_timer()
6051 busy = atomic_xchg(&phba->cmf_busy, 0); in lpfc_cmf_timer()
6052 max_read = atomic_xchg(&phba->rx_max_read_cnt, 0); in lpfc_cmf_timer()
6056 if (mbpi > phba->cmf_link_byte_count || in lpfc_cmf_timer()
6057 phba->cmf_active_mode == LPFC_CFG_MONITOR) in lpfc_cmf_timer()
6058 mbpi = phba->cmf_link_byte_count; in lpfc_cmf_timer()
6063 if (mbpi != phba->cmf_max_bytes_per_interval) in lpfc_cmf_timer()
6064 phba->cmf_max_bytes_per_interval = mbpi; in lpfc_cmf_timer()
6068 if (phba->rx_monitor) { in lpfc_cmf_timer()
6073 entry.cmf_info = phba->cmf_active_info; in lpfc_cmf_timer()
6084 if (phba->cmf_active_mode == LPFC_CFG_MANAGED) in lpfc_cmf_timer()
6085 entry.timer_utilization = phba->cmf_last_ts; in lpfc_cmf_timer()
6089 phba->cmf_last_ts = 0; in lpfc_cmf_timer()
6091 lpfc_rx_monitor_record(phba->rx_monitor, &entry); in lpfc_cmf_timer()
6094 if (phba->cmf_active_mode == LPFC_CFG_MONITOR) { in lpfc_cmf_timer()
6099 atomic_inc(&phba->cgn_driver_evt_cnt); in lpfc_cmf_timer()
6101 phba->rx_block_cnt += div_u64(rcv, 512); /* save 512 byte block cnt */ in lpfc_cmf_timer()
6106 if (atomic_xchg(&phba->cmf_bw_wait, 0)) in lpfc_cmf_timer()
6107 queue_work(phba->wq, &phba->unblock_request_work); in lpfc_cmf_timer()
6110 atomic_set(&phba->cmf_stop_io, 0); in lpfc_cmf_timer()
6120 ((phba->trunk_link.link##__idx.state == LPFC_LINK_UP) ?\
6128 lpfc_update_trunk_link_status(struct lpfc_hba *phba, in lpfc_update_trunk_link_status() argument
6135 phba->sli4_hba.link_state.speed = in lpfc_update_trunk_link_status()
6136 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_update_trunk_link_status()
6139 phba->sli4_hba.link_state.logical_speed = in lpfc_update_trunk_link_status()
6142 phba->fc_linkspeed = in lpfc_update_trunk_link_status()
6144 phba, in lpfc_update_trunk_link_status()
6148 phba->trunk_link.link0.state = in lpfc_update_trunk_link_status()
6151 phba->trunk_link.link0.fault = port_fault & 0x1 ? err : 0; in lpfc_update_trunk_link_status()
6155 phba->trunk_link.link1.state = in lpfc_update_trunk_link_status()
6158 phba->trunk_link.link1.fault = port_fault & 0x2 ? err : 0; in lpfc_update_trunk_link_status()
6162 phba->trunk_link.link2.state = in lpfc_update_trunk_link_status()
6165 phba->trunk_link.link2.fault = port_fault & 0x4 ? err : 0; in lpfc_update_trunk_link_status()
6169 phba->trunk_link.link3.state = in lpfc_update_trunk_link_status()
6172 phba->trunk_link.link3.fault = port_fault & 0x8 ? err : 0; in lpfc_update_trunk_link_status()
6177 phba->trunk_link.phy_lnk_speed = in lpfc_update_trunk_link_status()
6178 phba->sli4_hba.link_state.logical_speed / (cnt * 1000); in lpfc_update_trunk_link_status()
6180 phba->trunk_link.phy_lnk_speed = LPFC_LINK_SPEED_UNKNOWN; in lpfc_update_trunk_link_status()
6182 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
6186 phba->sli4_hba.link_state.speed, in lpfc_update_trunk_link_status()
6187 phba->sli4_hba.link_state.logical_speed, in lpfc_update_trunk_link_status()
6191 if (phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_update_trunk_link_status()
6192 lpfc_cmf_signal_init(phba); in lpfc_update_trunk_link_status()
6195 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
6219 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
6229 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6237 lpfc_update_trunk_link_status(phba, acqe_fc); in lpfc_sli4_async_fc_evt()
6242 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
6243 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
6245 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
6246 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
6248 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
6250 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
6252 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
6254 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
6256 phba->sli4_hba.link_state.link_status = in lpfc_sli4_async_fc_evt()
6263 if (phba->sli4_hba.link_state.status >= LPFC_FC_LA_TYPE_LINK_UP && in lpfc_sli4_async_fc_evt()
6264 phba->sli4_hba.link_state.status < LPFC_FC_LA_TYPE_ACTIVATE_FAIL) { in lpfc_sli4_async_fc_evt()
6267 phba->sli4_hba.link_state.logical_speed = 0; in lpfc_sli4_async_fc_evt()
6268 else if (!phba->sli4_hba.conf_trunk) in lpfc_sli4_async_fc_evt()
6269 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
6273 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
6277 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
6278 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
6279 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
6280 phba->sli4_hba.link_state.type, in lpfc_sli4_async_fc_evt()
6281 phba->sli4_hba.link_state.number, in lpfc_sli4_async_fc_evt()
6282 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
6283 phba->sli4_hba.link_state.fault, in lpfc_sli4_async_fc_evt()
6284 phba->sli4_hba.link_state.link_status); in lpfc_sli4_async_fc_evt()
6291 if (phba->sli4_hba.link_state.status >= LPFC_FC_LA_TYPE_ACTIVATE_FAIL) { in lpfc_sli4_async_fc_evt()
6292 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
6295 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
6306 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
6313 lpfc_log_msg(phba, log_level, LOG_SLI, in lpfc_sli4_async_fc_evt()
6320 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
6322 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6326 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_sli4_async_fc_evt()
6328 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6334 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
6337 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
6340 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
6343 lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); in lpfc_sli4_async_fc_evt()
6345 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
6347 if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) { in lpfc_sli4_async_fc_evt()
6348 phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK); in lpfc_sli4_async_fc_evt()
6350 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
6352 phba->link_flag |= LS_MDS_LINK_DOWN; in lpfc_sli4_async_fc_evt()
6355 phba->link_flag |= LS_MDS_LOOPBACK; in lpfc_sli4_async_fc_evt()
6366 lpfc_sli4_parse_latt_fault(phba, (void *)acqe_fc); in lpfc_sli4_async_fc_evt()
6372 if (phba->sli4_hba.link_state.status == in lpfc_sli4_async_fc_evt()
6381 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_fc_evt()
6386 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
6392 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_sli4_async_fc_evt()
6403 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
6419 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6425 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
6435 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6439 phba->sfp_warning |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_sli4_async_sli_evt()
6440 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
6452 lpfc_printf_log(phba, KERN_INFO, LOG_SLI | LOG_LDS_EVENT, in lpfc_sli4_async_sli_evt()
6456 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
6468 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
6494 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_sli_evt()
6498 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_async_sli_evt()
6503 if (phba->sli4_hba.lnk_info.optic_state == status) in lpfc_sli4_async_sli_evt()
6543 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_async_sli_evt()
6545 phba->lmt = 0; in lpfc_sli4_async_sli_evt()
6546 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_sli_evt()
6551 rc = lpfc_sli4_refresh_params(phba); in lpfc_sli4_async_sli_evt()
6553 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
6557 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_sli_evt()
6559 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_sli_evt()
6565 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_sli_evt()
6567 phba->sli4_hba.lnk_info.optic_state = status; in lpfc_sli4_async_sli_evt()
6568 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
6572 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6579 lpfc_sli4_cgn_parm_chg_evt(phba); in lpfc_sli4_async_sli_evt()
6587 lpfc_log_msg(phba, KERN_WARNING, LOG_SLI | LOG_DISCOVERY, in lpfc_sli4_async_sli_evt()
6590 phba->sli4_hba.fawwpn_flag &= ~LPFC_FAWWPN_FABRIC; in lpfc_sli4_async_sli_evt()
6591 memset(phba->pport->fc_portname.u.wwn, 0, in lpfc_sli4_async_sli_evt()
6596 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6602 if (phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_sli4_async_sli_evt()
6606 phba->cgn_acqe_cnt++; in lpfc_sli4_async_sli_evt()
6609 atomic64_add(cnt, &phba->cgn_acqe_stat.warn); in lpfc_sli4_async_sli_evt()
6610 atomic64_add(cgn_signal->alarm_cnt, &phba->cgn_acqe_stat.alarm); in lpfc_sli4_async_sli_evt()
6616 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { in lpfc_sli4_async_sli_evt()
6619 &phba->cgn_sync_alarm_cnt); in lpfc_sli4_async_sli_evt()
6623 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_sli4_async_sli_evt()
6624 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { in lpfc_sli4_async_sli_evt()
6626 atomic_add(cnt, &phba->cgn_sync_warn_cnt); in lpfc_sli4_async_sli_evt()
6632 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_async_sli_evt()
6640 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6662 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
6666 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
6667 if (!phba) in lpfc_sli4_perform_vport_cvl()
6680 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
6681 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
6684 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
6707 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
6712 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
6714 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
6716 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
6727 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
6738 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6739 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6744 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6750 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
6756 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
6762 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
6767 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
6771 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6772 if (phba->hba_flag & FCF_TS_INPROG) { in lpfc_sli4_async_fip_evt()
6773 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6777 if (phba->fcf.fcf_flag & (FCF_REDISC_EVT | FCF_REDISC_PEND)) { in lpfc_sli4_async_fip_evt()
6778 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6783 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
6784 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6787 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6790 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
6794 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
6797 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6803 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6810 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6811 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6819 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6820 if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && in lpfc_sli4_async_fip_evt()
6821 (phba->fcf.current_rec.fcf_indx != acqe_fip->index)) { in lpfc_sli4_async_fip_evt()
6822 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6824 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
6827 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6830 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
6839 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6841 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
6842 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6844 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
6848 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
6850 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
6855 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6856 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
6857 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6862 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
6865 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
6870 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
6874 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6875 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_fip_evt()
6880 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
6887 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
6889 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
6898 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
6927 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6928 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
6929 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6933 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
6934 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6935 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
6939 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
6941 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
6946 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6947 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
6948 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6953 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
6959 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
6963 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6978 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
6981 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
6982 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_dcbx_evt()
6997 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
7002 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
7003 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
7004 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
7005 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
7007 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
7010 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
7021 lpfc_sli4_async_cmstat_evt(struct lpfc_hba *phba) in lpfc_sli4_async_cmstat_evt() argument
7023 if (!phba->cgn_i) in lpfc_sli4_async_cmstat_evt()
7025 lpfc_init_congestion_stat(phba); in lpfc_sli4_async_cmstat_evt()
7037 lpfc_cgn_params_val(struct lpfc_hba *phba, struct lpfc_cgn_param *p_cfg_param) in lpfc_cgn_params_val() argument
7039 spin_lock_irq(&phba->hbalock); in lpfc_cgn_params_val()
7043 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, in lpfc_cgn_params_val()
7049 spin_unlock_irq(&phba->hbalock); in lpfc_cgn_params_val()
7072 lpfc_cgn_params_parse(struct lpfc_hba *phba, in lpfc_cgn_params_parse() argument
7083 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_cgn_params_parse()
7101 phba->cmf_active_mode); in lpfc_cgn_params_parse()
7103 oldmode = phba->cmf_active_mode; in lpfc_cgn_params_parse()
7108 lpfc_cgn_params_val(phba, p_cgn_param); in lpfc_cgn_params_parse()
7111 spin_lock_irq(&phba->hbalock); in lpfc_cgn_params_parse()
7112 memcpy(&phba->cgn_p, p_cgn_param, in lpfc_cgn_params_parse()
7116 if (phba->cgn_i) { in lpfc_cgn_params_parse()
7117 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_params_parse()
7118 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_params_parse()
7119 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_cgn_params_parse()
7120 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_cgn_params_parse()
7121 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_cgn_params_parse()
7126 spin_unlock_irq(&phba->hbalock); in lpfc_cgn_params_parse()
7128 phba->cmf_active_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_params_parse()
7132 if (phba->cgn_p.cgn_param_mode != LPFC_CFG_OFF) { in lpfc_cgn_params_parse()
7134 lpfc_cmf_start(phba); in lpfc_cgn_params_parse()
7136 if (phba->link_state >= LPFC_LINK_UP) { in lpfc_cgn_params_parse()
7137 phba->cgn_reg_fpin = in lpfc_cgn_params_parse()
7138 phba->cgn_init_reg_fpin; in lpfc_cgn_params_parse()
7139 phba->cgn_reg_signal = in lpfc_cgn_params_parse()
7140 phba->cgn_init_reg_signal; in lpfc_cgn_params_parse()
7141 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7146 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7149 lpfc_cmf_stop(phba); in lpfc_cgn_params_parse()
7150 if (phba->link_state >= LPFC_LINK_UP) in lpfc_cgn_params_parse()
7151 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7154 phba->cmf_max_bytes_per_interval = in lpfc_cgn_params_parse()
7155 phba->cmf_link_byte_count; in lpfc_cgn_params_parse()
7158 queue_work(phba->wq, in lpfc_cgn_params_parse()
7159 &phba->unblock_request_work); in lpfc_cgn_params_parse()
7164 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7167 lpfc_cmf_stop(phba); in lpfc_cgn_params_parse()
7168 if (phba->link_state >= LPFC_LINK_UP) in lpfc_cgn_params_parse()
7169 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7172 lpfc_cmf_signal_init(phba); in lpfc_cgn_params_parse()
7178 oldmode != phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7179 if (phba->cgn_p.cgn_param_mode == LPFC_CFG_MANAGED) in lpfc_cgn_params_parse()
7181 phba->cgn_p.cgn_param_level0); in lpfc_cgn_params_parse()
7185 dev_info(&phba->pcidev->dev, "%d: " in lpfc_cgn_params_parse()
7187 phba->brd_no, in lpfc_cgn_params_parse()
7189 [phba->cgn_p.cgn_param_mode], in lpfc_cgn_params_parse()
7193 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_cgn_params_parse()
7214 lpfc_sli4_cgn_params_read(struct lpfc_hba *phba) in lpfc_sli4_cgn_params_read() argument
7226 ret = lpfc_read_object(phba, (char *)LPFC_PORT_CFG_NAME, in lpfc_sli4_cgn_params_read()
7233 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7241 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7249 lpfc_cgn_params_parse(phba, p_cgn_param, len); in lpfc_sli4_cgn_params_read()
7275 lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *phba) in lpfc_sli4_cgn_parm_chg_evt() argument
7279 if (!phba->sli4_hba.pc_sli4_params.cmf) { in lpfc_sli4_cgn_parm_chg_evt()
7280 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7289 ret = lpfc_sli4_cgn_params_read(phba); in lpfc_sli4_cgn_parm_chg_evt()
7291 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7295 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7308 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
7314 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
7315 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
7316 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
7319 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7320 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
7321 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
7323 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, in lpfc_sli4_async_event_proc()
7329 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
7333 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
7336 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
7340 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
7344 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
7347 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
7350 lpfc_sli4_async_cmstat_evt(phba); in lpfc_sli4_async_event_proc()
7353 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_event_proc()
7362 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
7363 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7365 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7375 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
7379 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7381 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
7383 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
7385 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
7386 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7389 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
7391 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
7393 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fcf_redisc_event_proc()
7409 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
7414 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
7418 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
7421 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7425 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7429 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7433 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7448 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
7452 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7456 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7460 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7464 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_intr_mode()
7483 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
7488 if (!phba->pcidev) in lpfc_enable_pci_dev()
7491 pdev = phba->pcidev; in lpfc_enable_pci_dev()
7512 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_enable_pci_dev()
7525 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
7530 if (!phba->pcidev) in lpfc_disable_pci_dev()
7533 pdev = phba->pcidev; in lpfc_disable_pci_dev()
7551 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
7556 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
7557 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
7562 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) { in lpfc_reset_hba()
7563 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
7565 if (test_bit(MBX_TMO_ERR, &phba->bit_flags)) { in lpfc_reset_hba()
7567 rc = lpfc_pci_function_reset(phba); in lpfc_reset_hba()
7568 lpfc_els_flush_all_cmd(phba); in lpfc_reset_hba()
7570 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
7571 lpfc_sli_flush_io_rings(phba); in lpfc_reset_hba()
7573 lpfc_offline(phba); in lpfc_reset_hba()
7574 clear_bit(MBX_TMO_ERR, &phba->bit_flags); in lpfc_reset_hba()
7576 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_reset_hba()
7580 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
7581 lpfc_online(phba); in lpfc_reset_hba()
7582 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
7597 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
7599 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
7623 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
7625 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
7629 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
7631 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_probe_sriov_nr_virtfn()
7639 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7644 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7653 struct lpfc_hba *phba = container_of(work, struct lpfc_hba, in lpfc_unblock_requests_work() local
7656 lpfc_unblock_requests(phba); in lpfc_unblock_requests_work()
7671 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
7673 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
7678 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
7679 atomic_set(&phba->dbg_log_idx, 0); in lpfc_setup_driver_resource_phase1()
7680 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_setup_driver_resource_phase1()
7681 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_setup_driver_resource_phase1()
7682 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
7685 spin_lock_init(&phba->port_list_lock); in lpfc_setup_driver_resource_phase1()
7686 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
7688 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
7691 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
7693 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
7695 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
7697 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
7699 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
7702 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
7703 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
7704 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
7705 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
7708 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
7711 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
7714 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
7717 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
7718 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
7723 timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); in lpfc_setup_driver_resource_phase1()
7725 timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); in lpfc_setup_driver_resource_phase1()
7727 timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); in lpfc_setup_driver_resource_phase1()
7729 INIT_DELAYED_WORK(&phba->eq_delay_work, lpfc_hb_eq_delay_work); in lpfc_setup_driver_resource_phase1()
7731 INIT_DELAYED_WORK(&phba->idle_stat_delay_work, in lpfc_setup_driver_resource_phase1()
7733 INIT_WORK(&phba->unblock_request_work, lpfc_unblock_requests_work); in lpfc_setup_driver_resource_phase1()
7749 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
7758 timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); in lpfc_sli_driver_resource_setup()
7761 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
7762 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
7765 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
7768 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli_driver_resource_setup()
7772 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7773 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, in lpfc_sli_driver_resource_setup()
7776 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7784 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_driver_resource_setup()
7790 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
7800 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7804 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
7805 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
7808 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
7815 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7817 ((phba->cfg_sg_seg_cnt + 2) * entry_sz); in lpfc_sli_driver_resource_setup()
7820 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
7823 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
7825 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7826 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
7828 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
7830 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
7835 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
7836 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
7839 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
7842 phba->lpfc_sg_dma_buf_pool = in lpfc_sli_driver_resource_setup()
7844 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7847 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli_driver_resource_setup()
7850 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli_driver_resource_setup()
7852 &phba->pcidev->dev, in lpfc_sli_driver_resource_setup()
7857 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli_driver_resource_setup()
7864 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
7865 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
7866 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7868 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
7872 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7873 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
7880 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli_driver_resource_setup()
7881 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli_driver_resource_setup()
7883 lpfc_mem_free(phba); in lpfc_sli_driver_resource_setup()
7895 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
7898 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
7915 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
7926 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
7927 phba->sli4_hba.num_possible_cpu = cpumask_last(cpu_possible_mask) + 1; in lpfc_sli4_driver_resource_setup()
7928 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
7931 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
7934 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
7939 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
7946 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0); in lpfc_sli4_driver_resource_setup()
7947 if (!phba->wq) in lpfc_sli4_driver_resource_setup()
7954 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
7957 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
7960 hrtimer_init(&phba->cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in lpfc_sli4_driver_resource_setup()
7961 phba->cmf_timer.function = lpfc_cmf_timer; in lpfc_sli4_driver_resource_setup()
7963 hrtimer_init(&phba->cmf_stats_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in lpfc_sli4_driver_resource_setup()
7964 phba->cmf_stats_timer.function = lpfc_cmf_stats_timer; in lpfc_sli4_driver_resource_setup()
7970 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
7972 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
7974 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
7977 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
7980 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
7981 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
7982 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
7983 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
7992 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
7993 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
7994 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
7997 if (lpfc_is_vmid_enabled(phba)) in lpfc_sli4_driver_resource_setup()
7998 timer_setup(&phba->inactive_vmid_poll, lpfc_vmid_poll, 0); in lpfc_sli4_driver_resource_setup()
8004 spin_lock_init(&phba->sli4_hba.abts_io_buf_list_lock); in lpfc_sli4_driver_resource_setup()
8005 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_io_buf_list); in lpfc_sli4_driver_resource_setup()
8007 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8009 spin_lock_init(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_sli4_driver_resource_setup()
8010 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
8011 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
8012 spin_lock_init(&phba->sli4_hba.t_active_list_lock); in lpfc_sli4_driver_resource_setup()
8013 INIT_LIST_HEAD(&phba->sli4_hba.t_active_ctx_list); in lpfc_sli4_driver_resource_setup()
8017 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
8018 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
8019 spin_lock_init(&phba->sli4_hba.asynce_list_lock); in lpfc_sli4_driver_resource_setup()
8020 spin_lock_init(&phba->sli4_hba.els_xri_abrt_list_lock); in lpfc_sli4_driver_resource_setup()
8027 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
8029 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
8031 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
8033 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
8035 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
8038 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
8039 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
8040 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
8041 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
8046 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
8047 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
8050 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
8053 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
8058 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
8060 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
8065 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
8069 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8074 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
8079 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
8083 if (phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG) { in lpfc_sli4_driver_resource_setup()
8091 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_FABRIC; in lpfc_sli4_driver_resource_setup()
8094 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
8099 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
8101 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
8106 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
8114 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
8118 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8119 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
8121 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8127 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8135 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
8140 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
8146 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
8149 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
8151 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8156 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8163 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_driver_resource_setup()
8164 if (phba->irq_chann_mode == NHT_MODE) { in lpfc_sli4_driver_resource_setup()
8165 phba->cfg_irq_chann = in lpfc_sli4_driver_resource_setup()
8166 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
8167 phba->cfg_hdw_queue = in lpfc_sli4_driver_resource_setup()
8168 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
8169 phba->irq_chann_mode = NORMAL_MODE; in lpfc_sli4_driver_resource_setup()
8176 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
8183 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8186 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
8188 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
8189 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
8190 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
8191 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8196 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8203 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8214 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
8228 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
8240 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
8244 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8250 if (phba->cfg_enable_bg && in lpfc_sli4_driver_resource_setup()
8251 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
8252 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
8254 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8262 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
8264 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
8268 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
8269 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8277 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_driver_resource_setup()
8278 phba->cfg_sg_dma_buf_size = LPFC_DEFAULT_XPSGL_SIZE; in lpfc_sli4_driver_resource_setup()
8279 else if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
8280 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
8282 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
8283 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
8285 phba->border_sge_num = phba->cfg_sg_dma_buf_size / in lpfc_sli4_driver_resource_setup()
8289 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8290 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { in lpfc_sli4_driver_resource_setup()
8291 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, in lpfc_sli4_driver_resource_setup()
8295 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8297 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8300 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
8303 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8304 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sli4_driver_resource_setup()
8305 phba->cfg_nvme_seg_cnt); in lpfc_sli4_driver_resource_setup()
8307 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_sli4_driver_resource_setup()
8308 i = phba->cfg_sg_dma_buf_size; in lpfc_sli4_driver_resource_setup()
8312 phba->lpfc_sg_dma_buf_pool = in lpfc_sli4_driver_resource_setup()
8314 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8315 phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8317 if (!phba->lpfc_sg_dma_buf_pool) { in lpfc_sli4_driver_resource_setup()
8322 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli4_driver_resource_setup()
8324 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8328 if (!phba->lpfc_cmd_rsp_buf_pool) { in lpfc_sli4_driver_resource_setup()
8333 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8336 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
8339 lpfc_sli4_ras_init(phba); in lpfc_sli4_driver_resource_setup()
8342 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
8347 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
8352 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
8355 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
8357 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8361 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8363 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8370 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
8372 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
8373 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8380 phba->sli4_hba.hba_eq_hdl = kcalloc(phba->cfg_irq_chann, in lpfc_sli4_driver_resource_setup()
8383 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
8384 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8391 phba->sli4_hba.cpu_map = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
8394 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
8395 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8402 phba->sli4_hba.eq_info = alloc_percpu(struct lpfc_eq_intr_info); in lpfc_sli4_driver_resource_setup()
8403 if (!phba->sli4_hba.eq_info) { in lpfc_sli4_driver_resource_setup()
8404 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8410 phba->sli4_hba.idle_stat = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
8411 sizeof(*phba->sli4_hba.idle_stat), in lpfc_sli4_driver_resource_setup()
8413 if (!phba->sli4_hba.idle_stat) { in lpfc_sli4_driver_resource_setup()
8414 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8421 phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); in lpfc_sli4_driver_resource_setup()
8422 if (!phba->sli4_hba.c_stat) { in lpfc_sli4_driver_resource_setup()
8423 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8430 phba->cmf_stat = alloc_percpu(struct lpfc_cgn_stat); in lpfc_sli4_driver_resource_setup()
8431 if (!phba->cmf_stat) { in lpfc_sli4_driver_resource_setup()
8432 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8442 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
8443 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
8444 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8446 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
8450 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8451 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
8459 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_setup()
8462 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_setup()
8464 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_setup()
8466 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
8468 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
8470 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
8472 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8474 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
8476 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
8478 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool); in lpfc_sli4_driver_resource_setup()
8479 phba->lpfc_cmd_rsp_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8481 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli4_driver_resource_setup()
8482 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8484 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8486 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
8488 destroy_workqueue(phba->wq); in lpfc_sli4_driver_resource_setup()
8489 phba->wq = NULL; in lpfc_sli4_driver_resource_setup()
8501 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
8505 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_unset()
8507 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_unset()
8509 free_percpu(phba->cmf_stat); in lpfc_sli4_driver_resource_unset()
8510 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_unset()
8513 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
8514 phba->sli4_hba.num_possible_cpu = 0; in lpfc_sli4_driver_resource_unset()
8515 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
8516 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
8517 cpumask_clear(&phba->sli4_hba.irq_aff_mask); in lpfc_sli4_driver_resource_unset()
8520 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
8523 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
8524 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
8527 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
8530 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
8531 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8532 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8535 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
8536 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
8539 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
8542 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
8545 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
8549 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
8568 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
8570 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
8571 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
8572 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
8575 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
8576 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
8577 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
8580 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
8581 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
8582 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
8585 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_init_api_table_setup()
8605 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
8610 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
8611 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
8612 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
8613 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
8629 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
8631 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
8632 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
8633 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
8637 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
8638 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
8648 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
8652 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8654 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
8657 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
8659 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8677 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
8684 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8694 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
8704 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8705 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8706 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
8707 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8713 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
8726 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
8732 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
8744 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
8749 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8750 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
8751 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8754 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
8764 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
8770 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8771 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8772 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
8773 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8774 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8779 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
8787 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
8798 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
8802 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
8804 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
8806 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
8820 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
8822 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
8834 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
8837 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
8838 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
8839 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
8840 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
8843 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
8846 phba->sli4_hba.io_xri_cnt = 0; in lpfc_init_sgl_list()
8864 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
8869 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
8870 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
8872 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
8875 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
8877 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_init_rpi_hdrs()
8879 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
8900 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
8911 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
8913 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
8917 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
8919 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8925 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
8926 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8940 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
8961 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8965 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
8966 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
8968 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8972 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
8989 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
8993 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
8997 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
8999 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
9006 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
9024 struct lpfc_hba *phba; in lpfc_hba_alloc() local
9027 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
9028 if (!phba) { in lpfc_hba_alloc()
9034 phba->pcidev = pdev; in lpfc_hba_alloc()
9037 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
9038 if (phba->brd_no < 0) { in lpfc_hba_alloc()
9039 kfree(phba); in lpfc_hba_alloc()
9042 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
9044 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
9045 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
9047 return phba; in lpfc_hba_alloc()
9058 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
9060 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_hba_free()
9061 kfree(phba->sli4_hba.hdwq); in lpfc_hba_free()
9064 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
9067 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
9068 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
9070 kfree(phba); in lpfc_hba_free()
9086 struct lpfc_hba *phba = vport->phba; in lpfc_setup_fdmi_mask() local
9089 if (phba->cfg_enable_SmartSAN || in lpfc_setup_fdmi_mask()
9090 phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT) { in lpfc_setup_fdmi_mask()
9093 if (phba->cfg_enable_SmartSAN) in lpfc_setup_fdmi_mask()
9099 lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, in lpfc_setup_fdmi_mask()
9116 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
9122 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
9123 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
9124 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
9125 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
9127 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
9128 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
9133 phba->pport = vport; in lpfc_create_shost()
9135 if (phba->nvmet_support) { in lpfc_create_shost()
9137 phba->targetport = NULL; in lpfc_create_shost()
9138 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
9139 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME_DISC, in lpfc_create_shost()
9145 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
9164 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
9166 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
9183 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
9188 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9189 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
9193 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
9194 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
9197 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
9200 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
9204 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
9205 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
9207 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9208 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
9209 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
9210 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9213 phba->cfg_prot_mask, in lpfc_setup_bg()
9214 phba->cfg_prot_guard); in lpfc_setup_bg()
9216 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
9217 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
9219 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9234 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
9240 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
9246 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
9247 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
9251 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
9253 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
9257 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
9281 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
9283 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
9303 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
9306 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
9310 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
9311 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
9318 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
9319 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
9326 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
9327 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
9328 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
9331 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
9332 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9334 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
9335 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9338 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
9340 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
9342 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
9346 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
9348 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
9349 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
9353 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
9354 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
9356 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
9358 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
9359 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9360 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9361 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9362 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9368 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
9370 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
9372 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
9385 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
9390 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
9393 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
9397 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
9399 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
9402 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
9403 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
9418 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
9427 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
9432 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
9450 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9464 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
9469 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9471 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9473 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9475 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9477 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9479 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
9486 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
9489 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
9490 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
9491 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
9492 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
9494 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
9496 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
9497 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
9498 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
9499 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_post_status_check()
9509 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
9510 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
9517 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
9520 phba->work_status[0] = in lpfc_sli4_post_status_check()
9521 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9523 phba->work_status[1] = in lpfc_sli4_post_status_check()
9524 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9526 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9533 phba->work_status[0], in lpfc_sli4_post_status_check()
9534 phba->work_status[1]); in lpfc_sli4_post_status_check()
9541 &phba->sli4_hba.sli_intf) == in lpfc_sli4_post_status_check()
9543 pci_write_config_byte(phba->pcidev, in lpfc_sli4_post_status_check()
9563 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
9567 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
9568 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
9569 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
9570 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
9571 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
9572 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
9573 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
9574 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
9575 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9576 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9579 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9580 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9582 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9583 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9585 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9586 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9588 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9589 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9591 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9592 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9594 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9595 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9596 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9597 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9599 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9600 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9602 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9603 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9605 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9606 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9607 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
9608 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9609 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9610 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9611 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9614 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9615 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9617 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9618 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9620 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9621 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9623 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9624 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9626 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9627 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9629 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9630 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9632 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9633 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9637 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
9652 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
9656 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
9657 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9659 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9661 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9663 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9667 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9669 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9671 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9673 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9675 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9681 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
9699 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
9704 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9707 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9710 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9713 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
9714 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9716 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9737 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
9754 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
9768 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
9769 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
9771 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
9773 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
9784 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
9785 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
9790 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
9808 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
9810 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
9811 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
9812 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
9813 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
9815 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
9816 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
9843 lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) in lpfc_map_topology() argument
9851 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9855 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9858 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9862 phba->hba_flag |= HBA_PERSISTENT_TOPO; in lpfc_map_topology()
9865 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9867 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9870 phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) in lpfc_map_topology()
9874 phba->hba_flag &= ~HBA_PERSISTENT_TOPO; in lpfc_map_topology()
9879 phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : in lpfc_map_topology()
9882 phba->cfg_topology = ((pt == LINK_FLAGS_P2P) in lpfc_map_topology()
9887 if (phba->hba_flag & HBA_PERSISTENT_TOPO) { in lpfc_map_topology()
9888 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9890 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9892 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9895 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9914 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
9927 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
9929 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9935 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
9937 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
9939 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9948 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
9949 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
9951 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
9953 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
9955 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
9956 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
9958 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
9962 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
9963 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
9969 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_read_config()
9973 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_CONFIG; in lpfc_sli4_read_config()
9976 phba->sli4_hba.fawwpn_flag &= ~LPFC_FAWWPN_CONFIG; in lpfc_sli4_read_config()
9979 phba->sli4_hba.conf_trunk = in lpfc_sli4_read_config()
9981 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
9984 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
9988 phba->sli4_hba.max_cfg_param.max_xri > 512) in lpfc_sli4_read_config()
9989 phba->sli4_hba.max_cfg_param.max_xri = 512; in lpfc_sli4_read_config()
9990 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
9992 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
9995 if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) in lpfc_sli4_read_config()
9996 phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; in lpfc_sli4_read_config()
9997 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
9999 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
10001 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
10003 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
10005 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
10007 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
10009 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
10011 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
10013 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
10015 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
10017 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
10018 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
10019 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
10020 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
10021 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
10022 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
10023 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
10034 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
10035 phba->cgn_reg_signal = EDC_CG_SIG_NOTSUPPORTED; in lpfc_sli4_read_config()
10036 phba->cgn_sig_freq = lpfc_fabric_cgn_frequency; in lpfc_sli4_read_config()
10040 phba->cgn_reg_signal = EDC_CG_SIG_WARN_ONLY; in lpfc_sli4_read_config()
10041 phba->cgn_reg_fpin &= ~LPFC_CGN_FPIN_WARN; in lpfc_sli4_read_config()
10047 if (phba->cgn_reg_signal != in lpfc_sli4_read_config()
10050 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
10051 phba->cgn_reg_signal = in lpfc_sli4_read_config()
10054 phba->cgn_reg_signal = in lpfc_sli4_read_config()
10056 phba->cgn_reg_fpin = in lpfc_sli4_read_config()
10063 phba->cgn_init_reg_fpin = phba->cgn_reg_fpin; in lpfc_sli4_read_config()
10064 phba->cgn_init_reg_signal = phba->cgn_reg_signal; in lpfc_sli4_read_config()
10066 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_sli4_read_config()
10068 phba->cgn_reg_signal, phba->cgn_reg_fpin); in lpfc_sli4_read_config()
10070 lpfc_map_topology(phba, rd_config); in lpfc_sli4_read_config()
10071 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10078 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
10079 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
10080 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
10081 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
10082 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
10083 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
10084 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
10085 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
10086 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
10087 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
10088 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
10089 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
10090 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
10091 phba->sli4_hba.max_cfg_param.max_rq, in lpfc_sli4_read_config()
10092 phba->lmt); in lpfc_sli4_read_config()
10098 qmin = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
10099 if (phba->sli4_hba.max_cfg_param.max_cq < qmin) in lpfc_sli4_read_config()
10100 qmin = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
10106 if (phba->sli4_hba.max_cfg_param.max_eq < qmin) in lpfc_sli4_read_config()
10107 qmin = phba->sli4_hba.max_cfg_param.max_eq; in lpfc_sli4_read_config()
10110 if ((phba->cfg_irq_chann > qmin) || in lpfc_sli4_read_config()
10111 (phba->cfg_hdw_queue > qmin)) { in lpfc_sli4_read_config()
10112 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10117 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
10118 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
10119 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
10120 qmin, phba->cfg_irq_chann, in lpfc_sli4_read_config()
10121 phba->cfg_hdw_queue); in lpfc_sli4_read_config()
10123 if (phba->cfg_irq_chann > qmin) in lpfc_sli4_read_config()
10124 phba->cfg_irq_chann = qmin; in lpfc_sli4_read_config()
10125 if (phba->cfg_hdw_queue > qmin) in lpfc_sli4_read_config()
10126 phba->cfg_hdw_queue = qmin; in lpfc_sli4_read_config()
10134 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
10139 phba->hba_flag |= HBA_FORCED_LINK_SPEED; in lpfc_sli4_read_config()
10143 phba->cfg_link_speed = in lpfc_sli4_read_config()
10147 phba->cfg_link_speed = in lpfc_sli4_read_config()
10151 phba->cfg_link_speed = in lpfc_sli4_read_config()
10155 phba->cfg_link_speed = in lpfc_sli4_read_config()
10159 phba->cfg_link_speed = in lpfc_sli4_read_config()
10163 phba->cfg_link_speed = in lpfc_sli4_read_config()
10167 phba->cfg_link_speed = in lpfc_sli4_read_config()
10171 phba->cfg_link_speed = in lpfc_sli4_read_config()
10175 phba->cfg_link_speed = in lpfc_sli4_read_config()
10179 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_read_config()
10184 phba->cfg_link_speed = in lpfc_sli4_read_config()
10191 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
10192 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
10193 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
10194 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
10196 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
10197 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
10200 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
10207 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
10211 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
10217 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10240 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
10242 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
10249 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10251 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
10252 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
10254 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10260 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
10278 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
10285 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
10288 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
10291 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10304 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
10306 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10312 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
10337 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
10344 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
10345 if (phba->cfg_hdw_queue < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
10346 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_sli4_queue_verify()
10347 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
10348 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
10351 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
10353 phba->cfg_hdw_queue, phba->cfg_irq_chann, in lpfc_sli4_queue_verify()
10354 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
10357 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
10358 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10361 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
10362 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10367 lpfc_alloc_io_wq_cq(struct lpfc_hba *phba, int idx) in lpfc_alloc_io_wq_cq() argument
10373 cpu = lpfc_find_cpu_handle(phba, idx, LPFC_FIND_BY_HDWQ); in lpfc_alloc_io_wq_cq()
10375 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_io_wq_cq()
10377 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10378 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10382 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10383 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10384 phba->sli4_hba.cq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10386 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10394 phba->sli4_hba.hdwq[idx].io_cq = qdesc; in lpfc_alloc_io_wq_cq()
10397 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_io_wq_cq()
10399 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_io_wq_cq()
10400 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_io_wq_cq()
10401 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10405 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10406 phba->sli4_hba.wq_esize, in lpfc_alloc_io_wq_cq()
10407 phba->sli4_hba.wq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10410 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10417 phba->sli4_hba.hdwq[idx].io_wq = qdesc; in lpfc_alloc_io_wq_cq()
10418 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_io_wq_cq()
10437 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
10450 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
10451 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
10452 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
10453 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
10454 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
10455 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
10456 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
10457 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
10458 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
10459 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
10461 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10462 phba->sli4_hba.hdwq = kcalloc( in lpfc_sli4_queue_create()
10463 phba->cfg_hdw_queue, sizeof(struct lpfc_sli4_hdw_queue), in lpfc_sli4_queue_create()
10465 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10466 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10472 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10473 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_queue_create()
10491 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10492 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10493 phba->sli4_hba.nvmet_cqset = kcalloc( in lpfc_sli4_queue_create()
10494 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10497 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
10498 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10503 phba->sli4_hba.nvmet_mrq_hdr = kcalloc( in lpfc_sli4_queue_create()
10504 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10507 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
10508 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10513 phba->sli4_hba.nvmet_mrq_data = kcalloc( in lpfc_sli4_queue_create()
10514 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10517 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
10518 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10526 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10534 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10539 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10542 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10543 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
10544 phba->sli4_hba.eq_ecount, cpu); in lpfc_sli4_queue_create()
10546 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10559 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, qdesc->last_cpu); in lpfc_sli4_queue_create()
10567 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10574 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10579 eqcpu = lpfc_find_cpu_handle(phba, cpup->eq, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10580 eqcpup = &phba->sli4_hba.cpu_map[eqcpu]; in lpfc_sli4_queue_create()
10581 qp->hba_eq = phba->sli4_hba.hdwq[eqcpup->hdwq].hba_eq; in lpfc_sli4_queue_create()
10585 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10586 if (lpfc_alloc_io_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
10590 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10591 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10592 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10594 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10596 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10597 phba->sli4_hba.cq_ecount, in lpfc_sli4_queue_create()
10600 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10608 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
10616 cpu = lpfc_find_cpu_handle(phba, 0, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10618 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10619 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10620 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10622 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10627 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
10630 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10631 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10632 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10634 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10640 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
10649 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10650 phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
10651 phba->sli4_hba.mq_ecount, cpu); in lpfc_sli4_queue_create()
10653 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10658 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
10665 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10666 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
10667 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10669 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10674 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
10675 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10677 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10679 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10680 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10681 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10683 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10689 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
10692 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10693 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
10694 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10696 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10701 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
10702 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10710 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10711 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10712 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10714 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10718 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
10721 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10722 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10723 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10725 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10729 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
10731 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_sli4_queue_create()
10732 phba->nvmet_support) { in lpfc_sli4_queue_create()
10733 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10734 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10737 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10739 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10743 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10749 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
10756 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10766 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10768 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10772 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10778 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
10783 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10784 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10785 memset(&phba->sli4_hba.hdwq[idx].nvme_cstat, 0, in lpfc_sli4_queue_create()
10786 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); in lpfc_sli4_queue_create()
10791 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_queue_create()
10792 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10793 memset(&phba->sli4_hba.hdwq[idx].scsi_cstat, 0, in lpfc_sli4_queue_create()
10794 sizeof(phba->sli4_hba.hdwq[idx].scsi_cstat)); in lpfc_sli4_queue_create()
10801 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
10830 lpfc_sli4_release_hdwq(struct lpfc_hba *phba) in lpfc_sli4_release_hdwq() argument
10836 hdwq = phba->sli4_hba.hdwq; in lpfc_sli4_release_hdwq()
10839 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_release_hdwq()
10846 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_release_hdwq()
10847 lpfc_free_sgl_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10848 lpfc_free_cmd_rsp_buf_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10851 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_release_hdwq()
10853 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_sli4_release_hdwq()
10855 phba->sli4_hba.hba_eq_hdl[idx].eq = NULL; in lpfc_sli4_release_hdwq()
10872 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
10879 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10880 phba->sli.sli_flag |= LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10881 while (phba->sli.sli_flag & LPFC_QUEUE_FREE_WAIT) { in lpfc_sli4_queue_destroy()
10882 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10884 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10886 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10888 lpfc_sli4_cleanup_poll_list(phba); in lpfc_sli4_queue_destroy()
10891 if (phba->sli4_hba.hdwq) in lpfc_sli4_queue_destroy()
10892 lpfc_sli4_release_hdwq(phba); in lpfc_sli4_queue_destroy()
10894 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
10895 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
10896 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10898 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
10899 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10900 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
10901 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10905 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
10908 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
10911 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
10914 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
10915 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
10918 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
10921 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
10924 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
10927 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
10930 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10931 phba->sli.sli_flag &= ~LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10932 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10936 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
10948 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
10955 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
10963 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10970 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
10973 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10984 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
10989 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
10991 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
11003 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
11007 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
11009 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
11016 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
11018 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
11019 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
11033 lpfc_setup_cq_lookup(struct lpfc_hba *phba) in lpfc_setup_cq_lookup() argument
11038 memset(phba->sli4_hba.cq_lookup, 0, in lpfc_setup_cq_lookup()
11039 (sizeof(struct lpfc_queue *) * (phba->sli4_hba.cq_max + 1))); in lpfc_setup_cq_lookup()
11041 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_setup_cq_lookup()
11043 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_setup_cq_lookup()
11048 if (childq->queue_id > phba->sli4_hba.cq_max) in lpfc_setup_cq_lookup()
11051 phba->sli4_hba.cq_lookup[childq->queue_id] = in lpfc_setup_cq_lookup()
11070 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
11082 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
11084 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11091 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
11095 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
11102 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11106 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
11111 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
11113 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
11114 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
11115 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
11117 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11119 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
11120 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
11122 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
11127 qp = phba->sli4_hba.hdwq; in lpfc_sli4_queue_setup()
11131 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11138 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_setup()
11141 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
11152 rc = lpfc_eq_create(phba, qp[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
11153 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
11155 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11163 phba->sli4_hba.hba_eq_hdl[cpup->eq].eq = in lpfc_sli4_queue_setup()
11166 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11174 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_setup()
11175 cpu = lpfc_find_cpu_handle(phba, qidx, LPFC_FIND_BY_HDWQ); in lpfc_sli4_queue_setup()
11176 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
11179 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
11180 phba->sli4_hba.hdwq[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
11183 &phba->sli4_hba.hdwq[qidx].io_cq_map, in lpfc_sli4_queue_setup()
11187 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11201 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
11202 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11204 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
11210 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11211 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
11212 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
11215 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11220 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11221 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
11222 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11228 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11229 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
11230 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11234 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11242 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11246 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11251 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
11253 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11256 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
11262 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
11263 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11265 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11269 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11270 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
11271 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
11274 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11279 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11281 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
11282 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11284 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_setup()
11286 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
11287 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11289 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11293 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11294 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
11295 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
11298 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11304 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11307 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
11308 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
11314 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11315 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
11316 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
11317 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
11318 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11324 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11325 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
11326 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
11327 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
11328 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11331 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11339 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
11340 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
11341 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
11342 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11345 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11353 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11356 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
11357 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
11358 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
11363 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
11364 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11370 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
11371 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
11373 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11379 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11382 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
11383 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
11384 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11386 if (phba->cfg_fcp_imax) in lpfc_sli4_queue_setup()
11387 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_sli4_queue_setup()
11391 for (qidx = 0; qidx < phba->cfg_irq_chann; in lpfc_sli4_queue_setup()
11393 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
11396 if (phba->sli4_hba.cq_max) { in lpfc_sli4_queue_setup()
11397 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_setup()
11398 phba->sli4_hba.cq_lookup = kcalloc((phba->sli4_hba.cq_max + 1), in lpfc_sli4_queue_setup()
11400 if (!phba->sli4_hba.cq_lookup) { in lpfc_sli4_queue_setup()
11401 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11403 "size 0x%x\n", phba->sli4_hba.cq_max); in lpfc_sli4_queue_setup()
11407 lpfc_setup_cq_lookup(phba); in lpfc_sli4_queue_setup()
11412 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
11430 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
11437 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
11438 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
11441 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
11442 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
11445 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
11446 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
11449 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
11450 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
11451 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
11454 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
11455 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
11458 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
11459 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
11462 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
11463 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
11465 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
11467 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
11468 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11470 phba, in lpfc_sli4_queue_unset()
11471 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
11472 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
11476 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
11477 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11479 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
11484 if (phba->sli4_hba.hdwq) { in lpfc_sli4_queue_unset()
11486 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_unset()
11488 qp = &phba->sli4_hba.hdwq[qidx]; in lpfc_sli4_queue_unset()
11489 lpfc_wq_destroy(phba, qp->io_wq); in lpfc_sli4_queue_unset()
11490 lpfc_cq_destroy(phba, qp->io_cq); in lpfc_sli4_queue_unset()
11493 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_unset()
11495 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_sli4_queue_unset()
11496 lpfc_eq_destroy(phba, eq); in lpfc_sli4_queue_unset()
11500 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_unset()
11501 phba->sli4_hba.cq_lookup = NULL; in lpfc_sli4_queue_unset()
11502 phba->sli4_hba.cq_max = 0; in lpfc_sli4_queue_unset()
11522 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
11527 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
11532 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
11537 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
11552 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
11557 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
11574 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
11578 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
11594 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
11599 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11600 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
11601 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11614 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
11617 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
11629 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
11633 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11634 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
11635 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11646 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
11655 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11656 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
11658 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11661 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11662 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
11664 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11669 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release_all()
11686 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
11697 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
11700 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
11703 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11711 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
11714 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
11720 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
11722 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11739 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11750 phba->work_status[0] = readl( in lpfc_pci_function_reset()
11751 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
11752 phba->work_status[1] = readl( in lpfc_pci_function_reset()
11753 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
11754 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11758 phba->work_status[0], in lpfc_pci_function_reset()
11759 phba->work_status[1]); in lpfc_pci_function_reset()
11776 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11779 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
11799 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11820 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
11822 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
11842 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
11847 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
11849 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_pci_mem_setup()
11852 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
11856 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
11864 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
11871 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11872 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11873 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11879 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11881 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11883 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
11890 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11891 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11892 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11898 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11907 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11910 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11911 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
11913 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11920 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
11921 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11922 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11935 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
11937 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11938 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
11939 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11945 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11946 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11955 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11958 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11959 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
11961 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11968 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
11969 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11970 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
11985 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
11987 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11988 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
11989 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11995 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
12002 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
12003 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_write_eq_db; in lpfc_sli4_pci_mem_setup()
12004 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_write_cq_db; in lpfc_sli4_pci_mem_setup()
12007 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
12008 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_if6_write_eq_db; in lpfc_sli4_pci_mem_setup()
12009 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_if6_write_cq_db; in lpfc_sli4_pci_mem_setup()
12018 if (phba->sli4_hba.drbl_regs_memmap_p) in lpfc_sli4_pci_mem_setup()
12019 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12021 if (phba->sli4_hba.ctrl_regs_memmap_p) in lpfc_sli4_pci_mem_setup()
12022 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12024 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12037 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
12040 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
12044 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12045 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12046 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12049 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12052 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12053 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12054 if (phba->sli4_hba.dpp_regs_memmap_p) in lpfc_sli4_pci_mem_unset()
12055 iounmap(phba->sli4_hba.dpp_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12060 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
12079 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
12085 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
12088 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
12098 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
12100 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
12102 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
12109 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
12111 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
12114 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
12123 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
12127 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_enable_msix()
12132 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
12135 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
12137 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
12145 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
12150 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
12154 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
12158 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
12162 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
12183 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
12187 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
12189 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
12192 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
12197 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
12198 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
12200 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
12201 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
12225 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
12231 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
12234 phba->hba_flag &= ~HBA_NEEDS_CFG_PORT; in lpfc_sli_enable_intr()
12238 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
12241 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
12247 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12248 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
12251 phba->intr_type = MSI; in lpfc_sli_enable_intr()
12257 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12258 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
12259 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
12262 phba->intr_type = INTx; in lpfc_sli_enable_intr()
12279 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
12283 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
12289 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
12290 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
12293 phba->intr_type = NONE; in lpfc_sli_disable_intr()
12294 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
12306 lpfc_find_cpu_handle(struct lpfc_hba *phba, uint16_t id, int match) in lpfc_find_cpu_handle() argument
12313 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_find_cpu_handle()
12340 lpfc_find_hyper(struct lpfc_hba *phba, int cpu, in lpfc_find_hyper() argument
12347 cpup = &phba->sli4_hba.cpu_map[idx]; in lpfc_find_hyper()
12368 lpfc_assign_eq_map_info(struct lpfc_hba *phba, uint16_t eqidx, uint16_t flag, in lpfc_assign_eq_map_info() argument
12371 struct lpfc_vector_map_info *cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_assign_eq_map_info()
12377 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_assign_eq_map_info()
12389 lpfc_cpu_map_array_init(struct lpfc_hba *phba) in lpfc_cpu_map_array_init() argument
12396 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_map_array_init()
12402 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, cpu); in lpfc_cpu_map_array_init()
12415 lpfc_hba_eq_hdl_array_init(struct lpfc_hba *phba) in lpfc_hba_eq_hdl_array_init() argument
12420 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hba_eq_hdl_array_init()
12423 eqhdl->phba = phba; in lpfc_hba_eq_hdl_array_init()
12438 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
12459 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12464 if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id)) in lpfc_cpu_affinity_check()
12472 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12496 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12509 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12510 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12529 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12542 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12555 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12556 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12563 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
12578 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12591 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12600 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12618 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12628 if (next_idx < phba->cfg_hdw_queue) { in lpfc_cpu_affinity_check()
12640 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12641 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12654 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12655 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12663 cpup->hdwq = idx % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12671 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12684 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12686 c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, cpu); in lpfc_cpu_affinity_check()
12692 cpup->hdwq = idx++ % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12696 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12716 lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu, in lpfc_cpuhp_get_eq() argument
12728 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_cpuhp_get_eq()
12729 maskp = pci_irq_get_affinity(phba->pcidev, idx); in lpfc_cpuhp_get_eq()
12754 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_cpuhp_get_eq()
12761 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba) in __lpfc_cpuhp_remove() argument
12763 if (phba->sli_rev != LPFC_SLI_REV4) in __lpfc_cpuhp_remove()
12767 &phba->cpuhp); in __lpfc_cpuhp_remove()
12773 del_timer_sync(&phba->cpuhp_poll_timer); in __lpfc_cpuhp_remove()
12776 static void lpfc_cpuhp_remove(struct lpfc_hba *phba) in lpfc_cpuhp_remove() argument
12778 if (phba->pport && (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_cpuhp_remove()
12781 __lpfc_cpuhp_remove(phba); in lpfc_cpuhp_remove()
12784 static void lpfc_cpuhp_add(struct lpfc_hba *phba) in lpfc_cpuhp_add() argument
12786 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cpuhp_add()
12791 if (!list_empty(&phba->poll_list)) in lpfc_cpuhp_add()
12792 mod_timer(&phba->cpuhp_poll_timer, in lpfc_cpuhp_add()
12798 &phba->cpuhp); in lpfc_cpuhp_add()
12801 static int __lpfc_cpuhp_checks(struct lpfc_hba *phba, int *retval) in __lpfc_cpuhp_checks() argument
12803 if (phba->pport->load_flag & FC_UNLOADING) { in __lpfc_cpuhp_checks()
12808 if (phba->sli_rev != LPFC_SLI_REV4) { in __lpfc_cpuhp_checks()
12861 lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline) in lpfc_irq_rebalance() argument
12868 if (phba->irq_chann_mode == NORMAL_MODE) in lpfc_irq_rebalance()
12871 orig_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_rebalance()
12876 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_irq_rebalance()
12891 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_irq_rebalance()
12901 for (idx = 0; idx < phba->cfg_irq_chann; idx++) in lpfc_irq_rebalance()
12912 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_offline() local
12917 if (!phba) { in lpfc_cpu_offline()
12918 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_offline()
12922 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_offline()
12925 lpfc_irq_rebalance(phba, cpu, true); in lpfc_cpu_offline()
12927 retval = lpfc_cpuhp_get_eq(phba, cpu, &eqlist); in lpfc_cpu_offline()
12942 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_online() local
12947 if (!phba) { in lpfc_cpu_online()
12948 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_online()
12952 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_online()
12955 lpfc_irq_rebalance(phba, cpu, false); in lpfc_cpu_online()
12957 list_for_each_entry_safe(eq, next, &phba->poll_list, _poll_list) { in lpfc_cpu_online()
12958 n = lpfc_find_cpu_handle(phba, eq->hdwq, LPFC_FIND_BY_HDWQ); in lpfc_cpu_online()
12995 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
13007 vectors = phba->cfg_irq_chann; in lpfc_sli4_enable_msix()
13009 if (phba->irq_chann_mode != NORMAL_MODE) in lpfc_sli4_enable_msix()
13010 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_sli4_enable_msix()
13014 vectors = min(phba->cfg_irq_chann, cpu_cnt); in lpfc_sli4_enable_msix()
13025 rc = pci_alloc_irq_vectors(phba->pcidev, 1, vectors, flags); in lpfc_sli4_enable_msix()
13027 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
13042 rc = pci_irq_vector(phba->pcidev, index); in lpfc_sli4_enable_msix()
13044 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
13056 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
13068 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
13079 lpfc_assign_eq_map_info(phba, index, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_msix()
13082 maskp = pci_irq_get_affinity(phba->pcidev, index); in lpfc_sli4_enable_msix()
13086 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_enable_msix()
13102 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
13110 if (vectors != phba->cfg_irq_chann) { in lpfc_sli4_enable_msix()
13111 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_enable_msix()
13114 phba->cfg_irq_chann, vectors); in lpfc_sli4_enable_msix()
13115 if (phba->cfg_irq_chann > vectors) in lpfc_sli4_enable_msix()
13116 phba->cfg_irq_chann = vectors; in lpfc_sli4_enable_msix()
13130 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
13151 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
13157 rc = pci_alloc_irq_vectors(phba->pcidev, 1, 1, in lpfc_sli4_enable_msi()
13160 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
13163 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
13168 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
13169 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
13171 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
13172 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
13178 rc = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_msi()
13180 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
13181 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
13188 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); in lpfc_sli4_enable_msi()
13190 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_enable_msi()
13216 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
13226 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
13229 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
13236 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13237 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
13240 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
13246 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13247 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
13248 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
13254 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
13258 retval = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_intr()
13260 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_intr()
13268 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_intr()
13270 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_enable_intr()
13289 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
13292 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
13297 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_disable_intr()
13303 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
13306 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
13309 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
13310 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
13321 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
13323 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
13330 kfree(phba->vpi_bmask); in lpfc_unset_hba()
13331 kfree(phba->vpi_ids); in lpfc_unset_hba()
13333 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
13335 phba->pport->work_port_events = 0; in lpfc_unset_hba()
13337 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
13339 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
13341 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
13360 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
13367 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13376 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
13377 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
13380 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13381 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13389 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13391 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13397 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13402 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13407 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13419 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13420 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13429 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13431 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13434 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13450 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
13454 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
13456 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
13457 hrtimer_cancel(&phba->cmf_stats_timer); in lpfc_sli4_hba_unset()
13458 hrtimer_cancel(&phba->cmf_timer); in lpfc_sli4_hba_unset()
13460 if (phba->pport) in lpfc_sli4_hba_unset()
13461 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
13469 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13470 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
13471 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13473 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13479 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13480 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13481 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
13483 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
13484 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
13485 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
13486 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13490 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
13492 if (!pci_channel_offline(phba->pcidev)) in lpfc_sli4_hba_unset()
13494 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
13497 if (phba->pport) in lpfc_sli4_hba_unset()
13498 lpfc_cpuhp_remove(phba); in lpfc_sli4_hba_unset()
13501 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
13504 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
13508 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
13511 lpfc_ras_stop_fwlog(phba); in lpfc_sli4_hba_unset()
13514 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
13517 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
13520 if (phba->ras_fwlog.ras_enabled) in lpfc_sli4_hba_unset()
13521 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_hba_unset()
13524 if (phba->pport) in lpfc_sli4_hba_unset()
13525 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
13579 lpfc_init_congestion_buf(struct lpfc_hba *phba) in lpfc_init_congestion_buf() argument
13585 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_buf()
13586 "6235 INIT Congestion Buffer %p\n", phba->cgn_i); in lpfc_init_congestion_buf()
13588 if (!phba->cgn_i) in lpfc_init_congestion_buf()
13590 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_buf()
13592 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_init_congestion_buf()
13593 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_init_congestion_buf()
13594 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_init_congestion_buf()
13595 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_init_congestion_buf()
13597 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_init_congestion_buf()
13598 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_init_congestion_buf()
13599 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_init_congestion_buf()
13600 phba->cgn_evt_minute = 0; in lpfc_init_congestion_buf()
13607 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_init_congestion_buf()
13608 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_init_congestion_buf()
13609 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_init_congestion_buf()
13610 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_init_congestion_buf()
13612 lpfc_cgn_update_tstamp(phba, &cp->base_time); in lpfc_init_congestion_buf()
13615 if (phba->pport) { in lpfc_init_congestion_buf()
13616 size = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_init_congestion_buf()
13627 phba->cgn_evt_timestamp = jiffies + in lpfc_init_congestion_buf()
13632 lpfc_init_congestion_stat(struct lpfc_hba *phba) in lpfc_init_congestion_stat() argument
13637 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_stat()
13638 "6236 INIT Congestion Stat %p\n", phba->cgn_i); in lpfc_init_congestion_stat()
13640 if (!phba->cgn_i) in lpfc_init_congestion_stat()
13643 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_stat()
13646 lpfc_cgn_update_tstamp(phba, &cp->stat_start); in lpfc_init_congestion_stat()
13657 __lpfc_reg_congestion_buf(struct lpfc_hba *phba, int reg) in __lpfc_reg_congestion_buf() argument
13665 if (!phba->cgn_i) in __lpfc_reg_congestion_buf()
13668 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in __lpfc_reg_congestion_buf()
13670 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in __lpfc_reg_congestion_buf()
13673 phba->pport->port_state, reg); in __lpfc_reg_congestion_buf()
13679 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in __lpfc_reg_congestion_buf()
13690 putPaddrLow(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13692 putPaddrHigh(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13694 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in __lpfc_reg_congestion_buf()
13700 mempool_free(mboxq, phba->mbox_mem_pool); in __lpfc_reg_congestion_buf()
13702 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in __lpfc_reg_congestion_buf()
13713 lpfc_unreg_congestion_buf(struct lpfc_hba *phba) in lpfc_unreg_congestion_buf() argument
13715 lpfc_cmf_stop(phba); in lpfc_unreg_congestion_buf()
13716 return __lpfc_reg_congestion_buf(phba, 0); in lpfc_unreg_congestion_buf()
13720 lpfc_reg_congestion_buf(struct lpfc_hba *phba) in lpfc_reg_congestion_buf() argument
13722 return __lpfc_reg_congestion_buf(phba, 1); in lpfc_reg_congestion_buf()
13738 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
13753 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
13758 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
13761 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
13762 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
13764 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
13765 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
13769 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
13779 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13781 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13800 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13801 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13805 phba->cfg_xpsgl = bf_get(cfg_xpsgl, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13816 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) { in lpfc_get_sli4_parameters()
13817 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13820 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13826 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
13827 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13832 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13834 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
13835 phba->cfg_nvmet_mrq = 0; in lpfc_get_sli4_parameters()
13836 phba->cfg_nvme_seg_cnt = 0; in lpfc_get_sli4_parameters()
13839 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
13841 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
13848 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_get_sli4_parameters()
13849 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_get_sli4_parameters()
13853 phba->cfg_enable_pbde = 1; in lpfc_get_sli4_parameters()
13855 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
13865 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
13867 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
13869 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
13872 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
13878 rc = dma_set_max_seg_size(&phba->pcidev->dev, sli4_params->sge_supp_len); in lpfc_get_sli4_parameters()
13880 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_get_sli4_parameters()
13891 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
13893 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
13895 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13898 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
13899 phba->fcp_embed_io, sli4_params->nvme, in lpfc_get_sli4_parameters()
13900 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
13902 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13904 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13912 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
13914 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
13919 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
13921 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
13927 phba->nsler = 1; in lpfc_get_sli4_parameters()
13929 phba->nsler = 0; in lpfc_get_sli4_parameters()
13954 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
13961 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
13962 if (!phba) in lpfc_pci_probe_one_s3()
13966 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
13971 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
13976 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
13978 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13984 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
13986 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13993 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
13995 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14001 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
14003 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14009 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
14012 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
14014 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14020 vport = phba->pport; in lpfc_pci_probe_one_s3()
14023 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
14030 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
14033 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
14035 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
14037 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
14043 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
14044 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
14054 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
14056 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
14057 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
14060 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
14065 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
14072 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
14075 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
14080 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
14084 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
14086 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
14088 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
14090 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
14092 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
14094 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
14098 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
14117 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
14120 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
14122 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
14127 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
14129 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
14134 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
14150 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
14152 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
14154 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
14156 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
14157 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
14159 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
14160 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
14162 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
14167 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
14171 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
14179 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
14180 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s3()
14182 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
14185 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
14189 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
14192 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
14193 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
14195 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
14225 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
14227 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
14231 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
14232 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
14233 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
14236 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
14264 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
14268 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
14272 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
14273 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
14274 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
14275 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
14276 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
14283 lpfc_cpu_map_array_init(phba); in lpfc_pci_resume_one_s3()
14285 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_resume_one_s3()
14287 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14289 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s3()
14293 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
14296 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
14297 lpfc_online(phba); in lpfc_pci_resume_one_s3()
14300 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14313 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
14315 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_recover()
14322 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
14334 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
14336 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_reset()
14340 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
14343 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
14346 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_reset()
14349 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
14352 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
14353 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
14365 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
14367 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_perm_failure()
14370 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
14371 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_sli_prep_dev_for_perm_failure()
14374 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
14377 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
14402 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
14407 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
14411 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14415 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
14419 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s3()
14421 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14448 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
14449 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
14470 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14472 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14475 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14477 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s3()
14482 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
14485 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
14486 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
14487 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
14490 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14509 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
14512 lpfc_online(phba); in lpfc_io_resume_s3()
14522 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
14524 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
14526 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
14552 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
14554 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
14556 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
14563 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
14570 sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf); in lpfc_log_write_firmware_error()
14584 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14588 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14592 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14597 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14601 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14605 offset, phba->pcidev->device, magic_number, in lpfc_log_write_firmware_error()
14621 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
14643 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
14645 lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI, in lpfc_write_firmware()
14656 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
14681 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
14684 rc = lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
14695 lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI, in lpfc_write_firmware()
14703 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
14710 lpfc_log_msg(phba, KERN_ERR, LOG_INIT | LOG_SLI, in lpfc_write_firmware()
14713 lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI, in lpfc_write_firmware()
14726 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
14733 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
14737 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
14741 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
14742 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
14745 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
14747 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
14776 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
14783 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
14784 if (!phba) in lpfc_pci_probe_one_s4()
14787 INIT_LIST_HEAD(&phba->poll_list); in lpfc_pci_probe_one_s4()
14790 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14795 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
14800 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
14802 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14808 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
14810 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14815 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
14816 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
14819 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14821 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14827 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
14830 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
14833 phba->pport = NULL; in lpfc_pci_probe_one_s4()
14834 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
14837 lpfc_cpu_map_array_init(phba); in lpfc_pci_probe_one_s4()
14840 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_probe_one_s4()
14843 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
14845 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14851 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
14852 phba->cfg_irq_chann = 1; in lpfc_pci_probe_one_s4()
14853 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14854 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
14855 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
14858 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_pci_probe_one_s4()
14861 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
14863 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14867 vport = phba->pport; in lpfc_pci_probe_one_s4()
14873 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14879 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
14880 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14887 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
14888 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
14891 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
14896 if (phba->nvmet_support == 0) { in lpfc_pci_probe_one_s4()
14897 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14905 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14914 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
14915 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
14918 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
14920 timer_setup(&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer, 0); in lpfc_pci_probe_one_s4()
14921 cpuhp_state_add_instance_nocalls(lpfc_cpuhp_state, &phba->cpuhp); in lpfc_pci_probe_one_s4()
14928 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
14930 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
14932 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14934 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
14936 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
14938 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14942 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
14961 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
14965 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
14967 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
14968 if (phba->cgn_i) in lpfc_pci_remove_one_s4()
14969 lpfc_unreg_congestion_buf(phba); in lpfc_pci_remove_one_s4()
14974 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
14976 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
14981 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
14991 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
14995 if (phba->cfg_xri_rebalancing) in lpfc_pci_remove_one_s4()
14996 lpfc_destroy_multixri_pools(phba); in lpfc_pci_remove_one_s4()
15005 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
15006 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
15008 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
15013 lpfc_io_free(phba); in lpfc_pci_remove_one_s4()
15014 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
15015 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
15017 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
15018 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
15021 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
15025 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
15028 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
15057 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
15059 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
15063 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
15064 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
15065 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
15068 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
15069 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
15097 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
15101 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
15105 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
15106 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
15107 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
15108 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
15109 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
15116 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
15118 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s4()
15122 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
15125 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
15126 lpfc_online(phba); in lpfc_pci_resume_one_s4()
15129 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
15142 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
15144 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_recover()
15150 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
15162 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
15164 int offline = pci_channel_offline(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
15166 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_reset()
15171 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
15175 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
15177 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_reset()
15178 lpfc_offline(phba); in lpfc_sli4_prep_dev_for_reset()
15181 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
15183 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
15185 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
15186 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
15198 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
15200 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_perm_failure()
15204 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15207 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15210 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15233 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
15239 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
15242 hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15245 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15247 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s4()
15252 set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15254 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
15257 hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15259 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15261 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s4()
15263 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15290 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
15291 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
15304 hba_pci_err = test_and_clear_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_slot_reset_s4()
15317 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15319 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15322 lpfc_cpu_map_array_init(phba); in lpfc_io_slot_reset_s4()
15324 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15326 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s4()
15331 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
15332 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_io_slot_reset_s4()
15335 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15354 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
15362 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
15364 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
15366 lpfc_online(phba); in lpfc_io_resume_s4()
15420 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
15422 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
15430 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_remove_one()
15432 phba->pci_dev_grp); in lpfc_pci_remove_one()
15455 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
15458 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
15466 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_suspend_one()
15468 phba->pci_dev_grp); in lpfc_pci_suspend_one()
15491 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
15494 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
15502 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one()
15504 phba->pci_dev_grp); in lpfc_pci_resume_one()
15529 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
15532 if (phba->link_state == LPFC_HBA_ERROR && in lpfc_io_error_detected()
15533 phba->hba_flag & HBA_IOQ_FLUSH) in lpfc_io_error_detected()
15536 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
15544 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected()
15546 phba->pci_dev_grp); in lpfc_io_error_detected()
15570 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
15573 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
15581 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset()
15583 phba->pci_dev_grp); in lpfc_io_slot_reset()
15603 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
15605 switch (phba->pci_dev_grp) { in lpfc_io_resume()
15613 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_resume()
15615 phba->pci_dev_grp); in lpfc_io_resume()
15632 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
15635 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
15638 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
15639 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
15641 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
15642 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
15643 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
15657 lpfc_sli4_ras_init(struct lpfc_hba *phba) in lpfc_sli4_ras_init() argument
15660 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15662 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15664 phba->ras_fwlog.ras_hwsupport = true; in lpfc_sli4_ras_init()
15665 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && in lpfc_sli4_ras_init()
15666 phba->cfg_ras_fwlog_buffsize) in lpfc_sli4_ras_init()
15667 phba->ras_fwlog.ras_enabled = true; in lpfc_sli4_ras_init()
15669 phba->ras_fwlog.ras_enabled = false; in lpfc_sli4_ras_init()
15671 phba->ras_fwlog.ras_hwsupport = false; in lpfc_sli4_ras_init()
15778 void lpfc_dmp_dbg(struct lpfc_hba *phba) in lpfc_dmp_dbg() argument
15787 if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0) in lpfc_dmp_dbg()
15790 start_idx = (unsigned int)atomic_read(&phba->dbg_log_idx) % DBG_LOG_SZ; in lpfc_dmp_dbg()
15791 dbg_cnt = (unsigned int)atomic_read(&phba->dbg_log_cnt); in lpfc_dmp_dbg()
15808 dev_info(&phba->pcidev->dev, "start %d end %d cnt %d\n", in lpfc_dmp_dbg()
15816 rem_nsec = do_div(phba->dbg_log[temp_idx].t_ns, NSEC_PER_SEC); in lpfc_dmp_dbg()
15817 dev_info(&phba->pcidev->dev, "%d: [%5lu.%06lu] %s", in lpfc_dmp_dbg()
15819 (unsigned long)phba->dbg_log[temp_idx].t_ns, in lpfc_dmp_dbg()
15821 phba->dbg_log[temp_idx].log); in lpfc_dmp_dbg()
15824 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_dmp_dbg()
15825 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_dmp_dbg()
15829 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...) in lpfc_dbg_print() argument
15833 int dbg_dmping = atomic_read(&phba->dbg_log_dmping); in lpfc_dbg_print()
15841 dev_info(&phba->pcidev->dev, "%pV", &vaf); in lpfc_dbg_print()
15845 idx = (unsigned int)atomic_fetch_add(1, &phba->dbg_log_idx) % in lpfc_dbg_print()
15848 atomic_inc(&phba->dbg_log_cnt); in lpfc_dbg_print()
15850 vscnprintf(phba->dbg_log[idx].log, in lpfc_dbg_print()
15851 sizeof(phba->dbg_log[idx].log), fmt, args); in lpfc_dbg_print()
15854 phba->dbg_log[idx].t_ns = local_clock(); in lpfc_dbg_print()