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_async_cmstat_evt(struct lpfc_hba *phba);
98 static void lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba);
104 static int lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport);
105 static void lpfc_cgn_update_tstamp(struct lpfc_hba *phba, struct lpfc_cgn_ts *ts);
122 lpfc_config_port_prep(struct lpfc_hba *phba) in lpfc_config_port_prep() argument
124 lpfc_vpd_t *vp = &phba->vpd; in lpfc_config_port_prep()
134 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_prep()
136 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_prep()
141 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_config_port_prep()
143 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port_prep()
152 lpfc_read_nv(phba, pmb); in lpfc_config_port_prep()
158 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
161 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
166 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
169 memcpy(phba->wwnn, (char *)mb->un.varRDnvp.nodename, in lpfc_config_port_prep()
170 sizeof(phba->wwnn)); in lpfc_config_port_prep()
171 memcpy(phba->wwpn, (char *)mb->un.varRDnvp.portname, in lpfc_config_port_prep()
172 sizeof(phba->wwpn)); in lpfc_config_port_prep()
179 phba->sli3_options &= (uint32_t)LPFC_SLI3_BG_ENABLED; in lpfc_config_port_prep()
182 lpfc_read_rev(phba, pmb); in lpfc_config_port_prep()
183 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
185 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
189 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
200 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
203 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
207 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) { in lpfc_config_port_prep()
208 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
235 phba->sli3_options |= LPFC_SLI3_VPORT_TEARDOWN; in lpfc_config_port_prep()
237 if (lpfc_is_LC_HBA(phba->pcidev->device)) in lpfc_config_port_prep()
238 memcpy(phba->RandomData, (char *)&mb->un.varWords[24], in lpfc_config_port_prep()
239 sizeof (phba->RandomData)); in lpfc_config_port_prep()
246 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD); in lpfc_config_port_prep()
247 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
250 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_config_port_prep()
270 lpfc_parse_vpd(phba, lpfc_vpd_data, offset); in lpfc_config_port_prep()
274 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
289 lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_config_async_cmpl() argument
292 phba->temp_sensor_support = 1; in lpfc_config_async_cmpl()
294 phba->temp_sensor_support = 0; in lpfc_config_async_cmpl()
295 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_config_async_cmpl()
310 lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_dump_wakeup_param_cmpl() argument
319 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
332 snprintf(phba->OptionROMVersion, 32, "%d.%d%d", in lpfc_dump_wakeup_param_cmpl()
335 snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", in lpfc_dump_wakeup_param_cmpl()
338 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
353 struct lpfc_hba *phba = vport->phba; in lpfc_update_vport_wwn() local
375 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_update_vport_wwn()
377 phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_FABRIC) { in lpfc_update_vport_wwn()
378 if (!(phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG)) in lpfc_update_vport_wwn()
379 phba->sli4_hba.fawwpn_flag &= in lpfc_update_vport_wwn()
381 lpfc_printf_log(phba, KERN_INFO, in lpfc_update_vport_wwn()
389 phba->sli4_hba.fawwpn_flag); in lpfc_update_vport_wwn()
417 lpfc_config_port_post(struct lpfc_hba *phba) in lpfc_config_port_post() argument
419 struct lpfc_vport *vport = phba->pport; in lpfc_config_port_post()
424 struct lpfc_sli *psli = &phba->sli; in lpfc_config_port_post()
429 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
434 if (phba->over_temp_state == HBA_OVER_TEMP) in lpfc_config_port_post()
435 phba->over_temp_state = HBA_NORMAL_TEMP; in lpfc_config_port_post()
436 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
438 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
440 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
446 rc = lpfc_read_sparam(phba, pmb, 0); in lpfc_config_port_post()
448 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
453 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
454 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
458 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
459 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_config_port_post()
470 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
478 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_config_port_post()
482 if (phba->SerialNumber[0] == 0) { in lpfc_config_port_post()
490 phba->SerialNumber[i] = in lpfc_config_port_post()
493 phba->SerialNumber[i] = in lpfc_config_port_post()
498 phba->SerialNumber[i] = in lpfc_config_port_post()
501 phba->SerialNumber[i] = in lpfc_config_port_post()
506 lpfc_read_config(phba, pmb); in lpfc_config_port_post()
508 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
509 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
513 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
514 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
519 lpfc_sli_read_link_ste(phba); in lpfc_config_port_post()
522 if (phba->cfg_hba_queue_depth > mb->un.varRdConfig.max_xri) { in lpfc_config_port_post()
523 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
525 phba->cfg_hba_queue_depth, in lpfc_config_port_post()
527 phba->cfg_hba_queue_depth = mb->un.varRdConfig.max_xri; in lpfc_config_port_post()
530 phba->lmt = mb->un.varRdConfig.lmt; in lpfc_config_port_post()
533 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_config_port_post()
535 phba->link_state = LPFC_LINK_DOWN; in lpfc_config_port_post()
544 if (phba->sli_rev != 3) in lpfc_config_port_post()
545 lpfc_post_rcv_buf(phba); in lpfc_config_port_post()
550 if (phba->intr_type == MSIX) { in lpfc_config_port_post()
551 rc = lpfc_config_msi(phba, pmb); in lpfc_config_port_post()
553 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
556 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_post()
558 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
563 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
568 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
570 clear_bit(HBA_ERATT_HANDLED, &phba->hba_flag); in lpfc_config_port_post()
573 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_config_port_post()
574 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
587 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && in lpfc_config_port_post()
588 (phba->cfg_poll & DISABLE_FCP_RING_INT)) in lpfc_config_port_post()
591 writel(status, phba->HCregaddr); in lpfc_config_port_post()
592 readl(phba->HCregaddr); /* flush */ in lpfc_config_port_post()
593 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
596 timeout = phba->fc_ratov * 2; in lpfc_config_port_post()
600 mod_timer(&phba->hb_tmofunc, in lpfc_config_port_post()
602 clear_bit(HBA_HBEAT_INP, &phba->hba_flag); in lpfc_config_port_post()
603 clear_bit(HBA_HBEAT_TMO, &phba->hba_flag); in lpfc_config_port_post()
604 phba->last_completion_time = jiffies; in lpfc_config_port_post()
606 mod_timer(&phba->eratt_poll, in lpfc_config_port_post()
607 jiffies + secs_to_jiffies(phba->eratt_poll_interval)); in lpfc_config_port_post()
609 if (test_bit(LINK_DISABLED, &phba->hba_flag)) { in lpfc_config_port_post()
610 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
612 lpfc_down_link(phba, pmb); in lpfc_config_port_post()
614 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
616 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
620 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
623 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_config_port_post()
624 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
625 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_config_port_post()
630 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
632 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
636 lpfc_config_async(phba, pmb, LPFC_ELS_RING); in lpfc_config_port_post()
638 pmb->vport = phba->pport; in lpfc_config_port_post()
639 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
642 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
646 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
650 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
652 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
656 lpfc_dump_wakeup_param(phba, pmb); in lpfc_config_port_post()
658 pmb->vport = phba->pport; in lpfc_config_port_post()
659 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
662 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
665 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
679 lpfc_sli4_refresh_params(struct lpfc_hba *phba) in lpfc_sli4_refresh_params() argument
686 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_refresh_params()
694 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_refresh_params()
698 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_refresh_params()
700 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_refresh_params()
704 phba->sli4_hba.pc_sli4_params.mi_cap = in lpfc_sli4_refresh_params()
708 if (phba->cfg_enable_mi) in lpfc_sli4_refresh_params()
709 phba->sli4_hba.pc_sli4_params.mi_ver = in lpfc_sli4_refresh_params()
712 phba->sli4_hba.pc_sli4_params.mi_ver = 0; in lpfc_sli4_refresh_params()
714 phba->sli4_hba.pc_sli4_params.cmf = in lpfc_sli4_refresh_params()
716 phba->sli4_hba.pc_sli4_params.pls = in lpfc_sli4_refresh_params()
719 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_refresh_params()
738 lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_init_link() argument
740 return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); in lpfc_hba_init_link()
759 lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, in lpfc_hba_init_link_fc_topology() argument
762 struct lpfc_vport *vport = phba->pport; in lpfc_hba_init_link_fc_topology()
767 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_init_link_fc_topology()
769 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
775 if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || in lpfc_hba_init_link_fc_topology()
776 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && in lpfc_hba_init_link_fc_topology()
777 !(phba->lmt & LMT_1Gb)) || in lpfc_hba_init_link_fc_topology()
778 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && in lpfc_hba_init_link_fc_topology()
779 !(phba->lmt & LMT_2Gb)) || in lpfc_hba_init_link_fc_topology()
780 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && in lpfc_hba_init_link_fc_topology()
781 !(phba->lmt & LMT_4Gb)) || in lpfc_hba_init_link_fc_topology()
782 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && in lpfc_hba_init_link_fc_topology()
783 !(phba->lmt & LMT_8Gb)) || in lpfc_hba_init_link_fc_topology()
784 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && in lpfc_hba_init_link_fc_topology()
785 !(phba->lmt & LMT_10Gb)) || in lpfc_hba_init_link_fc_topology()
786 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && in lpfc_hba_init_link_fc_topology()
787 !(phba->lmt & LMT_16Gb)) || in lpfc_hba_init_link_fc_topology()
788 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && in lpfc_hba_init_link_fc_topology()
789 !(phba->lmt & LMT_32Gb)) || in lpfc_hba_init_link_fc_topology()
790 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) && in lpfc_hba_init_link_fc_topology()
791 !(phba->lmt & LMT_64Gb))) { in lpfc_hba_init_link_fc_topology()
793 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
796 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
797 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
799 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
801 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
802 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
803 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
805 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
809 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
811 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
812 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
814 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
815 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
817 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
819 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
822 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
824 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
843 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
848 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
850 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
854 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
856 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
858 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
860 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
864 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
868 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
885 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
890 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
892 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
893 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
896 if (test_bit(FC_UNLOADING, &phba->pport->load_flag)) in lpfc_hba_down_prep()
897 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
899 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
901 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
904 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
923 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
929 clear_bit(HBA_SP_QUEUE_EVT, &phba->hba_flag); 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 = timer_container_of(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
1231 phba = timer_container_of(phba, t, rrq_tmr); in lpfc_rrq_timeout()
1232 if (test_bit(FC_UNLOADING, &phba->pport->load_flag)) { in lpfc_rrq_timeout()
1233 clear_bit(HBA_RRQ_ACTIVE, &phba->hba_flag); in lpfc_rrq_timeout()
1237 set_bit(HBA_RRQ_ACTIVE, &phba->hba_flag); in lpfc_rrq_timeout()
1238 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1258 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1260 clear_bit(HBA_HBEAT_INP, &phba->hba_flag); in lpfc_hb_mbox_cmpl()
1261 clear_bit(HBA_HBEAT_TMO, &phba->hba_flag); in lpfc_hb_mbox_cmpl()
1264 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1265 if (!test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag) && in lpfc_hb_mbox_cmpl()
1266 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1267 !test_bit(FC_UNLOADING, &phba->pport->load_flag)) in lpfc_hb_mbox_cmpl()
1268 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1285 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_idle_stat_delay_work() local
1294 if (test_bit(FC_UNLOADING, &phba->pport->load_flag)) in lpfc_idle_stat_delay_work()
1297 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_idle_stat_delay_work()
1298 test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag) || in lpfc_idle_stat_delay_work()
1299 phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_idle_stat_delay_work()
1303 hdwq = &phba->sli4_hba.hdwq[phba->sli4_hba.cpu_map[i].hdwq]; in lpfc_idle_stat_delay_work()
1310 idle_stat = &phba->sli4_hba.idle_stat[i]; in lpfc_idle_stat_delay_work()
1340 schedule_delayed_work(&phba->idle_stat_delay_work, in lpfc_idle_stat_delay_work()
1347 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_hb_eq_delay_work() local
1355 if (!phba->cfg_auto_imax || in lpfc_hb_eq_delay_work()
1356 test_bit(FC_UNLOADING, &phba->pport->load_flag)) in lpfc_hb_eq_delay_work()
1359 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_hb_eq_delay_work()
1360 test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag)) in lpfc_hb_eq_delay_work()
1363 ena_delay = kcalloc(phba->sli4_hba.num_possible_cpu, sizeof(*ena_delay), in lpfc_hb_eq_delay_work()
1368 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hb_eq_delay_work()
1370 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_hb_eq_delay_work()
1380 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_hb_eq_delay_work()
1393 eqi_new = per_cpu_ptr(phba->sli4_hba.eq_info, in lpfc_hb_eq_delay_work()
1399 lpfc_modify_hba_eq_delay(phba, eq->hdwq, 1, in lpfc_hb_eq_delay_work()
1407 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_hb_eq_delay_work()
1418 static void lpfc_hb_mxp_handler(struct lpfc_hba *phba) in lpfc_hb_mxp_handler() argument
1423 hwq_count = phba->cfg_hdw_queue; in lpfc_hb_mxp_handler()
1426 lpfc_adjust_pvt_pool_count(phba, i); in lpfc_hb_mxp_handler()
1429 lpfc_adjust_high_watermark(phba, i); in lpfc_hb_mxp_handler()
1433 lpfc_snapshot_mxp(phba, i); in lpfc_hb_mxp_handler()
1447 lpfc_issue_hb_mbox(struct lpfc_hba *phba) in lpfc_issue_hb_mbox() argument
1453 if (test_bit(HBA_HBEAT_INP, &phba->hba_flag)) in lpfc_issue_hb_mbox()
1456 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_issue_hb_mbox()
1460 lpfc_heart_beat(phba, pmboxq); in lpfc_issue_hb_mbox()
1462 pmboxq->vport = phba->pport; in lpfc_issue_hb_mbox()
1463 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); in lpfc_issue_hb_mbox()
1466 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_hb_mbox()
1469 set_bit(HBA_HBEAT_INP, &phba->hba_flag); in lpfc_issue_hb_mbox()
1485 lpfc_issue_hb_tmo(struct lpfc_hba *phba) in lpfc_issue_hb_tmo() argument
1487 if (phba->cfg_enable_hba_heartbeat) in lpfc_issue_hb_tmo()
1489 set_bit(HBA_HBEAT_TMO, &phba->hba_flag); in lpfc_issue_hb_tmo()
1509 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1515 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1518 if (phba->cfg_xri_rebalancing) { in lpfc_hb_timeout_handler()
1520 lpfc_hb_mxp_handler(phba); in lpfc_hb_timeout_handler()
1523 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1525 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_hb_timeout_handler()
1529 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1531 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_hb_timeout_handler()
1532 test_bit(FC_UNLOADING, &phba->pport->load_flag) || in lpfc_hb_timeout_handler()
1533 test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag)) in lpfc_hb_timeout_handler()
1536 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1537 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1538 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1539 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1540 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1541 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1542 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1547 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1551 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1554 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1556 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1557 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1560 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1561 if (test_bit(HBA_HBEAT_INP, &phba->hba_flag)) in lpfc_hb_timeout_handler()
1567 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1570 if (test_bit(HBA_HBEAT_INP, &phba->hba_flag)) { in lpfc_hb_timeout_handler()
1576 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1580 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1586 retval = lpfc_issue_hb_mbox(phba); in lpfc_hb_timeout_handler()
1591 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1592 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1593 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1594 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1598 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1600 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1607 if (test_bit(HBA_HBEAT_TMO, &phba->hba_flag)) { in lpfc_hb_timeout_handler()
1608 retval = lpfc_issue_hb_mbox(phba); in lpfc_hb_timeout_handler()
1618 mod_timer(&phba->hb_tmofunc, jiffies + msecs_to_jiffies(tmo)); in lpfc_hb_timeout_handler()
1629 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1631 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1633 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1635 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1636 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1638 lpfc_offline(phba); in lpfc_offline_eratt()
1639 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1640 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1641 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1642 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1643 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1644 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1645 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1646 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1658 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1660 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1661 if (phba->link_state == LPFC_HBA_ERROR && in lpfc_sli4_offline_eratt()
1662 test_bit(HBA_PCI_ERR, &phba->bit_flags)) { in lpfc_sli4_offline_eratt()
1663 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1666 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1667 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1669 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1670 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_offline_eratt()
1671 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1672 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1673 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1686 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1688 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1689 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1694 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1695 clear_bit(DEFER_ERATT, &phba->hba_flag); in lpfc_handle_deferred_eratt()
1699 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_deferred_eratt()
1702 phba->work_hs, phba->work_status[0], in lpfc_handle_deferred_eratt()
1703 phba->work_status[1]); in lpfc_handle_deferred_eratt()
1705 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1707 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1715 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1721 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1722 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1725 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1727 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1728 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1732 if (test_bit(FC_UNLOADING, &phba->pport->load_flag)) { in lpfc_handle_deferred_eratt()
1733 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1743 if (!phba->work_hs && !test_bit(FC_UNLOADING, &phba->pport->load_flag)) in lpfc_handle_deferred_eratt()
1744 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1746 clear_bit(DEFER_ERATT, &phba->hba_flag); in lpfc_handle_deferred_eratt()
1747 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1748 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1752 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1759 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1777 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1779 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1780 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1789 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1790 clear_bit(DEFER_ERATT, &phba->hba_flag); in lpfc_handle_eratt_s3()
1795 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1799 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1801 if (test_bit(DEFER_ERATT, &phba->hba_flag)) in lpfc_handle_eratt_s3()
1802 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1804 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1805 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1807 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1810 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1811 phba->work_status[1]); in lpfc_handle_eratt_s3()
1812 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1814 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1817 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1818 phba->work_status[1]); in lpfc_handle_eratt_s3()
1820 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1822 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1830 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1836 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1837 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1838 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1839 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1840 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1843 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1844 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1845 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1850 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1854 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1855 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1857 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1864 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1865 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1866 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1867 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1874 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1877 phba->work_hs, in lpfc_handle_eratt_s3()
1878 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1886 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1903 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1911 lpfc_scsi_dev_block(phba); in lpfc_sli4_port_sta_fn_reset()
1913 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_port_sta_fn_reset()
1919 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1926 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_port_sta_fn_reset()
1935 spin_lock_irq(&phba->hbalock); in lpfc_sli4_port_sta_fn_reset()
1936 phba->sli.sli_flag &= ~LPFC_SLI_ACTIVE; in lpfc_sli4_port_sta_fn_reset()
1937 if (phba->sli.mbox_active) { in lpfc_sli4_port_sta_fn_reset()
1938 mboxq = phba->sli.mbox_active; in lpfc_sli4_port_sta_fn_reset()
1940 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_port_sta_fn_reset()
1941 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_port_sta_fn_reset()
1942 phba->sli.mbox_active = NULL; in lpfc_sli4_port_sta_fn_reset()
1944 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_port_sta_fn_reset()
1947 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1948 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_port_sta_fn_reset()
1949 lpfc_nvmels_flush_cmd(phba); in lpfc_sli4_port_sta_fn_reset()
1950 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1952 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1953 rc = lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1955 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1960 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1962 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1966 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1967 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1969 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1982 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1984 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
2000 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s4()
2001 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2003 lpfc_sli_flush_io_rings(phba); in lpfc_handle_eratt_s4()
2008 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_handle_eratt_s4()
2012 phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_handle_eratt_s4()
2015 phba->sli4_hba.u.if_type0.UEMASKLOregaddr, in lpfc_handle_eratt_s4()
2020 if (!test_bit(HBA_RECOVERABLE_UE, &phba->hba_flag)) { in lpfc_handle_eratt_s4()
2021 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2024 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2027 for (i = 0; i < phba->sli4_hba.ue_to_sr / 1000; i++) { in lpfc_handle_eratt_s4()
2028 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
2041 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2050 if (!lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
2055 rc = lpfc_sli4_port_sta_fn_reset(phba, in lpfc_handle_eratt_s4()
2059 lpfc_printf_log(phba, KERN_ERR, in lpfc_handle_eratt_s4()
2066 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2069 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
2075 phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_handle_eratt_s4()
2079 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2081 readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); in lpfc_handle_eratt_s4()
2082 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2085 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
2086 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
2088 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2093 phba->sfp_alarm |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_handle_eratt_s4()
2098 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
2105 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
2106 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
2107 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
2108 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2113 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_handle_eratt_s4()
2119 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_handle_eratt_s4()
2123 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2127 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
2131 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
2142 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2144 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2150 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_handle_eratt_s4()
2153 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s4()
2174 lpfc_handle_eratt(struct lpfc_hba *phba) in lpfc_handle_eratt() argument
2176 (*phba->lpfc_handle_eratt)(phba); in lpfc_handle_eratt()
2187 lpfc_handle_latt(struct lpfc_hba *phba) in lpfc_handle_latt() argument
2189 struct lpfc_vport *vport = phba->pport; in lpfc_handle_latt()
2190 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_latt()
2195 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_handle_latt()
2201 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_handle_latt()
2204 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_handle_latt()
2209 lpfc_els_flush_all_cmd(phba); in lpfc_handle_latt()
2211 lpfc_read_topology(phba, pmb, pmb->ctx_buf); in lpfc_handle_latt()
2215 phba->sli.sli3_ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2216 rc = lpfc_sli_issue_mbox (phba, pmb, MBX_NOWAIT); in lpfc_handle_latt()
2223 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2224 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2225 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2226 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2231 phba->sli.sli3_ring[LPFC_ELS_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2232 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_handle_latt()
2235 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2237 control = readl(phba->HCregaddr); in lpfc_handle_latt()
2239 writel(control, phba->HCregaddr); in lpfc_handle_latt()
2240 readl(phba->HCregaddr); /* flush */ in lpfc_handle_latt()
2243 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2244 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2245 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2246 lpfc_linkdown(phba); in lpfc_handle_latt()
2247 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_latt()
2249 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_latt()
2256 lpfc_fill_vpd(struct lpfc_hba *phba, uint8_t *vpd, int length, int *pindex) in lpfc_fill_vpd() argument
2269 phba->SerialNumber[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2273 phba->SerialNumber[j] = 0; in lpfc_fill_vpd()
2276 phba->vpd_flag |= VPD_MODEL_DESC; in lpfc_fill_vpd()
2283 phba->ModelDesc[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2287 phba->ModelDesc[j] = 0; in lpfc_fill_vpd()
2290 phba->vpd_flag |= VPD_MODEL_NAME; in lpfc_fill_vpd()
2297 phba->ModelName[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2301 phba->ModelName[j] = 0; in lpfc_fill_vpd()
2304 phba->vpd_flag |= VPD_PROGRAM_TYPE; in lpfc_fill_vpd()
2311 phba->ProgramType[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2315 phba->ProgramType[j] = 0; in lpfc_fill_vpd()
2318 phba->vpd_flag |= VPD_PORT; in lpfc_fill_vpd()
2325 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_fill_vpd()
2326 (phba->sli4_hba.pport_name_sta == in lpfc_fill_vpd()
2331 phba->Port[j++] = vpd[(*pindex)++]; in lpfc_fill_vpd()
2335 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fill_vpd()
2336 (phba->sli4_hba.pport_name_sta == in lpfc_fill_vpd()
2338 phba->Port[j] = 0; in lpfc_fill_vpd()
2365 lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) in lpfc_parse_vpd() argument
2377 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_parse_vpd()
2403 lpfc_fill_vpd(phba, vpd, Length, &index); in lpfc_parse_vpd()
2431 lpfc_get_atto_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_atto_model_desc() argument
2433 uint16_t sub_dev_id = phba->pcidev->subsystem_device; in lpfc_get_atto_model_desc()
2499 phba->Port); in lpfc_get_atto_model_desc()
2515 lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_hba_model_desc() argument
2518 uint16_t dev_id = phba->pcidev->device; in lpfc_get_hba_model_desc()
2532 if (phba->pcidev->vendor == PCI_VENDOR_ID_ATTO) { in lpfc_get_hba_model_desc()
2533 lpfc_get_atto_model_desc(phba, mdp, descp); in lpfc_get_hba_model_desc()
2537 if (phba->lmt & LMT_64Gb) in lpfc_get_hba_model_desc()
2539 else if (phba->lmt & LMT_32Gb) in lpfc_get_hba_model_desc()
2541 else if (phba->lmt & LMT_16Gb) in lpfc_get_hba_model_desc()
2543 else if (phba->lmt & LMT_10Gb) in lpfc_get_hba_model_desc()
2545 else if (phba->lmt & LMT_8Gb) in lpfc_get_hba_model_desc()
2547 else if (phba->lmt & LMT_4Gb) in lpfc_get_hba_model_desc()
2549 else if (phba->lmt & LMT_2Gb) in lpfc_get_hba_model_desc()
2551 else if (phba->lmt & LMT_1Gb) in lpfc_get_hba_model_desc()
2556 vp = &phba->vpd; in lpfc_get_hba_model_desc()
2777 phba->Port); in lpfc_get_hba_model_desc()
2803 lpfc_sli3_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt) in lpfc_sli3_post_buffer() argument
2814 iocb = lpfc_sli_get_iocbq(phba); in lpfc_sli3_post_buffer()
2825 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp1->phys); in lpfc_sli3_post_buffer()
2828 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2838 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, in lpfc_sli3_post_buffer()
2842 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_sli3_post_buffer()
2844 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2870 if (lpfc_sli_issue_iocb(phba, pring->ringno, iocb, 0) == in lpfc_sli3_post_buffer()
2872 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_sli3_post_buffer()
2876 lpfc_mbuf_free(phba, mp2->virt, mp2->phys); in lpfc_sli3_post_buffer()
2880 lpfc_sli_release_iocbq(phba, iocb); in lpfc_sli3_post_buffer()
2884 lpfc_sli_ringpostbuf_put(phba, pring, mp1); in lpfc_sli3_post_buffer()
2886 lpfc_sli_ringpostbuf_put(phba, pring, mp2); in lpfc_sli3_post_buffer()
2904 lpfc_post_rcv_buf(struct lpfc_hba *phba) in lpfc_post_rcv_buf() argument
2906 struct lpfc_sli *psli = &phba->sli; in lpfc_post_rcv_buf()
2909 lpfc_sli3_post_buffer(phba, &psli->sli3_ring[LPFC_ELS_RING], LPFC_BUF_RING0); in lpfc_post_rcv_buf()
3015 lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) in lpfc_hba_init() argument
3019 uint32_t *pwwnn = (uint32_t *) phba->wwnn; in lpfc_hba_init()
3029 lpfc_challenge_key(phba->RandomData + t, HashWorking + t); in lpfc_hba_init()
3048 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup() local
3052 if (phba->link_state > LPFC_LINK_DOWN) in lpfc_cleanup()
3056 if (lpfc_is_vmid_enabled(phba)) in lpfc_cleanup()
3086 pci_channel_offline(phba->pcidev)) in lpfc_cleanup()
3087 lpfc_sli_flush_io_rings(vport->phba); in lpfc_cleanup()
3144 __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in __lpfc_sli4_stop_fcf_redisc_wait_timer() argument
3147 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in __lpfc_sli4_stop_fcf_redisc_wait_timer()
3150 timer_delete(&phba->fcf.redisc_wait); in __lpfc_sli4_stop_fcf_redisc_wait_timer()
3163 lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in lpfc_sli4_stop_fcf_redisc_wait_timer() argument
3165 spin_lock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3166 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_stop_fcf_redisc_wait_timer()
3168 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3171 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3173 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3174 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3186 lpfc_cmf_stop(struct lpfc_hba *phba) in lpfc_cmf_stop() argument
3192 if (!phba->sli4_hba.pc_sli4_params.cmf) in lpfc_cmf_stop()
3195 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stop()
3199 hrtimer_cancel(&phba->cmf_stats_timer); in lpfc_cmf_stop()
3200 hrtimer_cancel(&phba->cmf_timer); in lpfc_cmf_stop()
3203 atomic_set(&phba->cmf_busy, 0); in lpfc_cmf_stop()
3205 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_stop()
3211 atomic_set(&phba->cmf_bw_wait, 0); in lpfc_cmf_stop()
3214 queue_work(phba->wq, &phba->unblock_request_work); in lpfc_cmf_stop()
3218 lpfc_get_max_line_rate(struct lpfc_hba *phba) in lpfc_get_max_line_rate() argument
3220 uint64_t rate = lpfc_sli_port_speed_get(phba); in lpfc_get_max_line_rate()
3226 lpfc_cmf_signal_init(struct lpfc_hba *phba) in lpfc_cmf_signal_init() argument
3228 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_signal_init()
3232 phba->cmf_interval_rate = LPFC_CMF_INTERVAL; in lpfc_cmf_signal_init()
3233 phba->cmf_max_line_rate = lpfc_get_max_line_rate(phba); in lpfc_cmf_signal_init()
3234 phba->cmf_link_byte_count = div_u64(phba->cmf_max_line_rate * in lpfc_cmf_signal_init()
3235 phba->cmf_interval_rate, 1000); in lpfc_cmf_signal_init()
3236 phba->cmf_max_bytes_per_interval = phba->cmf_link_byte_count; in lpfc_cmf_signal_init()
3239 lpfc_issue_cmf_sync_wqe(phba, 0, 0); in lpfc_cmf_signal_init()
3250 lpfc_cmf_start(struct lpfc_hba *phba) in lpfc_cmf_start() argument
3256 if (!phba->sli4_hba.pc_sli4_params.cmf || in lpfc_cmf_start()
3257 phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_cmf_start()
3261 lpfc_init_congestion_buf(phba); in lpfc_cmf_start()
3263 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_cmf_start()
3264 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_cmf_start()
3265 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_cmf_start()
3266 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_cmf_start()
3268 atomic_set(&phba->cmf_busy, 0); in lpfc_cmf_start()
3270 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_start()
3276 phba->cmf_latency.tv_sec = 0; in lpfc_cmf_start()
3277 phba->cmf_latency.tv_nsec = 0; in lpfc_cmf_start()
3279 lpfc_cmf_signal_init(phba); in lpfc_cmf_start()
3281 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_start()
3284 phba->cmf_timer_cnt = 0; in lpfc_cmf_start()
3285 hrtimer_start(&phba->cmf_timer, in lpfc_cmf_start()
3288 hrtimer_start(&phba->cmf_stats_timer, in lpfc_cmf_start()
3292 ktime_get_real_ts64(&phba->cmf_latency); in lpfc_cmf_start()
3294 atomic_set(&phba->cmf_bw_wait, 0); in lpfc_cmf_start()
3295 atomic_set(&phba->cmf_stop_io, 0); in lpfc_cmf_start()
3306 lpfc_stop_hba_timers(struct lpfc_hba *phba) in lpfc_stop_hba_timers() argument
3308 if (phba->pport) in lpfc_stop_hba_timers()
3309 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
3310 cancel_delayed_work_sync(&phba->eq_delay_work); in lpfc_stop_hba_timers()
3311 cancel_delayed_work_sync(&phba->idle_stat_delay_work); in lpfc_stop_hba_timers()
3312 timer_delete_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
3313 timer_delete_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
3314 timer_delete_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
3315 timer_delete_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
3316 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
3317 timer_delete_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
3318 clear_bit(HBA_RRQ_ACTIVE, &phba->hba_flag); in lpfc_stop_hba_timers()
3320 clear_bit(HBA_HBEAT_INP, &phba->hba_flag); in lpfc_stop_hba_timers()
3321 clear_bit(HBA_HBEAT_TMO, &phba->hba_flag); in lpfc_stop_hba_timers()
3323 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
3326 timer_delete_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
3330 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
3333 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_stop_hba_timers()
3335 phba->pci_dev_grp); in lpfc_stop_hba_timers()
3353 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
3359 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3360 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
3361 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3365 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3366 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3367 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
3371 timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
3372 phba->sli.mbox_active)) + jiffies; in lpfc_block_mgmt_io()
3374 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3377 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3381 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_block_mgmt_io()
3384 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
3399 lpfc_sli4_node_rpi_restore(struct lpfc_hba *phba) in lpfc_sli4_node_rpi_restore() argument
3405 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_rpi_restore()
3408 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_rpi_restore()
3412 for (i = 0; i <= phba->max_vports && vports[i]; i++) { in lpfc_sli4_node_rpi_restore()
3419 rpi = lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_rpi_restore()
3439 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_rpi_restore()
3449 static void lpfc_create_expedite_pool(struct lpfc_hba *phba) in lpfc_create_expedite_pool() argument
3457 epd_pool = &phba->epd_pool; in lpfc_create_expedite_pool()
3458 qp = &phba->sli4_hba.hdwq[0]; in lpfc_create_expedite_pool()
3484 static void lpfc_destroy_expedite_pool(struct lpfc_hba *phba) in lpfc_destroy_expedite_pool() argument
3492 epd_pool = &phba->epd_pool; in lpfc_destroy_expedite_pool()
3493 qp = &phba->sli4_hba.hdwq[0]; in lpfc_destroy_expedite_pool()
3517 void lpfc_create_multixri_pools(struct lpfc_hba *phba) in lpfc_create_multixri_pools() argument
3530 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3532 phba->cfg_hdw_queue, phba->sli4_hba.num_present_cpu, in lpfc_create_multixri_pools()
3533 phba->sli4_hba.io_xri_cnt); in lpfc_create_multixri_pools()
3535 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3536 lpfc_create_expedite_pool(phba); in lpfc_create_multixri_pools()
3538 hwq_count = phba->cfg_hdw_queue; in lpfc_create_multixri_pools()
3539 count_per_hwq = phba->sli4_hba.io_xri_cnt / hwq_count; in lpfc_create_multixri_pools()
3545 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3549 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3550 lpfc_destroy_expedite_pool(phba); in lpfc_create_multixri_pools()
3554 qp = &phba->sli4_hba.hdwq[j]; in lpfc_create_multixri_pools()
3558 phba->cfg_xri_rebalancing = 0; in lpfc_create_multixri_pools()
3562 qp = &phba->sli4_hba.hdwq[i]; in lpfc_create_multixri_pools()
3580 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3604 static void lpfc_destroy_multixri_pools(struct lpfc_hba *phba) in lpfc_destroy_multixri_pools() argument
3616 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_destroy_multixri_pools()
3617 lpfc_destroy_expedite_pool(phba); in lpfc_destroy_multixri_pools()
3619 if (!test_bit(FC_UNLOADING, &phba->pport->load_flag)) in lpfc_destroy_multixri_pools()
3620 lpfc_sli_flush_io_rings(phba); in lpfc_destroy_multixri_pools()
3622 hwq_count = phba->cfg_hdw_queue; in lpfc_destroy_multixri_pools()
3625 qp = &phba->sli4_hba.hdwq[i]; in lpfc_destroy_multixri_pools()
3638 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3659 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3694 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
3701 if (!phba) in lpfc_online()
3703 vport = phba->pport; in lpfc_online()
3708 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
3711 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
3713 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3714 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
3715 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3718 spin_lock_irq(&phba->hbalock); in lpfc_online()
3719 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
3721 spin_unlock_irq(&phba->hbalock); in lpfc_online()
3726 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_online()
3727 !phba->nvmet_support) { in lpfc_online()
3728 error = lpfc_nvme_create_localport(phba->pport); in lpfc_online()
3730 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_online()
3735 lpfc_sli_queue_init(phba); in lpfc_online()
3736 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
3737 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3742 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
3744 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
3746 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
3749 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3759 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
3761 if (phba->cfg_xri_rebalancing) in lpfc_online()
3762 lpfc_create_multixri_pools(phba); in lpfc_online()
3764 lpfc_cpuhp_add(phba); in lpfc_online()
3766 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3782 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
3786 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3787 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
3788 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3801 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
3803 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
3814 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
3816 lpfc_linkdown(phba); in lpfc_offline_prep()
3818 offline = pci_channel_offline(phba->pcidev); in lpfc_offline_prep()
3819 hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_offline_prep()
3822 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
3824 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
3869 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
3871 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
3873 if (phba->wq) in lpfc_offline_prep()
3874 flush_workqueue(phba->wq); in lpfc_offline_prep()
3886 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
3892 if (test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag)) in lpfc_offline()
3896 lpfc_stop_port(phba); in lpfc_offline()
3901 lpfc_nvmet_destroy_targetport(phba); in lpfc_offline()
3902 lpfc_nvme_destroy_localport(phba->pport); in lpfc_offline()
3904 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3906 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
3908 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3909 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3913 lpfc_sli_hba_down(phba); in lpfc_offline()
3914 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3915 phba->work_ha = 0; in lpfc_offline()
3916 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3917 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3919 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3926 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3930 if (test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag)) in lpfc_offline()
3931 __lpfc_cpuhp_remove(phba); in lpfc_offline()
3933 if (phba->cfg_xri_rebalancing) in lpfc_offline()
3934 lpfc_destroy_multixri_pools(phba); in lpfc_offline()
3946 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3950 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_scsi_free()
3953 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3957 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3958 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3961 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3964 phba->total_scsi_bufs--; in lpfc_scsi_free()
3966 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3968 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3969 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3972 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3975 phba->total_scsi_bufs--; in lpfc_scsi_free()
3977 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3978 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
3990 lpfc_io_free(struct lpfc_hba *phba) in lpfc_io_free() argument
3996 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_free()
3997 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_free()
4005 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
4007 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
4008 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4009 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4021 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
4023 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
4024 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4025 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
4046 lpfc_sli4_els_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_els_sgl_update() argument
4056 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_els_sgl_update()
4058 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
4060 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_els_sgl_update()
4061 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4063 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
4069 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4077 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_els_sgl_update()
4081 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4093 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4095 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
4096 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4097 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
4099 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_els_sgl_update()
4100 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4102 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
4104 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4105 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, in lpfc_sli4_els_sgl_update()
4112 __lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_els_sgl_update()
4118 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
4119 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
4121 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
4124 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_els_sgl_update()
4130 &phba->sli4_hba.lpfc_els_sgl_list, list) { in lpfc_sli4_els_sgl_update()
4131 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_els_sgl_update()
4133 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
4141 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_els_sgl_update()
4146 lpfc_free_els_sgl_list(phba); in lpfc_sli4_els_sgl_update()
4163 lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_nvmet_sgl_update() argument
4174 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_nvmet_sgl_update()
4177 nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4178 if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
4180 xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4181 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4183 phba->sli4_hba.nvmet_xri_cnt, nvmet_xri_cnt); in lpfc_sli4_nvmet_sgl_update()
4188 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4196 sglq_entry->virt = lpfc_nvmet_buf_alloc(phba, 0, in lpfc_sli4_nvmet_sgl_update()
4200 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4209 phba->cfg_sg_dma_buf_size); in lpfc_sli4_nvmet_sgl_update()
4213 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4214 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4216 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
4217 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4218 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4219 } else if (nvmet_xri_cnt < phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
4221 xri_cnt = phba->sli4_hba.nvmet_xri_cnt - nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4222 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4224 "%d to %d\n", phba->sli4_hba.nvmet_xri_cnt, in lpfc_sli4_nvmet_sgl_update()
4226 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4227 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4228 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, in lpfc_sli4_nvmet_sgl_update()
4235 lpfc_nvmet_buf_free(phba, sglq_entry->virt, in lpfc_sli4_nvmet_sgl_update()
4241 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
4242 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4243 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4245 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4248 phba->sli4_hba.nvmet_xri_cnt = nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4254 &phba->sli4_hba.lpfc_nvmet_sgl_list, list) { in lpfc_sli4_nvmet_sgl_update()
4255 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_nvmet_sgl_update()
4257 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4265 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_nvmet_sgl_update()
4270 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_nvmet_sgl_update()
4275 lpfc_io_buf_flush(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_flush() argument
4284 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_flush()
4285 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_flush()
4337 lpfc_io_buf_replenish(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_replenish() argument
4344 qp = phba->sli4_hba.hdwq; in lpfc_io_buf_replenish()
4347 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_replenish()
4353 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_replenish()
4382 lpfc_sli4_io_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_io_sgl_update() argument
4395 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_io_sgl_update()
4396 io_xri_max = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_io_sgl_update()
4397 phba->sli4_hba.io_xri_max = io_xri_max; in lpfc_sli4_io_sgl_update()
4399 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_io_sgl_update()
4402 phba->sli4_hba.io_xri_cnt, in lpfc_sli4_io_sgl_update()
4403 phba->sli4_hba.io_xri_max, in lpfc_sli4_io_sgl_update()
4406 cnt = lpfc_io_buf_flush(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4408 if (phba->sli4_hba.io_xri_cnt > phba->sli4_hba.io_xri_max) { in lpfc_sli4_io_sgl_update()
4410 io_xri_cnt = phba->sli4_hba.io_xri_cnt - in lpfc_sli4_io_sgl_update()
4411 phba->sli4_hba.io_xri_max; in lpfc_sli4_io_sgl_update()
4417 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_sli4_io_sgl_update()
4423 phba->sli4_hba.io_xri_cnt -= io_xri_cnt; in lpfc_sli4_io_sgl_update()
4429 phba->sli4_hba.io_xri_cnt = cnt; in lpfc_sli4_io_sgl_update()
4432 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_io_sgl_update()
4434 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_io_sgl_update()
4442 lpfc_ncmd->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_io_sgl_update()
4444 cnt = lpfc_io_buf_replenish(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4448 lpfc_io_free(phba); in lpfc_sli4_io_sgl_update()
4467 lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) in lpfc_new_io_buf() argument
4477 phba->sli4_hba.io_xri_cnt = 0; in lpfc_new_io_buf()
4487 lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4495 if (phba->cfg_xpsgl && !phba->nvmet_support) { in lpfc_new_io_buf()
4502 if ((phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_new_io_buf()
4505 lpfc_printf_log(phba, KERN_ERR, in lpfc_new_io_buf()
4510 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4520 lxri = lpfc_sli4_next_xritag(phba); in lpfc_new_io_buf()
4522 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4530 iotag = lpfc_sli_next_iotag(phba, pwqeq); in lpfc_new_io_buf()
4532 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4535 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_new_io_buf()
4538 lpfc_sli4_free_xri(phba, lxri); in lpfc_new_io_buf()
4542 pwqeq->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_new_io_buf()
4552 phba->sli4_hba.io_xri_cnt++; in lpfc_new_io_buf()
4554 lpfc_printf_log(phba, KERN_INFO, LOG_NVME, in lpfc_new_io_buf()
4563 phba, &post_nblist, bcnt); in lpfc_new_io_buf()
4571 lpfc_get_wwpn(struct lpfc_hba *phba) in lpfc_get_wwpn() argument
4578 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_get_wwpn()
4584 lpfc_read_nv(phba, mboxq); in lpfc_get_wwpn()
4585 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_wwpn()
4587 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_get_wwpn()
4592 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4598 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4599 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_wwpn()
4605 static unsigned short lpfc_get_sg_tablesize(struct lpfc_hba *phba) in lpfc_get_sg_tablesize() argument
4607 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_sg_tablesize()
4608 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_get_sg_tablesize()
4611 return phba->cfg_scsi_seg_cnt; in lpfc_get_sg_tablesize()
4613 return phba->cfg_sg_seg_cnt; in lpfc_get_sg_tablesize()
4628 lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport) in lpfc_vmid_res_alloc() argument
4631 if (phba->sli_rev == LPFC_SLI_REV3) { in lpfc_vmid_res_alloc()
4632 phba->cfg_vmid_app_header = 0; in lpfc_vmid_res_alloc()
4633 phba->cfg_vmid_priority_tagging = 0; in lpfc_vmid_res_alloc()
4636 if (lpfc_is_vmid_enabled(phba)) { in lpfc_vmid_res_alloc()
4638 kzalloc_objs(struct lpfc_vmid, phba->cfg_max_vmid); in lpfc_vmid_res_alloc()
4645 vport->vmid_priority_tagging = phba->cfg_vmid_priority_tagging; in lpfc_vmid_res_alloc()
4647 phba->cfg_vmid_inactivity_timeout; in lpfc_vmid_res_alloc()
4648 vport->max_vmid = phba->cfg_max_vmid; in lpfc_vmid_res_alloc()
4681 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
4694 if (phba->sli_rev < LPFC_SLI_REV4 && in lpfc_create_port()
4695 dev == &phba->pcidev->dev) { in lpfc_create_port()
4697 lpfc_sli_brdrestart(phba); in lpfc_create_port()
4698 rc = lpfc_sli_chipset_init(phba); in lpfc_create_port()
4702 wwn = lpfc_get_wwpn(phba); in lpfc_create_port()
4707 lpfc_printf_log(phba, KERN_ERR, in lpfc_create_port()
4717 if (dev == &phba->pcidev->dev) { in lpfc_create_port()
4718 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_create_port()
4727 template->sg_tablesize = lpfc_get_sg_tablesize(phba); in lpfc_create_port()
4737 template->sg_tablesize = lpfc_get_sg_tablesize(phba); in lpfc_create_port()
4745 vport->phba = phba; in lpfc_create_port()
4760 vport->cfg_enable_fc4_type = phba->cfg_enable_fc4_type; in lpfc_create_port()
4768 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4770 &phba->sli4_hba.sli_intf); in lpfc_create_port()
4785 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4786 if (!phba->cfg_fcp_mq_threshold || in lpfc_create_port()
4787 phba->cfg_fcp_mq_threshold > phba->cfg_hdw_queue) in lpfc_create_port()
4788 phba->cfg_fcp_mq_threshold = phba->cfg_hdw_queue; in lpfc_create_port()
4791 phba->cfg_fcp_mq_threshold); in lpfc_create_port()
4794 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
4806 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
4807 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
4815 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_create_port()
4819 phba->cfg_scsi_seg_cnt, phba->cfg_sg_seg_cnt); in lpfc_create_port()
4822 rc = lpfc_vmid_res_alloc(phba, vport); in lpfc_create_port()
4839 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_create_port()
4840 lpfc_setup_bg(phba, shost); in lpfc_create_port()
4842 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
4846 spin_lock_irq(&phba->port_list_lock); in lpfc_create_port()
4847 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
4848 spin_unlock_irq(&phba->port_list_lock); in lpfc_create_port()
4871 struct lpfc_hba *phba = vport->phba; in destroy_port() local
4877 spin_lock_irq(&phba->port_list_lock); in destroy_port()
4879 spin_unlock_irq(&phba->port_list_lock); in destroy_port()
4922 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
4932 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4939 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
4940 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4954 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
4967 struct lpfc_hba *phba = vport->phba; in lpfc_host_supported_speeds_set() local
4974 if (test_bit(HBA_FCOE_MODE, &phba->hba_flag)) in lpfc_host_supported_speeds_set()
4977 if (phba->lmt & LMT_256Gb) in lpfc_host_supported_speeds_set()
4979 if (phba->lmt & LMT_128Gb) in lpfc_host_supported_speeds_set()
4981 if (phba->lmt & LMT_64Gb) in lpfc_host_supported_speeds_set()
4983 if (phba->lmt & LMT_32Gb) in lpfc_host_supported_speeds_set()
4985 if (phba->lmt & LMT_16Gb) in lpfc_host_supported_speeds_set()
4987 if (phba->lmt & LMT_10Gb) in lpfc_host_supported_speeds_set()
4989 if (phba->lmt & LMT_8Gb) in lpfc_host_supported_speeds_set()
4991 if (phba->lmt & LMT_4Gb) in lpfc_host_supported_speeds_set()
4993 if (phba->lmt & LMT_2Gb) in lpfc_host_supported_speeds_set()
4995 if (phba->lmt & LMT_1Gb) in lpfc_host_supported_speeds_set()
5009 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
5040 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
5053 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
5056 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
5057 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
5059 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
5060 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
5063 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
5064 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
5076 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
5079 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
5080 if (phba->pport) in lpfc_stop_port_s4()
5081 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
5082 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
5093 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
5095 phba->lpfc_stop_port(phba); in lpfc_stop_port()
5097 if (phba->wq) in lpfc_stop_port()
5098 flush_workqueue(phba->wq); in lpfc_stop_port()
5108 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
5113 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
5114 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
5116 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
5118 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
5119 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
5135 struct lpfc_hba *phba = timer_container_of(phba, t, fcf.redisc_wait); in lpfc_sli4_fcf_redisc_wait_tmo() local
5138 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5139 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
5140 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5144 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
5146 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
5147 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
5148 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
5151 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
5166 struct lpfc_hba *phba = timer_container_of(phba, t, in lpfc_vmid_poll() local
5171 if (phba->pport->vmid_priority_tagging) { in lpfc_vmid_poll()
5173 phba->pport->work_port_events |= WORKER_CHECK_VMID_ISSUE_QFPA; in lpfc_vmid_poll()
5177 if (phba->pport->vmid_inactivity_timeout || in lpfc_vmid_poll()
5178 test_bit(FC_DEREGISTER_ALL_APP_ID, &phba->pport->load_flag)) { in lpfc_vmid_poll()
5180 phba->pport->work_port_events |= WORKER_CHECK_INACTIVE_VMID; in lpfc_vmid_poll()
5184 lpfc_worker_wake_up(phba); in lpfc_vmid_poll()
5187 mod_timer(&phba->inactive_vmid_poll, in lpfc_vmid_poll()
5199 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
5216 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_fault()
5236 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
5254 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_type()
5272 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
5276 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
5279 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_sli_port_speed_get()
5280 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
5303 if (phba->sli4_hba.link_state.logical_speed) in lpfc_sli_port_speed_get()
5305 phba->sli4_hba.link_state.logical_speed; in lpfc_sli_port_speed_get()
5307 link_speed = phba->sli4_hba.link_state.speed; in lpfc_sli_port_speed_get()
5324 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
5416 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
5425 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
5428 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
5429 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
5431 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5436 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_sli4_async_link_evt()
5438 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5444 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
5447 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
5450 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
5453 lpfc_read_topology(phba, pmb, pmb->ctx_buf); in lpfc_sli4_async_link_evt()
5455 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
5458 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
5459 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
5461 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
5463 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
5465 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
5467 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
5469 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
5471 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
5474 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
5478 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
5479 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
5480 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
5481 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
5482 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
5483 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
5484 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
5489 if (!test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_sli4_async_link_evt()
5490 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
5505 lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
5523 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
5528 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_sli4_async_link_evt()
5543 lpfc_async_link_speed_to_read_top(struct lpfc_hba *phba, uint8_t speed_code) in lpfc_async_link_speed_to_read_top() argument
5584 lpfc_cgn_dump_rxmonitor(struct lpfc_hba *phba) in lpfc_cgn_dump_rxmonitor() argument
5586 if (!phba->rx_monitor) { in lpfc_cgn_dump_rxmonitor()
5587 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_dump_rxmonitor()
5590 lpfc_rx_monitor_report(phba, phba->rx_monitor, NULL, 0, in lpfc_cgn_dump_rxmonitor()
5603 lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag) in lpfc_cgn_update_stat() argument
5609 if (!phba->cgn_i) in lpfc_cgn_update_stat()
5611 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_update_stat()
5617 lpfc_cgn_update_tstamp(phba, &cp->stat_lnk); in lpfc_cgn_update_stat()
5621 lpfc_cgn_update_tstamp(phba, &cp->stat_delivery); in lpfc_cgn_update_stat()
5625 lpfc_cgn_update_tstamp(phba, &cp->stat_peer); in lpfc_cgn_update_stat()
5629 lpfc_cgn_update_tstamp(phba, &cp->stat_fpin); in lpfc_cgn_update_stat()
5631 if (phba->cgn_fpin_frequency && in lpfc_cgn_update_stat()
5632 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { in lpfc_cgn_update_stat()
5633 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; in lpfc_cgn_update_stat()
5648 lpfc_cgn_update_tstamp(struct lpfc_hba *phba, struct lpfc_cgn_ts *ts) in lpfc_cgn_update_tstamp() argument
5663 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_update_tstamp()
5684 struct lpfc_hba *phba; in lpfc_cmf_stats_timer() local
5696 phba = container_of(timer, struct lpfc_hba, cmf_stats_timer); in lpfc_cmf_stats_timer()
5698 if (!phba->cgn_i) in lpfc_cmf_stats_timer()
5700 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cmf_stats_timer()
5702 phba->cgn_evt_timestamp = jiffies + in lpfc_cmf_stats_timer()
5704 phba->cgn_evt_minute++; in lpfc_cmf_stats_timer()
5707 lpfc_cgn_update_tstamp(phba, &cp->base_time); in lpfc_cmf_stats_timer()
5709 if (phba->cgn_fpin_frequency && in lpfc_cmf_stats_timer()
5710 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { in lpfc_cmf_stats_timer()
5711 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; in lpfc_cmf_stats_timer()
5716 lvalue = atomic_read(&phba->cgn_latency_evt_cnt); in lpfc_cmf_stats_timer()
5717 latsum = atomic64_read(&phba->cgn_latency_evt); in lpfc_cmf_stats_timer()
5718 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_cmf_stats_timer()
5719 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_cmf_stats_timer()
5725 bps = div_u64(phba->rx_block_cnt, LPFC_SEC_MIN) * 512; in lpfc_cmf_stats_timer()
5726 phba->rx_block_cnt = 0; in lpfc_cmf_stats_timer()
5731 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_cmf_stats_timer()
5732 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_cmf_stats_timer()
5733 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_cmf_stats_timer()
5734 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_cmf_stats_timer()
5737 value = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_cmf_stats_timer()
5753 dvalue = atomic_read(&phba->cgn_driver_evt_cnt); in lpfc_cmf_stats_timer()
5754 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_cmf_stats_timer()
5758 if ((phba->cgn_reg_fpin & LPFC_CGN_FPIN_WARN) || in lpfc_cmf_stats_timer()
5759 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_cmf_stats_timer()
5760 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cmf_stats_timer()
5761 wvalue = atomic_read(&phba->cgn_fabric_warn_cnt); in lpfc_cmf_stats_timer()
5762 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_cmf_stats_timer()
5766 if ((phba->cgn_reg_fpin & LPFC_CGN_FPIN_ALARM) || in lpfc_cmf_stats_timer()
5767 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cmf_stats_timer()
5768 avalue = atomic_read(&phba->cgn_fabric_alarm_cnt); in lpfc_cmf_stats_timer()
5769 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_cmf_stats_timer()
5798 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stats_timer()
5803 if ((phba->cgn_evt_minute % LPFC_MIN_HOUR) == 0) { in lpfc_cmf_stats_timer()
5842 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stats_timer()
5849 if ((phba->cgn_evt_minute % LPFC_MIN_DAY) == 0) { in lpfc_cmf_stats_timer()
5889 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stats_timer()
5896 value = phba->cgn_fpin_frequency; in lpfc_cmf_stats_timer()
5918 lpfc_calc_cmf_latency(struct lpfc_hba *phba) in lpfc_calc_cmf_latency() argument
5928 if (cmpl_time.tv_sec == phba->cmf_latency.tv_sec) { in lpfc_calc_cmf_latency()
5929 msec = (cmpl_time.tv_nsec - phba->cmf_latency.tv_nsec) / in lpfc_calc_cmf_latency()
5932 if (cmpl_time.tv_nsec >= phba->cmf_latency.tv_nsec) { in lpfc_calc_cmf_latency()
5934 phba->cmf_latency.tv_sec) * MSEC_PER_SEC; in lpfc_calc_cmf_latency()
5936 phba->cmf_latency.tv_nsec) / NSEC_PER_MSEC); in lpfc_calc_cmf_latency()
5938 msec = (cmpl_time.tv_sec - phba->cmf_latency.tv_sec - in lpfc_calc_cmf_latency()
5940 msec += (((NSEC_PER_SEC - phba->cmf_latency.tv_nsec) + in lpfc_calc_cmf_latency()
5955 struct lpfc_hba *phba = container_of(timer, struct lpfc_hba, in lpfc_cmf_timer() local
5967 if (phba->cmf_active_mode == LPFC_CFG_OFF || in lpfc_cmf_timer()
5968 !phba->cmf_latency.tv_sec) { in lpfc_cmf_timer()
5969 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_timer()
5971 phba->cmf_active_mode, in lpfc_cmf_timer()
5972 (uint64_t)phba->cmf_latency.tv_sec); in lpfc_cmf_timer()
5979 if (!phba->pport) in lpfc_cmf_timer()
5985 atomic_set(&phba->cmf_stop_io, 1); in lpfc_cmf_timer()
5992 ms = lpfc_calc_cmf_latency(phba); in lpfc_cmf_timer()
5999 ktime_get_real_ts64(&phba->cmf_latency); in lpfc_cmf_timer()
6001 phba->cmf_link_byte_count = in lpfc_cmf_timer()
6002 div_u64(phba->cmf_max_line_rate * LPFC_CMF_INTERVAL, 1000); in lpfc_cmf_timer()
6010 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_timer()
6022 if (phba->cmf_active_mode == LPFC_CFG_MANAGED && in lpfc_cmf_timer()
6023 phba->link_state != LPFC_LINK_DOWN && in lpfc_cmf_timer()
6024 test_bit(HBA_SETUP, &phba->hba_flag)) { in lpfc_cmf_timer()
6025 mbpi = phba->cmf_last_sync_bw; in lpfc_cmf_timer()
6026 phba->cmf_last_sync_bw = 0; in lpfc_cmf_timer()
6039 lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); in lpfc_cmf_timer()
6044 mbpi = phba->cmf_link_byte_count; in lpfc_cmf_timer()
6047 phba->cmf_timer_cnt++; in lpfc_cmf_timer()
6051 atomic_add(io_cnt, &phba->cgn_latency_evt_cnt); in lpfc_cmf_timer()
6052 atomic64_add(lat, &phba->cgn_latency_evt); in lpfc_cmf_timer()
6054 busy = atomic_xchg(&phba->cmf_busy, 0); in lpfc_cmf_timer()
6055 max_read = atomic_xchg(&phba->rx_max_read_cnt, 0); in lpfc_cmf_timer()
6059 if (mbpi > phba->cmf_link_byte_count || in lpfc_cmf_timer()
6060 phba->cmf_active_mode == LPFC_CFG_MONITOR) in lpfc_cmf_timer()
6061 mbpi = phba->cmf_link_byte_count; in lpfc_cmf_timer()
6066 if (mbpi != phba->cmf_max_bytes_per_interval) in lpfc_cmf_timer()
6067 phba->cmf_max_bytes_per_interval = mbpi; in lpfc_cmf_timer()
6071 if (phba->rx_monitor) { in lpfc_cmf_timer()
6076 entry.cmf_info = phba->cmf_active_info; in lpfc_cmf_timer()
6087 if (phba->cmf_active_mode == LPFC_CFG_MANAGED) in lpfc_cmf_timer()
6088 entry.timer_utilization = phba->cmf_last_ts; in lpfc_cmf_timer()
6092 phba->cmf_last_ts = 0; in lpfc_cmf_timer()
6094 lpfc_rx_monitor_record(phba->rx_monitor, &entry); in lpfc_cmf_timer()
6097 if (phba->cmf_active_mode == LPFC_CFG_MONITOR) { in lpfc_cmf_timer()
6102 atomic_inc(&phba->cgn_driver_evt_cnt); in lpfc_cmf_timer()
6104 phba->rx_block_cnt += div_u64(rcv, 512); /* save 512 byte block cnt */ in lpfc_cmf_timer()
6109 if (atomic_xchg(&phba->cmf_bw_wait, 0)) in lpfc_cmf_timer()
6110 queue_work(phba->wq, &phba->unblock_request_work); in lpfc_cmf_timer()
6113 atomic_set(&phba->cmf_stop_io, 0); in lpfc_cmf_timer()
6123 ((phba->trunk_link.link##__idx.state == LPFC_LINK_UP) ?\
6131 lpfc_update_trunk_link_status(struct lpfc_hba *phba, in lpfc_update_trunk_link_status() argument
6138 phba->sli4_hba.link_state.speed = in lpfc_update_trunk_link_status()
6139 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_update_trunk_link_status()
6142 phba->sli4_hba.link_state.logical_speed = in lpfc_update_trunk_link_status()
6145 phba->fc_linkspeed = in lpfc_update_trunk_link_status()
6147 phba, in lpfc_update_trunk_link_status()
6151 phba->trunk_link.link0.state = in lpfc_update_trunk_link_status()
6154 phba->trunk_link.link0.fault = port_fault & 0x1 ? err : 0; in lpfc_update_trunk_link_status()
6158 phba->trunk_link.link1.state = in lpfc_update_trunk_link_status()
6161 phba->trunk_link.link1.fault = port_fault & 0x2 ? err : 0; in lpfc_update_trunk_link_status()
6165 phba->trunk_link.link2.state = in lpfc_update_trunk_link_status()
6168 phba->trunk_link.link2.fault = port_fault & 0x4 ? err : 0; in lpfc_update_trunk_link_status()
6172 phba->trunk_link.link3.state = in lpfc_update_trunk_link_status()
6175 phba->trunk_link.link3.fault = port_fault & 0x8 ? err : 0; in lpfc_update_trunk_link_status()
6180 phba->trunk_link.phy_lnk_speed = in lpfc_update_trunk_link_status()
6181 phba->sli4_hba.link_state.logical_speed / (cnt * 1000); in lpfc_update_trunk_link_status()
6183 phba->trunk_link.phy_lnk_speed = LPFC_LINK_SPEED_UNKNOWN; in lpfc_update_trunk_link_status()
6185 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
6189 phba->sli4_hba.link_state.speed, in lpfc_update_trunk_link_status()
6190 phba->sli4_hba.link_state.logical_speed, in lpfc_update_trunk_link_status()
6194 if (phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_update_trunk_link_status()
6195 lpfc_cmf_signal_init(phba); in lpfc_update_trunk_link_status()
6198 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
6222 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
6232 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6240 lpfc_update_trunk_link_status(phba, acqe_fc); in lpfc_sli4_async_fc_evt()
6245 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
6246 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
6248 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
6249 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
6251 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
6253 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
6255 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
6257 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
6259 phba->sli4_hba.link_state.link_status = in lpfc_sli4_async_fc_evt()
6266 if (phba->sli4_hba.link_state.status >= LPFC_FC_LA_TYPE_LINK_UP && in lpfc_sli4_async_fc_evt()
6267 phba->sli4_hba.link_state.status < LPFC_FC_LA_TYPE_ACTIVATE_FAIL) { in lpfc_sli4_async_fc_evt()
6270 phba->sli4_hba.link_state.logical_speed = 0; in lpfc_sli4_async_fc_evt()
6271 else if (!phba->sli4_hba.conf_trunk) in lpfc_sli4_async_fc_evt()
6272 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
6276 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
6280 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
6281 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
6282 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
6283 phba->sli4_hba.link_state.type, in lpfc_sli4_async_fc_evt()
6284 phba->sli4_hba.link_state.number, in lpfc_sli4_async_fc_evt()
6285 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
6286 phba->sli4_hba.link_state.fault, in lpfc_sli4_async_fc_evt()
6287 phba->sli4_hba.link_state.link_status); in lpfc_sli4_async_fc_evt()
6294 if (phba->sli4_hba.link_state.status >= LPFC_FC_LA_TYPE_ACTIVATE_FAIL) { in lpfc_sli4_async_fc_evt()
6295 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
6298 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
6309 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
6316 lpfc_log_msg(phba, log_level, LOG_SLI, in lpfc_sli4_async_fc_evt()
6323 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
6325 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6329 rc = lpfc_mbox_rsrc_prep(phba, pmb); in lpfc_sli4_async_fc_evt()
6331 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6337 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
6340 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
6343 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
6346 lpfc_read_topology(phba, pmb, pmb->ctx_buf); in lpfc_sli4_async_fc_evt()
6348 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
6350 if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) { in lpfc_sli4_async_fc_evt()
6351 phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK); in lpfc_sli4_async_fc_evt()
6353 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
6355 phba->link_flag |= LS_MDS_LINK_DOWN; in lpfc_sli4_async_fc_evt()
6358 phba->link_flag |= LS_MDS_LOOPBACK; in lpfc_sli4_async_fc_evt()
6369 lpfc_sli4_parse_latt_fault(phba, (void *)acqe_fc); in lpfc_sli4_async_fc_evt()
6375 if (phba->sli4_hba.link_state.status == in lpfc_sli4_async_fc_evt()
6384 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_fc_evt()
6389 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
6395 lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED); in lpfc_sli4_async_fc_evt()
6406 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
6422 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6428 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
6438 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6442 phba->sfp_warning |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_sli4_async_sli_evt()
6443 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
6455 lpfc_printf_log(phba, KERN_INFO, LOG_SLI | LOG_LDS_EVENT, in lpfc_sli4_async_sli_evt()
6459 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
6471 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
6497 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_sli_evt()
6501 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_async_sli_evt()
6506 if (phba->sli4_hba.lnk_info.optic_state == status) in lpfc_sli4_async_sli_evt()
6546 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_async_sli_evt()
6548 phba->lmt = 0; in lpfc_sli4_async_sli_evt()
6549 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_sli_evt()
6554 rc = lpfc_sli4_refresh_params(phba); in lpfc_sli4_async_sli_evt()
6556 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
6560 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_sli_evt()
6562 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_sli_evt()
6568 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_sli_evt()
6570 phba->sli4_hba.lnk_info.optic_state = status; in lpfc_sli4_async_sli_evt()
6571 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
6575 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6582 lpfc_sli4_cgn_parm_chg_evt(phba); in lpfc_sli4_async_sli_evt()
6590 lpfc_log_msg(phba, KERN_WARNING, LOG_SLI | LOG_DISCOVERY, in lpfc_sli4_async_sli_evt()
6593 phba->sli4_hba.fawwpn_flag &= ~LPFC_FAWWPN_FABRIC; in lpfc_sli4_async_sli_evt()
6594 memset(phba->pport->fc_portname.u.wwn, 0, in lpfc_sli4_async_sli_evt()
6599 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6605 if (phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_sli4_async_sli_evt()
6609 phba->cgn_acqe_cnt++; in lpfc_sli4_async_sli_evt()
6612 atomic64_add(cnt, &phba->cgn_acqe_stat.warn); in lpfc_sli4_async_sli_evt()
6613 atomic64_add(cgn_signal->alarm_cnt, &phba->cgn_acqe_stat.alarm); in lpfc_sli4_async_sli_evt()
6619 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { in lpfc_sli4_async_sli_evt()
6622 &phba->cgn_sync_alarm_cnt); in lpfc_sli4_async_sli_evt()
6626 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_sli4_async_sli_evt()
6627 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { in lpfc_sli4_async_sli_evt()
6629 atomic_add(cnt, &phba->cgn_sync_warn_cnt); in lpfc_sli4_async_sli_evt()
6635 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_async_sli_evt()
6643 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_sli4_async_sli_evt()
6645 lpfc_sli4_async_cmstat_evt(phba); in lpfc_sli4_async_sli_evt()
6648 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6670 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
6674 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
6675 if (!phba) in lpfc_sli4_perform_vport_cvl()
6688 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
6689 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
6692 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
6713 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
6718 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
6720 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
6722 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
6733 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
6744 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6745 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6750 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6756 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
6762 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
6768 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
6773 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
6777 if (test_bit(FCF_TS_INPROG, &phba->hba_flag)) in lpfc_sli4_async_fip_evt()
6779 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6781 if (phba->fcf.fcf_flag & (FCF_REDISC_EVT | FCF_REDISC_PEND)) { in lpfc_sli4_async_fip_evt()
6782 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6787 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
6788 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6791 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6794 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
6798 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
6801 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6807 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6814 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6815 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6823 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6824 if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && in lpfc_sli4_async_fip_evt()
6825 (phba->fcf.current_rec.fcf_indx != acqe_fip->index)) { in lpfc_sli4_async_fip_evt()
6826 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6828 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
6831 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6834 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
6843 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6845 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
6846 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6848 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
6852 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
6854 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
6859 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6860 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
6861 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6866 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
6869 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
6874 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
6878 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6879 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_fip_evt()
6884 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
6891 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
6893 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
6902 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
6929 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6930 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
6931 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6935 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
6936 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6937 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
6941 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
6943 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
6948 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6949 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
6950 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6955 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
6961 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
6965 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6980 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
6983 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
6984 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_dcbx_evt()
6999 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
7004 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
7005 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
7006 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
7007 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
7009 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
7012 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
7023 lpfc_sli4_async_cmstat_evt(struct lpfc_hba *phba) in lpfc_sli4_async_cmstat_evt() argument
7025 if (!phba->cgn_i) in lpfc_sli4_async_cmstat_evt()
7027 lpfc_init_congestion_stat(phba); in lpfc_sli4_async_cmstat_evt()
7039 lpfc_cgn_params_val(struct lpfc_hba *phba, struct lpfc_cgn_param *p_cfg_param) in lpfc_cgn_params_val() argument
7041 spin_lock_irq(&phba->hbalock); in lpfc_cgn_params_val()
7045 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, in lpfc_cgn_params_val()
7051 spin_unlock_irq(&phba->hbalock); in lpfc_cgn_params_val()
7074 lpfc_cgn_params_parse(struct lpfc_hba *phba, in lpfc_cgn_params_parse() argument
7085 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_cgn_params_parse()
7103 phba->cmf_active_mode); in lpfc_cgn_params_parse()
7105 oldmode = phba->cmf_active_mode; in lpfc_cgn_params_parse()
7110 lpfc_cgn_params_val(phba, p_cgn_param); in lpfc_cgn_params_parse()
7113 spin_lock_irq(&phba->hbalock); in lpfc_cgn_params_parse()
7114 memcpy(&phba->cgn_p, p_cgn_param, in lpfc_cgn_params_parse()
7118 if (phba->cgn_i) { in lpfc_cgn_params_parse()
7119 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_params_parse()
7120 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_params_parse()
7121 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_cgn_params_parse()
7122 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_cgn_params_parse()
7123 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_cgn_params_parse()
7128 spin_unlock_irq(&phba->hbalock); in lpfc_cgn_params_parse()
7130 phba->cmf_active_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_params_parse()
7134 if (phba->cgn_p.cgn_param_mode != LPFC_CFG_OFF) { in lpfc_cgn_params_parse()
7136 lpfc_cmf_start(phba); in lpfc_cgn_params_parse()
7138 if (phba->link_state >= LPFC_LINK_UP) { in lpfc_cgn_params_parse()
7139 phba->cgn_reg_fpin = in lpfc_cgn_params_parse()
7140 phba->cgn_init_reg_fpin; in lpfc_cgn_params_parse()
7141 phba->cgn_reg_signal = in lpfc_cgn_params_parse()
7142 phba->cgn_init_reg_signal; in lpfc_cgn_params_parse()
7143 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7148 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7151 lpfc_cmf_stop(phba); in lpfc_cgn_params_parse()
7152 if (phba->link_state >= LPFC_LINK_UP) in lpfc_cgn_params_parse()
7153 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7156 phba->cmf_max_bytes_per_interval = in lpfc_cgn_params_parse()
7157 phba->cmf_link_byte_count; in lpfc_cgn_params_parse()
7160 queue_work(phba->wq, in lpfc_cgn_params_parse()
7161 &phba->unblock_request_work); in lpfc_cgn_params_parse()
7166 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7169 lpfc_cmf_stop(phba); in lpfc_cgn_params_parse()
7170 if (phba->link_state >= LPFC_LINK_UP) in lpfc_cgn_params_parse()
7171 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7174 lpfc_cmf_signal_init(phba); in lpfc_cgn_params_parse()
7180 oldmode != phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7181 if (phba->cgn_p.cgn_param_mode == LPFC_CFG_MANAGED) in lpfc_cgn_params_parse()
7183 phba->cgn_p.cgn_param_level0); in lpfc_cgn_params_parse()
7187 dev_info(&phba->pcidev->dev, "%d: " in lpfc_cgn_params_parse()
7189 phba->brd_no, in lpfc_cgn_params_parse()
7191 [phba->cgn_p.cgn_param_mode], in lpfc_cgn_params_parse()
7195 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_cgn_params_parse()
7216 lpfc_sli4_cgn_params_read(struct lpfc_hba *phba) in lpfc_sli4_cgn_params_read() argument
7228 ret = lpfc_read_object(phba, (char *)LPFC_PORT_CFG_NAME, in lpfc_sli4_cgn_params_read()
7235 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7243 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7251 lpfc_cgn_params_parse(phba, p_cgn_param, len); in lpfc_sli4_cgn_params_read()
7277 lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *phba) in lpfc_sli4_cgn_parm_chg_evt() argument
7281 if (!phba->sli4_hba.pc_sli4_params.cmf) { in lpfc_sli4_cgn_parm_chg_evt()
7282 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7291 ret = lpfc_sli4_cgn_params_read(phba); in lpfc_sli4_cgn_parm_chg_evt()
7293 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7297 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7310 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
7316 clear_bit(ASYNC_EVENT, &phba->hba_flag); 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_printf_log(phba, KERN_ERR, in lpfc_sli4_async_event_proc()
7359 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
7360 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7362 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7372 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
7376 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7378 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
7380 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
7382 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
7383 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7386 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
7388 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
7390 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fcf_redisc_event_proc()
7406 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
7411 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
7415 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
7418 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7422 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7426 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7430 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7445 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
7449 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7453 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7457 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7461 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_intr_mode()
7480 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
7485 if (!phba->pcidev) in lpfc_enable_pci_dev()
7488 pdev = phba->pcidev; in lpfc_enable_pci_dev()
7509 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_enable_pci_dev()
7522 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
7527 if (!phba->pcidev) in lpfc_disable_pci_dev()
7530 pdev = phba->pcidev; in lpfc_disable_pci_dev()
7548 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
7553 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
7554 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
7559 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) { in lpfc_reset_hba()
7560 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
7562 if (test_bit(MBX_TMO_ERR, &phba->bit_flags)) { in lpfc_reset_hba()
7564 rc = lpfc_pci_function_reset(phba); in lpfc_reset_hba()
7565 lpfc_els_flush_all_cmd(phba); in lpfc_reset_hba()
7567 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
7568 lpfc_sli_flush_io_rings(phba); in lpfc_reset_hba()
7570 lpfc_offline(phba); in lpfc_reset_hba()
7571 clear_bit(MBX_TMO_ERR, &phba->bit_flags); in lpfc_reset_hba()
7573 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_reset_hba()
7577 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
7578 lpfc_online(phba); in lpfc_reset_hba()
7579 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
7594 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
7596 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
7620 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
7622 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
7626 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
7628 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_probe_sriov_nr_virtfn()
7636 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7641 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7650 struct lpfc_hba *phba = container_of(work, struct lpfc_hba, in lpfc_unblock_requests_work() local
7653 lpfc_unblock_requests(phba); in lpfc_unblock_requests_work()
7668 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
7670 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
7675 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
7676 atomic_set(&phba->dbg_log_idx, 0); in lpfc_setup_driver_resource_phase1()
7677 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_setup_driver_resource_phase1()
7678 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_setup_driver_resource_phase1()
7679 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
7682 spin_lock_init(&phba->port_list_lock); in lpfc_setup_driver_resource_phase1()
7683 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
7685 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
7688 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
7690 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
7692 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
7694 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
7696 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
7699 spin_lock_init(&phba->ras_fwlog_lock); 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 = kzalloc_objs(struct lpfc_sli_ring, in lpfc_sli_driver_resource_setup()
7775 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7783 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_driver_resource_setup()
7789 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
7799 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7803 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
7804 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
7807 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
7814 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7816 ((phba->cfg_sg_seg_cnt + 2) * entry_sz); in lpfc_sli_driver_resource_setup()
7819 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
7822 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
7824 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7825 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
7827 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
7829 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
7834 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
7835 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
7838 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
7841 phba->lpfc_sg_dma_buf_pool = in lpfc_sli_driver_resource_setup()
7843 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7846 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli_driver_resource_setup()
7849 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli_driver_resource_setup()
7851 &phba->pcidev->dev, in lpfc_sli_driver_resource_setup()
7856 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli_driver_resource_setup()
7863 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
7864 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
7865 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7867 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
7871 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7872 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
7879 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli_driver_resource_setup()
7880 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli_driver_resource_setup()
7882 lpfc_mem_free(phba); in lpfc_sli_driver_resource_setup()
7894 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
7897 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
7914 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
7923 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
7924 phba->sli4_hba.num_possible_cpu = cpumask_last(cpu_possible_mask) + 1; in lpfc_sli4_driver_resource_setup()
7925 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
7928 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
7931 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
7936 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
7943 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM | WQ_PERCPU, 0); in lpfc_sli4_driver_resource_setup()
7944 if (!phba->wq) in lpfc_sli4_driver_resource_setup()
7951 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
7954 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
7957 hrtimer_setup(&phba->cmf_timer, lpfc_cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in lpfc_sli4_driver_resource_setup()
7959 hrtimer_setup(&phba->cmf_stats_timer, lpfc_cmf_stats_timer, CLOCK_MONOTONIC, in lpfc_sli4_driver_resource_setup()
7966 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
7968 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
7970 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
7973 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
7976 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
7977 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
7978 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
7979 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
7988 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
7989 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
7990 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
7993 if (lpfc_is_vmid_enabled(phba)) in lpfc_sli4_driver_resource_setup()
7994 timer_setup(&phba->inactive_vmid_poll, lpfc_vmid_poll, 0); in lpfc_sli4_driver_resource_setup()
8000 spin_lock_init(&phba->sli4_hba.abts_io_buf_list_lock); in lpfc_sli4_driver_resource_setup()
8001 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_io_buf_list); in lpfc_sli4_driver_resource_setup()
8003 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8005 spin_lock_init(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_sli4_driver_resource_setup()
8006 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
8007 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
8008 spin_lock_init(&phba->sli4_hba.t_active_list_lock); in lpfc_sli4_driver_resource_setup()
8009 INIT_LIST_HEAD(&phba->sli4_hba.t_active_ctx_list); in lpfc_sli4_driver_resource_setup()
8013 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
8014 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
8015 spin_lock_init(&phba->sli4_hba.asynce_list_lock); in lpfc_sli4_driver_resource_setup()
8016 spin_lock_init(&phba->sli4_hba.els_xri_abrt_list_lock); in lpfc_sli4_driver_resource_setup()
8023 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
8025 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
8027 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
8029 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
8031 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
8034 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
8035 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
8036 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
8037 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
8042 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
8043 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
8046 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
8049 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
8054 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
8056 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
8061 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
8065 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8070 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
8075 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
8079 if (phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG) { in lpfc_sli4_driver_resource_setup()
8087 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_FABRIC; in lpfc_sli4_driver_resource_setup()
8090 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
8095 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
8097 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
8102 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
8110 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
8114 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8115 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
8117 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8123 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8131 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
8136 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
8142 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
8145 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
8147 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8152 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
8159 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_driver_resource_setup()
8160 if (phba->irq_chann_mode == NHT_MODE) { in lpfc_sli4_driver_resource_setup()
8161 phba->cfg_irq_chann = in lpfc_sli4_driver_resource_setup()
8162 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
8163 phba->cfg_hdw_queue = in lpfc_sli4_driver_resource_setup()
8164 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
8165 phba->irq_chann_mode = NORMAL_MODE; in lpfc_sli4_driver_resource_setup()
8172 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
8179 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8181 lpfc_log_msg(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
8184 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8193 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
8207 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
8219 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd32) + in lpfc_sli4_driver_resource_setup()
8223 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8229 if (phba->cfg_enable_bg && in lpfc_sli4_driver_resource_setup()
8230 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
8231 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
8233 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8241 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd32) + in lpfc_sli4_driver_resource_setup()
8243 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
8247 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
8248 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8256 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_driver_resource_setup()
8257 phba->cfg_sg_dma_buf_size = LPFC_DEFAULT_XPSGL_SIZE; in lpfc_sli4_driver_resource_setup()
8258 else if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
8259 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
8261 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
8262 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
8264 phba->border_sge_num = phba->cfg_sg_dma_buf_size / in lpfc_sli4_driver_resource_setup()
8268 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8269 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { in lpfc_sli4_driver_resource_setup()
8270 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, in lpfc_sli4_driver_resource_setup()
8274 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8276 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8279 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
8282 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8283 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sli4_driver_resource_setup()
8284 phba->cfg_nvme_seg_cnt); in lpfc_sli4_driver_resource_setup()
8286 i = min(phba->cfg_sg_dma_buf_size, SLI4_PAGE_SIZE); in lpfc_sli4_driver_resource_setup()
8288 phba->lpfc_sg_dma_buf_pool = in lpfc_sli4_driver_resource_setup()
8290 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8291 phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8293 if (!phba->lpfc_sg_dma_buf_pool) { in lpfc_sli4_driver_resource_setup()
8298 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli4_driver_resource_setup()
8300 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8304 if (!phba->lpfc_cmd_rsp_buf_pool) { in lpfc_sli4_driver_resource_setup()
8309 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8312 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
8315 lpfc_sli4_ras_init(phba); in lpfc_sli4_driver_resource_setup()
8318 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
8323 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
8328 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
8331 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
8333 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8337 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8339 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8346 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
8348 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
8349 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8356 phba->sli4_hba.hba_eq_hdl = kzalloc_objs(struct lpfc_hba_eq_hdl, in lpfc_sli4_driver_resource_setup()
8357 phba->cfg_irq_chann); in lpfc_sli4_driver_resource_setup()
8358 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
8359 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8366 phba->sli4_hba.cpu_map = kzalloc_objs(struct lpfc_vector_map_info, in lpfc_sli4_driver_resource_setup()
8367 phba->sli4_hba.num_possible_cpu); in lpfc_sli4_driver_resource_setup()
8368 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
8369 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8376 phba->sli4_hba.eq_info = alloc_percpu(struct lpfc_eq_intr_info); in lpfc_sli4_driver_resource_setup()
8377 if (!phba->sli4_hba.eq_info) { in lpfc_sli4_driver_resource_setup()
8378 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8384 phba->sli4_hba.idle_stat = kzalloc_objs(*phba->sli4_hba.idle_stat, in lpfc_sli4_driver_resource_setup()
8385 phba->sli4_hba.num_possible_cpu); in lpfc_sli4_driver_resource_setup()
8386 if (!phba->sli4_hba.idle_stat) { in lpfc_sli4_driver_resource_setup()
8387 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8394 phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); in lpfc_sli4_driver_resource_setup()
8395 if (!phba->sli4_hba.c_stat) { in lpfc_sli4_driver_resource_setup()
8396 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8403 phba->cmf_stat = alloc_percpu(struct lpfc_cgn_stat); in lpfc_sli4_driver_resource_setup()
8404 if (!phba->cmf_stat) { in lpfc_sli4_driver_resource_setup()
8405 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8415 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
8416 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
8417 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8419 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
8423 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8424 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
8432 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_setup()
8435 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_setup()
8437 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_setup()
8439 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
8441 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
8443 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
8445 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8447 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
8449 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
8451 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool); in lpfc_sli4_driver_resource_setup()
8452 phba->lpfc_cmd_rsp_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8454 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli4_driver_resource_setup()
8455 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8457 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8459 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
8461 destroy_workqueue(phba->wq); in lpfc_sli4_driver_resource_setup()
8462 phba->wq = NULL; in lpfc_sli4_driver_resource_setup()
8474 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
8478 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_unset()
8480 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_unset()
8482 free_percpu(phba->cmf_stat); in lpfc_sli4_driver_resource_unset()
8483 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_unset()
8486 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
8487 phba->sli4_hba.num_possible_cpu = 0; in lpfc_sli4_driver_resource_unset()
8488 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
8489 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
8490 cpumask_clear(&phba->sli4_hba.irq_aff_mask); in lpfc_sli4_driver_resource_unset()
8493 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
8496 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
8497 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
8500 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
8503 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
8504 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8505 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8508 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
8509 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
8512 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
8515 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
8518 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
8522 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
8541 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
8543 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
8544 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
8545 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
8548 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
8549 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
8550 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
8553 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
8554 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
8555 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
8558 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_init_api_table_setup()
8578 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
8583 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
8584 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
8585 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
8586 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
8602 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
8604 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
8605 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
8606 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
8610 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
8611 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
8621 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
8625 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8627 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
8630 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
8632 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8650 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
8657 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8667 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
8677 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8678 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8679 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
8680 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8686 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
8699 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
8705 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
8717 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
8722 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8723 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
8724 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8727 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
8737 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
8743 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8744 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8745 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
8746 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8747 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8752 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
8760 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
8771 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
8775 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
8777 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
8779 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
8793 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
8795 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
8807 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
8810 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
8811 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
8812 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
8813 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
8816 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
8819 phba->sli4_hba.io_xri_cnt = 0; in lpfc_init_sgl_list()
8837 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
8842 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
8843 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
8845 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
8848 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
8850 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_init_rpi_hdrs()
8852 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
8873 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
8884 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
8886 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
8890 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
8892 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8898 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
8899 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8913 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
8934 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8938 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
8939 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
8941 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8945 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
8962 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
8966 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
8970 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
8972 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
8979 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
8997 struct lpfc_hba *phba; in lpfc_hba_alloc() local
9000 phba = kzalloc_obj(struct lpfc_hba); in lpfc_hba_alloc()
9001 if (!phba) { in lpfc_hba_alloc()
9007 phba->pcidev = pdev; in lpfc_hba_alloc()
9010 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
9011 if (phba->brd_no < 0) { in lpfc_hba_alloc()
9012 kfree(phba); in lpfc_hba_alloc()
9015 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
9017 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
9018 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
9020 return phba; in lpfc_hba_alloc()
9031 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
9033 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_hba_free()
9034 kfree(phba->sli4_hba.hdwq); in lpfc_hba_free()
9037 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
9040 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
9041 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
9043 kfree(phba); in lpfc_hba_free()
9059 struct lpfc_hba *phba = vport->phba; in lpfc_setup_fdmi_mask() local
9062 if (phba->cfg_enable_SmartSAN || in lpfc_setup_fdmi_mask()
9063 phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT) { in lpfc_setup_fdmi_mask()
9066 if (phba->cfg_enable_SmartSAN) in lpfc_setup_fdmi_mask()
9089 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
9095 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
9096 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
9097 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
9098 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
9100 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
9101 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
9106 phba->pport = vport; in lpfc_create_shost()
9108 if (phba->nvmet_support) { in lpfc_create_shost()
9110 phba->targetport = NULL; in lpfc_create_shost()
9111 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
9112 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME_DISC, in lpfc_create_shost()
9118 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
9137 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
9139 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
9156 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
9161 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9162 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
9166 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
9167 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
9170 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
9173 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
9177 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
9178 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
9180 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9181 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
9182 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
9183 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9186 phba->cfg_prot_mask, in lpfc_setup_bg()
9187 phba->cfg_prot_guard); in lpfc_setup_bg()
9189 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
9190 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
9192 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9207 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
9213 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
9219 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
9220 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
9224 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
9226 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
9230 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
9254 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
9256 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
9276 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
9279 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
9283 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
9284 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
9291 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
9292 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
9299 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
9300 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
9301 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
9304 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
9305 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9307 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
9308 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9311 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
9313 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
9315 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
9319 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
9321 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
9322 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
9326 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
9327 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
9329 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
9331 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
9332 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9333 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9334 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9335 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9341 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
9343 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
9345 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
9358 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
9363 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
9366 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
9370 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
9372 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
9375 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
9376 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
9391 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
9400 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
9405 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
9423 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9437 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
9442 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9444 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9446 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9448 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9450 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9452 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
9459 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
9462 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
9463 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
9464 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
9465 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
9467 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
9469 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
9470 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
9471 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
9472 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_post_status_check()
9482 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
9483 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
9490 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
9493 phba->work_status[0] = in lpfc_sli4_post_status_check()
9494 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9496 phba->work_status[1] = in lpfc_sli4_post_status_check()
9497 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9499 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9506 phba->work_status[0], in lpfc_sli4_post_status_check()
9507 phba->work_status[1]); in lpfc_sli4_post_status_check()
9514 &phba->sli4_hba.sli_intf) == in lpfc_sli4_post_status_check()
9516 pci_write_config_byte(phba->pcidev, in lpfc_sli4_post_status_check()
9536 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
9540 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
9541 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
9542 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
9543 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
9544 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
9545 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
9546 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
9547 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
9548 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9549 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9552 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9553 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9555 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9556 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9558 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9559 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9561 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9562 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9564 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9565 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9567 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9568 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9569 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9570 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9572 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9573 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9575 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9576 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9578 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9579 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9580 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
9581 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9582 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9583 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9584 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9587 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9588 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9590 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9591 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9593 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9594 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9596 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9597 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9599 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9600 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9602 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9603 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9605 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9606 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9610 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
9625 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
9629 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
9630 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9632 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9634 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9636 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9640 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9642 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9644 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9646 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9648 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9654 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
9672 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
9677 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9680 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9683 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9686 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
9687 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9689 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9710 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
9727 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
9741 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
9742 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
9744 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
9746 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
9757 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
9758 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
9763 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
9781 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
9783 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
9784 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
9785 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
9786 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
9788 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
9789 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
9816 lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) in lpfc_map_topology() argument
9824 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9828 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9831 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9835 set_bit(HBA_PERSISTENT_TOPO, &phba->hba_flag); in lpfc_map_topology()
9838 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9840 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9843 phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) in lpfc_map_topology()
9847 clear_bit(HBA_PERSISTENT_TOPO, &phba->hba_flag); in lpfc_map_topology()
9851 phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : in lpfc_map_topology()
9854 phba->cfg_topology = ((pt == LINK_FLAGS_P2P) in lpfc_map_topology()
9858 if (test_bit(HBA_PERSISTENT_TOPO, &phba->hba_flag)) in lpfc_map_topology()
9859 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9861 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9863 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9866 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9884 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
9897 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
9899 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9905 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
9907 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
9909 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9918 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
9919 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
9921 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
9923 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
9925 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
9926 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
9928 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
9932 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
9933 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
9939 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_read_config()
9943 phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_CONFIG; in lpfc_sli4_read_config()
9946 phba->sli4_hba.fawwpn_flag &= ~LPFC_FAWWPN_CONFIG; in lpfc_sli4_read_config()
9949 phba->sli4_hba.conf_trunk = in lpfc_sli4_read_config()
9951 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
9954 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
9958 phba->sli4_hba.max_cfg_param.max_xri > 512) in lpfc_sli4_read_config()
9959 phba->sli4_hba.max_cfg_param.max_xri = 512; in lpfc_sli4_read_config()
9960 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
9962 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
9965 if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) in lpfc_sli4_read_config()
9966 phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; in lpfc_sli4_read_config()
9967 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
9969 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
9971 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
9973 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
9975 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
9977 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
9979 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
9981 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
9983 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
9985 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
9987 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
9988 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
9989 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
9990 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
9991 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
9992 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
9993 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
9996 phba->sli4_hba.encryption_support = true; in lpfc_sli4_read_config()
9998 phba->sli4_hba.encryption_support = false; in lpfc_sli4_read_config()
10009 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
10010 phba->cgn_reg_signal = EDC_CG_SIG_NOTSUPPORTED; in lpfc_sli4_read_config()
10011 phba->cgn_sig_freq = lpfc_fabric_cgn_frequency; in lpfc_sli4_read_config()
10015 phba->cgn_reg_signal = EDC_CG_SIG_WARN_ONLY; in lpfc_sli4_read_config()
10016 phba->cgn_reg_fpin &= ~LPFC_CGN_FPIN_WARN; in lpfc_sli4_read_config()
10022 if (phba->cgn_reg_signal != in lpfc_sli4_read_config()
10025 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
10026 phba->cgn_reg_signal = in lpfc_sli4_read_config()
10029 phba->cgn_reg_signal = in lpfc_sli4_read_config()
10031 phba->cgn_reg_fpin = in lpfc_sli4_read_config()
10038 phba->cgn_init_reg_fpin = phba->cgn_reg_fpin; in lpfc_sli4_read_config()
10039 phba->cgn_init_reg_signal = phba->cgn_reg_signal; in lpfc_sli4_read_config()
10041 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_sli4_read_config()
10043 phba->cgn_reg_signal, phba->cgn_reg_fpin); in lpfc_sli4_read_config()
10045 lpfc_map_topology(phba, rd_config); in lpfc_sli4_read_config()
10046 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10053 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
10054 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
10055 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
10056 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
10057 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
10058 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
10059 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
10060 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
10061 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
10062 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
10063 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
10064 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
10065 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
10066 phba->sli4_hba.max_cfg_param.max_rq, in lpfc_sli4_read_config()
10067 phba->lmt); in lpfc_sli4_read_config()
10073 qmin = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
10074 if (phba->sli4_hba.max_cfg_param.max_cq < qmin) in lpfc_sli4_read_config()
10075 qmin = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
10081 if (phba->sli4_hba.max_cfg_param.max_eq < qmin) in lpfc_sli4_read_config()
10082 qmin = phba->sli4_hba.max_cfg_param.max_eq; in lpfc_sli4_read_config()
10085 if ((phba->cfg_irq_chann > qmin) || in lpfc_sli4_read_config()
10086 (phba->cfg_hdw_queue > qmin)) { in lpfc_sli4_read_config()
10087 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10092 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
10093 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
10094 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
10095 qmin, phba->cfg_irq_chann, in lpfc_sli4_read_config()
10096 phba->cfg_hdw_queue); in lpfc_sli4_read_config()
10098 if (phba->cfg_irq_chann > qmin) in lpfc_sli4_read_config()
10099 phba->cfg_irq_chann = qmin; in lpfc_sli4_read_config()
10100 if (phba->cfg_hdw_queue > qmin) in lpfc_sli4_read_config()
10101 phba->cfg_hdw_queue = qmin; in lpfc_sli4_read_config()
10109 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
10114 set_bit(HBA_FORCED_LINK_SPEED, &phba->hba_flag); in lpfc_sli4_read_config()
10118 phba->cfg_link_speed = in lpfc_sli4_read_config()
10122 phba->cfg_link_speed = in lpfc_sli4_read_config()
10126 phba->cfg_link_speed = in lpfc_sli4_read_config()
10130 phba->cfg_link_speed = in lpfc_sli4_read_config()
10134 phba->cfg_link_speed = in lpfc_sli4_read_config()
10138 phba->cfg_link_speed = in lpfc_sli4_read_config()
10142 phba->cfg_link_speed = in lpfc_sli4_read_config()
10146 phba->cfg_link_speed = in lpfc_sli4_read_config()
10150 phba->cfg_link_speed = in lpfc_sli4_read_config()
10154 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_read_config()
10159 phba->cfg_link_speed = in lpfc_sli4_read_config()
10166 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
10167 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
10168 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
10169 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
10171 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
10172 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
10175 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
10182 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
10186 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
10192 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10215 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
10217 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
10224 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10226 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
10227 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
10229 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10235 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
10253 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
10260 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
10263 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
10266 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10279 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
10281 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10287 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
10312 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
10319 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
10320 if (phba->cfg_hdw_queue < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
10321 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_sli4_queue_verify()
10322 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
10323 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
10326 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
10328 phba->cfg_hdw_queue, phba->cfg_irq_chann, in lpfc_sli4_queue_verify()
10329 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
10332 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
10333 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10336 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
10337 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10342 lpfc_alloc_io_wq_cq(struct lpfc_hba *phba, int idx) in lpfc_alloc_io_wq_cq() argument
10348 cpu = lpfc_find_cpu_handle(phba, idx, LPFC_FIND_BY_HDWQ); in lpfc_alloc_io_wq_cq()
10350 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_io_wq_cq()
10352 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10353 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10357 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10358 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10359 phba->sli4_hba.cq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10361 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10369 phba->sli4_hba.hdwq[idx].io_cq = qdesc; in lpfc_alloc_io_wq_cq()
10372 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_io_wq_cq()
10374 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_io_wq_cq()
10375 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_io_wq_cq()
10376 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10380 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10381 phba->sli4_hba.wq_esize, in lpfc_alloc_io_wq_cq()
10382 phba->sli4_hba.wq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10385 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10392 phba->sli4_hba.hdwq[idx].io_wq = qdesc; in lpfc_alloc_io_wq_cq()
10393 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_io_wq_cq()
10412 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
10426 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
10427 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
10428 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
10429 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
10430 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
10431 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
10432 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
10433 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
10434 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
10435 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
10437 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10438 phba->sli4_hba.hdwq = kzalloc_objs(struct lpfc_sli4_hdw_queue, in lpfc_sli4_queue_create()
10439 phba->cfg_hdw_queue); in lpfc_sli4_queue_create()
10440 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10441 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10447 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10448 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_queue_create()
10466 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10467 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10468 phba->sli4_hba.nvmet_cqset = kzalloc_objs(struct lpfc_queue *, in lpfc_sli4_queue_create()
10469 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_create()
10470 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
10471 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10476 phba->sli4_hba.nvmet_mrq_hdr = kzalloc_objs(struct lpfc_queue *, in lpfc_sli4_queue_create()
10477 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_create()
10478 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
10479 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10484 phba->sli4_hba.nvmet_mrq_data = kzalloc_objs(struct lpfc_queue *, in lpfc_sli4_queue_create()
10485 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_create()
10486 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
10487 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10495 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10503 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10508 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10511 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10512 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
10513 phba->sli4_hba.eq_ecount, cpu); in lpfc_sli4_queue_create()
10515 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10528 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, qdesc->last_cpu); in lpfc_sli4_queue_create()
10536 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10543 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10548 eqcpu = lpfc_find_cpu_handle(phba, cpup->eq, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10549 eqcpup = &phba->sli4_hba.cpu_map[eqcpu]; in lpfc_sli4_queue_create()
10550 qp->hba_eq = phba->sli4_hba.hdwq[eqcpup->hdwq].hba_eq; in lpfc_sli4_queue_create()
10554 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10555 if (lpfc_alloc_io_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
10559 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10560 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10561 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10563 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10565 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10566 phba->sli4_hba.cq_ecount, in lpfc_sli4_queue_create()
10569 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10577 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
10585 cpu = lpfc_find_cpu_handle(phba, 0, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10587 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10588 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10589 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10591 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10596 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
10599 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10600 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10601 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10603 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10609 phba->sli4_hba.els_cq = qdesc; 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.mq_esize, in lpfc_sli4_queue_create()
10620 phba->sli4_hba.mq_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_wq = qdesc; in lpfc_sli4_queue_create()
10637 wqesize = (phba->fcp_embed_io) ? in lpfc_sli4_queue_create()
10638 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_sli4_queue_create()
10640 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10642 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10644 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10649 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
10650 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10652 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10654 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10655 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10656 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10658 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10664 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
10667 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10668 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
10669 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10671 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10676 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
10677 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10685 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10686 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10687 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10689 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10693 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
10696 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10697 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10698 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10700 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10704 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
10706 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_sli4_queue_create()
10707 phba->nvmet_support) { in lpfc_sli4_queue_create()
10708 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10709 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10712 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10714 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10718 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10724 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
10731 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10741 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10743 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10747 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10753 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
10758 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10759 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10760 memset(&phba->sli4_hba.hdwq[idx].nvme_cstat, 0, in lpfc_sli4_queue_create()
10761 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); in lpfc_sli4_queue_create()
10766 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_queue_create()
10767 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10768 memset(&phba->sli4_hba.hdwq[idx].scsi_cstat, 0, in lpfc_sli4_queue_create()
10769 sizeof(phba->sli4_hba.hdwq[idx].scsi_cstat)); in lpfc_sli4_queue_create()
10776 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
10805 lpfc_sli4_release_hdwq(struct lpfc_hba *phba) in lpfc_sli4_release_hdwq() argument
10811 hdwq = phba->sli4_hba.hdwq; in lpfc_sli4_release_hdwq()
10814 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_release_hdwq()
10821 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_release_hdwq()
10822 lpfc_free_sgl_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10823 lpfc_free_cmd_rsp_buf_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10826 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_release_hdwq()
10828 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_sli4_release_hdwq()
10830 phba->sli4_hba.hba_eq_hdl[idx].eq = NULL; in lpfc_sli4_release_hdwq()
10847 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
10854 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10855 phba->sli.sli_flag |= LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10856 while (phba->sli.sli_flag & LPFC_QUEUE_FREE_WAIT) { in lpfc_sli4_queue_destroy()
10857 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10859 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10861 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10863 lpfc_sli4_cleanup_poll_list(phba); in lpfc_sli4_queue_destroy()
10866 if (phba->sli4_hba.hdwq) in lpfc_sli4_queue_destroy()
10867 lpfc_sli4_release_hdwq(phba); in lpfc_sli4_queue_destroy()
10869 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
10870 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
10871 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10873 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
10874 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10875 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
10876 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10880 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
10883 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
10886 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
10889 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
10890 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
10893 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
10896 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
10899 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
10902 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
10905 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10906 phba->sli.sli_flag &= ~LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10907 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10911 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
10923 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
10930 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
10938 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10945 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
10948 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10959 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
10964 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
10966 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10978 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
10982 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
10984 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10991 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
10993 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
10994 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
11008 lpfc_setup_cq_lookup(struct lpfc_hba *phba) in lpfc_setup_cq_lookup() argument
11013 memset(phba->sli4_hba.cq_lookup, 0, in lpfc_setup_cq_lookup()
11014 (sizeof(struct lpfc_queue *) * (phba->sli4_hba.cq_max + 1))); in lpfc_setup_cq_lookup()
11016 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_setup_cq_lookup()
11018 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_setup_cq_lookup()
11023 if (childq->queue_id > phba->sli4_hba.cq_max) in lpfc_setup_cq_lookup()
11026 phba->sli4_hba.cq_lookup[childq->queue_id] = in lpfc_setup_cq_lookup()
11045 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
11057 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
11059 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11066 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
11070 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
11077 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11081 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
11086 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
11088 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
11090 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11092 phba->sli4_hba.fw_func_mode); in lpfc_sli4_queue_setup()
11094 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
11099 qp = phba->sli4_hba.hdwq; in lpfc_sli4_queue_setup()
11103 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11110 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_setup()
11113 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
11124 rc = lpfc_eq_create(phba, qp[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
11125 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
11127 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11135 phba->sli4_hba.hba_eq_hdl[cpup->eq].eq = in lpfc_sli4_queue_setup()
11138 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11146 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_setup()
11147 cpu = lpfc_find_cpu_handle(phba, qidx, LPFC_FIND_BY_HDWQ); in lpfc_sli4_queue_setup()
11148 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
11151 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
11152 phba->sli4_hba.hdwq[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
11155 &phba->sli4_hba.hdwq[qidx].io_cq_map, in lpfc_sli4_queue_setup()
11159 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11173 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
11174 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11176 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
11182 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11183 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
11184 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
11187 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11192 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11193 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
11194 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11200 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11201 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
11202 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11206 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11214 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11218 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11223 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
11225 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11228 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
11234 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
11235 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11237 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11241 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11242 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
11243 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
11246 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11251 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11253 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
11254 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11256 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_setup()
11258 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
11259 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11261 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11265 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11266 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
11267 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
11270 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11276 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11279 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
11280 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
11286 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11287 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
11288 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
11289 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
11290 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11296 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11297 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
11298 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
11299 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
11300 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11303 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11311 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
11312 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
11313 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
11314 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11317 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11325 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11328 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
11329 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
11330 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
11335 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
11336 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11342 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
11343 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
11345 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11351 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11354 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
11355 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
11356 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11358 if (phba->cfg_fcp_imax) in lpfc_sli4_queue_setup()
11359 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_sli4_queue_setup()
11363 for (qidx = 0; qidx < phba->cfg_irq_chann; in lpfc_sli4_queue_setup()
11365 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
11368 if (phba->sli4_hba.cq_max) { in lpfc_sli4_queue_setup()
11369 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_setup()
11370 phba->sli4_hba.cq_lookup = kzalloc_objs(struct lpfc_queue *, in lpfc_sli4_queue_setup()
11371 (phba->sli4_hba.cq_max + 1)); in lpfc_sli4_queue_setup()
11372 if (!phba->sli4_hba.cq_lookup) { in lpfc_sli4_queue_setup()
11373 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11375 "size 0x%x\n", phba->sli4_hba.cq_max); in lpfc_sli4_queue_setup()
11379 lpfc_setup_cq_lookup(phba); in lpfc_sli4_queue_setup()
11384 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
11402 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
11409 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
11410 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
11413 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
11414 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
11417 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
11418 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
11421 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
11422 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
11423 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
11426 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
11427 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
11430 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
11431 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
11434 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
11435 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
11437 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
11439 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
11440 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11442 phba, in lpfc_sli4_queue_unset()
11443 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
11444 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
11448 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
11449 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11451 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
11456 if (phba->sli4_hba.hdwq) { in lpfc_sli4_queue_unset()
11458 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_unset()
11460 qp = &phba->sli4_hba.hdwq[qidx]; in lpfc_sli4_queue_unset()
11461 lpfc_wq_destroy(phba, qp->io_wq); in lpfc_sli4_queue_unset()
11462 lpfc_cq_destroy(phba, qp->io_cq); in lpfc_sli4_queue_unset()
11465 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_unset()
11467 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_sli4_queue_unset()
11468 lpfc_eq_destroy(phba, eq); in lpfc_sli4_queue_unset()
11472 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_unset()
11473 phba->sli4_hba.cq_lookup = NULL; in lpfc_sli4_queue_unset()
11474 phba->sli4_hba.cq_max = 0; in lpfc_sli4_queue_unset()
11494 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
11499 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
11504 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
11509 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
11524 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
11529 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
11546 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
11550 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
11566 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
11571 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11572 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
11573 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11586 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
11589 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
11601 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
11605 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11606 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
11607 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11618 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
11627 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11628 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
11630 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11633 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11634 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
11636 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11641 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release_all()
11658 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
11669 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
11672 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
11675 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11683 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
11686 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
11692 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
11694 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11711 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11722 phba->work_status[0] = readl( in lpfc_pci_function_reset()
11723 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
11724 phba->work_status[1] = readl( in lpfc_pci_function_reset()
11725 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
11726 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11730 phba->work_status[0], in lpfc_pci_function_reset()
11731 phba->work_status[1]); in lpfc_pci_function_reset()
11748 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11751 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
11771 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11792 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
11794 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
11814 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
11819 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
11821 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_pci_mem_setup()
11824 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
11828 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
11836 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
11843 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11844 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11845 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11851 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11853 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11855 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
11862 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11863 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11864 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11870 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11879 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11882 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11883 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
11885 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11892 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
11893 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11894 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11907 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
11909 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11910 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
11911 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11917 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11918 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11927 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11930 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11931 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
11933 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11940 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
11941 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11942 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
11957 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
11959 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11960 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
11961 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11967 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11974 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
11975 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_write_eq_db; in lpfc_sli4_pci_mem_setup()
11976 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_write_cq_db; in lpfc_sli4_pci_mem_setup()
11979 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
11980 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_if6_write_eq_db; in lpfc_sli4_pci_mem_setup()
11981 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_if6_write_cq_db; in lpfc_sli4_pci_mem_setup()
11990 if (phba->sli4_hba.drbl_regs_memmap_p) in lpfc_sli4_pci_mem_setup()
11991 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
11993 if (phba->sli4_hba.ctrl_regs_memmap_p) in lpfc_sli4_pci_mem_setup()
11994 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
11996 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
12009 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
12012 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
12016 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12017 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12018 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12021 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12024 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12025 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12026 if (phba->sli4_hba.dpp_regs_memmap_p) in lpfc_sli4_pci_mem_unset()
12027 iounmap(phba->sli4_hba.dpp_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
12028 if (phba->sli4_hba.dpp_regs_memmap_wc_p) in lpfc_sli4_pci_mem_unset()
12029 iounmap(phba->sli4_hba.dpp_regs_memmap_wc_p); in lpfc_sli4_pci_mem_unset()
12034 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
12053 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
12059 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
12062 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
12072 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
12074 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
12076 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
12083 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
12085 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
12088 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
12097 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
12101 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_enable_msix()
12106 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
12109 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
12111 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
12119 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
12124 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
12128 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
12132 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
12136 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
12157 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
12161 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
12163 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
12166 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
12171 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
12172 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
12174 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
12175 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
12199 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
12205 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
12208 clear_bit(HBA_NEEDS_CFG_PORT, &phba->hba_flag); in lpfc_sli_enable_intr()
12212 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
12215 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
12221 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12222 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
12225 phba->intr_type = MSI; in lpfc_sli_enable_intr()
12231 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12232 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
12233 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
12236 phba->intr_type = INTx; in lpfc_sli_enable_intr()
12253 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
12257 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
12263 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
12264 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
12267 phba->intr_type = NONE; in lpfc_sli_disable_intr()
12268 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
12280 lpfc_find_cpu_handle(struct lpfc_hba *phba, uint16_t id, int match) in lpfc_find_cpu_handle() argument
12287 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_find_cpu_handle()
12314 lpfc_find_hyper(struct lpfc_hba *phba, int cpu, in lpfc_find_hyper() argument
12321 cpup = &phba->sli4_hba.cpu_map[idx]; in lpfc_find_hyper()
12342 lpfc_assign_eq_map_info(struct lpfc_hba *phba, uint16_t eqidx, uint16_t flag, in lpfc_assign_eq_map_info() argument
12345 struct lpfc_vector_map_info *cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_assign_eq_map_info()
12351 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_assign_eq_map_info()
12363 lpfc_cpu_map_array_init(struct lpfc_hba *phba) in lpfc_cpu_map_array_init() argument
12370 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_map_array_init()
12376 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, cpu); in lpfc_cpu_map_array_init()
12389 lpfc_hba_eq_hdl_array_init(struct lpfc_hba *phba) in lpfc_hba_eq_hdl_array_init() argument
12394 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hba_eq_hdl_array_init()
12397 eqhdl->phba = phba; in lpfc_hba_eq_hdl_array_init()
12412 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
12430 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12434 if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id)) in lpfc_cpu_affinity_check()
12442 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12466 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12479 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12480 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12499 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12512 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12525 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12526 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12533 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
12548 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12561 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12570 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12588 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12598 if (next_idx < phba->cfg_hdw_queue) { in lpfc_cpu_affinity_check()
12610 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12611 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12624 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12625 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12633 cpup->hdwq = idx % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12641 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12654 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12656 c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, cpu); in lpfc_cpu_affinity_check()
12662 cpup->hdwq = idx++ % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12666 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12686 lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu, in lpfc_cpuhp_get_eq() argument
12698 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_cpuhp_get_eq()
12699 maskp = pci_irq_get_affinity(phba->pcidev, idx); in lpfc_cpuhp_get_eq()
12724 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_cpuhp_get_eq()
12731 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba) in __lpfc_cpuhp_remove() argument
12733 if (phba->sli_rev != LPFC_SLI_REV4) in __lpfc_cpuhp_remove()
12737 &phba->cpuhp); in __lpfc_cpuhp_remove()
12743 timer_delete_sync(&phba->cpuhp_poll_timer); in __lpfc_cpuhp_remove()
12746 static void lpfc_cpuhp_remove(struct lpfc_hba *phba) in lpfc_cpuhp_remove() argument
12748 if (phba->pport && in lpfc_cpuhp_remove()
12749 test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag)) in lpfc_cpuhp_remove()
12752 __lpfc_cpuhp_remove(phba); in lpfc_cpuhp_remove()
12755 static void lpfc_cpuhp_add(struct lpfc_hba *phba) in lpfc_cpuhp_add() argument
12757 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cpuhp_add()
12762 if (!list_empty(&phba->poll_list)) in lpfc_cpuhp_add()
12763 mod_timer(&phba->cpuhp_poll_timer, in lpfc_cpuhp_add()
12769 &phba->cpuhp); in lpfc_cpuhp_add()
12772 static int __lpfc_cpuhp_checks(struct lpfc_hba *phba, int *retval) in __lpfc_cpuhp_checks() argument
12774 if (test_bit(FC_UNLOADING, &phba->pport->load_flag)) { in __lpfc_cpuhp_checks()
12779 if (phba->sli_rev != LPFC_SLI_REV4) { in __lpfc_cpuhp_checks()
12832 lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline) in lpfc_irq_rebalance() argument
12839 if (phba->irq_chann_mode == NORMAL_MODE) in lpfc_irq_rebalance()
12842 orig_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_rebalance()
12847 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_irq_rebalance()
12862 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_irq_rebalance()
12872 for (idx = 0; idx < phba->cfg_irq_chann; idx++) in lpfc_irq_rebalance()
12883 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_offline() local
12888 if (!phba) { in lpfc_cpu_offline()
12889 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_offline()
12893 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_offline()
12896 lpfc_irq_rebalance(phba, cpu, true); in lpfc_cpu_offline()
12898 retval = lpfc_cpuhp_get_eq(phba, cpu, &eqlist); in lpfc_cpu_offline()
12913 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_online() local
12918 if (!phba) { in lpfc_cpu_online()
12919 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_online()
12923 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_online()
12926 lpfc_irq_rebalance(phba, cpu, false); in lpfc_cpu_online()
12928 list_for_each_entry_safe(eq, next, &phba->poll_list, _poll_list) { in lpfc_cpu_online()
12929 n = lpfc_find_cpu_handle(phba, eq->hdwq, LPFC_FIND_BY_HDWQ); in lpfc_cpu_online()
12966 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
12978 vectors = phba->cfg_irq_chann; in lpfc_sli4_enable_msix()
12980 if (phba->irq_chann_mode != NORMAL_MODE) in lpfc_sli4_enable_msix()
12981 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_sli4_enable_msix()
12985 vectors = min(phba->cfg_irq_chann, cpu_cnt); in lpfc_sli4_enable_msix()
12996 rc = pci_alloc_irq_vectors(phba->pcidev, 1, vectors, flags); in lpfc_sli4_enable_msix()
12998 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
13013 rc = pci_irq_vector(phba->pcidev, index); in lpfc_sli4_enable_msix()
13015 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
13027 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
13039 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
13050 lpfc_assign_eq_map_info(phba, index, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_msix()
13053 maskp = pci_irq_get_affinity(phba->pcidev, index); in lpfc_sli4_enable_msix()
13057 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_enable_msix()
13073 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
13081 if (vectors != phba->cfg_irq_chann) { in lpfc_sli4_enable_msix()
13082 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_enable_msix()
13085 phba->cfg_irq_chann, vectors); in lpfc_sli4_enable_msix()
13086 if (phba->cfg_irq_chann > vectors) in lpfc_sli4_enable_msix()
13087 phba->cfg_irq_chann = vectors; in lpfc_sli4_enable_msix()
13101 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
13122 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
13128 rc = pci_alloc_irq_vectors(phba->pcidev, 1, 1, in lpfc_sli4_enable_msi()
13131 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
13134 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
13139 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
13140 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
13142 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
13143 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
13149 rc = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_msi()
13151 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_enable_msi()
13152 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
13153 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
13160 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); in lpfc_sli4_enable_msi()
13162 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_enable_msi()
13188 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
13198 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
13201 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
13208 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13209 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
13212 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
13218 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13219 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
13220 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
13226 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
13230 retval = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_intr()
13232 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_enable_intr()
13233 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_intr()
13241 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_intr()
13243 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_enable_intr()
13262 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
13265 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
13270 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_disable_intr()
13276 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
13279 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
13282 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
13283 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
13294 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
13296 set_bit(FC_UNLOADING, &phba->pport->load_flag); in lpfc_unset_hba()
13298 kfree(phba->vpi_bmask); in lpfc_unset_hba()
13299 kfree(phba->vpi_ids); in lpfc_unset_hba()
13301 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
13303 phba->pport->work_port_events = 0; in lpfc_unset_hba()
13305 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
13307 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
13309 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
13328 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
13335 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13344 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
13345 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
13348 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13349 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13357 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13359 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13365 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13370 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13375 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13387 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13388 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13397 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13399 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13402 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13418 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
13422 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
13424 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
13425 hrtimer_cancel(&phba->cmf_stats_timer); in lpfc_sli4_hba_unset()
13426 hrtimer_cancel(&phba->cmf_timer); in lpfc_sli4_hba_unset()
13428 if (phba->pport) in lpfc_sli4_hba_unset()
13429 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
13437 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13438 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
13439 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13441 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13447 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13448 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13449 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
13451 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
13452 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
13453 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
13454 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13458 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
13460 if (!pci_channel_offline(phba->pcidev)) in lpfc_sli4_hba_unset()
13462 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
13465 if (phba->pport) in lpfc_sli4_hba_unset()
13466 lpfc_cpuhp_remove(phba); in lpfc_sli4_hba_unset()
13469 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
13472 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
13476 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
13479 lpfc_ras_stop_fwlog(phba); in lpfc_sli4_hba_unset()
13481 lpfc_sli4_queue_unset(phba); in lpfc_sli4_hba_unset()
13484 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
13487 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
13490 if (phba->ras_fwlog.ras_enabled) in lpfc_sli4_hba_unset()
13491 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_hba_unset()
13494 if (phba->pport) in lpfc_sli4_hba_unset()
13495 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
13549 lpfc_init_congestion_buf(struct lpfc_hba *phba) in lpfc_init_congestion_buf() argument
13555 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_buf()
13556 "6235 INIT Congestion Buffer %p\n", phba->cgn_i); in lpfc_init_congestion_buf()
13558 if (!phba->cgn_i) in lpfc_init_congestion_buf()
13560 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_buf()
13562 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_init_congestion_buf()
13563 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_init_congestion_buf()
13564 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_init_congestion_buf()
13565 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_init_congestion_buf()
13567 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_init_congestion_buf()
13568 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_init_congestion_buf()
13569 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_init_congestion_buf()
13570 phba->cgn_evt_minute = 0; in lpfc_init_congestion_buf()
13577 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_init_congestion_buf()
13578 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_init_congestion_buf()
13579 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_init_congestion_buf()
13580 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_init_congestion_buf()
13582 lpfc_cgn_update_tstamp(phba, &cp->base_time); in lpfc_init_congestion_buf()
13585 if (phba->pport) { in lpfc_init_congestion_buf()
13586 size = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_init_congestion_buf()
13597 phba->cgn_evt_timestamp = jiffies + in lpfc_init_congestion_buf()
13602 lpfc_init_congestion_stat(struct lpfc_hba *phba) in lpfc_init_congestion_stat() argument
13607 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_stat()
13608 "6236 INIT Congestion Stat %p\n", phba->cgn_i); in lpfc_init_congestion_stat()
13610 if (!phba->cgn_i) in lpfc_init_congestion_stat()
13613 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_stat()
13616 lpfc_cgn_update_tstamp(phba, &cp->stat_start); in lpfc_init_congestion_stat()
13627 __lpfc_reg_congestion_buf(struct lpfc_hba *phba, int reg) in __lpfc_reg_congestion_buf() argument
13635 if (!phba->cgn_i) in __lpfc_reg_congestion_buf()
13638 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in __lpfc_reg_congestion_buf()
13640 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in __lpfc_reg_congestion_buf()
13643 phba->pport->port_state, reg); in __lpfc_reg_congestion_buf()
13649 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in __lpfc_reg_congestion_buf()
13660 putPaddrLow(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13662 putPaddrHigh(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13664 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in __lpfc_reg_congestion_buf()
13670 mempool_free(mboxq, phba->mbox_mem_pool); in __lpfc_reg_congestion_buf()
13672 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in __lpfc_reg_congestion_buf()
13683 lpfc_unreg_congestion_buf(struct lpfc_hba *phba) in lpfc_unreg_congestion_buf() argument
13685 lpfc_cmf_stop(phba); in lpfc_unreg_congestion_buf()
13686 return __lpfc_reg_congestion_buf(phba, 0); in lpfc_unreg_congestion_buf()
13690 lpfc_reg_congestion_buf(struct lpfc_hba *phba) in lpfc_reg_congestion_buf() argument
13692 return __lpfc_reg_congestion_buf(phba, 1); in lpfc_reg_congestion_buf()
13708 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
13723 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
13728 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
13731 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
13732 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
13734 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
13735 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
13739 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
13749 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13751 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13770 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13771 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13775 phba->cfg_xpsgl = bf_get(cfg_xpsgl, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13786 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) { in lpfc_get_sli4_parameters()
13787 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13790 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13796 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
13797 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13802 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13804 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
13805 phba->cfg_nvmet_mrq = 0; in lpfc_get_sli4_parameters()
13806 phba->cfg_nvme_seg_cnt = 0; in lpfc_get_sli4_parameters()
13809 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
13811 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
13818 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_get_sli4_parameters()
13819 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_get_sli4_parameters()
13823 phba->cfg_enable_pbde = 1; in lpfc_get_sli4_parameters()
13825 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
13835 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
13837 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
13839 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
13842 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
13848 dma_set_max_seg_size(&phba->pcidev->dev, sli4_params->sge_supp_len); in lpfc_get_sli4_parameters()
13856 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
13858 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
13860 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13863 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
13864 phba->fcp_embed_io, sli4_params->nvme, in lpfc_get_sli4_parameters()
13865 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
13867 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13869 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13877 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
13879 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
13884 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
13886 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
13892 phba->nsler = 1; in lpfc_get_sli4_parameters()
13894 phba->nsler = 0; in lpfc_get_sli4_parameters()
13919 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
13926 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
13927 if (!phba) in lpfc_pci_probe_one_s3()
13931 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
13936 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
13941 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
13943 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13949 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
13951 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13958 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
13960 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13966 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
13968 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13974 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
13977 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
13979 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13985 vport = phba->pport; in lpfc_pci_probe_one_s3()
13988 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13995 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
13998 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
14000 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
14002 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
14008 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
14009 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
14019 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
14021 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
14022 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
14025 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
14030 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
14037 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
14040 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
14045 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
14049 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
14051 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
14053 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
14055 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
14057 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
14059 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
14063 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
14082 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
14090 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
14092 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
14097 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
14113 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
14115 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
14117 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
14119 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
14120 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
14122 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
14123 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
14125 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
14130 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
14134 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
14142 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
14143 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s3()
14145 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
14148 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
14152 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
14155 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
14156 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
14158 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
14188 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
14190 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
14194 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
14195 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
14196 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
14199 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
14227 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
14231 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
14235 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
14236 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
14237 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
14238 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
14239 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
14246 lpfc_cpu_map_array_init(phba); in lpfc_pci_resume_one_s3()
14248 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_resume_one_s3()
14250 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14252 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s3()
14256 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
14259 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
14260 lpfc_online(phba); in lpfc_pci_resume_one_s3()
14263 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14276 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
14278 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_recover()
14285 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
14297 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
14299 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_reset()
14303 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
14306 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
14309 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_reset()
14312 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
14315 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
14316 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
14328 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
14330 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_perm_failure()
14333 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
14334 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_sli_prep_dev_for_perm_failure()
14337 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
14340 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
14365 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
14370 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
14374 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14378 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
14382 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s3()
14384 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14411 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
14412 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
14427 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14429 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14432 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14434 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s3()
14439 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
14442 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
14443 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
14444 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
14447 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14466 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
14469 lpfc_online(phba); in lpfc_io_resume_s3()
14479 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
14481 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
14483 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
14509 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
14511 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
14513 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
14520 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
14527 sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf); in lpfc_log_write_firmware_error()
14541 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14545 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14549 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14554 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14558 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14562 offset, phba->pcidev->device, magic_number, in lpfc_log_write_firmware_error()
14578 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
14600 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
14602 lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI, in lpfc_write_firmware()
14612 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
14637 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
14640 rc = lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
14651 lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI, in lpfc_write_firmware()
14659 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
14666 lpfc_log_msg(phba, KERN_ERR, LOG_INIT | LOG_SLI, in lpfc_write_firmware()
14669 lpfc_log_msg(phba, KERN_NOTICE, LOG_INIT | LOG_SLI, in lpfc_write_firmware()
14682 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
14689 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
14693 scnprintf(file_name, sizeof(file_name), "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
14697 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
14698 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
14701 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
14703 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
14732 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
14739 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
14740 if (!phba) in lpfc_pci_probe_one_s4()
14743 INIT_LIST_HEAD(&phba->poll_list); in lpfc_pci_probe_one_s4()
14746 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14751 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
14756 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
14758 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14764 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
14766 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14771 spin_lock_init(&phba->rrq_list_lock); in lpfc_pci_probe_one_s4()
14772 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
14773 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
14776 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14778 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14784 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
14787 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
14790 phba->pport = NULL; in lpfc_pci_probe_one_s4()
14791 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
14794 lpfc_cpu_map_array_init(phba); in lpfc_pci_probe_one_s4()
14797 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_probe_one_s4()
14800 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
14802 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14808 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
14809 phba->cfg_irq_chann = 1; in lpfc_pci_probe_one_s4()
14810 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14811 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
14812 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
14815 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_pci_probe_one_s4()
14818 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
14820 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14824 vport = phba->pport; in lpfc_pci_probe_one_s4()
14830 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14836 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
14837 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14844 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
14845 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
14848 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
14853 if (phba->nvmet_support == 0) { in lpfc_pci_probe_one_s4()
14854 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14862 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14871 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
14872 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
14875 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
14877 timer_setup(&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer, 0); in lpfc_pci_probe_one_s4()
14878 cpuhp_state_add_instance_nocalls(lpfc_cpuhp_state, &phba->cpuhp); in lpfc_pci_probe_one_s4()
14885 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
14887 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
14889 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14891 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
14893 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
14895 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14899 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
14918 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
14923 if (phba->cgn_i) in lpfc_pci_remove_one_s4()
14924 lpfc_unreg_congestion_buf(phba); in lpfc_pci_remove_one_s4()
14929 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
14931 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
14936 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
14946 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
14950 if (phba->cfg_xri_rebalancing) in lpfc_pci_remove_one_s4()
14951 lpfc_destroy_multixri_pools(phba); in lpfc_pci_remove_one_s4()
14960 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
14961 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
14963 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
14968 lpfc_io_free(phba); in lpfc_pci_remove_one_s4()
14969 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
14970 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
14972 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
14973 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
14976 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
14980 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
14983 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
15012 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
15014 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
15018 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
15019 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
15020 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
15023 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
15024 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
15052 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
15056 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
15060 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
15061 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
15062 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
15063 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
15064 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
15071 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
15073 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s4()
15077 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
15080 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
15081 lpfc_online(phba); in lpfc_pci_resume_one_s4()
15084 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
15097 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
15099 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_recover()
15105 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
15117 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
15119 int offline = pci_channel_offline(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
15121 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_reset()
15126 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
15130 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
15132 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_reset()
15133 lpfc_offline(phba); in lpfc_sli4_prep_dev_for_reset()
15136 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
15138 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
15140 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
15141 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
15153 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
15155 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_perm_failure()
15159 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15162 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15165 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15188 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
15194 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
15197 hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15200 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15202 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s4()
15207 set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15209 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
15212 hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_error_detected_s4()
15214 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15216 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s4()
15218 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15245 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
15246 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
15259 hba_pci_err = test_and_clear_bit(HBA_PCI_ERR, &phba->bit_flags); in lpfc_io_slot_reset_s4()
15272 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15274 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15277 lpfc_cpu_map_array_init(phba); in lpfc_io_slot_reset_s4()
15279 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15281 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s4()
15286 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
15287 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_io_slot_reset_s4()
15290 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15309 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
15317 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
15319 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
15321 lpfc_online(phba); in lpfc_io_resume_s4()
15375 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
15377 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
15385 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_remove_one()
15387 phba->pci_dev_grp); in lpfc_pci_remove_one()
15410 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
15413 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
15421 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_suspend_one()
15423 phba->pci_dev_grp); in lpfc_pci_suspend_one()
15446 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
15449 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
15457 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one()
15459 phba->pci_dev_grp); in lpfc_pci_resume_one()
15484 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
15487 if (phba->link_state == LPFC_HBA_ERROR && in lpfc_io_error_detected()
15488 test_bit(HBA_IOQ_FLUSH, &phba->hba_flag)) in lpfc_io_error_detected()
15491 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
15499 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected()
15501 phba->pci_dev_grp); in lpfc_io_error_detected()
15525 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
15528 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
15536 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset()
15538 phba->pci_dev_grp); in lpfc_io_slot_reset()
15558 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
15560 switch (phba->pci_dev_grp) { in lpfc_io_resume()
15568 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_resume()
15570 phba->pci_dev_grp); in lpfc_io_resume()
15587 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
15590 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
15593 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
15594 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
15596 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
15597 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
15598 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
15612 lpfc_sli4_ras_init(struct lpfc_hba *phba) in lpfc_sli4_ras_init() argument
15615 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15617 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15619 phba->ras_fwlog.ras_hwsupport = true; in lpfc_sli4_ras_init()
15620 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && in lpfc_sli4_ras_init()
15621 phba->cfg_ras_fwlog_buffsize) in lpfc_sli4_ras_init()
15622 phba->ras_fwlog.ras_enabled = true; in lpfc_sli4_ras_init()
15624 phba->ras_fwlog.ras_enabled = false; in lpfc_sli4_ras_init()
15626 phba->ras_fwlog.ras_hwsupport = false; in lpfc_sli4_ras_init()
15733 void lpfc_dmp_dbg(struct lpfc_hba *phba) in lpfc_dmp_dbg() argument
15742 if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0) in lpfc_dmp_dbg()
15745 start_idx = (unsigned int)atomic_read(&phba->dbg_log_idx) % DBG_LOG_SZ; in lpfc_dmp_dbg()
15746 dbg_cnt = (unsigned int)atomic_read(&phba->dbg_log_cnt); in lpfc_dmp_dbg()
15763 dev_info(&phba->pcidev->dev, "start %d end %d cnt %d\n", in lpfc_dmp_dbg()
15771 rem_nsec = do_div(phba->dbg_log[temp_idx].t_ns, NSEC_PER_SEC); in lpfc_dmp_dbg()
15772 dev_info(&phba->pcidev->dev, "%d: [%5lu.%06lu] %s", in lpfc_dmp_dbg()
15774 (unsigned long)phba->dbg_log[temp_idx].t_ns, in lpfc_dmp_dbg()
15776 phba->dbg_log[temp_idx].log); in lpfc_dmp_dbg()
15779 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_dmp_dbg()
15780 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_dmp_dbg()
15784 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...) in lpfc_dbg_print() argument
15788 int dbg_dmping = atomic_read(&phba->dbg_log_dmping); in lpfc_dbg_print()
15796 dev_info(&phba->pcidev->dev, "%pV", &vaf); in lpfc_dbg_print()
15800 idx = (unsigned int)atomic_fetch_add(1, &phba->dbg_log_idx) % in lpfc_dbg_print()
15803 atomic_inc(&phba->dbg_log_cnt); in lpfc_dbg_print()
15805 vscnprintf(phba->dbg_log[idx].log, in lpfc_dbg_print()
15806 sizeof(phba->dbg_log[idx].log), fmt, args); in lpfc_dbg_print()
15809 phba->dbg_log[idx].t_ns = local_clock(); in lpfc_dbg_print()