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);
102 static int lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport);
119 lpfc_config_port_prep(struct lpfc_hba *phba) in lpfc_config_port_prep() argument
121 lpfc_vpd_t *vp = &phba->vpd; in lpfc_config_port_prep()
131 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_prep()
133 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_prep()
138 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_config_port_prep()
140 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port_prep()
149 lpfc_read_nv(phba, pmb); in lpfc_config_port_prep()
155 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
158 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
163 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
166 memcpy(phba->wwnn, (char *)mb->un.varRDnvp.nodename, in lpfc_config_port_prep()
167 sizeof(phba->wwnn)); in lpfc_config_port_prep()
168 memcpy(phba->wwpn, (char *)mb->un.varRDnvp.portname, in lpfc_config_port_prep()
169 sizeof(phba->wwpn)); in lpfc_config_port_prep()
176 phba->sli3_options &= (uint32_t)LPFC_SLI3_BG_ENABLED; in lpfc_config_port_prep()
179 lpfc_read_rev(phba, pmb); in lpfc_config_port_prep()
180 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
182 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
186 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
197 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_prep()
200 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
204 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) { in lpfc_config_port_prep()
205 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
232 phba->sli3_options |= LPFC_SLI3_VPORT_TEARDOWN; in lpfc_config_port_prep()
234 if (lpfc_is_LC_HBA(phba->pcidev->device)) in lpfc_config_port_prep()
235 memcpy(phba->RandomData, (char *)&mb->un.varWords[24], in lpfc_config_port_prep()
236 sizeof (phba->RandomData)); in lpfc_config_port_prep()
243 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD); in lpfc_config_port_prep()
244 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
247 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_config_port_prep()
267 lpfc_parse_vpd(phba, lpfc_vpd_data, offset); in lpfc_config_port_prep()
271 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
286 lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_config_async_cmpl() argument
289 phba->temp_sensor_support = 1; in lpfc_config_async_cmpl()
291 phba->temp_sensor_support = 0; in lpfc_config_async_cmpl()
292 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_config_async_cmpl()
307 lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_dump_wakeup_param_cmpl() argument
316 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
330 snprintf(phba->OptionROMVersion, 32, "%d.%d%d", in lpfc_dump_wakeup_param_cmpl()
333 snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", in lpfc_dump_wakeup_param_cmpl()
336 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
356 if (vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
357 u64_to_wwn(vport->phba->cfg_soft_wwnn, in lpfc_update_vport_wwn()
359 if (vport->phba->cfg_soft_wwpn) in lpfc_update_vport_wwn()
360 u64_to_wwn(vport->phba->cfg_soft_wwpn, in lpfc_update_vport_wwn()
367 if (vport->fc_nodename.u.wwn[0] == 0 || vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
384 vport->phba->cfg_soft_wwpn || in lpfc_update_vport_wwn()
412 lpfc_config_port_post(struct lpfc_hba *phba) in lpfc_config_port_post() argument
414 struct lpfc_vport *vport = phba->pport; in lpfc_config_port_post()
419 struct lpfc_sli *psli = &phba->sli; in lpfc_config_port_post()
424 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
429 if (phba->over_temp_state == HBA_OVER_TEMP) in lpfc_config_port_post()
430 phba->over_temp_state = HBA_NORMAL_TEMP; in lpfc_config_port_post()
431 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
433 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
435 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
441 rc = lpfc_read_sparam(phba, pmb, 0); in lpfc_config_port_post()
443 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
448 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
449 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
453 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
455 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
456 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
464 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
472 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_config_port_post()
476 if (phba->SerialNumber[0] == 0) { in lpfc_config_port_post()
484 phba->SerialNumber[i] = in lpfc_config_port_post()
487 phba->SerialNumber[i] = in lpfc_config_port_post()
492 phba->SerialNumber[i] = in lpfc_config_port_post()
495 phba->SerialNumber[i] = in lpfc_config_port_post()
500 lpfc_read_config(phba, pmb); in lpfc_config_port_post()
502 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
503 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
507 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
508 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
513 lpfc_sli_read_link_ste(phba); in lpfc_config_port_post()
516 if (phba->cfg_hba_queue_depth > mb->un.varRdConfig.max_xri) { in lpfc_config_port_post()
517 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
519 phba->cfg_hba_queue_depth, in lpfc_config_port_post()
521 phba->cfg_hba_queue_depth = mb->un.varRdConfig.max_xri; in lpfc_config_port_post()
524 phba->lmt = mb->un.varRdConfig.lmt; in lpfc_config_port_post()
527 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_config_port_post()
529 phba->link_state = LPFC_LINK_DOWN; in lpfc_config_port_post()
538 if (phba->sli_rev != 3) in lpfc_config_port_post()
539 lpfc_post_rcv_buf(phba); in lpfc_config_port_post()
544 if (phba->intr_type == MSIX) { in lpfc_config_port_post()
545 rc = lpfc_config_msi(phba, pmb); in lpfc_config_port_post()
547 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
550 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_post()
552 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
557 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
562 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
564 phba->hba_flag &= ~HBA_ERATT_HANDLED; in lpfc_config_port_post()
567 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_config_port_post()
568 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
581 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && in lpfc_config_port_post()
582 (phba->cfg_poll & DISABLE_FCP_RING_INT)) in lpfc_config_port_post()
585 writel(status, phba->HCregaddr); in lpfc_config_port_post()
586 readl(phba->HCregaddr); /* flush */ in lpfc_config_port_post()
587 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
590 timeout = phba->fc_ratov * 2; in lpfc_config_port_post()
594 mod_timer(&phba->hb_tmofunc, in lpfc_config_port_post()
596 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_config_port_post()
597 phba->last_completion_time = jiffies; in lpfc_config_port_post()
599 mod_timer(&phba->eratt_poll, in lpfc_config_port_post()
600 jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); in lpfc_config_port_post()
602 if (phba->hba_flag & LINK_DISABLED) { in lpfc_config_port_post()
603 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
605 lpfc_down_link(phba, pmb); in lpfc_config_port_post()
607 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
609 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
613 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
616 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_config_port_post()
617 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
618 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_config_port_post()
623 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
625 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
629 lpfc_config_async(phba, pmb, LPFC_ELS_RING); in lpfc_config_port_post()
631 pmb->vport = phba->pport; in lpfc_config_port_post()
632 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
635 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
639 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
643 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
645 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
649 lpfc_dump_wakeup_param(phba, pmb); in lpfc_config_port_post()
651 pmb->vport = phba->pport; in lpfc_config_port_post()
652 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
655 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_config_port_post()
658 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
679 lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_init_link() argument
681 return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); in lpfc_hba_init_link()
700 lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, in lpfc_hba_init_link_fc_topology() argument
703 struct lpfc_vport *vport = phba->pport; in lpfc_hba_init_link_fc_topology()
708 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_init_link_fc_topology()
710 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
716 if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || in lpfc_hba_init_link_fc_topology()
717 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && in lpfc_hba_init_link_fc_topology()
718 !(phba->lmt & LMT_1Gb)) || in lpfc_hba_init_link_fc_topology()
719 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && in lpfc_hba_init_link_fc_topology()
720 !(phba->lmt & LMT_2Gb)) || in lpfc_hba_init_link_fc_topology()
721 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && in lpfc_hba_init_link_fc_topology()
722 !(phba->lmt & LMT_4Gb)) || in lpfc_hba_init_link_fc_topology()
723 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && in lpfc_hba_init_link_fc_topology()
724 !(phba->lmt & LMT_8Gb)) || in lpfc_hba_init_link_fc_topology()
725 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && in lpfc_hba_init_link_fc_topology()
726 !(phba->lmt & LMT_10Gb)) || in lpfc_hba_init_link_fc_topology()
727 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && in lpfc_hba_init_link_fc_topology()
728 !(phba->lmt & LMT_16Gb)) || in lpfc_hba_init_link_fc_topology()
729 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && in lpfc_hba_init_link_fc_topology()
730 !(phba->lmt & LMT_32Gb)) || in lpfc_hba_init_link_fc_topology()
731 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) && in lpfc_hba_init_link_fc_topology()
732 !(phba->lmt & LMT_64Gb))) { in lpfc_hba_init_link_fc_topology()
734 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
737 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
738 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
740 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
742 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
743 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
744 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
746 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_init_link_fc_topology()
750 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
752 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
753 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
755 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
756 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
758 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
760 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
763 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
765 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
784 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
789 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
791 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
795 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
797 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
799 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
801 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_hba_down_link()
805 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
809 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
826 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
831 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
833 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
834 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
837 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_hba_down_prep()
838 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
840 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
842 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
845 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
864 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
870 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
871 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli4_free_sp_events()
872 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
874 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli4_free_sp_events()
876 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
877 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli4_free_sp_events()
879 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
885 lpfc_sli_release_iocbq(phba, rspiocbq); in lpfc_sli4_free_sp_events()
891 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_free_sp_events()
908 lpfc_hba_free_post_buf(struct lpfc_hba *phba) in lpfc_hba_free_post_buf() argument
910 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_free_post_buf()
916 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) in lpfc_hba_free_post_buf()
917 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_free_post_buf()
921 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
923 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
929 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_hba_free_post_buf()
933 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
935 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
950 lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) in lpfc_hba_clean_txcmplq() argument
952 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_clean_txcmplq()
959 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_hba_clean_txcmplq()
962 spin_lock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
969 spin_unlock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
971 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
974 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
978 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_hba_clean_txcmplq()
989 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
992 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
1008 lpfc_hba_down_post_s3(struct lpfc_hba *phba) in lpfc_hba_down_post_s3() argument
1010 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s3()
1011 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s3()
1027 lpfc_hba_down_post_s4(struct lpfc_hba *phba) in lpfc_hba_down_post_s4() argument
1039 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_down_post_s4()
1040 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s4()
1052 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1054 &phba->sli4_hba.lpfc_abts_els_sgl_list, list) in lpfc_hba_down_post_s4()
1057 list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, in lpfc_hba_down_post_s4()
1058 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_hba_down_post_s4()
1061 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1066 spin_lock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1068 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_hba_down_post_s4()
1069 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_hba_down_post_s4()
1089 spin_unlock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1091 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_hba_down_post_s4()
1092 spin_lock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1093 list_splice_init(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list, in lpfc_hba_down_post_s4()
1095 spin_unlock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1098 lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf); in lpfc_hba_down_post_s4()
1102 lpfc_sli4_free_sp_events(phba); in lpfc_hba_down_post_s4()
1118 lpfc_hba_down_post(struct lpfc_hba *phba) in lpfc_hba_down_post() argument
1120 return (*phba->lpfc_hba_down_post)(phba); in lpfc_hba_down_post()
1138 struct lpfc_hba *phba; in lpfc_hb_timeout() local
1142 phba = from_timer(phba, t, hb_tmofunc); in lpfc_hb_timeout()
1145 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1146 tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; in lpfc_hb_timeout()
1148 phba->pport->work_port_events |= WORKER_HB_TMO; in lpfc_hb_timeout()
1149 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1153 lpfc_worker_wake_up(phba); in lpfc_hb_timeout()
1172 struct lpfc_hba *phba; in lpfc_rrq_timeout() local
1175 phba = from_timer(phba, t, rrq_tmr); in lpfc_rrq_timeout()
1176 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1177 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1178 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1180 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1181 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1183 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1184 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1204 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1208 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1209 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_hb_mbox_cmpl()
1210 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1213 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1214 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && in lpfc_hb_mbox_cmpl()
1215 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1216 !(phba->pport->load_flag & FC_UNLOADING)) in lpfc_hb_mbox_cmpl()
1217 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1234 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_idle_stat_delay_work() local
1243 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_idle_stat_delay_work()
1246 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_idle_stat_delay_work()
1247 phba->pport->fc_flag & FC_OFFLINE_MODE || in lpfc_idle_stat_delay_work()
1248 phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_idle_stat_delay_work()
1252 hdwq = &phba->sli4_hba.hdwq[phba->sli4_hba.cpu_map[i].hdwq]; in lpfc_idle_stat_delay_work()
1259 idle_stat = &phba->sli4_hba.idle_stat[i]; in lpfc_idle_stat_delay_work()
1289 schedule_delayed_work(&phba->idle_stat_delay_work, in lpfc_idle_stat_delay_work()
1296 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_hb_eq_delay_work() local
1304 if (!phba->cfg_auto_imax || phba->pport->load_flag & FC_UNLOADING) in lpfc_hb_eq_delay_work()
1307 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_hb_eq_delay_work()
1308 phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_hb_eq_delay_work()
1311 ena_delay = kcalloc(phba->sli4_hba.num_possible_cpu, sizeof(*ena_delay), in lpfc_hb_eq_delay_work()
1316 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hb_eq_delay_work()
1318 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_hb_eq_delay_work()
1328 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_hb_eq_delay_work()
1341 eqi_new = per_cpu_ptr(phba->sli4_hba.eq_info, in lpfc_hb_eq_delay_work()
1347 lpfc_modify_hba_eq_delay(phba, eq->hdwq, 1, in lpfc_hb_eq_delay_work()
1355 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_hb_eq_delay_work()
1366 static void lpfc_hb_mxp_handler(struct lpfc_hba *phba) in lpfc_hb_mxp_handler() argument
1371 hwq_count = phba->cfg_hdw_queue; in lpfc_hb_mxp_handler()
1374 lpfc_adjust_pvt_pool_count(phba, i); in lpfc_hb_mxp_handler()
1377 lpfc_adjust_high_watermark(phba, i); in lpfc_hb_mxp_handler()
1381 lpfc_snapshot_mxp(phba, i); in lpfc_hb_mxp_handler()
1395 lpfc_issue_hb_mbox(struct lpfc_hba *phba) in lpfc_issue_hb_mbox() argument
1401 if (phba->hba_flag & HBA_HBEAT_INP) in lpfc_issue_hb_mbox()
1404 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_issue_hb_mbox()
1408 lpfc_heart_beat(phba, pmboxq); in lpfc_issue_hb_mbox()
1410 pmboxq->vport = phba->pport; in lpfc_issue_hb_mbox()
1411 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); in lpfc_issue_hb_mbox()
1414 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_hb_mbox()
1417 phba->hba_flag |= HBA_HBEAT_INP; in lpfc_issue_hb_mbox()
1433 lpfc_issue_hb_tmo(struct lpfc_hba *phba) in lpfc_issue_hb_tmo() argument
1435 if (phba->cfg_enable_hba_heartbeat) in lpfc_issue_hb_tmo()
1437 phba->hba_flag |= HBA_HBEAT_TMO; in lpfc_issue_hb_tmo()
1457 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1463 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1466 if (phba->cfg_xri_rebalancing) { in lpfc_hb_timeout_handler()
1468 lpfc_hb_mxp_handler(phba); in lpfc_hb_timeout_handler()
1471 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1473 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_hb_timeout_handler()
1477 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1479 if ((phba->link_state == LPFC_HBA_ERROR) || in lpfc_hb_timeout_handler()
1480 (phba->pport->load_flag & FC_UNLOADING) || in lpfc_hb_timeout_handler()
1481 (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_hb_timeout_handler()
1484 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1485 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1486 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1487 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1488 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1489 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1490 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1495 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1499 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1502 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1504 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1505 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1508 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1509 if (phba->hba_flag & HBA_HBEAT_INP) in lpfc_hb_timeout_handler()
1515 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1518 if (phba->hba_flag & HBA_HBEAT_INP) { in lpfc_hb_timeout_handler()
1524 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1528 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1534 retval = lpfc_issue_hb_mbox(phba); in lpfc_hb_timeout_handler()
1539 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1540 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1541 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1542 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1546 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1548 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1555 if (phba->hba_flag & HBA_HBEAT_TMO) { in lpfc_hb_timeout_handler()
1556 retval = lpfc_issue_hb_mbox(phba); in lpfc_hb_timeout_handler()
1566 mod_timer(&phba->hb_tmofunc, jiffies + msecs_to_jiffies(tmo)); in lpfc_hb_timeout_handler()
1577 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1579 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1581 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1583 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1584 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1586 lpfc_offline(phba); in lpfc_offline_eratt()
1587 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1588 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1589 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1590 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1591 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1592 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1593 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1594 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1606 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1608 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1609 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1610 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1612 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1613 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_offline_eratt()
1614 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1615 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1616 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1629 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1631 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1632 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1637 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1638 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1639 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1640 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1644 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_deferred_eratt()
1647 phba->work_hs, phba->work_status[0], in lpfc_handle_deferred_eratt()
1648 phba->work_status[1]); in lpfc_handle_deferred_eratt()
1650 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1652 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1660 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1666 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1667 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1670 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1672 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1673 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1677 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_handle_deferred_eratt()
1678 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1688 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_deferred_eratt()
1689 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1691 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1692 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1693 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1694 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1695 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1699 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1706 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1724 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1726 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1727 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1736 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1737 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1738 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_eratt_s3()
1739 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1744 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1748 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1750 if (phba->hba_flag & DEFER_ERATT) in lpfc_handle_eratt_s3()
1751 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1753 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1754 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1756 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1759 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1760 phba->work_status[1]); in lpfc_handle_eratt_s3()
1761 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1763 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1766 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1767 phba->work_status[1]); in lpfc_handle_eratt_s3()
1769 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1771 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1779 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1785 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1786 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1787 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1788 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1789 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1792 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1793 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1794 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1799 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1803 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1804 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1806 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1813 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1814 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1815 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1816 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1823 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s3()
1826 phba->work_hs, in lpfc_handle_eratt_s3()
1827 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1835 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1852 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1859 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_port_sta_fn_reset()
1865 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1872 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_port_sta_fn_reset()
1881 spin_lock_irq(&phba->hbalock); in lpfc_sli4_port_sta_fn_reset()
1882 phba->sli.sli_flag &= ~LPFC_SLI_ACTIVE; in lpfc_sli4_port_sta_fn_reset()
1883 if (phba->sli.mbox_active) { in lpfc_sli4_port_sta_fn_reset()
1884 mboxq = phba->sli.mbox_active; in lpfc_sli4_port_sta_fn_reset()
1886 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_port_sta_fn_reset()
1887 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_port_sta_fn_reset()
1888 phba->sli.mbox_active = NULL; in lpfc_sli4_port_sta_fn_reset()
1890 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_port_sta_fn_reset()
1893 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1894 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_port_sta_fn_reset()
1895 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1897 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1898 rc = lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1900 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1905 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1907 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_port_sta_fn_reset()
1911 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1912 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1914 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1927 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1929 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
1945 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s4()
1946 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1948 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1953 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_handle_eratt_s4()
1957 phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_handle_eratt_s4()
1960 phba->sli4_hba.u.if_type0.UEMASKLOregaddr, in lpfc_handle_eratt_s4()
1965 if (!(phba->hba_flag & HBA_RECOVERABLE_UE)) { in lpfc_handle_eratt_s4()
1966 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1969 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1972 for (i = 0; i < phba->sli4_hba.ue_to_sr / 1000; i++) { in lpfc_handle_eratt_s4()
1973 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
1986 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
1995 if (!lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
2000 rc = lpfc_sli4_port_sta_fn_reset(phba, in lpfc_handle_eratt_s4()
2004 lpfc_printf_log(phba, KERN_ERR, in lpfc_handle_eratt_s4()
2011 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2014 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
2020 phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_handle_eratt_s4()
2024 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2026 readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); in lpfc_handle_eratt_s4()
2027 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2030 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
2031 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
2033 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2038 phba->sfp_alarm |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_handle_eratt_s4()
2043 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
2050 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
2051 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
2052 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
2053 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
2058 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2064 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2068 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2072 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
2076 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
2087 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_eratt_s4()
2089 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
2095 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_handle_eratt_s4()
2098 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s4()
2119 lpfc_handle_eratt(struct lpfc_hba *phba) in lpfc_handle_eratt() argument
2121 (*phba->lpfc_handle_eratt)(phba); in lpfc_handle_eratt()
2132 lpfc_handle_latt(struct lpfc_hba *phba) in lpfc_handle_latt() argument
2134 struct lpfc_vport *vport = phba->pport; in lpfc_handle_latt()
2135 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_latt()
2141 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_handle_latt()
2153 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_handle_latt()
2160 lpfc_els_flush_all_cmd(phba); in lpfc_handle_latt()
2163 lpfc_read_topology(phba, pmb, mp); in lpfc_handle_latt()
2167 phba->sli.sli3_ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2168 rc = lpfc_sli_issue_mbox (phba, pmb, MBX_NOWAIT); in lpfc_handle_latt()
2175 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2176 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2177 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2178 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2183 phba->sli.sli3_ring[LPFC_ELS_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2184 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_handle_latt()
2188 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_handle_latt()
2191 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2193 control = readl(phba->HCregaddr); in lpfc_handle_latt()
2195 writel(control, phba->HCregaddr); in lpfc_handle_latt()
2196 readl(phba->HCregaddr); /* flush */ in lpfc_handle_latt()
2199 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2200 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2201 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2202 lpfc_linkdown(phba); in lpfc_handle_latt()
2203 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_latt()
2205 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_handle_latt()
2226 lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) in lpfc_parse_vpd() argument
2238 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_parse_vpd()
2272 phba->SerialNumber[j++] = vpd[index++]; in lpfc_parse_vpd()
2276 phba->SerialNumber[j] = 0; in lpfc_parse_vpd()
2280 phba->vpd_flag |= VPD_MODEL_DESC; in lpfc_parse_vpd()
2287 phba->ModelDesc[j++] = vpd[index++]; in lpfc_parse_vpd()
2291 phba->ModelDesc[j] = 0; in lpfc_parse_vpd()
2295 phba->vpd_flag |= VPD_MODEL_NAME; in lpfc_parse_vpd()
2302 phba->ModelName[j++] = vpd[index++]; in lpfc_parse_vpd()
2306 phba->ModelName[j] = 0; in lpfc_parse_vpd()
2310 phba->vpd_flag |= VPD_PROGRAM_TYPE; in lpfc_parse_vpd()
2317 phba->ProgramType[j++] = vpd[index++]; in lpfc_parse_vpd()
2321 phba->ProgramType[j] = 0; in lpfc_parse_vpd()
2325 phba->vpd_flag |= VPD_PORT; in lpfc_parse_vpd()
2332 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_parse_vpd()
2333 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
2338 phba->Port[j++] = vpd[index++]; in lpfc_parse_vpd()
2342 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_parse_vpd()
2343 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
2345 phba->Port[j] = 0; in lpfc_parse_vpd()
2383 lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_hba_model_desc() argument
2386 uint16_t dev_id = phba->pcidev->device; in lpfc_get_hba_model_desc()
2400 if (phba->lmt & LMT_64Gb) in lpfc_get_hba_model_desc()
2402 else if (phba->lmt & LMT_32Gb) in lpfc_get_hba_model_desc()
2404 else if (phba->lmt & LMT_16Gb) in lpfc_get_hba_model_desc()
2406 else if (phba->lmt & LMT_10Gb) in lpfc_get_hba_model_desc()
2408 else if (phba->lmt & LMT_8Gb) in lpfc_get_hba_model_desc()
2410 else if (phba->lmt & LMT_4Gb) in lpfc_get_hba_model_desc()
2412 else if (phba->lmt & LMT_2Gb) in lpfc_get_hba_model_desc()
2414 else if (phba->lmt & LMT_1Gb) in lpfc_get_hba_model_desc()
2419 vp = &phba->vpd; in lpfc_get_hba_model_desc()
2628 phba->Port); in lpfc_get_hba_model_desc()
2654 lpfc_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt) in lpfc_post_buffer() argument
2665 iocb = lpfc_sli_get_iocbq(phba); in lpfc_post_buffer()
2676 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp1->phys); in lpfc_post_buffer()
2679 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2689 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, in lpfc_post_buffer()
2693 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2695 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2721 if (lpfc_sli_issue_iocb(phba, pring->ringno, iocb, 0) == in lpfc_post_buffer()
2723 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2727 lpfc_mbuf_free(phba, mp2->virt, mp2->phys); in lpfc_post_buffer()
2731 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2735 lpfc_sli_ringpostbuf_put(phba, pring, mp1); in lpfc_post_buffer()
2737 lpfc_sli_ringpostbuf_put(phba, pring, mp2); in lpfc_post_buffer()
2755 lpfc_post_rcv_buf(struct lpfc_hba *phba) in lpfc_post_rcv_buf() argument
2757 struct lpfc_sli *psli = &phba->sli; in lpfc_post_rcv_buf()
2760 lpfc_post_buffer(phba, &psli->sli3_ring[LPFC_ELS_RING], LPFC_BUF_RING0); in lpfc_post_rcv_buf()
2866 lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) in lpfc_hba_init() argument
2870 uint32_t *pwwnn = (uint32_t *) phba->wwnn; in lpfc_hba_init()
2880 lpfc_challenge_key(phba->RandomData + t, HashWorking + t); in lpfc_hba_init()
2899 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup() local
2903 if (phba->link_state > LPFC_LINK_DOWN) in lpfc_cleanup()
2907 if (lpfc_is_vmid_enabled(phba)) in lpfc_cleanup()
2991 __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in __lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2994 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2997 del_timer(&phba->fcf.redisc_wait); in __lpfc_sli4_stop_fcf_redisc_wait_timer()
3010 lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in lpfc_sli4_stop_fcf_redisc_wait_timer() argument
3012 spin_lock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3013 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_stop_fcf_redisc_wait_timer()
3015 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3018 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3020 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3021 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
3033 lpfc_cmf_stop(struct lpfc_hba *phba) in lpfc_cmf_stop() argument
3039 if (!phba->sli4_hba.pc_sli4_params.cmf) in lpfc_cmf_stop()
3042 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_stop()
3046 hrtimer_cancel(&phba->cmf_timer); in lpfc_cmf_stop()
3049 atomic_set(&phba->cmf_busy, 0); in lpfc_cmf_stop()
3051 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_stop()
3057 atomic_set(&phba->cmf_bw_wait, 0); in lpfc_cmf_stop()
3060 queue_work(phba->wq, &phba->unblock_request_work); in lpfc_cmf_stop()
3064 lpfc_get_max_line_rate(struct lpfc_hba *phba) in lpfc_get_max_line_rate() argument
3066 uint64_t rate = lpfc_sli_port_speed_get(phba); in lpfc_get_max_line_rate()
3072 lpfc_cmf_signal_init(struct lpfc_hba *phba) in lpfc_cmf_signal_init() argument
3074 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_signal_init()
3078 phba->cmf_interval_rate = LPFC_CMF_INTERVAL; in lpfc_cmf_signal_init()
3079 phba->cmf_max_line_rate = lpfc_get_max_line_rate(phba); in lpfc_cmf_signal_init()
3080 phba->cmf_link_byte_count = div_u64(phba->cmf_max_line_rate * in lpfc_cmf_signal_init()
3081 phba->cmf_interval_rate, 1000); in lpfc_cmf_signal_init()
3082 phba->cmf_max_bytes_per_interval = phba->cmf_link_byte_count; in lpfc_cmf_signal_init()
3085 lpfc_issue_cmf_sync_wqe(phba, 0, 0); in lpfc_cmf_signal_init()
3096 lpfc_cmf_start(struct lpfc_hba *phba) in lpfc_cmf_start() argument
3102 if (!phba->sli4_hba.pc_sli4_params.cmf || in lpfc_cmf_start()
3103 phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_cmf_start()
3107 lpfc_init_congestion_buf(phba); in lpfc_cmf_start()
3109 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_cmf_start()
3110 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_cmf_start()
3111 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_cmf_start()
3112 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_cmf_start()
3114 atomic_set(&phba->cmf_busy, 0); in lpfc_cmf_start()
3116 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_start()
3122 phba->cmf_latency.tv_sec = 0; in lpfc_cmf_start()
3123 phba->cmf_latency.tv_nsec = 0; in lpfc_cmf_start()
3125 lpfc_cmf_signal_init(phba); in lpfc_cmf_start()
3127 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_start()
3130 phba->cmf_timer_cnt = 0; in lpfc_cmf_start()
3131 hrtimer_start(&phba->cmf_timer, in lpfc_cmf_start()
3135 ktime_get_real_ts64(&phba->cmf_latency); in lpfc_cmf_start()
3137 atomic_set(&phba->cmf_bw_wait, 0); in lpfc_cmf_start()
3138 atomic_set(&phba->cmf_stop_io, 0); in lpfc_cmf_start()
3149 lpfc_stop_hba_timers(struct lpfc_hba *phba) in lpfc_stop_hba_timers() argument
3151 if (phba->pport) in lpfc_stop_hba_timers()
3152 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
3153 cancel_delayed_work_sync(&phba->eq_delay_work); in lpfc_stop_hba_timers()
3154 cancel_delayed_work_sync(&phba->idle_stat_delay_work); in lpfc_stop_hba_timers()
3155 del_timer_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
3156 del_timer_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
3157 del_timer_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
3158 del_timer_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
3159 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
3160 del_timer_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
3161 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_stop_hba_timers()
3163 phba->hba_flag &= ~(HBA_HBEAT_INP | HBA_HBEAT_TMO); in lpfc_stop_hba_timers()
3165 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
3168 del_timer_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
3172 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
3175 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_stop_hba_timers()
3177 phba->pci_dev_grp); in lpfc_stop_hba_timers()
3195 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
3201 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3202 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
3203 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3207 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3208 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3209 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
3213 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
3214 phba->sli.mbox_active) * 1000) + jiffies; in lpfc_block_mgmt_io()
3216 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3219 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3223 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_block_mgmt_io()
3226 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
3241 lpfc_sli4_node_prep(struct lpfc_hba *phba) in lpfc_sli4_node_prep() argument
3247 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_prep()
3250 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_prep()
3254 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_sli4_node_prep()
3261 rpi = lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_prep()
3275 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_prep()
3285 static void lpfc_create_expedite_pool(struct lpfc_hba *phba) in lpfc_create_expedite_pool() argument
3293 epd_pool = &phba->epd_pool; in lpfc_create_expedite_pool()
3294 qp = &phba->sli4_hba.hdwq[0]; in lpfc_create_expedite_pool()
3320 static void lpfc_destroy_expedite_pool(struct lpfc_hba *phba) in lpfc_destroy_expedite_pool() argument
3328 epd_pool = &phba->epd_pool; in lpfc_destroy_expedite_pool()
3329 qp = &phba->sli4_hba.hdwq[0]; in lpfc_destroy_expedite_pool()
3353 void lpfc_create_multixri_pools(struct lpfc_hba *phba) in lpfc_create_multixri_pools() argument
3366 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3368 phba->cfg_hdw_queue, phba->sli4_hba.num_present_cpu, in lpfc_create_multixri_pools()
3369 phba->sli4_hba.io_xri_cnt); in lpfc_create_multixri_pools()
3371 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3372 lpfc_create_expedite_pool(phba); in lpfc_create_multixri_pools()
3374 hwq_count = phba->cfg_hdw_queue; in lpfc_create_multixri_pools()
3375 count_per_hwq = phba->sli4_hba.io_xri_cnt / hwq_count; in lpfc_create_multixri_pools()
3381 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3385 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3386 lpfc_destroy_expedite_pool(phba); in lpfc_create_multixri_pools()
3390 qp = &phba->sli4_hba.hdwq[j]; in lpfc_create_multixri_pools()
3394 phba->cfg_xri_rebalancing = 0; in lpfc_create_multixri_pools()
3398 qp = &phba->sli4_hba.hdwq[i]; in lpfc_create_multixri_pools()
3416 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3440 static void lpfc_destroy_multixri_pools(struct lpfc_hba *phba) in lpfc_destroy_multixri_pools() argument
3452 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_destroy_multixri_pools()
3453 lpfc_destroy_expedite_pool(phba); in lpfc_destroy_multixri_pools()
3455 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_destroy_multixri_pools()
3456 lpfc_sli_flush_io_rings(phba); in lpfc_destroy_multixri_pools()
3458 hwq_count = phba->cfg_hdw_queue; in lpfc_destroy_multixri_pools()
3461 qp = &phba->sli4_hba.hdwq[i]; in lpfc_destroy_multixri_pools()
3474 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3495 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3530 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
3537 if (!phba) in lpfc_online()
3539 vport = phba->pport; in lpfc_online()
3544 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
3547 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
3549 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3550 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
3551 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3554 spin_lock_irq(&phba->hbalock); in lpfc_online()
3555 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
3557 spin_unlock_irq(&phba->hbalock); in lpfc_online()
3562 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_online()
3563 !phba->nvmet_support) { in lpfc_online()
3564 error = lpfc_nvme_create_localport(phba->pport); in lpfc_online()
3566 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_online()
3571 lpfc_sli_queue_init(phba); in lpfc_online()
3572 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
3573 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3578 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
3580 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
3585 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
3587 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3597 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
3599 if (phba->cfg_xri_rebalancing) in lpfc_online()
3600 lpfc_create_multixri_pools(phba); in lpfc_online()
3602 lpfc_cpuhp_add(phba); in lpfc_online()
3604 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3620 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
3624 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3625 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
3626 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3639 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
3641 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
3650 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
3652 lpfc_linkdown(phba); in lpfc_offline_prep()
3655 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
3657 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
3682 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_offline_prep()
3689 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); in lpfc_offline_prep()
3712 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
3714 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
3716 if (phba->wq) in lpfc_offline_prep()
3717 flush_workqueue(phba->wq); in lpfc_offline_prep()
3729 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
3735 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3739 lpfc_stop_port(phba); in lpfc_offline()
3744 lpfc_nvmet_destroy_targetport(phba); in lpfc_offline()
3745 lpfc_nvme_destroy_localport(phba->pport); in lpfc_offline()
3747 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3749 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
3751 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3752 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3756 lpfc_sli_hba_down(phba); in lpfc_offline()
3757 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3758 phba->work_ha = 0; in lpfc_offline()
3759 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3760 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3762 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3769 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3773 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3774 __lpfc_cpuhp_remove(phba); in lpfc_offline()
3776 if (phba->cfg_xri_rebalancing) in lpfc_offline()
3777 lpfc_destroy_multixri_pools(phba); in lpfc_offline()
3789 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3793 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_scsi_free()
3796 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3800 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3801 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3804 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3807 phba->total_scsi_bufs--; in lpfc_scsi_free()
3809 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3811 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3812 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3815 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3818 phba->total_scsi_bufs--; in lpfc_scsi_free()
3820 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3821 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
3833 lpfc_io_free(struct lpfc_hba *phba) in lpfc_io_free() argument
3839 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_free()
3840 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_free()
3848 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
3850 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
3851 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3852 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3864 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
3866 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
3867 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3868 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3889 lpfc_sli4_els_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_els_sgl_update() argument
3899 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_els_sgl_update()
3901 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
3903 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_els_sgl_update()
3904 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3906 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
3913 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
3921 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_els_sgl_update()
3925 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
3937 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3939 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
3940 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3941 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
3943 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_els_sgl_update()
3944 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3946 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
3948 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3949 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, in lpfc_sli4_els_sgl_update()
3956 __lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_els_sgl_update()
3962 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
3963 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3965 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3968 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_els_sgl_update()
3974 &phba->sli4_hba.lpfc_els_sgl_list, list) { in lpfc_sli4_els_sgl_update()
3975 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_els_sgl_update()
3977 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_els_sgl_update()
3985 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_els_sgl_update()
3990 lpfc_free_els_sgl_list(phba); in lpfc_sli4_els_sgl_update()
4007 lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_nvmet_sgl_update() argument
4018 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_nvmet_sgl_update()
4021 nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4022 if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
4024 xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4025 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4027 phba->sli4_hba.nvmet_xri_cnt, nvmet_xri_cnt); in lpfc_sli4_nvmet_sgl_update()
4033 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4041 sglq_entry->virt = lpfc_nvmet_buf_alloc(phba, 0, in lpfc_sli4_nvmet_sgl_update()
4045 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4054 phba->cfg_sg_dma_buf_size); in lpfc_sli4_nvmet_sgl_update()
4058 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4059 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4061 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
4062 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4063 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4064 } else if (nvmet_xri_cnt < phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
4066 xri_cnt = phba->sli4_hba.nvmet_xri_cnt - nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4067 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4069 "%d to %d\n", phba->sli4_hba.nvmet_xri_cnt, in lpfc_sli4_nvmet_sgl_update()
4071 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4072 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4073 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, in lpfc_sli4_nvmet_sgl_update()
4080 lpfc_nvmet_buf_free(phba, sglq_entry->virt, in lpfc_sli4_nvmet_sgl_update()
4086 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
4087 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
4088 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
4090 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
4093 phba->sli4_hba.nvmet_xri_cnt = nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
4099 &phba->sli4_hba.lpfc_nvmet_sgl_list, list) { in lpfc_sli4_nvmet_sgl_update()
4100 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_nvmet_sgl_update()
4102 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_nvmet_sgl_update()
4110 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_nvmet_sgl_update()
4115 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_nvmet_sgl_update()
4120 lpfc_io_buf_flush(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_flush() argument
4129 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_flush()
4130 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_flush()
4182 lpfc_io_buf_replenish(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_replenish() argument
4188 qp = phba->sli4_hba.hdwq; in lpfc_io_buf_replenish()
4191 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_replenish()
4197 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_replenish()
4226 lpfc_sli4_io_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_io_sgl_update() argument
4239 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_io_sgl_update()
4240 io_xri_max = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_io_sgl_update()
4241 phba->sli4_hba.io_xri_max = io_xri_max; in lpfc_sli4_io_sgl_update()
4243 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_io_sgl_update()
4246 phba->sli4_hba.io_xri_cnt, in lpfc_sli4_io_sgl_update()
4247 phba->sli4_hba.io_xri_max); in lpfc_sli4_io_sgl_update()
4249 cnt = lpfc_io_buf_flush(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4251 if (phba->sli4_hba.io_xri_cnt > phba->sli4_hba.io_xri_max) { in lpfc_sli4_io_sgl_update()
4253 io_xri_cnt = phba->sli4_hba.io_xri_cnt - in lpfc_sli4_io_sgl_update()
4254 phba->sli4_hba.io_xri_max; in lpfc_sli4_io_sgl_update()
4260 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_sli4_io_sgl_update()
4266 phba->sli4_hba.io_xri_cnt -= io_xri_cnt; in lpfc_sli4_io_sgl_update()
4272 phba->sli4_hba.io_xri_cnt = cnt; in lpfc_sli4_io_sgl_update()
4275 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_io_sgl_update()
4277 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_io_sgl_update()
4285 lpfc_ncmd->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_io_sgl_update()
4287 cnt = lpfc_io_buf_replenish(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4291 lpfc_io_free(phba); in lpfc_sli4_io_sgl_update()
4310 lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) in lpfc_new_io_buf() argument
4320 phba->sli4_hba.io_xri_cnt = 0; in lpfc_new_io_buf()
4330 lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4338 if (phba->cfg_xpsgl && !phba->nvmet_support) { in lpfc_new_io_buf()
4345 if ((phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_new_io_buf()
4348 lpfc_printf_log(phba, KERN_ERR, in lpfc_new_io_buf()
4353 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4363 lxri = lpfc_sli4_next_xritag(phba); in lpfc_new_io_buf()
4365 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4373 iotag = lpfc_sli_next_iotag(phba, pwqeq); in lpfc_new_io_buf()
4375 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4378 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_new_io_buf()
4381 lpfc_sli4_free_xri(phba, lxri); in lpfc_new_io_buf()
4385 pwqeq->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_new_io_buf()
4396 phba->sli4_hba.io_xri_cnt++; in lpfc_new_io_buf()
4398 lpfc_printf_log(phba, KERN_INFO, LOG_NVME, in lpfc_new_io_buf()
4405 phba, &post_nblist, bcnt); in lpfc_new_io_buf()
4413 lpfc_get_wwpn(struct lpfc_hba *phba) in lpfc_get_wwpn() argument
4420 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_get_wwpn()
4426 lpfc_read_nv(phba, mboxq); in lpfc_get_wwpn()
4427 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_wwpn()
4429 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_get_wwpn()
4434 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4440 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4441 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_wwpn()
4459 lpfc_vmid_res_alloc(struct lpfc_hba *phba, struct lpfc_vport *vport) in lpfc_vmid_res_alloc() argument
4462 if (phba->sli_rev == LPFC_SLI_REV3) { in lpfc_vmid_res_alloc()
4463 phba->cfg_vmid_app_header = 0; in lpfc_vmid_res_alloc()
4464 phba->cfg_vmid_priority_tagging = 0; in lpfc_vmid_res_alloc()
4467 if (lpfc_is_vmid_enabled(phba)) { in lpfc_vmid_res_alloc()
4469 kcalloc(phba->cfg_max_vmid, sizeof(struct lpfc_vmid), in lpfc_vmid_res_alloc()
4477 vport->vmid_priority_tagging = phba->cfg_vmid_priority_tagging; in lpfc_vmid_res_alloc()
4479 phba->cfg_vmid_inactivity_timeout; in lpfc_vmid_res_alloc()
4480 vport->max_vmid = phba->cfg_max_vmid; in lpfc_vmid_res_alloc()
4513 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
4525 if (phba->sli_rev < LPFC_SLI_REV4 && in lpfc_create_port()
4526 dev == &phba->pcidev->dev) { in lpfc_create_port()
4528 lpfc_sli_brdrestart(phba); in lpfc_create_port()
4529 rc = lpfc_sli_chipset_init(phba); in lpfc_create_port()
4533 wwn = lpfc_get_wwpn(phba); in lpfc_create_port()
4538 lpfc_printf_log(phba, KERN_ERR, in lpfc_create_port()
4548 if (dev == &phba->pcidev->dev) { in lpfc_create_port()
4549 template = &phba->port_template; in lpfc_create_port()
4551 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_create_port()
4560 memcpy(&phba->vport_template, &lpfc_template, in lpfc_create_port()
4562 phba->vport_template.shost_attrs = lpfc_vport_attrs; in lpfc_create_port()
4563 phba->vport_template.eh_bus_reset_handler = NULL; in lpfc_create_port()
4564 phba->vport_template.eh_host_reset_handler = NULL; in lpfc_create_port()
4565 phba->vport_template.vendor_id = 0; in lpfc_create_port()
4568 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4569 template->sg_tablesize = phba->cfg_scsi_seg_cnt; in lpfc_create_port()
4570 phba->vport_template.sg_tablesize = in lpfc_create_port()
4571 phba->cfg_scsi_seg_cnt; in lpfc_create_port()
4573 template->sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_create_port()
4574 phba->vport_template.sg_tablesize = in lpfc_create_port()
4575 phba->cfg_sg_seg_cnt; in lpfc_create_port()
4584 template = &phba->vport_template; in lpfc_create_port()
4592 vport->phba = phba; in lpfc_create_port()
4599 vport->cfg_enable_fc4_type = phba->cfg_enable_fc4_type; in lpfc_create_port()
4607 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4608 if (!phba->cfg_fcp_mq_threshold || in lpfc_create_port()
4609 phba->cfg_fcp_mq_threshold > phba->cfg_hdw_queue) in lpfc_create_port()
4610 phba->cfg_fcp_mq_threshold = phba->cfg_hdw_queue; in lpfc_create_port()
4613 phba->cfg_fcp_mq_threshold); in lpfc_create_port()
4616 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
4618 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_create_port()
4621 shost->sg_tablesize = phba->cfg_scsi_seg_cnt; in lpfc_create_port()
4633 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
4634 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
4642 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_create_port()
4646 phba->cfg_scsi_seg_cnt, phba->cfg_sg_seg_cnt); in lpfc_create_port()
4649 rc = lpfc_vmid_res_alloc(phba, vport); in lpfc_create_port()
4665 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_create_port()
4666 lpfc_setup_bg(phba, shost); in lpfc_create_port()
4668 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
4672 spin_lock_irq(&phba->port_list_lock); in lpfc_create_port()
4673 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
4674 spin_unlock_irq(&phba->port_list_lock); in lpfc_create_port()
4696 struct lpfc_hba *phba = vport->phba; in destroy_port() local
4702 spin_lock_irq(&phba->port_list_lock); in destroy_port()
4704 spin_unlock_irq(&phba->port_list_lock); in destroy_port()
4747 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
4757 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4764 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
4765 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4778 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
4791 struct lpfc_hba *phba = vport->phba; in lpfc_host_supported_speeds_set() local
4798 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_host_supported_speeds_set()
4801 if (phba->lmt & LMT_256Gb) in lpfc_host_supported_speeds_set()
4803 if (phba->lmt & LMT_128Gb) in lpfc_host_supported_speeds_set()
4805 if (phba->lmt & LMT_64Gb) in lpfc_host_supported_speeds_set()
4807 if (phba->lmt & LMT_32Gb) in lpfc_host_supported_speeds_set()
4809 if (phba->lmt & LMT_16Gb) in lpfc_host_supported_speeds_set()
4811 if (phba->lmt & LMT_10Gb) in lpfc_host_supported_speeds_set()
4813 if (phba->lmt & LMT_8Gb) in lpfc_host_supported_speeds_set()
4815 if (phba->lmt & LMT_4Gb) in lpfc_host_supported_speeds_set()
4817 if (phba->lmt & LMT_2Gb) in lpfc_host_supported_speeds_set()
4819 if (phba->lmt & LMT_1Gb) in lpfc_host_supported_speeds_set()
4833 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
4864 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
4879 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
4882 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
4883 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
4885 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
4886 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
4889 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
4890 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
4902 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
4905 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
4906 if (phba->pport) in lpfc_stop_port_s4()
4907 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
4908 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
4919 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
4921 phba->lpfc_stop_port(phba); in lpfc_stop_port()
4923 if (phba->wq) in lpfc_stop_port()
4924 flush_workqueue(phba->wq); in lpfc_stop_port()
4934 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
4939 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
4940 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
4942 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
4944 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
4945 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
4961 struct lpfc_hba *phba = from_timer(phba, t, fcf.redisc_wait); in lpfc_sli4_fcf_redisc_wait_tmo() local
4964 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4965 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
4966 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4970 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
4972 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
4973 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4974 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
4977 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
4992 struct lpfc_hba *phba = from_timer(phba, t, inactive_vmid_poll); in lpfc_vmid_poll() local
4996 if (phba->pport->vmid_priority_tagging) { in lpfc_vmid_poll()
4998 phba->pport->work_port_events |= WORKER_CHECK_VMID_ISSUE_QFPA; in lpfc_vmid_poll()
5002 if (phba->pport->vmid_inactivity_timeout || in lpfc_vmid_poll()
5003 phba->pport->load_flag & FC_DEREGISTER_ALL_APP_ID) { in lpfc_vmid_poll()
5005 phba->pport->work_port_events |= WORKER_CHECK_INACTIVE_VMID; in lpfc_vmid_poll()
5009 lpfc_worker_wake_up(phba); in lpfc_vmid_poll()
5012 mod_timer(&phba->inactive_vmid_poll, jiffies + msecs_to_jiffies(1000 * in lpfc_vmid_poll()
5024 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
5034 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_fault()
5052 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
5070 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_parse_latt_type()
5088 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
5092 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
5095 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_sli_port_speed_get()
5096 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
5119 if (phba->sli4_hba.link_state.logical_speed) in lpfc_sli_port_speed_get()
5121 phba->sli4_hba.link_state.logical_speed; in lpfc_sli_port_speed_get()
5123 link_speed = phba->sli4_hba.link_state.speed; in lpfc_sli_port_speed_get()
5140 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
5232 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
5242 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
5245 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
5246 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
5248 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5254 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5258 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_link_evt()
5260 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_link_evt()
5266 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
5269 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
5272 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
5275 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_link_evt()
5277 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
5280 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
5281 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
5283 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
5285 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
5287 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
5289 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
5291 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
5293 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
5296 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
5300 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
5301 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
5302 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
5303 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
5304 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
5305 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
5306 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
5311 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_async_link_evt()
5312 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
5327 lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
5345 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
5352 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_link_evt()
5367 lpfc_async_link_speed_to_read_top(struct lpfc_hba *phba, uint8_t speed_code) in lpfc_async_link_speed_to_read_top() argument
5408 lpfc_cgn_dump_rxmonitor(struct lpfc_hba *phba) in lpfc_cgn_dump_rxmonitor() argument
5413 head = atomic_read(&phba->rxtable_idx_head); in lpfc_cgn_dump_rxmonitor()
5414 tail = atomic_read(&phba->rxtable_idx_tail); in lpfc_cgn_dump_rxmonitor()
5415 if (!phba->rxtable || head == tail) { in lpfc_cgn_dump_rxmonitor()
5416 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, in lpfc_cgn_dump_rxmonitor()
5429 entry = &phba->rxtable[start]; in lpfc_cgn_dump_rxmonitor()
5430 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_dump_rxmonitor()
5453 lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag) in lpfc_cgn_update_stat() argument
5462 if (!phba->cgn_i) in lpfc_cgn_update_stat()
5464 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_update_stat()
5518 if (phba->cgn_fpin_frequency && in lpfc_cgn_update_stat()
5519 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { in lpfc_cgn_update_stat()
5520 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; in lpfc_cgn_update_stat()
5539 lpfc_cgn_save_evt_cnt(struct lpfc_hba *phba) in lpfc_cgn_save_evt_cnt() argument
5555 if (!phba->cgn_i) in lpfc_cgn_save_evt_cnt()
5557 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_save_evt_cnt()
5559 if (time_before(jiffies, phba->cgn_evt_timestamp)) in lpfc_cgn_save_evt_cnt()
5561 phba->cgn_evt_timestamp = jiffies + in lpfc_cgn_save_evt_cnt()
5563 phba->cgn_evt_minute++; in lpfc_cgn_save_evt_cnt()
5570 if (phba->cgn_fpin_frequency && in lpfc_cgn_save_evt_cnt()
5571 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { in lpfc_cgn_save_evt_cnt()
5572 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; in lpfc_cgn_save_evt_cnt()
5577 lvalue = atomic_read(&phba->cgn_latency_evt_cnt); in lpfc_cgn_save_evt_cnt()
5578 latsum = atomic64_read(&phba->cgn_latency_evt); in lpfc_cgn_save_evt_cnt()
5579 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_cgn_save_evt_cnt()
5580 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_cgn_save_evt_cnt()
5586 bps = div_u64(phba->rx_block_cnt, LPFC_SEC_MIN) * 512; in lpfc_cgn_save_evt_cnt()
5587 phba->rx_block_cnt = 0; in lpfc_cgn_save_evt_cnt()
5592 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_save_evt_cnt()
5593 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_cgn_save_evt_cnt()
5594 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_cgn_save_evt_cnt()
5595 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_cgn_save_evt_cnt()
5598 value = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_cgn_save_evt_cnt()
5614 dvalue = atomic_read(&phba->cgn_driver_evt_cnt); in lpfc_cgn_save_evt_cnt()
5615 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_cgn_save_evt_cnt()
5619 if ((phba->cgn_reg_fpin & LPFC_CGN_FPIN_WARN) || in lpfc_cgn_save_evt_cnt()
5620 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_cgn_save_evt_cnt()
5621 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cgn_save_evt_cnt()
5622 wvalue = atomic_read(&phba->cgn_fabric_warn_cnt); in lpfc_cgn_save_evt_cnt()
5623 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_cgn_save_evt_cnt()
5627 if ((phba->cgn_reg_fpin & LPFC_CGN_FPIN_ALARM) || in lpfc_cgn_save_evt_cnt()
5628 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cgn_save_evt_cnt()
5629 avalue = atomic_read(&phba->cgn_fabric_alarm_cnt); in lpfc_cgn_save_evt_cnt()
5630 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_cgn_save_evt_cnt()
5659 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_save_evt_cnt()
5664 if ((phba->cgn_evt_minute % LPFC_MIN_HOUR) == 0) { in lpfc_cgn_save_evt_cnt()
5703 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_save_evt_cnt()
5710 if ((phba->cgn_evt_minute % LPFC_MIN_DAY) == 0) { in lpfc_cgn_save_evt_cnt()
5727 if ((phba->hba_flag & HBA_CGN_DAY_WRAP) && index == 0) { in lpfc_cgn_save_evt_cnt()
5728 time64_to_tm(phba->cgn_daily_ts.tv_sec, 0, &broken); in lpfc_cgn_save_evt_cnt()
5738 (phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_save_evt_cnt()
5775 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_save_evt_cnt()
5785 phba->hba_flag |= HBA_CGN_DAY_WRAP; in lpfc_cgn_save_evt_cnt()
5786 ktime_get_real_ts64(&phba->cgn_daily_ts); in lpfc_cgn_save_evt_cnt()
5791 value = phba->cgn_fpin_frequency; in lpfc_cgn_save_evt_cnt()
5792 if (phba->cgn_reg_fpin & LPFC_CGN_FPIN_WARN) in lpfc_cgn_save_evt_cnt()
5794 if (phba->cgn_reg_fpin & LPFC_CGN_FPIN_ALARM) in lpfc_cgn_save_evt_cnt()
5800 value = phba->cgn_sig_freq; in lpfc_cgn_save_evt_cnt()
5802 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_cgn_save_evt_cnt()
5803 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cgn_save_evt_cnt()
5805 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) in lpfc_cgn_save_evt_cnt()
5822 lpfc_calc_cmf_latency(struct lpfc_hba *phba) in lpfc_calc_cmf_latency() argument
5832 if (cmpl_time.tv_sec == phba->cmf_latency.tv_sec) { in lpfc_calc_cmf_latency()
5833 msec = (cmpl_time.tv_nsec - phba->cmf_latency.tv_nsec) / in lpfc_calc_cmf_latency()
5836 if (cmpl_time.tv_nsec >= phba->cmf_latency.tv_nsec) { in lpfc_calc_cmf_latency()
5838 phba->cmf_latency.tv_sec) * MSEC_PER_SEC; in lpfc_calc_cmf_latency()
5840 phba->cmf_latency.tv_nsec) / NSEC_PER_MSEC); in lpfc_calc_cmf_latency()
5842 msec = (cmpl_time.tv_sec - phba->cmf_latency.tv_sec - in lpfc_calc_cmf_latency()
5844 msec += (((NSEC_PER_SEC - phba->cmf_latency.tv_nsec) + in lpfc_calc_cmf_latency()
5859 struct lpfc_hba *phba = container_of(timer, struct lpfc_hba, in lpfc_cmf_timer() local
5872 if (phba->cmf_active_mode == LPFC_CFG_OFF || in lpfc_cmf_timer()
5873 !phba->cmf_latency.tv_sec) { in lpfc_cmf_timer()
5874 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cmf_timer()
5876 phba->cmf_active_mode, in lpfc_cmf_timer()
5877 (uint64_t)phba->cmf_latency.tv_sec); in lpfc_cmf_timer()
5884 if (!phba->pport) in lpfc_cmf_timer()
5890 atomic_set(&phba->cmf_stop_io, 1); in lpfc_cmf_timer()
5897 ms = lpfc_calc_cmf_latency(phba); in lpfc_cmf_timer()
5904 ktime_get_real_ts64(&phba->cmf_latency); in lpfc_cmf_timer()
5906 phba->cmf_link_byte_count = in lpfc_cmf_timer()
5907 div_u64(phba->cmf_max_line_rate * LPFC_CMF_INTERVAL, 1000); in lpfc_cmf_timer()
5915 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_timer()
5927 if (phba->cmf_active_mode == LPFC_CFG_MANAGED && in lpfc_cmf_timer()
5928 phba->link_state != LPFC_LINK_DOWN && in lpfc_cmf_timer()
5929 phba->hba_flag & HBA_SETUP) { in lpfc_cmf_timer()
5930 mbpi = phba->cmf_last_sync_bw; in lpfc_cmf_timer()
5931 phba->cmf_last_sync_bw = 0; in lpfc_cmf_timer()
5932 lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total); in lpfc_cmf_timer()
5937 mbpi = phba->cmf_link_byte_count; in lpfc_cmf_timer()
5939 phba->cmf_timer_cnt++; in lpfc_cmf_timer()
5943 atomic_add(io_cnt, &phba->cgn_latency_evt_cnt); in lpfc_cmf_timer()
5944 atomic64_add(lat, &phba->cgn_latency_evt); in lpfc_cmf_timer()
5946 busy = atomic_xchg(&phba->cmf_busy, 0); in lpfc_cmf_timer()
5947 max_read = atomic_xchg(&phba->rx_max_read_cnt, 0); in lpfc_cmf_timer()
5951 if (mbpi > phba->cmf_link_byte_count || in lpfc_cmf_timer()
5952 phba->cmf_active_mode == LPFC_CFG_MONITOR) in lpfc_cmf_timer()
5953 mbpi = phba->cmf_link_byte_count; in lpfc_cmf_timer()
5958 if (mbpi != phba->cmf_max_bytes_per_interval) in lpfc_cmf_timer()
5959 phba->cmf_max_bytes_per_interval = mbpi; in lpfc_cmf_timer()
5963 if (phba->rxtable) { in lpfc_cmf_timer()
5964 head = atomic_xchg(&phba->rxtable_idx_head, in lpfc_cmf_timer()
5966 entry = &phba->rxtable[head]; in lpfc_cmf_timer()
5970 entry->cmf_info = phba->cmf_active_info; in lpfc_cmf_timer()
5981 if (phba->cmf_active_mode == LPFC_CFG_MANAGED) in lpfc_cmf_timer()
5982 entry->timer_utilization = phba->cmf_last_ts; in lpfc_cmf_timer()
5986 phba->cmf_last_ts = 0; in lpfc_cmf_timer()
5990 tail = atomic_read(&phba->rxtable_idx_tail); in lpfc_cmf_timer()
5993 atomic_set(&phba->rxtable_idx_tail, tail); in lpfc_cmf_timer()
5995 atomic_set(&phba->rxtable_idx_head, head); in lpfc_cmf_timer()
5998 if (phba->cmf_active_mode == LPFC_CFG_MONITOR) { in lpfc_cmf_timer()
6003 atomic_inc(&phba->cgn_driver_evt_cnt); in lpfc_cmf_timer()
6005 phba->rx_block_cnt += div_u64(rcv, 512); /* save 512 byte block cnt */ in lpfc_cmf_timer()
6008 lpfc_cgn_save_evt_cnt(phba); in lpfc_cmf_timer()
6015 phba->cgn_evt_timestamp)) { in lpfc_cmf_timer()
6016 timer_interval = jiffies_to_msecs(phba->cgn_evt_timestamp - in lpfc_cmf_timer()
6024 phba->cmf_link_byte_count = div_u64(phba->cmf_max_line_rate * in lpfc_cmf_timer()
6026 if (phba->cmf_active_mode == LPFC_CFG_MONITOR) in lpfc_cmf_timer()
6027 phba->cmf_max_bytes_per_interval = in lpfc_cmf_timer()
6028 phba->cmf_link_byte_count; in lpfc_cmf_timer()
6034 if (atomic_xchg(&phba->cmf_bw_wait, 0)) in lpfc_cmf_timer()
6035 queue_work(phba->wq, &phba->unblock_request_work); in lpfc_cmf_timer()
6038 atomic_set(&phba->cmf_stop_io, 0); in lpfc_cmf_timer()
6048 ((phba->trunk_link.link##__idx.state == LPFC_LINK_UP) ?\
6056 lpfc_update_trunk_link_status(struct lpfc_hba *phba, in lpfc_update_trunk_link_status() argument
6062 phba->sli4_hba.link_state.speed = in lpfc_update_trunk_link_status()
6063 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_update_trunk_link_status()
6066 phba->sli4_hba.link_state.logical_speed = in lpfc_update_trunk_link_status()
6069 phba->fc_linkspeed = in lpfc_update_trunk_link_status()
6071 phba, in lpfc_update_trunk_link_status()
6075 phba->trunk_link.link0.state = in lpfc_update_trunk_link_status()
6078 phba->trunk_link.link0.fault = port_fault & 0x1 ? err : 0; in lpfc_update_trunk_link_status()
6081 phba->trunk_link.link1.state = in lpfc_update_trunk_link_status()
6084 phba->trunk_link.link1.fault = port_fault & 0x2 ? err : 0; in lpfc_update_trunk_link_status()
6087 phba->trunk_link.link2.state = in lpfc_update_trunk_link_status()
6090 phba->trunk_link.link2.fault = port_fault & 0x4 ? err : 0; in lpfc_update_trunk_link_status()
6093 phba->trunk_link.link3.state = in lpfc_update_trunk_link_status()
6096 phba->trunk_link.link3.fault = port_fault & 0x8 ? err : 0; in lpfc_update_trunk_link_status()
6099 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
6103 phba->sli4_hba.link_state.speed, in lpfc_update_trunk_link_status()
6104 phba->sli4_hba.link_state.logical_speed, in lpfc_update_trunk_link_status()
6108 if (phba->cmf_active_mode != LPFC_CFG_OFF) in lpfc_update_trunk_link_status()
6109 lpfc_cmf_signal_init(phba); in lpfc_update_trunk_link_status()
6112 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_update_trunk_link_status()
6136 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
6146 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6154 lpfc_update_trunk_link_status(phba, acqe_fc); in lpfc_sli4_async_fc_evt()
6159 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
6160 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
6162 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
6163 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
6165 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
6167 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
6169 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
6171 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
6176 phba->sli4_hba.link_state.logical_speed = 0; in lpfc_sli4_async_fc_evt()
6177 else if (!phba->sli4_hba.conf_trunk) in lpfc_sli4_async_fc_evt()
6178 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
6181 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
6185 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
6186 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
6187 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
6188 phba->sli4_hba.link_state.type, in lpfc_sli4_async_fc_evt()
6189 phba->sli4_hba.link_state.number, in lpfc_sli4_async_fc_evt()
6190 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
6191 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_fc_evt()
6192 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
6194 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6200 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6204 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_fc_evt()
6206 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fc_evt()
6212 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
6215 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
6218 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
6221 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_fc_evt()
6223 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
6225 if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) { in lpfc_sli4_async_fc_evt()
6226 phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK); in lpfc_sli4_async_fc_evt()
6228 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
6230 phba->link_flag |= LS_MDS_LINK_DOWN; in lpfc_sli4_async_fc_evt()
6233 phba->link_flag |= LS_MDS_LOOPBACK; in lpfc_sli4_async_fc_evt()
6244 lpfc_sli4_parse_latt_fault(phba, (void *)acqe_fc); in lpfc_sli4_async_fc_evt()
6250 if (phba->sli4_hba.link_state.status == in lpfc_sli4_async_fc_evt()
6259 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_fc_evt()
6264 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
6272 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_fc_evt()
6283 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
6299 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6305 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
6315 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6319 phba->sfp_warning |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_sli4_async_sli_evt()
6320 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
6332 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6336 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
6348 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
6374 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_sli_evt()
6378 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_async_sli_evt()
6383 if (phba->sli4_hba.lnk_info.optic_state == status) in lpfc_sli4_async_sli_evt()
6423 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_async_sli_evt()
6425 phba->lmt = 0; in lpfc_sli4_async_sli_evt()
6426 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_sli_evt()
6431 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_sli_evt()
6433 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_sli_evt()
6439 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_sli_evt()
6441 phba->sli4_hba.lnk_info.optic_state = status; in lpfc_sli4_async_sli_evt()
6442 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
6446 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6453 lpfc_sli4_cgn_parm_chg_evt(phba); in lpfc_sli4_async_sli_evt()
6461 lpfc_log_msg(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6467 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
6473 if (phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_sli4_async_sli_evt()
6477 phba->cgn_acqe_cnt++; in lpfc_sli4_async_sli_evt()
6480 atomic64_add(cnt, &phba->cgn_acqe_stat.warn); in lpfc_sli4_async_sli_evt()
6481 atomic64_add(cgn_signal->alarm_cnt, &phba->cgn_acqe_stat.alarm); in lpfc_sli4_async_sli_evt()
6487 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { in lpfc_sli4_async_sli_evt()
6490 &phba->cgn_fabric_alarm_cnt); in lpfc_sli4_async_sli_evt()
6493 &phba->cgn_sync_alarm_cnt); in lpfc_sli4_async_sli_evt()
6497 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || in lpfc_sli4_async_sli_evt()
6498 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { in lpfc_sli4_async_sli_evt()
6500 atomic_add(cnt, &phba->cgn_fabric_warn_cnt); in lpfc_sli4_async_sli_evt()
6502 atomic_add(cnt, &phba->cgn_sync_warn_cnt); in lpfc_sli4_async_sli_evt()
6507 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
6529 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
6533 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
6534 if (!phba) in lpfc_sli4_perform_vport_cvl()
6547 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
6548 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
6551 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
6574 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
6579 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
6581 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
6583 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
6594 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
6605 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6606 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6611 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6617 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
6623 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
6629 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
6634 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
6638 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6639 if (phba->hba_flag & FCF_TS_INPROG) { in lpfc_sli4_async_fip_evt()
6640 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6644 if (phba->fcf.fcf_flag & (FCF_REDISC_EVT | FCF_REDISC_PEND)) { in lpfc_sli4_async_fip_evt()
6645 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6650 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
6651 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6654 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6657 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
6661 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
6664 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6670 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6677 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6678 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6686 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6687 if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && in lpfc_sli4_async_fip_evt()
6688 (phba->fcf.current_rec.fcf_indx != acqe_fip->index)) { in lpfc_sli4_async_fip_evt()
6689 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6691 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
6694 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6697 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
6706 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6708 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
6709 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6711 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
6715 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
6717 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
6722 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6723 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
6724 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6729 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
6732 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
6737 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
6741 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
6742 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_fip_evt()
6747 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
6754 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
6756 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
6765 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
6794 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6795 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
6796 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6800 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
6801 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6802 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
6806 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
6808 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
6813 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6814 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
6815 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
6820 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
6826 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
6830 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_fip_evt()
6845 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
6848 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
6849 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_async_dcbx_evt()
6864 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
6869 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
6870 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
6871 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
6872 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
6874 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
6877 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
6888 lpfc_sli4_async_cmstat_evt(struct lpfc_hba *phba) in lpfc_sli4_async_cmstat_evt() argument
6890 if (!phba->cgn_i) in lpfc_sli4_async_cmstat_evt()
6892 lpfc_init_congestion_stat(phba); in lpfc_sli4_async_cmstat_evt()
6904 lpfc_cgn_params_val(struct lpfc_hba *phba, struct lpfc_cgn_param *p_cfg_param) in lpfc_cgn_params_val() argument
6906 spin_lock_irq(&phba->hbalock); in lpfc_cgn_params_val()
6910 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, in lpfc_cgn_params_val()
6916 spin_unlock_irq(&phba->hbalock); in lpfc_cgn_params_val()
6933 lpfc_cgn_params_parse(struct lpfc_hba *phba, in lpfc_cgn_params_parse() argument
6943 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_cgn_params_parse()
6961 phba->cmf_active_mode); in lpfc_cgn_params_parse()
6963 oldmode = phba->cmf_active_mode; in lpfc_cgn_params_parse()
6968 lpfc_cgn_params_val(phba, p_cgn_param); in lpfc_cgn_params_parse()
6971 spin_lock_irq(&phba->hbalock); in lpfc_cgn_params_parse()
6972 memcpy(&phba->cgn_p, p_cgn_param, in lpfc_cgn_params_parse()
6976 if (phba->cgn_i) { in lpfc_cgn_params_parse()
6977 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cgn_params_parse()
6978 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_params_parse()
6979 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_cgn_params_parse()
6980 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_cgn_params_parse()
6981 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_cgn_params_parse()
6986 spin_unlock_irq(&phba->hbalock); in lpfc_cgn_params_parse()
6988 phba->cmf_active_mode = phba->cgn_p.cgn_param_mode; in lpfc_cgn_params_parse()
6992 if (phba->cgn_p.cgn_param_mode != LPFC_CFG_OFF) { in lpfc_cgn_params_parse()
6994 lpfc_cmf_start(phba); in lpfc_cgn_params_parse()
6996 if (phba->link_state >= LPFC_LINK_UP) { in lpfc_cgn_params_parse()
6997 phba->cgn_reg_fpin = in lpfc_cgn_params_parse()
6998 phba->cgn_init_reg_fpin; in lpfc_cgn_params_parse()
6999 phba->cgn_reg_signal = in lpfc_cgn_params_parse()
7000 phba->cgn_init_reg_signal; in lpfc_cgn_params_parse()
7001 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7006 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7009 lpfc_cmf_stop(phba); in lpfc_cgn_params_parse()
7010 if (phba->link_state >= LPFC_LINK_UP) in lpfc_cgn_params_parse()
7011 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7014 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_params_parse()
7017 phba->cmf_max_bytes_per_interval = in lpfc_cgn_params_parse()
7018 phba->cmf_link_byte_count; in lpfc_cgn_params_parse()
7021 queue_work(phba->wq, in lpfc_cgn_params_parse()
7022 &phba->unblock_request_work); in lpfc_cgn_params_parse()
7027 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cgn_params_parse()
7030 lpfc_cmf_stop(phba); in lpfc_cgn_params_parse()
7031 if (phba->link_state >= LPFC_LINK_UP) in lpfc_cgn_params_parse()
7032 lpfc_issue_els_edc(phba->pport, 0); in lpfc_cgn_params_parse()
7035 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_cgn_params_parse()
7038 lpfc_cmf_signal_init(phba); in lpfc_cgn_params_parse()
7044 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_cgn_params_parse()
7065 lpfc_sli4_cgn_params_read(struct lpfc_hba *phba) in lpfc_sli4_cgn_params_read() argument
7075 ret = lpfc_read_object(phba, (char *)LPFC_PORT_CFG_NAME, in lpfc_sli4_cgn_params_read()
7082 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7090 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_params_read()
7098 lpfc_cgn_params_parse(phba, p_cgn_param, len); in lpfc_sli4_cgn_params_read()
7124 lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *phba) in lpfc_sli4_cgn_parm_chg_evt() argument
7128 if (!phba->sli4_hba.pc_sli4_params.cmf) { in lpfc_sli4_cgn_parm_chg_evt()
7129 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7138 ret = lpfc_sli4_cgn_params_read(phba); in lpfc_sli4_cgn_parm_chg_evt()
7140 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7144 lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT, in lpfc_sli4_cgn_parm_chg_evt()
7157 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
7163 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
7164 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
7165 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_async_event_proc()
7168 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7169 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
7170 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
7172 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, in lpfc_sli4_async_event_proc()
7178 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
7182 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
7185 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
7189 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
7193 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
7196 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
7199 lpfc_sli4_async_cmstat_evt(phba); in lpfc_sli4_async_event_proc()
7202 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_async_event_proc()
7211 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
7212 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7214 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_async_event_proc()
7224 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
7228 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7230 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
7232 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
7234 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
7235 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
7238 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
7240 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
7242 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fcf_redisc_event_proc()
7258 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
7263 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
7267 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
7270 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7274 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7278 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7282 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
7297 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
7301 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7305 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7309 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
7313 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_intr_mode()
7332 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
7337 if (!phba->pcidev) in lpfc_enable_pci_dev()
7340 pdev = phba->pcidev; in lpfc_enable_pci_dev()
7361 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_enable_pci_dev()
7374 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
7379 if (!phba->pcidev) in lpfc_disable_pci_dev()
7382 pdev = phba->pcidev; in lpfc_disable_pci_dev()
7400 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
7403 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
7404 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
7409 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) { in lpfc_reset_hba()
7410 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
7412 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
7413 lpfc_sli_flush_io_rings(phba); in lpfc_reset_hba()
7415 lpfc_offline(phba); in lpfc_reset_hba()
7416 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
7417 lpfc_online(phba); in lpfc_reset_hba()
7418 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
7432 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
7434 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
7458 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
7460 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
7464 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
7466 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_probe_sriov_nr_virtfn()
7474 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7479 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
7488 struct lpfc_hba *phba = container_of(work, struct lpfc_hba, in lpfc_unblock_requests_work() local
7491 lpfc_unblock_requests(phba); in lpfc_unblock_requests_work()
7506 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
7508 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
7513 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
7514 atomic_set(&phba->dbg_log_idx, 0); in lpfc_setup_driver_resource_phase1()
7515 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_setup_driver_resource_phase1()
7516 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_setup_driver_resource_phase1()
7517 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
7520 spin_lock_init(&phba->port_list_lock); in lpfc_setup_driver_resource_phase1()
7521 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
7523 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
7524 init_waitqueue_head(&phba->wait_4_mlo_m_q); in lpfc_setup_driver_resource_phase1()
7527 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
7529 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
7531 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
7533 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
7535 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
7538 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
7539 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
7540 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
7541 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
7544 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
7547 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
7550 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
7553 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
7554 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
7559 timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); in lpfc_setup_driver_resource_phase1()
7561 timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); in lpfc_setup_driver_resource_phase1()
7563 timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); in lpfc_setup_driver_resource_phase1()
7565 INIT_DELAYED_WORK(&phba->eq_delay_work, lpfc_hb_eq_delay_work); in lpfc_setup_driver_resource_phase1()
7567 INIT_DELAYED_WORK(&phba->idle_stat_delay_work, in lpfc_setup_driver_resource_phase1()
7569 INIT_WORK(&phba->unblock_request_work, lpfc_unblock_requests_work); in lpfc_setup_driver_resource_phase1()
7585 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
7594 timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); in lpfc_sli_driver_resource_setup()
7597 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
7598 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
7601 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
7604 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli_driver_resource_setup()
7608 if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { in lpfc_sli_driver_resource_setup()
7609 phba->menlo_flag |= HBA_MENLO_SUPPORT; in lpfc_sli_driver_resource_setup()
7611 if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) in lpfc_sli_driver_resource_setup()
7612 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
7615 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7616 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, in lpfc_sli_driver_resource_setup()
7619 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
7627 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_driver_resource_setup()
7633 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
7643 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7647 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
7648 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
7651 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
7658 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
7660 ((phba->cfg_sg_seg_cnt + 2) * entry_sz); in lpfc_sli_driver_resource_setup()
7663 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
7666 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
7668 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7669 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
7671 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
7673 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
7678 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
7679 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
7682 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
7685 phba->lpfc_sg_dma_buf_pool = in lpfc_sli_driver_resource_setup()
7687 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
7690 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli_driver_resource_setup()
7693 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli_driver_resource_setup()
7695 &phba->pcidev->dev, in lpfc_sli_driver_resource_setup()
7700 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli_driver_resource_setup()
7707 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
7708 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
7709 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7711 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
7715 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
7716 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
7723 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli_driver_resource_setup()
7724 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli_driver_resource_setup()
7726 lpfc_mem_free(phba); in lpfc_sli_driver_resource_setup()
7738 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
7741 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
7758 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
7769 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
7770 phba->sli4_hba.num_possible_cpu = cpumask_last(cpu_possible_mask) + 1; in lpfc_sli4_driver_resource_setup()
7771 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
7774 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
7777 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
7782 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
7789 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0); in lpfc_sli4_driver_resource_setup()
7795 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
7798 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
7801 hrtimer_init(&phba->cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in lpfc_sli4_driver_resource_setup()
7802 phba->cmf_timer.function = lpfc_cmf_timer; in lpfc_sli4_driver_resource_setup()
7808 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
7810 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
7812 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
7815 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
7818 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
7819 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
7820 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
7821 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
7830 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
7831 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
7832 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
7835 if (lpfc_is_vmid_enabled(phba)) in lpfc_sli4_driver_resource_setup()
7836 timer_setup(&phba->inactive_vmid_poll, lpfc_vmid_poll, 0); in lpfc_sli4_driver_resource_setup()
7842 spin_lock_init(&phba->sli4_hba.abts_io_buf_list_lock); in lpfc_sli4_driver_resource_setup()
7843 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_io_buf_list); in lpfc_sli4_driver_resource_setup()
7845 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
7847 spin_lock_init(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_sli4_driver_resource_setup()
7848 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
7849 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
7850 spin_lock_init(&phba->sli4_hba.t_active_list_lock); in lpfc_sli4_driver_resource_setup()
7851 INIT_LIST_HEAD(&phba->sli4_hba.t_active_ctx_list); in lpfc_sli4_driver_resource_setup()
7855 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
7856 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
7857 spin_lock_init(&phba->sli4_hba.asynce_list_lock); in lpfc_sli4_driver_resource_setup()
7858 spin_lock_init(&phba->sli4_hba.els_xri_abrt_list_lock); in lpfc_sli4_driver_resource_setup()
7865 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
7867 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
7869 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
7871 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
7873 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
7876 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
7877 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
7878 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
7879 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
7884 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
7885 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
7888 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
7891 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
7896 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
7898 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
7903 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
7907 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
7912 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
7917 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
7920 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
7925 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
7927 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
7932 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
7940 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
7944 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
7945 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
7947 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
7953 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
7961 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
7966 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
7972 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
7975 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
7977 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
7982 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_driver_resource_setup()
7989 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_driver_resource_setup()
7990 if (phba->irq_chann_mode == NHT_MODE) { in lpfc_sli4_driver_resource_setup()
7991 phba->cfg_irq_chann = in lpfc_sli4_driver_resource_setup()
7992 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
7993 phba->cfg_hdw_queue = in lpfc_sli4_driver_resource_setup()
7994 phba->sli4_hba.num_present_cpu; in lpfc_sli4_driver_resource_setup()
7995 phba->irq_chann_mode = NORMAL_MODE; in lpfc_sli4_driver_resource_setup()
8002 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
8009 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
8012 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
8014 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
8015 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
8016 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
8017 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8022 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8029 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8040 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
8054 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
8066 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
8070 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8076 if (phba->cfg_enable_bg && in lpfc_sli4_driver_resource_setup()
8077 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
8078 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
8080 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8088 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
8090 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
8094 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
8095 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8103 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_driver_resource_setup()
8104 phba->cfg_sg_dma_buf_size = LPFC_DEFAULT_XPSGL_SIZE; in lpfc_sli4_driver_resource_setup()
8105 else if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
8106 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
8108 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
8109 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
8111 phba->border_sge_num = phba->cfg_sg_dma_buf_size / in lpfc_sli4_driver_resource_setup()
8115 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
8116 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { in lpfc_sli4_driver_resource_setup()
8117 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, in lpfc_sli4_driver_resource_setup()
8121 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_sli4_driver_resource_setup()
8123 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
8126 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
8129 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8130 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sli4_driver_resource_setup()
8131 phba->cfg_nvme_seg_cnt); in lpfc_sli4_driver_resource_setup()
8133 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_sli4_driver_resource_setup()
8134 i = phba->cfg_sg_dma_buf_size; in lpfc_sli4_driver_resource_setup()
8138 phba->lpfc_sg_dma_buf_pool = in lpfc_sli4_driver_resource_setup()
8140 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8141 phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
8143 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli4_driver_resource_setup()
8146 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli4_driver_resource_setup()
8148 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
8152 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli4_driver_resource_setup()
8155 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
8158 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
8161 lpfc_sli4_ras_init(phba); in lpfc_sli4_driver_resource_setup()
8164 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
8169 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
8174 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
8177 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
8179 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8183 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8185 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8192 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
8194 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
8195 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8202 phba->sli4_hba.hba_eq_hdl = kcalloc(phba->cfg_irq_chann, in lpfc_sli4_driver_resource_setup()
8205 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
8206 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8213 phba->sli4_hba.cpu_map = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
8216 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
8217 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8224 phba->sli4_hba.eq_info = alloc_percpu(struct lpfc_eq_intr_info); in lpfc_sli4_driver_resource_setup()
8225 if (!phba->sli4_hba.eq_info) { in lpfc_sli4_driver_resource_setup()
8226 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8232 phba->sli4_hba.idle_stat = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
8233 sizeof(*phba->sli4_hba.idle_stat), in lpfc_sli4_driver_resource_setup()
8235 if (!phba->sli4_hba.idle_stat) { in lpfc_sli4_driver_resource_setup()
8236 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8243 phba->sli4_hba.c_stat = alloc_percpu(struct lpfc_hdwq_stat); in lpfc_sli4_driver_resource_setup()
8244 if (!phba->sli4_hba.c_stat) { in lpfc_sli4_driver_resource_setup()
8245 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8252 phba->cmf_stat = alloc_percpu(struct lpfc_cgn_stat); in lpfc_sli4_driver_resource_setup()
8253 if (!phba->cmf_stat) { in lpfc_sli4_driver_resource_setup()
8254 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_driver_resource_setup()
8264 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
8265 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
8266 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8268 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
8272 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
8273 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
8281 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_setup()
8284 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_setup()
8286 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_setup()
8288 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
8290 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
8292 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
8294 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
8296 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
8298 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
8300 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool); in lpfc_sli4_driver_resource_setup()
8301 phba->lpfc_cmd_rsp_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8303 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli4_driver_resource_setup()
8304 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
8306 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
8308 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
8320 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
8324 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_unset()
8326 free_percpu(phba->sli4_hba.c_stat); in lpfc_sli4_driver_resource_unset()
8328 free_percpu(phba->cmf_stat); in lpfc_sli4_driver_resource_unset()
8329 kfree(phba->sli4_hba.idle_stat); in lpfc_sli4_driver_resource_unset()
8332 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
8333 phba->sli4_hba.num_possible_cpu = 0; in lpfc_sli4_driver_resource_unset()
8334 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
8335 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
8336 cpumask_clear(&phba->sli4_hba.irq_aff_mask); in lpfc_sli4_driver_resource_unset()
8339 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
8342 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
8343 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
8346 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
8349 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
8350 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8351 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
8354 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
8355 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
8358 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
8361 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
8364 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
8368 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
8387 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
8389 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
8390 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
8391 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
8394 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
8395 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
8396 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
8399 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
8400 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
8401 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
8404 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_init_api_table_setup()
8424 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
8429 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
8430 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
8431 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
8432 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
8448 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
8450 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
8451 flush_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
8452 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
8453 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
8457 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
8458 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
8468 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
8472 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8474 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
8477 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
8479 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
8497 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
8504 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8514 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
8524 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8525 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
8526 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
8527 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
8533 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
8546 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
8552 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
8564 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
8569 spin_lock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8570 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
8571 spin_unlock_irq(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
8574 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
8584 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
8590 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8591 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8592 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
8593 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
8594 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
8599 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
8607 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
8618 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
8622 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
8624 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
8626 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
8640 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
8642 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
8654 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
8657 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
8658 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
8659 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
8660 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
8663 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
8666 phba->sli4_hba.io_xri_cnt = 0; in lpfc_init_sgl_list()
8684 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
8689 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
8690 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
8692 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
8695 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
8697 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_init_rpi_hdrs()
8699 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
8720 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
8731 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
8733 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
8737 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
8739 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8745 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
8746 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8760 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
8781 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8785 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
8786 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
8788 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
8792 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
8809 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
8813 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
8817 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
8819 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
8826 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
8844 struct lpfc_hba *phba; in lpfc_hba_alloc() local
8847 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
8848 if (!phba) { in lpfc_hba_alloc()
8854 phba->pcidev = pdev; in lpfc_hba_alloc()
8857 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
8858 if (phba->brd_no < 0) { in lpfc_hba_alloc()
8859 kfree(phba); in lpfc_hba_alloc()
8862 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
8864 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
8865 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
8867 return phba; in lpfc_hba_alloc()
8878 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
8880 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_hba_free()
8881 kfree(phba->sli4_hba.hdwq); in lpfc_hba_free()
8884 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
8887 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
8888 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
8890 kfree(phba); in lpfc_hba_free()
8906 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
8912 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
8913 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
8914 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
8915 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
8917 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
8918 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
8923 phba->pport = vport; in lpfc_create_shost()
8925 if (phba->nvmet_support) { in lpfc_create_shost()
8927 phba->targetport = NULL; in lpfc_create_shost()
8928 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
8929 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME_DISC, in lpfc_create_shost()
8935 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
8942 if (phba->cfg_enable_SmartSAN || in lpfc_create_shost()
8943 (phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT)) { in lpfc_create_shost()
8947 if (phba->cfg_enable_SmartSAN) in lpfc_create_shost()
8963 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
8965 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
8982 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
8987 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
8988 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
8992 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
8993 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
8996 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
8999 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
9003 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
9004 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
9006 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
9007 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
9008 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
9009 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9012 phba->cfg_prot_mask, in lpfc_setup_bg()
9013 phba->cfg_prot_guard); in lpfc_setup_bg()
9015 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
9016 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
9018 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_bg()
9033 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
9039 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
9045 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
9046 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
9050 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
9052 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
9056 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
9080 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
9082 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
9102 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
9105 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
9109 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
9110 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
9117 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
9118 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
9125 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
9126 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
9127 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
9130 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
9131 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9133 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
9134 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
9137 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
9139 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
9141 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
9145 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
9147 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
9148 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
9152 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
9153 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
9155 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
9157 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
9158 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9159 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9160 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9161 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
9167 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
9169 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
9171 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
9184 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
9189 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
9192 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
9196 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
9198 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
9201 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
9202 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
9217 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
9226 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
9231 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
9249 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9263 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
9268 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9270 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9272 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9274 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9276 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
9278 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
9285 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
9288 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
9289 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
9290 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
9291 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
9293 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
9295 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
9296 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
9297 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
9298 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_post_status_check()
9308 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
9309 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
9316 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
9320 phba->work_status[0] = in lpfc_sli4_post_status_check()
9321 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9323 phba->work_status[1] = in lpfc_sli4_post_status_check()
9324 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
9326 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_status_check()
9333 phba->work_status[0], in lpfc_sli4_post_status_check()
9334 phba->work_status[1]); in lpfc_sli4_post_status_check()
9355 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
9359 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
9360 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
9361 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
9362 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
9363 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
9364 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
9365 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
9366 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
9367 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9368 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9371 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9372 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9374 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9375 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9377 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9378 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9380 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9381 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9383 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9384 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9386 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
9387 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
9388 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9389 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9391 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9392 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9394 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9395 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9397 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9398 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9399 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
9400 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
9401 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
9402 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9403 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9406 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
9407 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9409 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
9410 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9412 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
9413 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9415 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
9416 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9418 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
9419 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9421 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
9422 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
9424 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
9425 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
9429 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
9444 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
9448 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
9449 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9451 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9453 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9455 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9459 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9461 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9463 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9465 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9467 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
9473 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
9491 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
9496 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9499 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9502 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9505 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
9506 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9508 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
9529 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
9546 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
9560 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
9561 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
9563 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
9565 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
9576 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
9577 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
9582 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
9600 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
9602 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
9603 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
9604 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
9605 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
9607 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
9608 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
9635 lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) in lpfc_map_topology() argument
9643 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9647 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9650 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9654 phba->hba_flag |= HBA_PERSISTENT_TOPO; in lpfc_map_topology()
9657 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9659 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_map_topology()
9662 phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) in lpfc_map_topology()
9666 phba->hba_flag &= ~HBA_PERSISTENT_TOPO; in lpfc_map_topology()
9671 phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : in lpfc_map_topology()
9674 phba->cfg_topology = ((pt == LINK_FLAGS_P2P) in lpfc_map_topology()
9679 if (phba->hba_flag & HBA_PERSISTENT_TOPO) { in lpfc_map_topology()
9680 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_map_topology()
9682 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9684 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_map_topology()
9687 lpfc_topo_to_str[phba->cfg_topology]); in lpfc_map_topology()
9706 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
9719 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
9721 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9727 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
9729 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
9731 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9740 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
9741 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
9743 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
9745 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
9747 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
9748 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
9750 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
9754 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
9755 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
9758 phba->sli4_hba.conf_trunk = in lpfc_sli4_read_config()
9760 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
9762 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
9766 phba->sli4_hba.max_cfg_param.max_xri > 512) in lpfc_sli4_read_config()
9767 phba->sli4_hba.max_cfg_param.max_xri = 512; in lpfc_sli4_read_config()
9768 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
9770 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
9773 if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) in lpfc_sli4_read_config()
9774 phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; in lpfc_sli4_read_config()
9775 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
9777 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
9779 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
9781 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
9783 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
9785 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
9787 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
9789 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
9791 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
9793 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
9795 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
9796 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
9797 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
9798 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
9799 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
9800 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
9801 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
9812 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
9813 phba->cgn_reg_signal = EDC_CG_SIG_NOTSUPPORTED; in lpfc_sli4_read_config()
9814 phba->cgn_sig_freq = lpfc_fabric_cgn_frequency; in lpfc_sli4_read_config()
9818 phba->cgn_reg_signal = EDC_CG_SIG_WARN_ONLY; in lpfc_sli4_read_config()
9819 phba->cgn_reg_fpin &= ~LPFC_CGN_FPIN_WARN; in lpfc_sli4_read_config()
9825 if (phba->cgn_reg_signal != in lpfc_sli4_read_config()
9828 phba->cgn_reg_fpin = LPFC_CGN_FPIN_BOTH; in lpfc_sli4_read_config()
9829 phba->cgn_reg_signal = in lpfc_sli4_read_config()
9832 phba->cgn_reg_signal = in lpfc_sli4_read_config()
9834 phba->cgn_reg_fpin = in lpfc_sli4_read_config()
9841 phba->cgn_init_reg_fpin = phba->cgn_reg_fpin; in lpfc_sli4_read_config()
9842 phba->cgn_init_reg_signal = phba->cgn_reg_signal; in lpfc_sli4_read_config()
9844 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_sli4_read_config()
9846 phba->cgn_reg_signal, phba->cgn_reg_fpin); in lpfc_sli4_read_config()
9848 lpfc_map_topology(phba, rd_config); in lpfc_sli4_read_config()
9849 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
9856 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
9857 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
9858 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
9859 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
9860 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
9861 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
9862 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
9863 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
9864 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
9865 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
9866 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
9867 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
9868 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
9869 phba->sli4_hba.max_cfg_param.max_rq, in lpfc_sli4_read_config()
9870 phba->lmt); in lpfc_sli4_read_config()
9876 qmin = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
9877 if (phba->sli4_hba.max_cfg_param.max_cq < qmin) in lpfc_sli4_read_config()
9878 qmin = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
9879 if (phba->sli4_hba.max_cfg_param.max_eq < qmin) in lpfc_sli4_read_config()
9880 qmin = phba->sli4_hba.max_cfg_param.max_eq; in lpfc_sli4_read_config()
9890 if ((phba->cfg_irq_chann > qmin) || in lpfc_sli4_read_config()
9891 (phba->cfg_hdw_queue > qmin)) { in lpfc_sli4_read_config()
9892 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
9897 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
9898 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
9899 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
9900 qmin, phba->cfg_irq_chann, in lpfc_sli4_read_config()
9901 phba->cfg_hdw_queue); in lpfc_sli4_read_config()
9903 if (phba->cfg_irq_chann > qmin) in lpfc_sli4_read_config()
9904 phba->cfg_irq_chann = qmin; in lpfc_sli4_read_config()
9905 if (phba->cfg_hdw_queue > qmin) in lpfc_sli4_read_config()
9906 phba->cfg_hdw_queue = qmin; in lpfc_sli4_read_config()
9914 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
9919 phba->hba_flag |= HBA_FORCED_LINK_SPEED; in lpfc_sli4_read_config()
9923 phba->cfg_link_speed = in lpfc_sli4_read_config()
9927 phba->cfg_link_speed = in lpfc_sli4_read_config()
9931 phba->cfg_link_speed = in lpfc_sli4_read_config()
9935 phba->cfg_link_speed = in lpfc_sli4_read_config()
9939 phba->cfg_link_speed = in lpfc_sli4_read_config()
9943 phba->cfg_link_speed = in lpfc_sli4_read_config()
9947 phba->cfg_link_speed = in lpfc_sli4_read_config()
9951 phba->cfg_link_speed = in lpfc_sli4_read_config()
9955 phba->cfg_link_speed = in lpfc_sli4_read_config()
9959 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_read_config()
9964 phba->cfg_link_speed = in lpfc_sli4_read_config()
9971 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
9972 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
9973 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
9974 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
9976 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
9977 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
9980 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
9987 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
9991 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
9997 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10020 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
10022 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
10029 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
10031 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
10032 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
10034 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_read_config()
10040 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
10058 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
10065 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
10068 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
10071 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10084 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
10086 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_setup_endian_order()
10092 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
10117 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
10124 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
10125 if (phba->cfg_hdw_queue < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
10126 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_sli4_queue_verify()
10127 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
10128 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
10131 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
10133 phba->cfg_hdw_queue, phba->cfg_irq_chann, in lpfc_sli4_queue_verify()
10134 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
10137 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
10138 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10141 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
10142 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
10147 lpfc_alloc_io_wq_cq(struct lpfc_hba *phba, int idx) in lpfc_alloc_io_wq_cq() argument
10153 cpu = lpfc_find_cpu_handle(phba, idx, LPFC_FIND_BY_HDWQ); in lpfc_alloc_io_wq_cq()
10155 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_io_wq_cq()
10157 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10158 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10162 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10163 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
10164 phba->sli4_hba.cq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10166 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10174 phba->sli4_hba.hdwq[idx].io_cq = qdesc; in lpfc_alloc_io_wq_cq()
10177 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_io_wq_cq()
10179 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_io_wq_cq()
10180 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_io_wq_cq()
10181 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10185 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
10186 phba->sli4_hba.wq_esize, in lpfc_alloc_io_wq_cq()
10187 phba->sli4_hba.wq_ecount, cpu); in lpfc_alloc_io_wq_cq()
10190 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_alloc_io_wq_cq()
10197 phba->sli4_hba.hdwq[idx].io_wq = qdesc; in lpfc_alloc_io_wq_cq()
10198 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_io_wq_cq()
10217 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
10230 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
10231 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
10232 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
10233 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
10234 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
10235 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
10236 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
10237 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
10238 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
10239 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
10241 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10242 phba->sli4_hba.hdwq = kcalloc( in lpfc_sli4_queue_create()
10243 phba->cfg_hdw_queue, sizeof(struct lpfc_sli4_hdw_queue), in lpfc_sli4_queue_create()
10245 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
10246 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10252 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10253 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_queue_create()
10271 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10272 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10273 phba->sli4_hba.nvmet_cqset = kcalloc( in lpfc_sli4_queue_create()
10274 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10277 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
10278 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10283 phba->sli4_hba.nvmet_mrq_hdr = kcalloc( in lpfc_sli4_queue_create()
10284 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10287 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
10288 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10293 phba->sli4_hba.nvmet_mrq_data = kcalloc( in lpfc_sli4_queue_create()
10294 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
10297 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
10298 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10306 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10314 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10319 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10322 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10323 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
10324 phba->sli4_hba.eq_ecount, cpu); in lpfc_sli4_queue_create()
10326 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10339 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, qdesc->last_cpu); in lpfc_sli4_queue_create()
10347 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
10354 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
10359 eqcpu = lpfc_find_cpu_handle(phba, cpup->eq, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10360 eqcpup = &phba->sli4_hba.cpu_map[eqcpu]; in lpfc_sli4_queue_create()
10361 qp->hba_eq = phba->sli4_hba.hdwq[eqcpup->hdwq].hba_eq; in lpfc_sli4_queue_create()
10365 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10366 if (lpfc_alloc_io_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
10370 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
10371 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10372 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10374 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10376 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10377 phba->sli4_hba.cq_ecount, in lpfc_sli4_queue_create()
10380 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10388 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
10396 cpu = lpfc_find_cpu_handle(phba, 0, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
10398 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10399 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10400 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10402 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10407 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
10410 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10411 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10412 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10414 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10420 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
10429 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10430 phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
10431 phba->sli4_hba.mq_ecount, cpu); in lpfc_sli4_queue_create()
10433 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10438 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
10445 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10446 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
10447 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10449 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10454 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
10455 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10457 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10459 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10460 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
10461 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
10463 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10469 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
10472 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10473 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
10474 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
10476 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10481 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
10482 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
10490 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10491 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10492 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10494 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10498 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
10501 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
10502 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10503 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
10505 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10509 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
10511 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_sli4_queue_create()
10512 phba->nvmet_support) { in lpfc_sli4_queue_create()
10513 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
10514 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
10517 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10519 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10523 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10529 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
10536 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10546 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
10548 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
10552 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_create()
10558 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
10563 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
10564 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10565 memset(&phba->sli4_hba.hdwq[idx].nvme_cstat, 0, in lpfc_sli4_queue_create()
10566 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); in lpfc_sli4_queue_create()
10571 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_queue_create()
10572 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
10573 memset(&phba->sli4_hba.hdwq[idx].scsi_cstat, 0, in lpfc_sli4_queue_create()
10574 sizeof(phba->sli4_hba.hdwq[idx].scsi_cstat)); in lpfc_sli4_queue_create()
10581 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
10610 lpfc_sli4_release_hdwq(struct lpfc_hba *phba) in lpfc_sli4_release_hdwq() argument
10616 hdwq = phba->sli4_hba.hdwq; in lpfc_sli4_release_hdwq()
10619 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_release_hdwq()
10626 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_release_hdwq()
10627 lpfc_free_sgl_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10628 lpfc_free_cmd_rsp_buf_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
10631 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_release_hdwq()
10633 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_sli4_release_hdwq()
10635 phba->sli4_hba.hba_eq_hdl[idx].eq = NULL; in lpfc_sli4_release_hdwq()
10652 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
10659 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10660 phba->sli.sli_flag |= LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10661 while (phba->sli.sli_flag & LPFC_QUEUE_FREE_WAIT) { in lpfc_sli4_queue_destroy()
10662 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10664 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10666 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10668 lpfc_sli4_cleanup_poll_list(phba); in lpfc_sli4_queue_destroy()
10671 if (phba->sli4_hba.hdwq) in lpfc_sli4_queue_destroy()
10672 lpfc_sli4_release_hdwq(phba); in lpfc_sli4_queue_destroy()
10674 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
10675 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
10676 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10678 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
10679 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10680 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
10681 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
10685 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
10688 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
10691 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
10694 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
10695 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
10698 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
10701 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
10704 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
10707 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
10710 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10711 phba->sli.sli_flag &= ~LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
10712 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
10716 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
10728 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
10735 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
10743 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10750 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
10753 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10764 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
10769 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
10771 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10783 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
10787 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
10789 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_create_wq_cq()
10796 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
10798 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
10799 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
10813 lpfc_setup_cq_lookup(struct lpfc_hba *phba) in lpfc_setup_cq_lookup() argument
10818 memset(phba->sli4_hba.cq_lookup, 0, in lpfc_setup_cq_lookup()
10819 (sizeof(struct lpfc_queue *) * (phba->sli4_hba.cq_max + 1))); in lpfc_setup_cq_lookup()
10821 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_setup_cq_lookup()
10823 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_setup_cq_lookup()
10828 if (childq->queue_id > phba->sli4_hba.cq_max) in lpfc_setup_cq_lookup()
10831 phba->sli4_hba.cq_lookup[childq->queue_id] = in lpfc_setup_cq_lookup()
10850 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
10862 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
10864 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
10871 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
10875 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
10882 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
10886 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
10891 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
10893 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
10894 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
10895 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
10897 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
10899 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
10900 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
10902 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
10907 qp = phba->sli4_hba.hdwq; in lpfc_sli4_queue_setup()
10911 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
10918 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_setup()
10921 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
10932 rc = lpfc_eq_create(phba, qp[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
10933 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
10935 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
10943 phba->sli4_hba.hba_eq_hdl[cpup->eq].eq = in lpfc_sli4_queue_setup()
10946 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
10954 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_setup()
10955 cpu = lpfc_find_cpu_handle(phba, qidx, LPFC_FIND_BY_HDWQ); in lpfc_sli4_queue_setup()
10956 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
10959 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
10960 phba->sli4_hba.hdwq[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
10963 &phba->sli4_hba.hdwq[qidx].io_cq_map, in lpfc_sli4_queue_setup()
10967 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
10981 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
10982 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
10984 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
10990 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
10991 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
10992 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
10995 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11000 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11001 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
11002 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11008 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11009 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
11010 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11014 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11022 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11026 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11031 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
11033 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11036 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
11042 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
11043 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11045 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11049 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11050 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
11051 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
11054 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11059 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11061 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
11062 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11064 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_setup()
11066 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
11067 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11069 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
11073 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
11074 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
11075 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
11078 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11084 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11087 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
11088 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
11094 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
11095 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
11096 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
11097 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
11098 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11104 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
11105 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
11106 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
11107 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
11108 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
11111 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11119 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
11120 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
11121 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
11122 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
11125 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11133 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11136 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
11137 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
11138 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
11143 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
11144 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11150 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
11151 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
11153 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11159 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
11162 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
11163 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
11164 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
11166 if (phba->cfg_fcp_imax) in lpfc_sli4_queue_setup()
11167 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_sli4_queue_setup()
11171 for (qidx = 0; qidx < phba->cfg_irq_chann; in lpfc_sli4_queue_setup()
11173 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
11176 if (phba->sli4_hba.cq_max) { in lpfc_sli4_queue_setup()
11177 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_setup()
11178 phba->sli4_hba.cq_lookup = kcalloc((phba->sli4_hba.cq_max + 1), in lpfc_sli4_queue_setup()
11180 if (!phba->sli4_hba.cq_lookup) { in lpfc_sli4_queue_setup()
11181 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_queue_setup()
11183 "size 0x%x\n", phba->sli4_hba.cq_max); in lpfc_sli4_queue_setup()
11187 lpfc_setup_cq_lookup(phba); in lpfc_sli4_queue_setup()
11192 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
11210 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
11217 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
11218 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
11221 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
11222 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
11225 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
11226 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
11229 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
11230 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
11231 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
11234 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
11235 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
11238 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
11239 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
11242 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
11243 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
11245 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
11247 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
11248 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11250 phba, in lpfc_sli4_queue_unset()
11251 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
11252 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
11256 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
11257 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
11259 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
11264 if (phba->sli4_hba.hdwq) { in lpfc_sli4_queue_unset()
11266 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_unset()
11268 qp = &phba->sli4_hba.hdwq[qidx]; in lpfc_sli4_queue_unset()
11269 lpfc_wq_destroy(phba, qp->io_wq); in lpfc_sli4_queue_unset()
11270 lpfc_cq_destroy(phba, qp->io_cq); in lpfc_sli4_queue_unset()
11273 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_unset()
11275 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_sli4_queue_unset()
11276 lpfc_eq_destroy(phba, eq); in lpfc_sli4_queue_unset()
11280 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_unset()
11281 phba->sli4_hba.cq_lookup = NULL; in lpfc_sli4_queue_unset()
11282 phba->sli4_hba.cq_max = 0; in lpfc_sli4_queue_unset()
11302 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
11307 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
11312 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
11317 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
11332 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
11337 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
11354 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
11358 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
11374 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
11379 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11380 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
11381 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
11394 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
11397 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
11409 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
11413 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11414 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
11415 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
11426 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
11435 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11436 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
11438 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11441 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11442 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
11444 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_cq_event_release_all()
11449 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release_all()
11466 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
11477 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
11480 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
11483 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11491 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
11494 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
11500 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
11502 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11519 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11530 phba->work_status[0] = readl( in lpfc_pci_function_reset()
11531 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
11532 phba->work_status[1] = readl( in lpfc_pci_function_reset()
11533 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
11534 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11538 phba->work_status[0], in lpfc_pci_function_reset()
11539 phba->work_status[1]); in lpfc_pci_function_reset()
11553 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
11556 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
11576 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_function_reset()
11597 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
11599 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
11619 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
11624 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
11626 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_pci_mem_setup()
11629 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
11633 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
11641 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
11648 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11649 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11650 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11656 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11658 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11660 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
11667 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11668 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
11669 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11675 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11684 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11687 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11688 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
11690 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11697 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
11698 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11699 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11712 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
11714 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11715 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
11716 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11722 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11723 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
11732 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
11735 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11736 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
11738 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11745 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
11746 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11747 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
11762 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
11764 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
11765 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
11766 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
11772 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
11779 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
11780 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_write_eq_db; in lpfc_sli4_pci_mem_setup()
11781 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_write_cq_db; in lpfc_sli4_pci_mem_setup()
11784 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
11785 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_if6_write_eq_db; in lpfc_sli4_pci_mem_setup()
11786 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_if6_write_cq_db; in lpfc_sli4_pci_mem_setup()
11795 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
11797 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
11799 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
11812 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
11815 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
11819 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
11820 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
11821 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
11824 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
11827 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
11828 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
11829 if (phba->sli4_hba.dpp_regs_memmap_p) in lpfc_sli4_pci_mem_unset()
11830 iounmap(phba->sli4_hba.dpp_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
11834 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
11853 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
11859 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
11862 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
11872 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
11874 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
11876 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
11883 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
11885 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
11888 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
11897 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
11901 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_enable_msix()
11906 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
11909 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
11911 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
11919 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
11924 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
11928 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
11932 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
11936 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
11957 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
11961 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
11963 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
11966 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
11971 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
11972 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
11974 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
11975 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
11999 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
12005 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
12008 phba->hba_flag &= ~HBA_NEEDS_CFG_PORT; in lpfc_sli_enable_intr()
12012 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
12015 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
12021 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12022 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
12025 phba->intr_type = MSI; in lpfc_sli_enable_intr()
12031 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
12032 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
12033 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
12036 phba->intr_type = INTx; in lpfc_sli_enable_intr()
12053 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
12057 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
12063 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
12064 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
12067 phba->intr_type = NONE; in lpfc_sli_disable_intr()
12068 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
12080 lpfc_find_cpu_handle(struct lpfc_hba *phba, uint16_t id, int match) in lpfc_find_cpu_handle() argument
12087 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_find_cpu_handle()
12114 lpfc_find_hyper(struct lpfc_hba *phba, int cpu, in lpfc_find_hyper() argument
12121 cpup = &phba->sli4_hba.cpu_map[idx]; in lpfc_find_hyper()
12142 lpfc_assign_eq_map_info(struct lpfc_hba *phba, uint16_t eqidx, uint16_t flag, in lpfc_assign_eq_map_info() argument
12145 struct lpfc_vector_map_info *cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_assign_eq_map_info()
12151 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_assign_eq_map_info()
12163 lpfc_cpu_map_array_init(struct lpfc_hba *phba) in lpfc_cpu_map_array_init() argument
12170 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_map_array_init()
12176 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, cpu); in lpfc_cpu_map_array_init()
12189 lpfc_hba_eq_hdl_array_init(struct lpfc_hba *phba) in lpfc_hba_eq_hdl_array_init() argument
12194 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hba_eq_hdl_array_init()
12197 eqhdl->phba = phba; in lpfc_hba_eq_hdl_array_init()
12212 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
12233 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12238 if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id)) in lpfc_cpu_affinity_check()
12246 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12270 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12283 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12284 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12308 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12321 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12334 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12335 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12345 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
12362 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12375 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12384 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12402 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12412 if (next_idx < phba->cfg_hdw_queue) { in lpfc_cpu_affinity_check()
12424 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12425 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12440 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
12441 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
12452 cpup->hdwq = idx % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12462 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12475 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
12477 c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, cpu); in lpfc_cpu_affinity_check()
12483 cpup->hdwq = idx++ % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
12487 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
12507 lpfc_cpuhp_get_eq(struct lpfc_hba *phba, unsigned int cpu, in lpfc_cpuhp_get_eq() argument
12519 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_cpuhp_get_eq()
12520 maskp = pci_irq_get_affinity(phba->pcidev, idx); in lpfc_cpuhp_get_eq()
12545 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_cpuhp_get_eq()
12552 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba) in __lpfc_cpuhp_remove() argument
12554 if (phba->sli_rev != LPFC_SLI_REV4) in __lpfc_cpuhp_remove()
12558 &phba->cpuhp); in __lpfc_cpuhp_remove()
12564 del_timer_sync(&phba->cpuhp_poll_timer); in __lpfc_cpuhp_remove()
12567 static void lpfc_cpuhp_remove(struct lpfc_hba *phba) in lpfc_cpuhp_remove() argument
12569 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_cpuhp_remove()
12572 __lpfc_cpuhp_remove(phba); in lpfc_cpuhp_remove()
12575 static void lpfc_cpuhp_add(struct lpfc_hba *phba) in lpfc_cpuhp_add() argument
12577 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cpuhp_add()
12582 if (!list_empty(&phba->poll_list)) in lpfc_cpuhp_add()
12583 mod_timer(&phba->cpuhp_poll_timer, in lpfc_cpuhp_add()
12589 &phba->cpuhp); in lpfc_cpuhp_add()
12592 static int __lpfc_cpuhp_checks(struct lpfc_hba *phba, int *retval) in __lpfc_cpuhp_checks() argument
12594 if (phba->pport->load_flag & FC_UNLOADING) { in __lpfc_cpuhp_checks()
12599 if (phba->sli_rev != LPFC_SLI_REV4) { in __lpfc_cpuhp_checks()
12652 lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline) in lpfc_irq_rebalance() argument
12659 if (phba->irq_chann_mode == NORMAL_MODE) in lpfc_irq_rebalance()
12662 orig_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_rebalance()
12667 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_irq_rebalance()
12682 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_irq_rebalance()
12692 for (idx = 0; idx < phba->cfg_irq_chann; idx++) in lpfc_irq_rebalance()
12703 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_offline() local
12708 if (!phba) { in lpfc_cpu_offline()
12709 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_offline()
12713 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_offline()
12716 lpfc_irq_rebalance(phba, cpu, true); in lpfc_cpu_offline()
12718 retval = lpfc_cpuhp_get_eq(phba, cpu, &eqlist); in lpfc_cpu_offline()
12733 struct lpfc_hba *phba = hlist_entry_safe(node, struct lpfc_hba, cpuhp); in lpfc_cpu_online() local
12738 if (!phba) { in lpfc_cpu_online()
12739 WARN_ONCE(!phba, "cpu: %u. phba:NULL", raw_smp_processor_id()); in lpfc_cpu_online()
12743 if (__lpfc_cpuhp_checks(phba, &retval)) in lpfc_cpu_online()
12746 lpfc_irq_rebalance(phba, cpu, false); in lpfc_cpu_online()
12748 list_for_each_entry_safe(eq, next, &phba->poll_list, _poll_list) { in lpfc_cpu_online()
12749 n = lpfc_find_cpu_handle(phba, eq->hdwq, LPFC_FIND_BY_HDWQ); in lpfc_cpu_online()
12786 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
12798 vectors = phba->cfg_irq_chann; in lpfc_sli4_enable_msix()
12800 if (phba->irq_chann_mode != NORMAL_MODE) in lpfc_sli4_enable_msix()
12801 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_sli4_enable_msix()
12805 vectors = min(phba->cfg_irq_chann, cpu_cnt); in lpfc_sli4_enable_msix()
12816 rc = pci_alloc_irq_vectors(phba->pcidev, 1, vectors, flags); in lpfc_sli4_enable_msix()
12818 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
12833 rc = request_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_enable_msix()
12837 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
12843 eqhdl->irq = pci_irq_vector(phba->pcidev, index); in lpfc_sli4_enable_msix()
12851 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
12862 lpfc_assign_eq_map_info(phba, index, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_msix()
12865 maskp = pci_irq_get_affinity(phba->pcidev, index); in lpfc_sli4_enable_msix()
12869 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_enable_msix()
12885 lpfc_assign_eq_map_info(phba, index, in lpfc_sli4_enable_msix()
12893 if (vectors != phba->cfg_irq_chann) { in lpfc_sli4_enable_msix()
12894 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_enable_msix()
12897 phba->cfg_irq_chann, vectors); in lpfc_sli4_enable_msix()
12898 if (phba->cfg_irq_chann > vectors) in lpfc_sli4_enable_msix()
12899 phba->cfg_irq_chann = vectors; in lpfc_sli4_enable_msix()
12914 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
12935 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
12941 rc = pci_alloc_irq_vectors(phba->pcidev, 1, 1, in lpfc_sli4_enable_msi()
12944 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
12947 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
12952 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
12953 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
12955 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
12956 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
12962 eqhdl->irq = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_msi()
12965 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); in lpfc_sli4_enable_msi()
12967 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_enable_msi()
12993 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
13003 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
13006 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
13013 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13014 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
13017 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
13023 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
13024 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
13025 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
13031 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
13035 eqhdl->irq = pci_irq_vector(phba->pcidev, 0); in lpfc_sli4_enable_intr()
13038 lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, in lpfc_sli4_enable_intr()
13040 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_enable_intr()
13059 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
13062 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
13067 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_disable_intr()
13074 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
13077 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
13080 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
13081 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
13092 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
13094 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
13101 kfree(phba->vpi_bmask); in lpfc_unset_hba()
13102 kfree(phba->vpi_ids); in lpfc_unset_hba()
13104 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
13106 phba->pport->work_port_events = 0; in lpfc_unset_hba()
13108 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
13110 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
13112 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
13131 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
13138 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13147 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
13148 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
13151 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13152 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13160 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13162 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13168 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13173 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13178 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_xri_exchange_busy_wait()
13190 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
13191 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
13200 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
13202 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
13205 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
13221 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
13225 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
13227 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
13228 hrtimer_cancel(&phba->cmf_timer); in lpfc_sli4_hba_unset()
13230 if (phba->pport) in lpfc_sli4_hba_unset()
13231 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
13239 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13240 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
13241 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13243 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13249 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
13250 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13251 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
13253 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
13254 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
13255 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
13256 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
13260 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
13263 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
13266 if (phba->pport) in lpfc_sli4_hba_unset()
13267 lpfc_cpuhp_remove(phba); in lpfc_sli4_hba_unset()
13270 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
13273 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
13277 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
13280 lpfc_ras_stop_fwlog(phba); in lpfc_sli4_hba_unset()
13285 lpfc_sli4_queue_unset(phba); in lpfc_sli4_hba_unset()
13286 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
13289 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
13292 if (phba->ras_fwlog.ras_enabled) in lpfc_sli4_hba_unset()
13293 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_hba_unset()
13296 if (phba->pport) in lpfc_sli4_hba_unset()
13297 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
13351 lpfc_init_congestion_buf(struct lpfc_hba *phba) in lpfc_init_congestion_buf() argument
13359 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_buf()
13360 "6235 INIT Congestion Buffer %p\n", phba->cgn_i); in lpfc_init_congestion_buf()
13362 if (!phba->cgn_i) in lpfc_init_congestion_buf()
13364 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_buf()
13366 atomic_set(&phba->cgn_fabric_warn_cnt, 0); in lpfc_init_congestion_buf()
13367 atomic_set(&phba->cgn_fabric_alarm_cnt, 0); in lpfc_init_congestion_buf()
13368 atomic_set(&phba->cgn_sync_alarm_cnt, 0); in lpfc_init_congestion_buf()
13369 atomic_set(&phba->cgn_sync_warn_cnt, 0); in lpfc_init_congestion_buf()
13371 atomic64_set(&phba->cgn_acqe_stat.alarm, 0); in lpfc_init_congestion_buf()
13372 atomic64_set(&phba->cgn_acqe_stat.warn, 0); in lpfc_init_congestion_buf()
13373 atomic_set(&phba->cgn_driver_evt_cnt, 0); in lpfc_init_congestion_buf()
13374 atomic_set(&phba->cgn_latency_evt_cnt, 0); in lpfc_init_congestion_buf()
13375 atomic64_set(&phba->cgn_latency_evt, 0); in lpfc_init_congestion_buf()
13376 phba->cgn_evt_minute = 0; in lpfc_init_congestion_buf()
13377 phba->hba_flag &= ~HBA_CGN_DAY_WRAP; in lpfc_init_congestion_buf()
13384 cp->cgn_info_mode = phba->cgn_p.cgn_param_mode; in lpfc_init_congestion_buf()
13385 cp->cgn_info_level0 = phba->cgn_p.cgn_param_level0; in lpfc_init_congestion_buf()
13386 cp->cgn_info_level1 = phba->cgn_p.cgn_param_level1; in lpfc_init_congestion_buf()
13387 cp->cgn_info_level2 = phba->cgn_p.cgn_param_level2; in lpfc_init_congestion_buf()
13399 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_init_congestion_buf()
13407 if (phba->pport) { in lpfc_init_congestion_buf()
13408 size = (uint16_t)(phba->pport->cfg_lun_queue_depth); in lpfc_init_congestion_buf()
13419 phba->cgn_evt_timestamp = jiffies + in lpfc_init_congestion_buf()
13424 lpfc_init_congestion_stat(struct lpfc_hba *phba) in lpfc_init_congestion_stat() argument
13431 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, in lpfc_init_congestion_stat()
13432 "6236 INIT Congestion Stat %p\n", phba->cgn_i); in lpfc_init_congestion_stat()
13434 if (!phba->cgn_i) in lpfc_init_congestion_stat()
13437 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_init_congestion_stat()
13449 lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT | LOG_INIT, in lpfc_init_congestion_stat()
13466 __lpfc_reg_congestion_buf(struct lpfc_hba *phba, int reg) in __lpfc_reg_congestion_buf() argument
13474 if (!phba->cgn_i) in __lpfc_reg_congestion_buf()
13477 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in __lpfc_reg_congestion_buf()
13479 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in __lpfc_reg_congestion_buf()
13482 phba->pport->port_state, reg); in __lpfc_reg_congestion_buf()
13488 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in __lpfc_reg_congestion_buf()
13499 putPaddrLow(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13501 putPaddrHigh(phba->cgn_i->phys); in __lpfc_reg_congestion_buf()
13503 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in __lpfc_reg_congestion_buf()
13509 mempool_free(mboxq, phba->mbox_mem_pool); in __lpfc_reg_congestion_buf()
13511 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in __lpfc_reg_congestion_buf()
13522 lpfc_unreg_congestion_buf(struct lpfc_hba *phba) in lpfc_unreg_congestion_buf() argument
13524 lpfc_cmf_stop(phba); in lpfc_unreg_congestion_buf()
13525 return __lpfc_reg_congestion_buf(phba, 0); in lpfc_unreg_congestion_buf()
13529 lpfc_reg_congestion_buf(struct lpfc_hba *phba) in lpfc_reg_congestion_buf() argument
13531 return __lpfc_reg_congestion_buf(phba, 1); in lpfc_reg_congestion_buf()
13547 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
13562 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
13567 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
13570 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
13571 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
13573 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
13574 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
13578 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
13588 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13590 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
13609 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13610 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13613 phba->cfg_xpsgl = bf_get(cfg_xpsgl, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
13624 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) { in lpfc_get_sli4_parameters()
13625 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13628 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13634 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
13635 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13640 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
13642 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
13643 phba->cfg_nvmet_mrq = 0; in lpfc_get_sli4_parameters()
13644 phba->cfg_nvme_seg_cnt = 0; in lpfc_get_sli4_parameters()
13647 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
13649 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
13656 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_get_sli4_parameters()
13657 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_get_sli4_parameters()
13661 phba->cfg_enable_pbde = 1; in lpfc_get_sli4_parameters()
13663 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
13673 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
13675 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
13677 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
13680 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
13692 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
13694 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
13696 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
13699 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
13700 phba->fcp_embed_io, sli4_params->nvme, in lpfc_get_sli4_parameters()
13701 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
13703 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13705 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
13713 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
13715 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
13720 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
13722 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
13728 phba->nsler = 1; in lpfc_get_sli4_parameters()
13730 phba->nsler = 0; in lpfc_get_sli4_parameters()
13755 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
13762 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
13763 if (!phba) in lpfc_pci_probe_one_s3()
13767 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
13772 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
13777 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
13779 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13785 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
13787 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13794 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
13796 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13802 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
13804 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13810 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
13813 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
13815 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13821 vport = phba->pport; in lpfc_pci_probe_one_s3()
13824 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
13831 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
13834 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
13836 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
13838 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
13844 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
13845 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s3()
13855 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
13857 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
13858 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
13861 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
13866 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
13873 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
13876 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
13881 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
13885 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
13887 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
13889 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
13891 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
13893 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
13895 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
13899 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
13918 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
13921 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
13923 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
13928 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
13930 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
13935 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
13951 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
13953 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
13955 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
13957 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
13958 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
13960 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
13961 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
13963 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
13968 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
13972 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
13980 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
13981 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s3()
13983 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
13986 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
13990 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
13993 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
13994 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
13996 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
14026 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
14028 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
14032 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
14033 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
14034 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
14037 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
14065 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
14069 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
14073 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
14074 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
14075 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
14076 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
14077 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
14084 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14086 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s3()
14090 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
14093 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
14094 lpfc_online(phba); in lpfc_pci_resume_one_s3()
14097 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
14110 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
14112 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_recover()
14119 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
14131 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
14133 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_reset()
14137 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
14140 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
14143 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_reset()
14146 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
14149 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
14150 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
14162 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
14164 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_prep_dev_for_perm_failure()
14167 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
14170 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
14173 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
14198 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
14203 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
14207 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14211 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
14215 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s3()
14217 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
14244 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
14245 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
14266 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14268 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
14271 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14273 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s3()
14278 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
14281 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
14282 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
14283 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
14286 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
14305 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
14308 lpfc_online(phba); in lpfc_io_resume_s3()
14318 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
14320 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
14322 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
14348 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
14350 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
14352 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
14359 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
14366 sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf); in lpfc_log_write_firmware_error()
14380 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14384 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14388 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14393 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
14397 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_log_write_firmware_error()
14401 offset, phba->pcidev->device, magic_number, in lpfc_log_write_firmware_error()
14417 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
14439 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
14441 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14452 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
14477 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
14480 rc = lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
14491 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14499 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
14506 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14509 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_write_firmware()
14522 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
14529 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
14533 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
14537 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
14538 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
14541 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
14543 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
14572 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
14579 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
14580 if (!phba) in lpfc_pci_probe_one_s4()
14583 INIT_LIST_HEAD(&phba->poll_list); in lpfc_pci_probe_one_s4()
14586 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14591 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
14596 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
14598 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14604 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
14606 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14611 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
14612 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
14615 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14617 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14623 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
14626 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
14629 phba->pport = NULL; in lpfc_pci_probe_one_s4()
14630 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
14633 lpfc_cpu_map_array_init(phba); in lpfc_pci_probe_one_s4()
14636 lpfc_hba_eq_hdl_array_init(phba); in lpfc_pci_probe_one_s4()
14639 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
14641 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14647 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
14648 phba->cfg_irq_chann = 1; in lpfc_pci_probe_one_s4()
14649 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14650 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
14651 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
14654 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_pci_probe_one_s4()
14657 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
14659 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14663 vport = phba->pport; in lpfc_pci_probe_one_s4()
14669 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
14675 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
14676 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14683 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
14684 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
14687 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
14692 if (phba->nvmet_support == 0) { in lpfc_pci_probe_one_s4()
14693 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
14701 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_probe_one_s4()
14710 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
14711 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
14714 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
14717 lpfc_sli4_ras_setup(phba); in lpfc_pci_probe_one_s4()
14719 timer_setup(&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer, 0); in lpfc_pci_probe_one_s4()
14720 cpuhp_state_add_instance_nocalls(lpfc_cpuhp_state, &phba->cpuhp); in lpfc_pci_probe_one_s4()
14727 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
14729 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
14731 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
14733 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
14735 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
14737 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
14741 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
14760 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
14764 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
14766 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
14767 if (phba->cgn_i) in lpfc_pci_remove_one_s4()
14768 lpfc_unreg_congestion_buf(phba); in lpfc_pci_remove_one_s4()
14773 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
14775 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
14780 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
14790 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
14794 if (phba->cfg_xri_rebalancing) in lpfc_pci_remove_one_s4()
14795 lpfc_destroy_multixri_pools(phba); in lpfc_pci_remove_one_s4()
14804 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
14805 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
14807 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
14812 lpfc_io_free(phba); in lpfc_pci_remove_one_s4()
14813 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
14814 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
14816 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
14817 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
14820 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
14824 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
14827 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
14856 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
14858 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
14862 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
14863 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
14864 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
14867 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
14868 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
14896 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
14900 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
14904 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
14905 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
14906 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
14907 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
14908 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
14915 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
14917 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one_s4()
14921 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
14924 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
14925 lpfc_online(phba); in lpfc_pci_resume_one_s4()
14928 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
14941 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
14943 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_recover()
14949 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
14961 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
14963 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_reset()
14967 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
14970 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_reset()
14973 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_reset()
14976 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
14979 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
14980 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
14981 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
14993 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
14995 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_prep_dev_for_perm_failure()
14999 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15002 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15005 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
15028 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
15033 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
15037 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15041 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
15045 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected_s4()
15047 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
15074 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
15075 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
15096 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15098 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
15101 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15103 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset_s4()
15108 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
15111 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
15130 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
15138 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
15140 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_resume_s4()
15141 lpfc_offline(phba); in lpfc_io_resume_s4()
15142 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
15144 lpfc_online(phba); in lpfc_io_resume_s4()
15198 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
15200 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
15208 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_remove_one()
15210 phba->pci_dev_grp); in lpfc_pci_remove_one()
15233 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
15236 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
15244 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_suspend_one()
15246 phba->pci_dev_grp); in lpfc_pci_suspend_one()
15269 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
15272 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
15280 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_pci_resume_one()
15282 phba->pci_dev_grp); in lpfc_pci_resume_one()
15307 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
15310 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
15318 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_error_detected()
15320 phba->pci_dev_grp); in lpfc_io_error_detected()
15344 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
15347 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
15355 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_slot_reset()
15357 phba->pci_dev_grp); in lpfc_io_slot_reset()
15377 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
15379 switch (phba->pci_dev_grp) { in lpfc_io_resume()
15387 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_io_resume()
15389 phba->pci_dev_grp); in lpfc_io_resume()
15406 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
15409 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
15412 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
15413 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
15415 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
15416 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
15417 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
15431 lpfc_sli4_ras_init(struct lpfc_hba *phba) in lpfc_sli4_ras_init() argument
15434 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15436 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_sli4_ras_init()
15438 phba->ras_fwlog.ras_hwsupport = true; in lpfc_sli4_ras_init()
15439 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && in lpfc_sli4_ras_init()
15440 phba->cfg_ras_fwlog_buffsize) in lpfc_sli4_ras_init()
15441 phba->ras_fwlog.ras_enabled = true; in lpfc_sli4_ras_init()
15443 phba->ras_fwlog.ras_enabled = false; in lpfc_sli4_ras_init()
15445 phba->ras_fwlog.ras_hwsupport = false; in lpfc_sli4_ras_init()
15550 void lpfc_dmp_dbg(struct lpfc_hba *phba) in lpfc_dmp_dbg() argument
15564 if (phba->cfg_log_verbose) in lpfc_dmp_dbg()
15567 spin_lock_irqsave(&phba->port_list_lock, iflags); in lpfc_dmp_dbg()
15568 list_for_each_entry(port_iterator, &phba->port_list, listentry) { in lpfc_dmp_dbg()
15578 spin_unlock_irqrestore(&phba->port_list_lock, in lpfc_dmp_dbg()
15584 spin_unlock_irqrestore(&phba->port_list_lock, iflags); in lpfc_dmp_dbg()
15586 if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0) in lpfc_dmp_dbg()
15589 start_idx = (unsigned int)atomic_read(&phba->dbg_log_idx) % DBG_LOG_SZ; in lpfc_dmp_dbg()
15590 dbg_cnt = (unsigned int)atomic_read(&phba->dbg_log_cnt); in lpfc_dmp_dbg()
15607 dev_info(&phba->pcidev->dev, "start %d end %d cnt %d\n", in lpfc_dmp_dbg()
15615 rem_nsec = do_div(phba->dbg_log[temp_idx].t_ns, NSEC_PER_SEC); in lpfc_dmp_dbg()
15616 dev_info(&phba->pcidev->dev, "%d: [%5lu.%06lu] %s", in lpfc_dmp_dbg()
15618 (unsigned long)phba->dbg_log[temp_idx].t_ns, in lpfc_dmp_dbg()
15620 phba->dbg_log[temp_idx].log); in lpfc_dmp_dbg()
15623 atomic_set(&phba->dbg_log_cnt, 0); in lpfc_dmp_dbg()
15624 atomic_set(&phba->dbg_log_dmping, 0); in lpfc_dmp_dbg()
15628 void lpfc_dbg_print(struct lpfc_hba *phba, const char *fmt, ...) in lpfc_dbg_print() argument
15632 int dbg_dmping = atomic_read(&phba->dbg_log_dmping); in lpfc_dbg_print()
15640 dev_info(&phba->pcidev->dev, "%pV", &vaf); in lpfc_dbg_print()
15644 idx = (unsigned int)atomic_fetch_add(1, &phba->dbg_log_idx) % in lpfc_dbg_print()
15647 atomic_inc(&phba->dbg_log_cnt); in lpfc_dbg_print()
15649 vscnprintf(phba->dbg_log[idx].log, in lpfc_dbg_print()
15650 sizeof(phba->dbg_log[idx].log), fmt, args); in lpfc_dbg_print()
15653 phba->dbg_log[idx].t_ns = local_clock(); in lpfc_dbg_print()