Lines Matching refs:phba

83 static int lpfc_hba_down_post_s3(struct lpfc_hba *phba);
84 static int lpfc_hba_down_post_s4(struct lpfc_hba *phba);
90 static void lpfc_sli4_oas_verify(struct lpfc_hba *phba);
114 lpfc_config_port_prep(struct lpfc_hba *phba) in lpfc_config_port_prep() argument
116 lpfc_vpd_t *vp = &phba->vpd; in lpfc_config_port_prep()
126 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_prep()
128 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_prep()
133 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_config_port_prep()
135 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port_prep()
144 lpfc_read_nv(phba, pmb); in lpfc_config_port_prep()
150 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
153 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_config_port_prep()
158 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
161 memcpy(phba->wwnn, (char *)mb->un.varRDnvp.nodename, in lpfc_config_port_prep()
162 sizeof(phba->wwnn)); in lpfc_config_port_prep()
163 memcpy(phba->wwpn, (char *)mb->un.varRDnvp.portname, in lpfc_config_port_prep()
164 sizeof(phba->wwpn)); in lpfc_config_port_prep()
171 phba->sli3_options &= (uint32_t)LPFC_SLI3_BG_ENABLED; in lpfc_config_port_prep()
174 lpfc_read_rev(phba, pmb); in lpfc_config_port_prep()
175 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
177 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_prep()
181 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
192 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_prep()
195 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
199 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) { in lpfc_config_port_prep()
200 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
227 phba->sli3_options |= LPFC_SLI3_VPORT_TEARDOWN; in lpfc_config_port_prep()
229 if (lpfc_is_LC_HBA(phba->pcidev->device)) in lpfc_config_port_prep()
230 memcpy(phba->RandomData, (char *)&mb->un.varWords[24], in lpfc_config_port_prep()
231 sizeof (phba->RandomData)); in lpfc_config_port_prep()
238 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD); in lpfc_config_port_prep()
239 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
242 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_config_port_prep()
260 lpfc_parse_vpd(phba, lpfc_vpd_data, offset); in lpfc_config_port_prep()
264 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
279 lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_config_async_cmpl() argument
282 phba->temp_sensor_support = 1; in lpfc_config_async_cmpl()
284 phba->temp_sensor_support = 0; in lpfc_config_async_cmpl()
285 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_config_async_cmpl()
300 lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_dump_wakeup_param_cmpl() argument
309 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
323 snprintf(phba->OptionROMVersion, 32, "%d.%d%d", in lpfc_dump_wakeup_param_cmpl()
326 snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", in lpfc_dump_wakeup_param_cmpl()
329 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
349 if (vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
350 u64_to_wwn(vport->phba->cfg_soft_wwnn, in lpfc_update_vport_wwn()
352 if (vport->phba->cfg_soft_wwpn) in lpfc_update_vport_wwn()
353 u64_to_wwn(vport->phba->cfg_soft_wwpn, in lpfc_update_vport_wwn()
360 if (vport->fc_nodename.u.wwn[0] == 0 || vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
377 vport->phba->cfg_soft_wwpn || in lpfc_update_vport_wwn()
405 lpfc_config_port_post(struct lpfc_hba *phba) in lpfc_config_port_post() argument
407 struct lpfc_vport *vport = phba->pport; in lpfc_config_port_post()
412 struct lpfc_sli *psli = &phba->sli; in lpfc_config_port_post()
417 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
422 if (phba->over_temp_state == HBA_OVER_TEMP) in lpfc_config_port_post()
423 phba->over_temp_state = HBA_NORMAL_TEMP; in lpfc_config_port_post()
424 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
426 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
428 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
434 rc = lpfc_read_sparam(phba, pmb, 0); in lpfc_config_port_post()
436 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
441 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
442 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_post()
446 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
448 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
449 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
457 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
465 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_config_port_post()
469 if (phba->SerialNumber[0] == 0) { in lpfc_config_port_post()
477 phba->SerialNumber[i] = in lpfc_config_port_post()
480 phba->SerialNumber[i] = in lpfc_config_port_post()
485 phba->SerialNumber[i] = in lpfc_config_port_post()
488 phba->SerialNumber[i] = in lpfc_config_port_post()
493 lpfc_read_config(phba, pmb); in lpfc_config_port_post()
495 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
496 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_post()
500 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
501 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
506 lpfc_sli_read_link_ste(phba); in lpfc_config_port_post()
510 if (phba->cfg_hba_queue_depth > i) { in lpfc_config_port_post()
511 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
513 phba->cfg_hba_queue_depth, i); in lpfc_config_port_post()
514 phba->cfg_hba_queue_depth = i; in lpfc_config_port_post()
519 if (phba->pport->cfg_lun_queue_depth > i) { in lpfc_config_port_post()
520 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
522 phba->pport->cfg_lun_queue_depth, i); in lpfc_config_port_post()
523 phba->pport->cfg_lun_queue_depth = i; in lpfc_config_port_post()
526 phba->lmt = mb->un.varRdConfig.lmt; in lpfc_config_port_post()
529 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_config_port_post()
531 phba->link_state = LPFC_LINK_DOWN; in lpfc_config_port_post()
540 if (phba->sli_rev != 3) in lpfc_config_port_post()
541 lpfc_post_rcv_buf(phba); in lpfc_config_port_post()
546 if (phba->intr_type == MSIX) { in lpfc_config_port_post()
547 rc = lpfc_config_msi(phba, pmb); in lpfc_config_port_post()
549 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
552 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_post()
554 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_config_port_post()
559 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
564 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
566 phba->hba_flag &= ~HBA_ERATT_HANDLED; in lpfc_config_port_post()
569 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_config_port_post()
570 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
583 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && in lpfc_config_port_post()
584 (phba->cfg_poll & DISABLE_FCP_RING_INT)) in lpfc_config_port_post()
587 writel(status, phba->HCregaddr); in lpfc_config_port_post()
588 readl(phba->HCregaddr); /* flush */ in lpfc_config_port_post()
589 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
592 timeout = phba->fc_ratov * 2; in lpfc_config_port_post()
596 mod_timer(&phba->hb_tmofunc, in lpfc_config_port_post()
598 phba->hb_outstanding = 0; in lpfc_config_port_post()
599 phba->last_completion_time = jiffies; in lpfc_config_port_post()
601 mod_timer(&phba->eratt_poll, in lpfc_config_port_post()
602 jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); in lpfc_config_port_post()
604 if (phba->hba_flag & LINK_DISABLED) { in lpfc_config_port_post()
605 lpfc_printf_log(phba, in lpfc_config_port_post()
608 lpfc_down_link(phba, pmb); in lpfc_config_port_post()
610 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
612 lpfc_printf_log(phba, in lpfc_config_port_post()
617 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
620 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_config_port_post()
621 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
622 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_config_port_post()
627 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
629 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
633 lpfc_config_async(phba, pmb, LPFC_ELS_RING); in lpfc_config_port_post()
635 pmb->vport = phba->pport; in lpfc_config_port_post()
636 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
639 lpfc_printf_log(phba, in lpfc_config_port_post()
645 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
649 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
651 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
655 lpfc_dump_wakeup_param(phba, pmb); in lpfc_config_port_post()
657 pmb->vport = phba->pport; in lpfc_config_port_post()
658 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
661 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0435 Adapter failed " in lpfc_config_port_post()
663 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
684 lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_init_link() argument
686 return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); in lpfc_hba_init_link()
705 lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, in lpfc_hba_init_link_fc_topology() argument
708 struct lpfc_vport *vport = phba->pport; in lpfc_hba_init_link_fc_topology()
713 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_init_link_fc_topology()
715 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
721 if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || in lpfc_hba_init_link_fc_topology()
722 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && in lpfc_hba_init_link_fc_topology()
723 !(phba->lmt & LMT_1Gb)) || in lpfc_hba_init_link_fc_topology()
724 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && in lpfc_hba_init_link_fc_topology()
725 !(phba->lmt & LMT_2Gb)) || in lpfc_hba_init_link_fc_topology()
726 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && in lpfc_hba_init_link_fc_topology()
727 !(phba->lmt & LMT_4Gb)) || in lpfc_hba_init_link_fc_topology()
728 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && in lpfc_hba_init_link_fc_topology()
729 !(phba->lmt & LMT_8Gb)) || in lpfc_hba_init_link_fc_topology()
730 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && in lpfc_hba_init_link_fc_topology()
731 !(phba->lmt & LMT_10Gb)) || in lpfc_hba_init_link_fc_topology()
732 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && in lpfc_hba_init_link_fc_topology()
733 !(phba->lmt & LMT_16Gb)) || in lpfc_hba_init_link_fc_topology()
734 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && in lpfc_hba_init_link_fc_topology()
735 !(phba->lmt & LMT_32Gb)) || in lpfc_hba_init_link_fc_topology()
736 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) && in lpfc_hba_init_link_fc_topology()
737 !(phba->lmt & LMT_64Gb))) { in lpfc_hba_init_link_fc_topology()
739 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, in lpfc_hba_init_link_fc_topology()
742 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
743 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
745 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
747 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
748 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
749 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
751 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_hba_init_link_fc_topology()
755 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
757 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
758 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
760 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
761 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
763 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
765 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
768 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
770 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
789 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
794 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
796 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
800 lpfc_printf_log(phba, in lpfc_hba_down_link()
803 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
805 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
807 lpfc_printf_log(phba, in lpfc_hba_down_link()
812 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
816 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
833 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
838 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
840 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
841 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
844 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_hba_down_prep()
845 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
847 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
849 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
852 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
871 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
877 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
878 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli4_free_sp_events()
879 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
881 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli4_free_sp_events()
883 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
884 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli4_free_sp_events()
886 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
892 lpfc_sli_release_iocbq(phba, rspiocbq); in lpfc_sli4_free_sp_events()
898 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_free_sp_events()
915 lpfc_hba_free_post_buf(struct lpfc_hba *phba) in lpfc_hba_free_post_buf() argument
917 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_free_post_buf()
923 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) in lpfc_hba_free_post_buf()
924 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_free_post_buf()
928 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
930 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
936 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_hba_free_post_buf()
940 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
942 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
957 lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) in lpfc_hba_clean_txcmplq() argument
959 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_clean_txcmplq()
966 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_hba_clean_txcmplq()
969 spin_lock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
976 spin_unlock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
978 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
981 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
985 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_hba_clean_txcmplq()
996 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
999 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
1016 lpfc_hba_down_post_s3(struct lpfc_hba *phba) in lpfc_hba_down_post_s3() argument
1018 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s3()
1019 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s3()
1035 lpfc_hba_down_post_s4(struct lpfc_hba *phba) in lpfc_hba_down_post_s4() argument
1047 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_down_post_s4()
1048 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s4()
1056 spin_lock_irq(&phba->hbalock); /* required for lpfc_els_sgl_list and */ in lpfc_hba_down_post_s4()
1061 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1063 &phba->sli4_hba.lpfc_abts_els_sgl_list, list) in lpfc_hba_down_post_s4()
1066 list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, in lpfc_hba_down_post_s4()
1067 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_hba_down_post_s4()
1070 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1076 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_hba_down_post_s4()
1077 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_hba_down_post_s4()
1097 spin_unlock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1099 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_hba_down_post_s4()
1100 spin_lock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1101 list_splice_init(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list, in lpfc_hba_down_post_s4()
1103 spin_unlock_irq(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_hba_down_post_s4()
1106 lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf); in lpfc_hba_down_post_s4()
1110 lpfc_sli4_free_sp_events(phba); in lpfc_hba_down_post_s4()
1126 lpfc_hba_down_post(struct lpfc_hba *phba) in lpfc_hba_down_post() argument
1128 return (*phba->lpfc_hba_down_post)(phba); in lpfc_hba_down_post()
1146 struct lpfc_hba *phba; in lpfc_hb_timeout() local
1150 phba = from_timer(phba, t, hb_tmofunc); in lpfc_hb_timeout()
1153 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1154 tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; in lpfc_hb_timeout()
1156 phba->pport->work_port_events |= WORKER_HB_TMO; in lpfc_hb_timeout()
1157 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1161 lpfc_worker_wake_up(phba); in lpfc_hb_timeout()
1180 struct lpfc_hba *phba; in lpfc_rrq_timeout() local
1183 phba = from_timer(phba, t, rrq_tmr); in lpfc_rrq_timeout()
1184 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1185 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1186 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1188 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1189 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1191 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1192 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1212 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1216 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1217 phba->hb_outstanding = 0; in lpfc_hb_mbox_cmpl()
1218 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1221 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1222 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && in lpfc_hb_mbox_cmpl()
1223 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1224 !(phba->pport->load_flag & FC_UNLOADING)) in lpfc_hb_mbox_cmpl()
1225 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1234 struct lpfc_hba *phba = container_of(to_delayed_work(work), in lpfc_hb_eq_delay_work() local
1243 if (!phba->cfg_auto_imax || phba->pport->load_flag & FC_UNLOADING) in lpfc_hb_eq_delay_work()
1246 if (phba->link_state == LPFC_HBA_ERROR || in lpfc_hb_eq_delay_work()
1247 phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_hb_eq_delay_work()
1255 if (phba->cfg_irq_chann > 1) { in lpfc_hb_eq_delay_work()
1257 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_hb_eq_delay_work()
1259 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_hb_eq_delay_work()
1273 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_hb_eq_delay_work()
1288 eqi_new = per_cpu_ptr(phba->sli4_hba.eq_info, in lpfc_hb_eq_delay_work()
1294 lpfc_modify_hba_eq_delay(phba, eq->hdwq, 1, in lpfc_hb_eq_delay_work()
1302 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_hb_eq_delay_work()
1313 static void lpfc_hb_mxp_handler(struct lpfc_hba *phba) in lpfc_hb_mxp_handler() argument
1318 hwq_count = phba->cfg_hdw_queue; in lpfc_hb_mxp_handler()
1321 lpfc_adjust_pvt_pool_count(phba, i); in lpfc_hb_mxp_handler()
1324 lpfc_adjust_high_watermark(phba, i); in lpfc_hb_mxp_handler()
1328 lpfc_snapshot_mxp(phba, i); in lpfc_hb_mxp_handler()
1350 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1356 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1359 if (phba->cfg_xri_rebalancing) { in lpfc_hb_timeout_handler()
1361 lpfc_hb_mxp_handler(phba); in lpfc_hb_timeout_handler()
1364 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1366 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_hb_timeout_handler()
1370 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1372 if ((phba->link_state == LPFC_HBA_ERROR) || in lpfc_hb_timeout_handler()
1373 (phba->pport->load_flag & FC_UNLOADING) || in lpfc_hb_timeout_handler()
1374 (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_hb_timeout_handler()
1377 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1379 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1382 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1383 if (!phba->hb_outstanding) in lpfc_hb_timeout_handler()
1384 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1388 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1393 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1395 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1396 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1397 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1398 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1399 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1400 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1401 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1406 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1410 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1413 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1414 if (!phba->hb_outstanding) { in lpfc_hb_timeout_handler()
1417 pmboxq = mempool_alloc(phba->mbox_mem_pool, in lpfc_hb_timeout_handler()
1420 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1427 lpfc_heart_beat(phba, pmboxq); in lpfc_hb_timeout_handler()
1429 pmboxq->vport = phba->pport; in lpfc_hb_timeout_handler()
1430 retval = lpfc_sli_issue_mbox(phba, pmboxq, in lpfc_hb_timeout_handler()
1436 phba->mbox_mem_pool); in lpfc_hb_timeout_handler()
1437 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1443 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1444 phba->hb_outstanding = 1; in lpfc_hb_timeout_handler()
1445 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1446 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1447 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1451 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1453 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1455 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1465 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1469 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1470 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1475 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1489 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1491 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1493 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1495 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1496 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1498 lpfc_offline(phba); in lpfc_offline_eratt()
1499 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1500 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1501 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1502 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1503 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1504 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1505 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1506 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1518 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1520 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1521 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1522 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1524 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1525 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_offline_eratt()
1526 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1527 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1528 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1541 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1543 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1544 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1549 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1550 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1551 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1552 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1556 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_deferred_eratt()
1559 phba->work_hs, in lpfc_handle_deferred_eratt()
1560 phba->work_status[0], phba->work_status[1]); in lpfc_handle_deferred_eratt()
1562 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1564 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1572 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1578 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1579 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1582 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1584 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1585 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1589 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_handle_deferred_eratt()
1590 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1600 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_deferred_eratt()
1601 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1603 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1604 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1605 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1606 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1607 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1611 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1618 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1636 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1638 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1639 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1648 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1649 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1650 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_eratt_s3()
1651 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1656 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1660 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1662 if (phba->hba_flag & DEFER_ERATT) in lpfc_handle_eratt_s3()
1663 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1665 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1666 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1668 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1671 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1672 phba->work_status[1]); in lpfc_handle_eratt_s3()
1673 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1675 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1678 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1679 phba->work_status[1]); in lpfc_handle_eratt_s3()
1681 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1683 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1691 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1697 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1698 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1699 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1700 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1701 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1704 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1705 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1706 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1711 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s3()
1715 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1716 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1718 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1725 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1726 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1727 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1728 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1735 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s3()
1738 phba->work_hs, in lpfc_handle_eratt_s3()
1739 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1747 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1764 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1770 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_port_sta_fn_reset()
1776 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1783 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1786 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1787 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_port_sta_fn_reset()
1788 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1790 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1791 rc = lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1793 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1798 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1800 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1804 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1805 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1807 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1820 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1822 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
1838 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s4()
1839 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1841 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1846 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_handle_eratt_s4()
1850 phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_handle_eratt_s4()
1853 phba->sli4_hba.u.if_type0.UEMASKLOregaddr, in lpfc_handle_eratt_s4()
1858 if (!(phba->hba_flag & HBA_RECOVERABLE_UE)) { in lpfc_handle_eratt_s4()
1859 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1862 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1865 for (i = 0; i < phba->sli4_hba.ue_to_sr / 1000; i++) { in lpfc_handle_eratt_s4()
1866 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
1879 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1888 if (!lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_handle_eratt_s4()
1893 rc = lpfc_sli4_port_sta_fn_reset(phba, in lpfc_handle_eratt_s4()
1897 lpfc_printf_log(phba, in lpfc_handle_eratt_s4()
1904 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1907 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
1913 phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_handle_eratt_s4()
1917 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1919 readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); in lpfc_handle_eratt_s4()
1920 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1923 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
1924 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
1926 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1931 phba->sfp_alarm |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_handle_eratt_s4()
1936 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
1943 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1944 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
1945 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1946 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1951 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1957 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1961 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1965 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
1969 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
1980 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1982 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_eratt_s4()
1988 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_handle_eratt_s4()
1991 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s4()
2012 lpfc_handle_eratt(struct lpfc_hba *phba) in lpfc_handle_eratt() argument
2014 (*phba->lpfc_handle_eratt)(phba); in lpfc_handle_eratt()
2025 lpfc_handle_latt(struct lpfc_hba *phba) in lpfc_handle_latt() argument
2027 struct lpfc_vport *vport = phba->pport; in lpfc_handle_latt()
2028 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_latt()
2034 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_handle_latt()
2046 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_handle_latt()
2053 lpfc_els_flush_all_cmd(phba); in lpfc_handle_latt()
2056 lpfc_read_topology(phba, pmb, mp); in lpfc_handle_latt()
2060 phba->sli.sli3_ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2061 rc = lpfc_sli_issue_mbox (phba, pmb, MBX_NOWAIT); in lpfc_handle_latt()
2068 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2069 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2070 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2071 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2076 phba->sli.sli3_ring[LPFC_ELS_RING].flag &= ~LPFC_STOP_IOCB_EVENT; in lpfc_handle_latt()
2077 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_handle_latt()
2081 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_handle_latt()
2084 spin_lock_irq(&phba->hbalock); in lpfc_handle_latt()
2086 control = readl(phba->HCregaddr); in lpfc_handle_latt()
2088 writel(control, phba->HCregaddr); in lpfc_handle_latt()
2089 readl(phba->HCregaddr); /* flush */ in lpfc_handle_latt()
2092 writel(HA_LATT, phba->HAregaddr); in lpfc_handle_latt()
2093 readl(phba->HAregaddr); /* flush */ in lpfc_handle_latt()
2094 spin_unlock_irq(&phba->hbalock); in lpfc_handle_latt()
2095 lpfc_linkdown(phba); in lpfc_handle_latt()
2096 phba->link_state = LPFC_HBA_ERROR; in lpfc_handle_latt()
2098 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_handle_latt()
2119 lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) in lpfc_parse_vpd() argument
2131 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_parse_vpd()
2165 phba->SerialNumber[j++] = vpd[index++]; in lpfc_parse_vpd()
2169 phba->SerialNumber[j] = 0; in lpfc_parse_vpd()
2173 phba->vpd_flag |= VPD_MODEL_DESC; in lpfc_parse_vpd()
2180 phba->ModelDesc[j++] = vpd[index++]; in lpfc_parse_vpd()
2184 phba->ModelDesc[j] = 0; in lpfc_parse_vpd()
2188 phba->vpd_flag |= VPD_MODEL_NAME; in lpfc_parse_vpd()
2195 phba->ModelName[j++] = vpd[index++]; in lpfc_parse_vpd()
2199 phba->ModelName[j] = 0; in lpfc_parse_vpd()
2203 phba->vpd_flag |= VPD_PROGRAM_TYPE; in lpfc_parse_vpd()
2210 phba->ProgramType[j++] = vpd[index++]; in lpfc_parse_vpd()
2214 phba->ProgramType[j] = 0; in lpfc_parse_vpd()
2218 phba->vpd_flag |= VPD_PORT; in lpfc_parse_vpd()
2225 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_parse_vpd()
2226 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
2231 phba->Port[j++] = vpd[index++]; in lpfc_parse_vpd()
2235 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_parse_vpd()
2236 (phba->sli4_hba.pport_name_sta == in lpfc_parse_vpd()
2238 phba->Port[j] = 0; in lpfc_parse_vpd()
2276 lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp) in lpfc_get_hba_model_desc() argument
2279 uint16_t dev_id = phba->pcidev->device; in lpfc_get_hba_model_desc()
2293 if (phba->lmt & LMT_64Gb) in lpfc_get_hba_model_desc()
2295 else if (phba->lmt & LMT_32Gb) in lpfc_get_hba_model_desc()
2297 else if (phba->lmt & LMT_16Gb) in lpfc_get_hba_model_desc()
2299 else if (phba->lmt & LMT_10Gb) in lpfc_get_hba_model_desc()
2301 else if (phba->lmt & LMT_8Gb) in lpfc_get_hba_model_desc()
2303 else if (phba->lmt & LMT_4Gb) in lpfc_get_hba_model_desc()
2305 else if (phba->lmt & LMT_2Gb) in lpfc_get_hba_model_desc()
2307 else if (phba->lmt & LMT_1Gb) in lpfc_get_hba_model_desc()
2312 vp = &phba->vpd; in lpfc_get_hba_model_desc()
2518 phba->Port); in lpfc_get_hba_model_desc()
2544 lpfc_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt) in lpfc_post_buffer() argument
2555 iocb = lpfc_sli_get_iocbq(phba); in lpfc_post_buffer()
2566 mp1->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp1->phys); in lpfc_post_buffer()
2569 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2579 mp2->virt = lpfc_mbuf_alloc(phba, MEM_PRI, in lpfc_post_buffer()
2583 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2585 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2611 if (lpfc_sli_issue_iocb(phba, pring->ringno, iocb, 0) == in lpfc_post_buffer()
2613 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); in lpfc_post_buffer()
2617 lpfc_mbuf_free(phba, mp2->virt, mp2->phys); in lpfc_post_buffer()
2621 lpfc_sli_release_iocbq(phba, iocb); in lpfc_post_buffer()
2625 lpfc_sli_ringpostbuf_put(phba, pring, mp1); in lpfc_post_buffer()
2627 lpfc_sli_ringpostbuf_put(phba, pring, mp2); in lpfc_post_buffer()
2645 lpfc_post_rcv_buf(struct lpfc_hba *phba) in lpfc_post_rcv_buf() argument
2647 struct lpfc_sli *psli = &phba->sli; in lpfc_post_rcv_buf()
2650 lpfc_post_buffer(phba, &psli->sli3_ring[LPFC_ELS_RING], LPFC_BUF_RING0); in lpfc_post_rcv_buf()
2756 lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit) in lpfc_hba_init() argument
2760 uint32_t *pwwnn = (uint32_t *) phba->wwnn; in lpfc_hba_init()
2770 lpfc_challenge_key(phba->RandomData + t, HashWorking + t); in lpfc_hba_init()
2789 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup() local
2793 if (phba->link_state > LPFC_LINK_DOWN) in lpfc_cleanup()
2802 spin_lock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2804 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2809 spin_lock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2812 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2817 spin_unlock_irq(&phba->ndlp_lock); in lpfc_cleanup()
2894 __lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in __lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2897 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2900 del_timer(&phba->fcf.redisc_wait); in __lpfc_sli4_stop_fcf_redisc_wait_timer()
2913 lpfc_sli4_stop_fcf_redisc_wait_timer(struct lpfc_hba *phba) in lpfc_sli4_stop_fcf_redisc_wait_timer() argument
2915 spin_lock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2916 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_stop_fcf_redisc_wait_timer()
2918 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2921 __lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2923 phba->fcf.fcf_flag &= ~(FCF_DEAD_DISC | FCF_ACVL_DISC); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2924 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_stop_fcf_redisc_wait_timer()
2935 lpfc_stop_hba_timers(struct lpfc_hba *phba) in lpfc_stop_hba_timers() argument
2937 if (phba->pport) in lpfc_stop_hba_timers()
2938 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
2939 cancel_delayed_work_sync(&phba->eq_delay_work); in lpfc_stop_hba_timers()
2940 del_timer_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
2941 del_timer_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
2942 del_timer_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
2943 del_timer_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
2944 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
2945 del_timer_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
2946 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_stop_hba_timers()
2948 phba->hb_outstanding = 0; in lpfc_stop_hba_timers()
2950 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
2953 del_timer_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
2957 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
2960 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_stop_hba_timers()
2962 phba->pci_dev_grp); in lpfc_stop_hba_timers()
2979 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
2985 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2986 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
2987 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2991 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2992 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
2993 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
2997 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
2998 phba->sli.mbox_active) * 1000) + jiffies; in lpfc_block_mgmt_io()
3000 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3003 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3007 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_block_mgmt_io()
3010 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
3025 lpfc_sli4_node_prep(struct lpfc_hba *phba) in lpfc_sli4_node_prep() argument
3032 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_prep()
3035 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_prep()
3039 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_sli4_node_prep()
3048 rpi = lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_prep()
3050 spin_lock_irqsave(&phba->ndlp_lock, flags); in lpfc_sli4_node_prep()
3052 spin_unlock_irqrestore(&phba->ndlp_lock, flags); in lpfc_sli4_node_prep()
3063 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_prep()
3073 static void lpfc_create_expedite_pool(struct lpfc_hba *phba) in lpfc_create_expedite_pool() argument
3081 epd_pool = &phba->epd_pool; in lpfc_create_expedite_pool()
3082 qp = &phba->sli4_hba.hdwq[0]; in lpfc_create_expedite_pool()
3108 static void lpfc_destroy_expedite_pool(struct lpfc_hba *phba) in lpfc_destroy_expedite_pool() argument
3116 epd_pool = &phba->epd_pool; in lpfc_destroy_expedite_pool()
3117 qp = &phba->sli4_hba.hdwq[0]; in lpfc_destroy_expedite_pool()
3141 void lpfc_create_multixri_pools(struct lpfc_hba *phba) in lpfc_create_multixri_pools() argument
3154 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3156 phba->cfg_hdw_queue, phba->sli4_hba.num_present_cpu, in lpfc_create_multixri_pools()
3157 phba->sli4_hba.io_xri_cnt); in lpfc_create_multixri_pools()
3159 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3160 lpfc_create_expedite_pool(phba); in lpfc_create_multixri_pools()
3162 hwq_count = phba->cfg_hdw_queue; in lpfc_create_multixri_pools()
3163 count_per_hwq = phba->sli4_hba.io_xri_cnt / hwq_count; in lpfc_create_multixri_pools()
3169 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3173 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_create_multixri_pools()
3174 lpfc_destroy_expedite_pool(phba); in lpfc_create_multixri_pools()
3178 qp = &phba->sli4_hba.hdwq[j]; in lpfc_create_multixri_pools()
3182 phba->cfg_xri_rebalancing = 0; in lpfc_create_multixri_pools()
3186 qp = &phba->sli4_hba.hdwq[i]; in lpfc_create_multixri_pools()
3204 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_multixri_pools()
3228 static void lpfc_destroy_multixri_pools(struct lpfc_hba *phba) in lpfc_destroy_multixri_pools() argument
3240 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_destroy_multixri_pools()
3241 lpfc_destroy_expedite_pool(phba); in lpfc_destroy_multixri_pools()
3243 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_destroy_multixri_pools()
3244 lpfc_sli_flush_io_rings(phba); in lpfc_destroy_multixri_pools()
3246 hwq_count = phba->cfg_hdw_queue; in lpfc_destroy_multixri_pools()
3249 qp = &phba->sli4_hba.hdwq[i]; in lpfc_destroy_multixri_pools()
3262 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3283 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_destroy_multixri_pools()
3318 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
3325 if (!phba) in lpfc_online()
3327 vport = phba->pport; in lpfc_online()
3332 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
3335 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
3337 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3338 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
3339 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3342 spin_lock_irq(&phba->hbalock); in lpfc_online()
3343 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
3345 spin_unlock_irq(&phba->hbalock); in lpfc_online()
3350 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_online()
3351 !phba->nvmet_support) { in lpfc_online()
3352 error = lpfc_nvme_create_localport(phba->pport); in lpfc_online()
3354 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_online()
3359 lpfc_sli_queue_init(phba); in lpfc_online()
3360 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
3361 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3366 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
3368 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
3373 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
3375 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3385 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
3387 if (phba->cfg_xri_rebalancing) in lpfc_online()
3388 lpfc_create_multixri_pools(phba); in lpfc_online()
3390 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3406 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
3410 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3411 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
3412 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3424 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
3426 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
3435 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
3437 lpfc_linkdown(phba); in lpfc_offline_prep()
3440 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
3442 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
3474 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_offline_prep()
3484 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); in lpfc_offline_prep()
3490 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
3492 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
3494 if (phba->wq) in lpfc_offline_prep()
3495 flush_workqueue(phba->wq); in lpfc_offline_prep()
3507 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
3513 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3517 lpfc_stop_port(phba); in lpfc_offline()
3522 lpfc_nvmet_destroy_targetport(phba); in lpfc_offline()
3523 lpfc_nvme_destroy_localport(phba->pport); in lpfc_offline()
3525 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3527 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
3529 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3530 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3534 lpfc_sli_hba_down(phba); in lpfc_offline()
3535 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3536 phba->work_ha = 0; in lpfc_offline()
3537 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3538 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3540 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3547 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3549 if (phba->cfg_xri_rebalancing) in lpfc_offline()
3550 lpfc_destroy_multixri_pools(phba); in lpfc_offline()
3562 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3566 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_scsi_free()
3569 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3573 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3574 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3577 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3580 phba->total_scsi_bufs--; in lpfc_scsi_free()
3582 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3584 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3585 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3588 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3591 phba->total_scsi_bufs--; in lpfc_scsi_free()
3593 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3594 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
3606 lpfc_io_free(struct lpfc_hba *phba) in lpfc_io_free() argument
3612 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_free()
3613 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_free()
3621 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
3623 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
3624 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3625 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3637 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_io_free()
3639 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_io_free()
3640 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3641 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_io_free()
3662 lpfc_sli4_els_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_els_sgl_update() argument
3672 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_els_sgl_update()
3674 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
3676 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_els_sgl_update()
3677 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3679 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
3686 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_els_sgl_update()
3693 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_els_sgl_update()
3697 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_els_sgl_update()
3708 spin_lock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3709 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3711 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
3712 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3713 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3714 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
3716 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_els_sgl_update()
3717 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3719 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
3721 spin_lock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3722 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3723 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, in lpfc_sli4_els_sgl_update()
3730 __lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_els_sgl_update()
3736 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
3737 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3738 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3740 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3743 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_els_sgl_update()
3749 &phba->sli4_hba.lpfc_els_sgl_list, list) { in lpfc_sli4_els_sgl_update()
3750 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_els_sgl_update()
3752 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_els_sgl_update()
3759 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_els_sgl_update()
3764 lpfc_free_els_sgl_list(phba); in lpfc_sli4_els_sgl_update()
3781 lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_nvmet_sgl_update() argument
3792 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_nvmet_sgl_update()
3795 nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3796 if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
3798 xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3799 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3801 phba->sli4_hba.nvmet_xri_cnt, nvmet_xri_cnt); in lpfc_sli4_nvmet_sgl_update()
3807 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3814 sglq_entry->virt = lpfc_nvmet_buf_alloc(phba, 0, in lpfc_sli4_nvmet_sgl_update()
3818 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3826 phba->cfg_sg_dma_buf_size); in lpfc_sli4_nvmet_sgl_update()
3830 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3831 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3833 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
3834 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3835 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3836 } else if (nvmet_xri_cnt < phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
3838 xri_cnt = phba->sli4_hba.nvmet_xri_cnt - nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3839 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3841 "%d to %d\n", phba->sli4_hba.nvmet_xri_cnt, in lpfc_sli4_nvmet_sgl_update()
3843 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3844 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3845 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, in lpfc_sli4_nvmet_sgl_update()
3852 lpfc_nvmet_buf_free(phba, sglq_entry->virt, in lpfc_sli4_nvmet_sgl_update()
3858 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
3859 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3860 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3862 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3865 phba->sli4_hba.nvmet_xri_cnt = nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3871 &phba->sli4_hba.lpfc_nvmet_sgl_list, list) { in lpfc_sli4_nvmet_sgl_update()
3872 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_nvmet_sgl_update()
3874 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3881 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_nvmet_sgl_update()
3886 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_nvmet_sgl_update()
3891 lpfc_io_buf_flush(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_flush() argument
3900 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_flush()
3901 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_flush()
3953 lpfc_io_buf_replenish(struct lpfc_hba *phba, struct list_head *cbuf) in lpfc_io_buf_replenish() argument
3959 qp = phba->sli4_hba.hdwq; in lpfc_io_buf_replenish()
3962 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_io_buf_replenish()
3968 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf_replenish()
3997 lpfc_sli4_io_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_io_sgl_update() argument
4010 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_io_sgl_update()
4011 io_xri_max = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_io_sgl_update()
4012 phba->sli4_hba.io_xri_max = io_xri_max; in lpfc_sli4_io_sgl_update()
4014 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_io_sgl_update()
4017 phba->sli4_hba.io_xri_cnt, in lpfc_sli4_io_sgl_update()
4018 phba->sli4_hba.io_xri_max); in lpfc_sli4_io_sgl_update()
4020 cnt = lpfc_io_buf_flush(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4022 if (phba->sli4_hba.io_xri_cnt > phba->sli4_hba.io_xri_max) { in lpfc_sli4_io_sgl_update()
4024 io_xri_cnt = phba->sli4_hba.io_xri_cnt - in lpfc_sli4_io_sgl_update()
4025 phba->sli4_hba.io_xri_max; in lpfc_sli4_io_sgl_update()
4031 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_sli4_io_sgl_update()
4037 phba->sli4_hba.io_xri_cnt -= io_xri_cnt; in lpfc_sli4_io_sgl_update()
4043 phba->sli4_hba.io_xri_cnt = cnt; in lpfc_sli4_io_sgl_update()
4046 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_io_sgl_update()
4048 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_io_sgl_update()
4055 lpfc_ncmd->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_io_sgl_update()
4057 cnt = lpfc_io_buf_replenish(phba, &io_sgl_list); in lpfc_sli4_io_sgl_update()
4061 lpfc_io_free(phba); in lpfc_sli4_io_sgl_update()
4080 lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) in lpfc_new_io_buf() argument
4090 phba->sli4_hba.io_xri_cnt = 0; in lpfc_new_io_buf()
4100 lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4108 if (phba->cfg_xpsgl && !phba->nvmet_support) { in lpfc_new_io_buf()
4115 if ((phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_new_io_buf()
4118 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_new_io_buf()
4122 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4132 lxri = lpfc_sli4_next_xritag(phba); in lpfc_new_io_buf()
4134 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4142 iotag = lpfc_sli_next_iotag(phba, pwqeq); in lpfc_new_io_buf()
4144 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_io_buf()
4147 lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR, in lpfc_new_io_buf()
4150 lpfc_sli4_free_xri(phba, lxri); in lpfc_new_io_buf()
4154 pwqeq->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_new_io_buf()
4165 phba->sli4_hba.io_xri_cnt++; in lpfc_new_io_buf()
4167 lpfc_printf_log(phba, KERN_INFO, LOG_NVME, in lpfc_new_io_buf()
4174 phba, &post_nblist, bcnt); in lpfc_new_io_buf()
4182 lpfc_get_wwpn(struct lpfc_hba *phba) in lpfc_get_wwpn() argument
4189 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_get_wwpn()
4195 lpfc_read_nv(phba, mboxq); in lpfc_get_wwpn()
4196 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_wwpn()
4198 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_get_wwpn()
4203 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4209 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
4210 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_wwpn()
4233 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
4244 if (phba->sli_rev < LPFC_SLI_REV4 && in lpfc_create_port()
4245 dev == &phba->pcidev->dev) { in lpfc_create_port()
4247 lpfc_sli_brdrestart(phba); in lpfc_create_port()
4248 rc = lpfc_sli_chipset_init(phba); in lpfc_create_port()
4252 wwn = lpfc_get_wwpn(phba); in lpfc_create_port()
4257 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_create_port()
4265 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_create_port()
4266 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
4277 } else if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_create_port()
4285 vport->phba = phba; in lpfc_create_port()
4292 vport->cfg_enable_fc4_type = phba->cfg_enable_fc4_type; in lpfc_create_port()
4300 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
4301 if (!phba->cfg_fcp_mq_threshold || in lpfc_create_port()
4302 phba->cfg_fcp_mq_threshold > phba->cfg_hdw_queue) in lpfc_create_port()
4303 phba->cfg_fcp_mq_threshold = phba->cfg_hdw_queue; in lpfc_create_port()
4306 phba->cfg_fcp_mq_threshold); in lpfc_create_port()
4309 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
4311 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_create_port()
4314 shost->sg_tablesize = phba->cfg_scsi_seg_cnt; in lpfc_create_port()
4326 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
4327 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
4346 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_create_port()
4347 lpfc_setup_bg(phba, shost); in lpfc_create_port()
4349 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
4353 spin_lock_irq(&phba->port_list_lock); in lpfc_create_port()
4354 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
4355 spin_unlock_irq(&phba->port_list_lock); in lpfc_create_port()
4375 struct lpfc_hba *phba = vport->phba; in destroy_port() local
4381 spin_lock_irq(&phba->port_list_lock); in destroy_port()
4383 spin_unlock_irq(&phba->port_list_lock); in destroy_port()
4426 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
4436 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4443 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
4444 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4457 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
4470 struct lpfc_hba *phba = vport->phba; in lpfc_host_supported_speeds_set() local
4473 if (phba->lmt & LMT_128Gb) in lpfc_host_supported_speeds_set()
4475 if (phba->lmt & LMT_64Gb) in lpfc_host_supported_speeds_set()
4477 if (phba->lmt & LMT_32Gb) in lpfc_host_supported_speeds_set()
4479 if (phba->lmt & LMT_16Gb) in lpfc_host_supported_speeds_set()
4481 if (phba->lmt & LMT_10Gb) in lpfc_host_supported_speeds_set()
4483 if (phba->lmt & LMT_8Gb) in lpfc_host_supported_speeds_set()
4485 if (phba->lmt & LMT_4Gb) in lpfc_host_supported_speeds_set()
4487 if (phba->lmt & LMT_2Gb) in lpfc_host_supported_speeds_set()
4489 if (phba->lmt & LMT_1Gb) in lpfc_host_supported_speeds_set()
4503 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
4534 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
4549 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
4552 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
4553 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
4555 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
4556 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
4559 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
4560 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
4572 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
4575 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
4576 if (phba->pport) in lpfc_stop_port_s4()
4577 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
4578 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
4589 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
4591 phba->lpfc_stop_port(phba); in lpfc_stop_port()
4593 if (phba->wq) in lpfc_stop_port()
4594 flush_workqueue(phba->wq); in lpfc_stop_port()
4604 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
4609 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
4610 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
4612 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
4614 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
4615 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
4631 struct lpfc_hba *phba = from_timer(phba, t, fcf.redisc_wait); in lpfc_sli4_fcf_redisc_wait_tmo() local
4634 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4635 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
4636 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4640 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
4642 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
4643 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4644 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
4647 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
4658 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
4668 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_fault()
4686 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
4704 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_type()
4722 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
4726 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
4729 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_sli_port_speed_get()
4730 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
4753 if (phba->sli4_hba.link_state.logical_speed) in lpfc_sli_port_speed_get()
4755 phba->sli4_hba.link_state.logical_speed; in lpfc_sli_port_speed_get()
4757 link_speed = phba->sli4_hba.link_state.speed; in lpfc_sli_port_speed_get()
4774 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
4860 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
4870 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
4873 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
4874 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
4876 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
4882 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
4886 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_link_evt()
4888 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
4894 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
4897 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
4900 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
4903 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_link_evt()
4905 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
4908 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
4909 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
4911 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
4913 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
4915 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
4917 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
4919 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
4921 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
4924 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
4928 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
4929 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
4930 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
4931 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
4932 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
4933 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
4934 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
4939 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_async_link_evt()
4940 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
4955 lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
4973 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
4980 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_link_evt()
4996 lpfc_async_link_speed_to_read_top(struct lpfc_hba *phba, uint8_t speed_code) in lpfc_async_link_speed_to_read_top() argument
5038 ((phba->trunk_link.link##__idx.state == LPFC_LINK_UP) ?\
5046 lpfc_update_trunk_link_status(struct lpfc_hba *phba, in lpfc_update_trunk_link_status() argument
5052 phba->sli4_hba.link_state.speed = in lpfc_update_trunk_link_status()
5053 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_update_trunk_link_status()
5056 phba->sli4_hba.link_state.logical_speed = in lpfc_update_trunk_link_status()
5059 phba->fc_linkspeed = in lpfc_update_trunk_link_status()
5061 phba, in lpfc_update_trunk_link_status()
5065 phba->trunk_link.link0.state = in lpfc_update_trunk_link_status()
5068 phba->trunk_link.link0.fault = port_fault & 0x1 ? err : 0; in lpfc_update_trunk_link_status()
5071 phba->trunk_link.link1.state = in lpfc_update_trunk_link_status()
5074 phba->trunk_link.link1.fault = port_fault & 0x2 ? err : 0; in lpfc_update_trunk_link_status()
5077 phba->trunk_link.link2.state = in lpfc_update_trunk_link_status()
5080 phba->trunk_link.link2.fault = port_fault & 0x4 ? err : 0; in lpfc_update_trunk_link_status()
5083 phba->trunk_link.link3.state = in lpfc_update_trunk_link_status()
5086 phba->trunk_link.link3.fault = port_fault & 0x8 ? err : 0; in lpfc_update_trunk_link_status()
5089 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_update_trunk_link_status()
5093 phba->sli4_hba.link_state.speed, in lpfc_update_trunk_link_status()
5094 phba->sli4_hba.link_state.logical_speed, in lpfc_update_trunk_link_status()
5099 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_update_trunk_link_status()
5123 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
5133 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
5141 lpfc_update_trunk_link_status(phba, acqe_fc); in lpfc_sli4_async_fc_evt()
5146 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
5147 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
5149 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
5150 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
5152 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
5154 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
5156 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
5158 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
5163 phba->sli4_hba.link_state.logical_speed = 0; in lpfc_sli4_async_fc_evt()
5164 else if (!phba->sli4_hba.conf_trunk) in lpfc_sli4_async_fc_evt()
5165 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
5168 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
5172 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
5173 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
5174 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
5175 phba->sli4_hba.link_state.type, in lpfc_sli4_async_fc_evt()
5176 phba->sli4_hba.link_state.number, in lpfc_sli4_async_fc_evt()
5177 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
5178 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_fc_evt()
5179 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
5181 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
5187 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
5191 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_fc_evt()
5193 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
5199 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
5202 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
5205 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
5208 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_fc_evt()
5210 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
5212 if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) { in lpfc_sli4_async_fc_evt()
5213 phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK); in lpfc_sli4_async_fc_evt()
5215 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
5217 phba->link_flag |= LS_MDS_LINK_DOWN; in lpfc_sli4_async_fc_evt()
5220 phba->link_flag |= LS_MDS_LOOPBACK; in lpfc_sli4_async_fc_evt()
5231 lpfc_sli4_parse_latt_fault(phba, (void *)acqe_fc); in lpfc_sli4_async_fc_evt()
5237 if (phba->sli4_hba.link_state.status == in lpfc_sli4_async_fc_evt()
5246 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_fc_evt()
5251 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
5259 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_fc_evt()
5270 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
5285 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
5291 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
5301 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
5305 phba->sfp_warning |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_sli4_async_sli_evt()
5306 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
5318 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
5322 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
5334 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
5360 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
5364 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_async_sli_evt()
5369 if (phba->sli4_hba.lnk_info.optic_state == status) in lpfc_sli4_async_sli_evt()
5409 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_async_sli_evt()
5411 phba->lmt = 0; in lpfc_sli4_async_sli_evt()
5412 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
5416 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_sli_evt()
5418 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_sli_evt()
5424 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_sli_evt()
5426 phba->sli4_hba.lnk_info.optic_state = status; in lpfc_sli4_async_sli_evt()
5427 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
5431 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
5437 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
5461 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
5465 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
5466 if (!phba) in lpfc_sli4_perform_vport_cvl()
5484 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
5485 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
5488 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
5511 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
5516 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
5518 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
5520 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
5531 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
5543 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5544 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5549 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
5556 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
5562 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
5568 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
5573 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
5577 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5578 if (phba->hba_flag & FCF_TS_INPROG) { in lpfc_sli4_async_fip_evt()
5579 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5583 if (phba->fcf.fcf_flag & (FCF_REDISC_EVT | FCF_REDISC_PEND)) { in lpfc_sli4_async_fip_evt()
5584 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5589 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
5590 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5593 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5596 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5600 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
5603 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5609 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fip_evt()
5616 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5617 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5624 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5625 if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && in lpfc_sli4_async_fip_evt()
5626 (phba->fcf.current_rec.fcf_indx != acqe_fip->index)) { in lpfc_sli4_async_fip_evt()
5627 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5629 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
5632 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5635 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
5644 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5646 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
5647 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5649 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5653 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
5655 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
5660 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5661 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
5662 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5667 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
5670 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
5675 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
5679 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5680 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5684 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
5691 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
5693 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
5702 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
5732 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5733 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
5734 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5738 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
5739 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5740 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
5744 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
5746 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
5751 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5752 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
5753 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5758 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
5764 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
5768 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fip_evt()
5783 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
5786 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
5787 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_dcbx_evt()
5802 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
5807 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
5808 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
5809 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
5810 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
5812 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
5815 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
5825 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
5830 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5831 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
5832 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5834 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
5836 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5837 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
5839 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5843 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
5847 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
5850 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
5854 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
5858 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
5861 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
5864 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_event_proc()
5871 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
5882 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
5886 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
5888 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
5890 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
5892 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
5893 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
5896 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
5898 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
5900 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
5916 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
5921 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
5925 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
5928 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
5932 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
5936 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
5940 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
5955 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
5959 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
5963 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
5967 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
5971 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_log_intr_mode()
5990 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
5995 if (!phba->pcidev) in lpfc_enable_pci_dev()
5998 pdev = phba->pcidev; in lpfc_enable_pci_dev()
6019 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_enable_pci_dev()
6032 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
6037 if (!phba->pcidev) in lpfc_disable_pci_dev()
6040 pdev = phba->pcidev; in lpfc_disable_pci_dev()
6058 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
6061 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
6062 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
6065 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_reset_hba()
6066 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
6068 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
6069 lpfc_offline(phba); in lpfc_reset_hba()
6070 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
6071 lpfc_online(phba); in lpfc_reset_hba()
6072 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
6086 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
6088 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
6112 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
6114 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
6118 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
6120 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
6128 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
6133 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
6151 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
6153 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
6158 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
6159 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
6162 spin_lock_init(&phba->ndlp_lock); in lpfc_setup_driver_resource_phase1()
6165 spin_lock_init(&phba->port_list_lock); in lpfc_setup_driver_resource_phase1()
6166 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
6168 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
6169 init_waitqueue_head(&phba->wait_4_mlo_m_q); in lpfc_setup_driver_resource_phase1()
6172 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
6174 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
6176 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
6178 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
6180 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
6183 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
6184 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
6185 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
6186 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
6189 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
6192 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
6195 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
6198 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
6199 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
6204 timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); in lpfc_setup_driver_resource_phase1()
6206 timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); in lpfc_setup_driver_resource_phase1()
6208 timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); in lpfc_setup_driver_resource_phase1()
6210 INIT_DELAYED_WORK(&phba->eq_delay_work, lpfc_hb_eq_delay_work); in lpfc_setup_driver_resource_phase1()
6227 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
6236 timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); in lpfc_sli_driver_resource_setup()
6239 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
6240 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
6243 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
6246 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli_driver_resource_setup()
6250 if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { in lpfc_sli_driver_resource_setup()
6251 phba->menlo_flag |= HBA_MENLO_SUPPORT; in lpfc_sli_driver_resource_setup()
6253 if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) in lpfc_sli_driver_resource_setup()
6254 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
6257 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
6258 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, in lpfc_sli_driver_resource_setup()
6261 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
6270 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
6271 lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
6272 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
6274 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_driver_resource_setup()
6280 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
6290 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
6294 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
6295 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
6298 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
6305 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
6307 ((phba->cfg_sg_seg_cnt + 2) * entry_sz); in lpfc_sli_driver_resource_setup()
6310 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
6313 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
6315 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
6316 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
6318 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
6320 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
6325 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
6326 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
6329 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
6332 phba->lpfc_sg_dma_buf_pool = in lpfc_sli_driver_resource_setup()
6334 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
6337 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli_driver_resource_setup()
6340 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli_driver_resource_setup()
6342 &phba->pcidev->dev, in lpfc_sli_driver_resource_setup()
6347 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli_driver_resource_setup()
6354 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
6355 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
6356 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
6358 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
6362 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
6363 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
6370 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli_driver_resource_setup()
6371 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli_driver_resource_setup()
6373 lpfc_mem_free(phba); in lpfc_sli_driver_resource_setup()
6385 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
6388 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
6405 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
6418 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
6419 phba->sli4_hba.num_possible_cpu = num_possible_cpus(); in lpfc_sli4_driver_resource_setup()
6420 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
6423 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
6426 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
6431 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
6438 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0); in lpfc_sli4_driver_resource_setup()
6444 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
6447 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
6453 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
6455 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
6457 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
6460 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
6463 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
6464 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
6465 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
6466 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
6475 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
6476 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
6477 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
6483 spin_lock_init(&phba->sli4_hba.abts_io_buf_list_lock); in lpfc_sli4_driver_resource_setup()
6484 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_io_buf_list); in lpfc_sli4_driver_resource_setup()
6486 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
6488 spin_lock_init(&phba->sli4_hba.abts_nvmet_buf_list_lock); in lpfc_sli4_driver_resource_setup()
6489 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
6490 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
6491 spin_lock_init(&phba->sli4_hba.t_active_list_lock); in lpfc_sli4_driver_resource_setup()
6492 INIT_LIST_HEAD(&phba->sli4_hba.t_active_ctx_list); in lpfc_sli4_driver_resource_setup()
6496 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
6497 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
6504 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
6506 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
6508 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
6510 INIT_LIST_HEAD(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
6512 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
6514 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
6517 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
6518 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
6519 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
6520 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
6525 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
6526 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
6529 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
6532 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
6537 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
6539 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
6544 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
6548 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
6553 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
6558 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
6561 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
6566 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
6568 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
6573 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
6581 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
6585 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6586 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
6588 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_driver_resource_setup()
6593 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6601 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
6606 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
6612 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
6615 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
6617 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6621 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6627 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_driver_resource_setup()
6633 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
6637 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
6645 phba->sli4_hba.pc_sli4_params.supported = 1; in lpfc_sli4_driver_resource_setup()
6652 if (phba->sli4_hba.pc_sli4_params.supported) in lpfc_sli4_driver_resource_setup()
6653 rc = lpfc_pc_sli4_params_get(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6655 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6666 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6669 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
6671 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
6672 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
6673 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
6674 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6679 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6686 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6697 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
6711 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
6723 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
6727 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
6733 if (phba->cfg_enable_bg && in lpfc_sli4_driver_resource_setup()
6734 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
6735 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; in lpfc_sli4_driver_resource_setup()
6737 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6745 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
6747 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
6751 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
6752 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6760 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_driver_resource_setup()
6761 phba->cfg_sg_dma_buf_size = LPFC_DEFAULT_XPSGL_SIZE; in lpfc_sli4_driver_resource_setup()
6762 else if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
6763 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
6765 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
6766 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
6768 phba->border_sge_num = phba->cfg_sg_dma_buf_size / in lpfc_sli4_driver_resource_setup()
6772 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
6773 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { in lpfc_sli4_driver_resource_setup()
6774 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, in lpfc_sli4_driver_resource_setup()
6778 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_sli4_driver_resource_setup()
6780 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
6784 lpfc_vport_template.sg_tablesize = phba->cfg_scsi_seg_cnt; in lpfc_sli4_driver_resource_setup()
6785 lpfc_template.sg_tablesize = phba->cfg_scsi_seg_cnt; in lpfc_sli4_driver_resource_setup()
6786 lpfc_template_no_hr.sg_tablesize = phba->cfg_scsi_seg_cnt; in lpfc_sli4_driver_resource_setup()
6788 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
6791 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
6792 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sli4_driver_resource_setup()
6793 phba->cfg_nvme_seg_cnt); in lpfc_sli4_driver_resource_setup()
6795 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_sli4_driver_resource_setup()
6796 i = phba->cfg_sg_dma_buf_size; in lpfc_sli4_driver_resource_setup()
6800 phba->lpfc_sg_dma_buf_pool = in lpfc_sli4_driver_resource_setup()
6802 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
6803 phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
6805 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_sli4_driver_resource_setup()
6808 phba->lpfc_cmd_rsp_buf_pool = in lpfc_sli4_driver_resource_setup()
6810 &phba->pcidev->dev, in lpfc_sli4_driver_resource_setup()
6814 if (!phba->lpfc_cmd_rsp_buf_pool) in lpfc_sli4_driver_resource_setup()
6817 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6820 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
6823 lpfc_sli4_ras_init(phba); in lpfc_sli4_driver_resource_setup()
6826 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
6831 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
6836 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
6839 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
6841 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6845 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
6847 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6854 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
6856 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
6857 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6864 phba->sli4_hba.hba_eq_hdl = kcalloc(phba->cfg_irq_chann, in lpfc_sli4_driver_resource_setup()
6867 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
6868 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6875 phba->sli4_hba.cpu_map = kcalloc(phba->sli4_hba.num_possible_cpu, in lpfc_sli4_driver_resource_setup()
6878 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
6879 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6886 phba->sli4_hba.eq_info = alloc_percpu(struct lpfc_eq_intr_info); in lpfc_sli4_driver_resource_setup()
6887 if (!phba->sli4_hba.eq_info) { in lpfc_sli4_driver_resource_setup()
6888 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6897 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
6898 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
6899 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
6901 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6905 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
6906 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
6913 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
6915 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
6917 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
6919 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
6921 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
6923 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
6925 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool); in lpfc_sli4_driver_resource_setup()
6926 phba->lpfc_cmd_rsp_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
6928 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_sli4_driver_resource_setup()
6929 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_sli4_driver_resource_setup()
6931 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
6933 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
6945 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
6949 free_percpu(phba->sli4_hba.eq_info); in lpfc_sli4_driver_resource_unset()
6952 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
6953 phba->sli4_hba.num_possible_cpu = 0; in lpfc_sli4_driver_resource_unset()
6954 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
6955 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
6958 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
6961 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
6962 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
6965 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
6968 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
6969 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
6970 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
6973 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
6974 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
6977 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
6980 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
6983 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
6987 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
7006 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
7008 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
7009 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
7010 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
7013 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
7014 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
7015 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
7018 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
7019 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
7020 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
7023 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_init_api_table_setup()
7044 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
7049 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
7050 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
7051 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
7052 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
7068 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
7070 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
7071 flush_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
7072 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
7073 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
7077 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
7078 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
7088 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
7092 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
7094 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
7097 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
7099 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
7116 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
7123 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
7133 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
7143 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
7144 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
7145 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
7146 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
7152 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
7165 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
7171 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
7183 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
7188 spin_lock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
7189 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
7190 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
7191 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
7192 spin_unlock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
7195 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
7205 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
7211 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
7212 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
7213 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
7214 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
7215 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
7220 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
7228 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
7239 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
7243 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
7245 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
7247 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
7261 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
7263 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
7275 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
7278 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
7279 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
7280 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
7281 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
7284 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
7287 phba->sli4_hba.io_xri_cnt = 0; in lpfc_init_sgl_list()
7305 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
7310 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
7311 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
7313 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
7316 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
7318 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_init_rpi_hdrs()
7320 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
7341 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
7352 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
7354 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
7358 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
7360 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7366 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
7367 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7381 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
7402 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7406 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
7407 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
7409 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
7413 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
7430 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
7434 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
7438 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
7440 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
7447 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
7465 struct lpfc_hba *phba; in lpfc_hba_alloc() local
7468 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
7469 if (!phba) { in lpfc_hba_alloc()
7475 phba->pcidev = pdev; in lpfc_hba_alloc()
7478 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
7479 if (phba->brd_no < 0) { in lpfc_hba_alloc()
7480 kfree(phba); in lpfc_hba_alloc()
7483 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
7485 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
7486 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
7488 return phba; in lpfc_hba_alloc()
7499 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
7501 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_hba_free()
7502 kfree(phba->sli4_hba.hdwq); in lpfc_hba_free()
7505 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
7508 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
7509 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
7511 kfree(phba); in lpfc_hba_free()
7527 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
7533 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
7534 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
7535 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
7536 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
7538 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
7539 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
7544 phba->pport = vport; in lpfc_create_shost()
7546 if (phba->nvmet_support) { in lpfc_create_shost()
7548 if (phba->txrdy_payload_pool == NULL) { in lpfc_create_shost()
7549 phba->txrdy_payload_pool = dma_pool_create( in lpfc_create_shost()
7550 "txrdy_pool", &phba->pcidev->dev, in lpfc_create_shost()
7552 if (phba->txrdy_payload_pool) { in lpfc_create_shost()
7553 phba->targetport = NULL; in lpfc_create_shost()
7554 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
7555 lpfc_printf_log(phba, KERN_INFO, in lpfc_create_shost()
7564 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
7571 if (phba->cfg_enable_SmartSAN || in lpfc_create_shost()
7572 (phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT)) { in lpfc_create_shost()
7576 if (phba->cfg_enable_SmartSAN) in lpfc_create_shost()
7592 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
7594 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
7611 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
7616 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
7617 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
7621 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
7622 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
7625 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
7628 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
7632 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
7633 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
7635 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
7636 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
7637 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
7638 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_bg()
7641 phba->cfg_prot_mask, in lpfc_setup_bg()
7642 phba->cfg_prot_guard); in lpfc_setup_bg()
7644 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
7645 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
7647 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_bg()
7662 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
7668 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
7674 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
7675 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
7679 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
7681 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
7685 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
7709 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
7711 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
7731 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
7734 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
7738 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
7739 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
7746 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
7747 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
7754 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
7755 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
7756 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
7759 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
7760 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
7762 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
7763 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
7766 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
7768 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
7770 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
7774 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
7776 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
7777 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
7781 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
7782 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
7784 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
7786 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
7787 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7788 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7789 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7790 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7796 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
7798 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
7800 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
7813 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
7818 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
7821 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
7825 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
7827 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
7830 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
7831 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
7846 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
7855 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
7860 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
7878 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
7892 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
7897 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7899 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7901 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7903 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7905 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7907 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
7914 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
7917 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
7918 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
7919 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
7920 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
7922 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
7924 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
7925 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
7926 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
7927 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
7936 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
7937 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
7944 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
7948 phba->work_status[0] = in lpfc_sli4_post_status_check()
7949 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
7951 phba->work_status[1] = in lpfc_sli4_post_status_check()
7952 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
7954 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
7961 phba->work_status[0], in lpfc_sli4_post_status_check()
7962 phba->work_status[1]); in lpfc_sli4_post_status_check()
7983 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
7987 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
7988 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
7989 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
7990 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
7991 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
7992 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
7993 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
7994 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
7995 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
7996 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
7999 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
8000 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8002 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
8003 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8005 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
8006 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8008 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
8009 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8011 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
8012 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8014 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
8015 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
8016 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
8017 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8019 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8020 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8022 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8023 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8025 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8026 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
8027 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
8028 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
8029 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
8030 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
8031 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
8034 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
8035 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8037 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
8038 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8040 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
8041 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8043 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
8044 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8046 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
8047 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8049 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
8050 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
8052 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
8053 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
8057 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
8071 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
8075 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
8076 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8078 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8080 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8082 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8086 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8088 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8090 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8092 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8094 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
8100 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
8118 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
8123 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8126 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8129 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8132 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
8133 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8135 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
8156 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
8173 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
8187 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
8188 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
8190 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
8192 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
8203 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
8204 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
8209 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
8227 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
8229 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
8230 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
8231 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
8232 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
8234 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
8235 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
8253 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
8266 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
8268 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
8274 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
8276 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
8278 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
8287 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
8288 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
8290 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
8292 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8294 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
8295 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
8297 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
8301 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
8302 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
8305 phba->sli4_hba.conf_trunk = in lpfc_sli4_read_config()
8307 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
8309 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
8313 phba->sli4_hba.max_cfg_param.max_xri > 512) in lpfc_sli4_read_config()
8314 phba->sli4_hba.max_cfg_param.max_xri = 512; in lpfc_sli4_read_config()
8315 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
8317 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
8320 if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) in lpfc_sli4_read_config()
8321 phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; in lpfc_sli4_read_config()
8322 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
8324 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
8326 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
8328 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
8330 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
8332 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
8334 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
8336 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
8338 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
8340 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
8342 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
8343 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
8344 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
8345 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
8346 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
8347 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
8348 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
8349 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8356 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
8357 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
8358 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
8359 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
8360 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
8361 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
8362 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
8363 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
8364 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
8365 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
8366 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
8367 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
8368 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
8369 phba->sli4_hba.max_cfg_param.max_rq); in lpfc_sli4_read_config()
8375 qmin = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
8376 if (phba->sli4_hba.max_cfg_param.max_cq < qmin) in lpfc_sli4_read_config()
8377 qmin = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
8378 if (phba->sli4_hba.max_cfg_param.max_eq < qmin) in lpfc_sli4_read_config()
8379 qmin = phba->sli4_hba.max_cfg_param.max_eq; in lpfc_sli4_read_config()
8389 if ((phba->cfg_irq_chann > qmin) || in lpfc_sli4_read_config()
8390 (phba->cfg_hdw_queue > qmin)) { in lpfc_sli4_read_config()
8391 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
8395 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
8396 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
8397 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
8398 qmin, phba->cfg_irq_chann, in lpfc_sli4_read_config()
8399 phba->cfg_hdw_queue); in lpfc_sli4_read_config()
8401 if (phba->cfg_irq_chann > qmin) in lpfc_sli4_read_config()
8402 phba->cfg_irq_chann = qmin; in lpfc_sli4_read_config()
8403 if (phba->cfg_hdw_queue > qmin) in lpfc_sli4_read_config()
8404 phba->cfg_hdw_queue = qmin; in lpfc_sli4_read_config()
8412 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
8417 phba->hba_flag |= HBA_FORCED_LINK_SPEED; in lpfc_sli4_read_config()
8421 phba->cfg_link_speed = in lpfc_sli4_read_config()
8425 phba->cfg_link_speed = in lpfc_sli4_read_config()
8429 phba->cfg_link_speed = in lpfc_sli4_read_config()
8433 phba->cfg_link_speed = in lpfc_sli4_read_config()
8437 phba->cfg_link_speed = in lpfc_sli4_read_config()
8441 phba->cfg_link_speed = in lpfc_sli4_read_config()
8445 phba->cfg_link_speed = in lpfc_sli4_read_config()
8449 phba->cfg_link_speed = in lpfc_sli4_read_config()
8453 phba->cfg_link_speed = in lpfc_sli4_read_config()
8457 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
8461 phba->cfg_link_speed = in lpfc_sli4_read_config()
8468 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
8469 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
8470 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
8471 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
8473 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
8474 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
8477 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
8484 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
8488 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
8494 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
8517 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
8519 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
8526 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
8528 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
8529 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
8531 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
8537 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
8555 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
8562 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
8565 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
8568 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_endian_order()
8581 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
8583 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_endian_order()
8589 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
8614 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
8621 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
8622 if (phba->cfg_irq_chann < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
8623 phba->cfg_nvmet_mrq = phba->cfg_irq_chann; in lpfc_sli4_queue_verify()
8624 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
8625 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
8628 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
8630 phba->cfg_hdw_queue, phba->cfg_irq_chann, in lpfc_sli4_queue_verify()
8631 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
8634 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
8635 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
8638 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
8639 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
8644 lpfc_alloc_io_wq_cq(struct lpfc_hba *phba, int idx) in lpfc_alloc_io_wq_cq() argument
8650 cpu = lpfc_find_cpu_handle(phba, idx, LPFC_FIND_BY_HDWQ); in lpfc_alloc_io_wq_cq()
8652 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_io_wq_cq()
8654 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8655 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
8659 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8660 phba->sli4_hba.cq_esize, in lpfc_alloc_io_wq_cq()
8661 phba->sli4_hba.cq_ecount, cpu); in lpfc_alloc_io_wq_cq()
8663 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_alloc_io_wq_cq()
8670 phba->sli4_hba.hdwq[idx].io_cq = qdesc; in lpfc_alloc_io_wq_cq()
8673 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_io_wq_cq()
8675 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_io_wq_cq()
8676 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_io_wq_cq()
8677 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8681 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_io_wq_cq()
8682 phba->sli4_hba.wq_esize, in lpfc_alloc_io_wq_cq()
8683 phba->sli4_hba.wq_ecount, cpu); in lpfc_alloc_io_wq_cq()
8686 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_alloc_io_wq_cq()
8693 phba->sli4_hba.hdwq[idx].io_wq = qdesc; in lpfc_alloc_io_wq_cq()
8694 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_io_wq_cq()
8713 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
8726 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
8727 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
8728 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
8729 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
8730 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
8731 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
8732 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
8733 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
8734 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
8735 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
8737 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
8738 phba->sli4_hba.hdwq = kcalloc( in lpfc_sli4_queue_create()
8739 phba->cfg_hdw_queue, sizeof(struct lpfc_sli4_hdw_queue), in lpfc_sli4_queue_create()
8741 if (!phba->sli4_hba.hdwq) { in lpfc_sli4_queue_create()
8742 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8748 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
8749 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_queue_create()
8767 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
8768 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
8769 phba->sli4_hba.nvmet_cqset = kcalloc( in lpfc_sli4_queue_create()
8770 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
8773 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
8774 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8779 phba->sli4_hba.nvmet_mrq_hdr = kcalloc( in lpfc_sli4_queue_create()
8780 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
8783 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
8784 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8789 phba->sli4_hba.nvmet_mrq_data = kcalloc( in lpfc_sli4_queue_create()
8790 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
8793 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
8794 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8802 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
8810 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
8815 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
8818 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8819 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
8820 phba->sli4_hba.eq_ecount, cpu); in lpfc_sli4_queue_create()
8822 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8835 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, qdesc->last_cpu); in lpfc_sli4_queue_create()
8843 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_create()
8850 qp = &phba->sli4_hba.hdwq[cpup->hdwq]; in lpfc_sli4_queue_create()
8855 eqcpu = lpfc_find_cpu_handle(phba, cpup->eq, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
8856 eqcpup = &phba->sli4_hba.cpu_map[eqcpu]; in lpfc_sli4_queue_create()
8857 qp->hba_eq = phba->sli4_hba.hdwq[eqcpup->hdwq].hba_eq; in lpfc_sli4_queue_create()
8861 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
8862 if (lpfc_alloc_io_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
8866 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
8867 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
8868 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
8870 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
8872 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
8873 phba->sli4_hba.cq_ecount, in lpfc_sli4_queue_create()
8876 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8884 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
8892 cpu = lpfc_find_cpu_handle(phba, 0, LPFC_FIND_BY_EQ); in lpfc_sli4_queue_create()
8894 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8895 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
8896 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
8898 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8903 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
8906 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8907 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
8908 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
8910 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8916 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
8925 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8926 phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
8927 phba->sli4_hba.mq_ecount, cpu); in lpfc_sli4_queue_create()
8929 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8934 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
8941 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8942 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
8943 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
8945 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8950 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
8951 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
8953 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
8955 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8956 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
8957 phba->sli4_hba.cq_ecount, cpu); in lpfc_sli4_queue_create()
8959 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8965 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
8968 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8969 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
8970 phba->sli4_hba.wq_ecount, cpu); in lpfc_sli4_queue_create()
8972 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8977 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
8978 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
8986 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8987 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
8988 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
8990 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8994 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
8997 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8998 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
8999 phba->sli4_hba.rq_ecount, cpu); in lpfc_sli4_queue_create()
9001 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
9005 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
9007 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_sli4_queue_create()
9008 phba->nvmet_support) { in lpfc_sli4_queue_create()
9009 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
9010 cpu = lpfc_find_cpu_handle(phba, idx, in lpfc_sli4_queue_create()
9013 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
9015 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9019 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
9025 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
9032 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
9042 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
9044 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
9048 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
9054 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
9059 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
9060 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9061 memset(&phba->sli4_hba.hdwq[idx].nvme_cstat, 0, in lpfc_sli4_queue_create()
9062 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); in lpfc_sli4_queue_create()
9067 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_queue_create()
9068 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_queue_create()
9069 memset(&phba->sli4_hba.hdwq[idx].scsi_cstat, 0, in lpfc_sli4_queue_create()
9070 sizeof(phba->sli4_hba.hdwq[idx].scsi_cstat)); in lpfc_sli4_queue_create()
9077 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
9106 lpfc_sli4_release_hdwq(struct lpfc_hba *phba) in lpfc_sli4_release_hdwq() argument
9112 hdwq = phba->sli4_hba.hdwq; in lpfc_sli4_release_hdwq()
9115 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_release_hdwq()
9121 if (phba->cfg_xpsgl && !phba->nvmet_support) in lpfc_sli4_release_hdwq()
9122 lpfc_free_sgl_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
9123 lpfc_free_cmd_rsp_buf_per_hdwq(phba, &hdwq[idx]); in lpfc_sli4_release_hdwq()
9126 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_release_hdwq()
9128 eq = phba->sli4_hba.hba_eq_hdl[idx].eq; in lpfc_sli4_release_hdwq()
9130 phba->sli4_hba.hba_eq_hdl[idx].eq = NULL; in lpfc_sli4_release_hdwq()
9147 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
9154 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9155 phba->sli.sli_flag |= LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
9156 while (phba->sli.sli_flag & LPFC_QUEUE_FREE_WAIT) { in lpfc_sli4_queue_destroy()
9157 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9159 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9161 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9164 if (phba->sli4_hba.hdwq) in lpfc_sli4_queue_destroy()
9165 lpfc_sli4_release_hdwq(phba); in lpfc_sli4_queue_destroy()
9167 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
9168 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
9169 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9171 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
9172 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9173 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
9174 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
9178 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
9181 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
9184 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
9187 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
9188 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
9191 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
9194 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
9197 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
9200 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
9203 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9204 phba->sli.sli_flag &= ~LPFC_QUEUE_FREE_INIT; in lpfc_sli4_queue_destroy()
9205 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_destroy()
9209 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
9221 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
9228 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
9236 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_create_wq_cq()
9243 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
9246 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_create_wq_cq()
9257 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
9262 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
9264 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_create_wq_cq()
9276 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
9280 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
9282 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_create_wq_cq()
9289 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
9291 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
9292 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
9306 lpfc_setup_cq_lookup(struct lpfc_hba *phba) in lpfc_setup_cq_lookup() argument
9311 memset(phba->sli4_hba.cq_lookup, 0, in lpfc_setup_cq_lookup()
9312 (sizeof(struct lpfc_queue *) * (phba->sli4_hba.cq_max + 1))); in lpfc_setup_cq_lookup()
9314 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_setup_cq_lookup()
9316 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_setup_cq_lookup()
9321 if (childq->queue_id > phba->sli4_hba.cq_max) in lpfc_setup_cq_lookup()
9324 phba->sli4_hba.cq_lookup[childq->queue_id] = in lpfc_setup_cq_lookup()
9343 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
9355 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
9357 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9364 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
9368 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
9375 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9380 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
9385 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
9387 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
9388 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
9389 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
9391 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9393 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
9394 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
9397 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
9402 qp = phba->sli4_hba.hdwq; in lpfc_sli4_queue_setup()
9406 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9413 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_setup()
9416 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
9427 rc = lpfc_eq_create(phba, qp[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
9428 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
9430 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9438 phba->sli4_hba.hba_eq_hdl[cpup->eq].eq = in lpfc_sli4_queue_setup()
9441 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9449 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_setup()
9450 cpu = lpfc_find_cpu_handle(phba, qidx, LPFC_FIND_BY_HDWQ); in lpfc_sli4_queue_setup()
9451 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_sli4_queue_setup()
9454 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
9455 phba->sli4_hba.hdwq[cpup->hdwq].hba_eq, in lpfc_sli4_queue_setup()
9458 &phba->sli4_hba.hdwq[qidx].io_cq_map, in lpfc_sli4_queue_setup()
9462 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9476 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
9477 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9479 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
9485 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9486 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
9487 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
9490 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9495 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
9496 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
9497 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9503 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
9504 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
9505 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
9509 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9517 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
9521 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9526 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
9528 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9531 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
9537 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
9538 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9540 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
9544 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9545 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
9546 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
9549 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9554 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9556 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
9557 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
9559 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_setup()
9561 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
9562 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9564 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
9568 rc = lpfc_create_wq_cq(phba, qp[0].hba_eq, in lpfc_sli4_queue_setup()
9569 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
9570 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
9573 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9579 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9582 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
9583 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
9589 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
9590 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
9591 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
9592 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
9593 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9599 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
9600 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
9601 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
9602 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
9603 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
9606 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9614 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
9615 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
9616 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
9617 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
9620 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9628 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9631 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
9632 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
9633 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
9638 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
9639 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9645 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
9646 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
9648 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9654 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9657 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
9658 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
9659 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
9661 if (phba->cfg_fcp_imax) in lpfc_sli4_queue_setup()
9662 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_sli4_queue_setup()
9666 for (qidx = 0; qidx < phba->cfg_irq_chann; in lpfc_sli4_queue_setup()
9668 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
9671 if (phba->sli4_hba.cq_max) { in lpfc_sli4_queue_setup()
9672 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_setup()
9673 phba->sli4_hba.cq_lookup = kcalloc((phba->sli4_hba.cq_max + 1), in lpfc_sli4_queue_setup()
9675 if (!phba->sli4_hba.cq_lookup) { in lpfc_sli4_queue_setup()
9676 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9678 "size 0x%x\n", phba->sli4_hba.cq_max); in lpfc_sli4_queue_setup()
9682 lpfc_setup_cq_lookup(phba); in lpfc_sli4_queue_setup()
9687 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
9705 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
9712 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
9713 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
9716 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
9717 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
9720 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
9721 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
9724 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
9725 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
9726 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
9729 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
9730 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
9733 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
9734 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
9737 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
9738 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
9740 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
9742 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
9743 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
9745 phba, in lpfc_sli4_queue_unset()
9746 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
9747 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
9751 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
9752 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
9754 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
9759 if (phba->sli4_hba.hdwq) { in lpfc_sli4_queue_unset()
9761 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_queue_unset()
9763 qp = &phba->sli4_hba.hdwq[qidx]; in lpfc_sli4_queue_unset()
9764 lpfc_wq_destroy(phba, qp->io_wq); in lpfc_sli4_queue_unset()
9765 lpfc_cq_destroy(phba, qp->io_cq); in lpfc_sli4_queue_unset()
9768 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_queue_unset()
9770 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_sli4_queue_unset()
9771 lpfc_eq_destroy(phba, eq); in lpfc_sli4_queue_unset()
9775 kfree(phba->sli4_hba.cq_lookup); in lpfc_sli4_queue_unset()
9776 phba->sli4_hba.cq_lookup = NULL; in lpfc_sli4_queue_unset()
9777 phba->sli4_hba.cq_max = 0; in lpfc_sli4_queue_unset()
9797 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
9802 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
9807 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
9812 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
9827 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
9832 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
9849 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
9853 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
9869 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
9874 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
9875 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
9876 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
9889 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
9892 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
9904 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
9908 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
9909 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
9910 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
9921 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
9928 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
9930 list_splice_init(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
9933 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
9936 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
9938 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
9942 lpfc_sli4_cq_event_release(phba, cqe); in lpfc_sli4_cq_event_release_all()
9959 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
9970 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
9973 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
9976 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
9984 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
9987 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
9994 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
9996 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
10013 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
10024 phba->work_status[0] = readl( in lpfc_pci_function_reset()
10025 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
10026 phba->work_status[1] = readl( in lpfc_pci_function_reset()
10027 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
10028 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
10032 phba->work_status[0], in lpfc_pci_function_reset()
10033 phba->work_status[1]); in lpfc_pci_function_reset()
10047 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
10050 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
10070 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
10091 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
10093 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
10113 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
10118 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
10120 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_pci_mem_setup()
10123 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
10127 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
10135 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
10142 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10143 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
10144 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10150 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10152 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10154 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
10161 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10162 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
10163 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10169 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10178 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
10181 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10182 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
10184 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10191 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
10192 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10193 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10206 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
10208 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10209 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
10210 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10216 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10217 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
10226 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
10229 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10230 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
10232 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10239 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
10240 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10241 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
10256 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
10258 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
10259 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
10260 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
10266 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
10273 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
10274 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_write_eq_db; in lpfc_sli4_pci_mem_setup()
10275 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_write_cq_db; in lpfc_sli4_pci_mem_setup()
10278 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
10279 phba->sli4_hba.sli4_write_eq_db = lpfc_sli4_if6_write_eq_db; in lpfc_sli4_pci_mem_setup()
10280 phba->sli4_hba.sli4_write_cq_db = lpfc_sli4_if6_write_cq_db; in lpfc_sli4_pci_mem_setup()
10289 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10291 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10293 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
10306 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
10309 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
10313 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10314 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10315 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10318 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10321 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10322 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
10326 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
10345 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
10351 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
10354 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
10364 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
10366 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
10368 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
10375 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
10377 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
10380 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
10389 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
10393 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_enable_msix()
10398 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
10401 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
10403 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
10411 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
10416 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
10420 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
10424 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
10428 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
10449 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
10453 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
10455 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
10458 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
10463 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
10464 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
10466 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
10467 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
10490 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
10497 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
10500 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
10503 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
10510 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
10511 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
10514 phba->intr_type = MSI; in lpfc_sli_enable_intr()
10520 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
10521 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
10522 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
10525 phba->intr_type = INTx; in lpfc_sli_enable_intr()
10542 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
10546 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
10552 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
10553 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
10556 phba->intr_type = NONE; in lpfc_sli_disable_intr()
10557 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
10569 lpfc_find_cpu_handle(struct lpfc_hba *phba, uint16_t id, int match) in lpfc_find_cpu_handle() argument
10576 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_find_cpu_handle()
10604 lpfc_find_hyper(struct lpfc_hba *phba, int cpu, in lpfc_find_hyper() argument
10611 cpup = &phba->sli4_hba.cpu_map[idx]; in lpfc_find_hyper()
10633 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
10647 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10663 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10668 if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id)) in lpfc_cpu_affinity_check()
10676 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
10693 per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_cpu_affinity_check()
10709 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_cpu_affinity_check()
10711 maskp = pci_irq_get_affinity(phba->pcidev, idx); in lpfc_cpu_affinity_check()
10713 if (phba->cfg_irq_chann > 1) in lpfc_cpu_affinity_check()
10714 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
10717 idx, phba->cfg_irq_chann); in lpfc_cpu_affinity_check()
10720 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10722 cpup->irq = pci_irq_vector(phba->pcidev, idx); in lpfc_cpu_affinity_check()
10732 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10734 cpup->irq = pci_irq_vector(phba->pcidev, idx); in lpfc_cpu_affinity_check()
10743 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
10759 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10772 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
10773 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
10798 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
10810 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10823 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
10824 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
10834 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
10852 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_cpu_affinity_check()
10865 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10874 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
10892 cpup = &phba->sli4_hba.cpu_map[cpu]; in lpfc_cpu_affinity_check()
10902 if (next_idx < phba->cfg_hdw_queue) { in lpfc_cpu_affinity_check()
10914 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
10915 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
10930 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { in lpfc_cpu_affinity_check()
10931 new_cpup = &phba->sli4_hba.cpu_map[new_cpu]; in lpfc_cpu_affinity_check()
10942 cpup->hdwq = idx % phba->cfg_hdw_queue; in lpfc_cpu_affinity_check()
10952 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cpu_affinity_check()
10977 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
10983 vectors = phba->cfg_irq_chann; in lpfc_sli4_enable_msix()
10985 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli4_enable_msix()
10989 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
10997 name = phba->sli4_hba.hba_eq_hdl[index].handler_name; in lpfc_sli4_enable_msix()
11002 phba->sli4_hba.hba_eq_hdl[index].idx = index; in lpfc_sli4_enable_msix()
11003 phba->sli4_hba.hba_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msix()
11004 rc = request_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_enable_msix()
11007 &phba->sli4_hba.hba_eq_hdl[index]); in lpfc_sli4_enable_msix()
11009 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
11016 if (vectors != phba->cfg_irq_chann) { in lpfc_sli4_enable_msix()
11017 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_enable_msix()
11020 phba->cfg_irq_chann, vectors); in lpfc_sli4_enable_msix()
11021 if (phba->cfg_irq_chann > vectors) in lpfc_sli4_enable_msix()
11022 phba->cfg_irq_chann = vectors; in lpfc_sli4_enable_msix()
11023 if (phba->nvmet_support && (phba->cfg_nvmet_mrq > vectors)) in lpfc_sli4_enable_msix()
11024 phba->cfg_nvmet_mrq = vectors; in lpfc_sli4_enable_msix()
11032 free_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_enable_msix()
11033 &phba->sli4_hba.hba_eq_hdl[index]); in lpfc_sli4_enable_msix()
11036 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
11057 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
11061 rc = pci_alloc_irq_vectors(phba->pcidev, 1, 1, in lpfc_sli4_enable_msi()
11064 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
11067 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
11072 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
11073 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
11075 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msi()
11076 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
11081 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_enable_msi()
11082 phba->sli4_hba.hba_eq_hdl[index].idx = index; in lpfc_sli4_enable_msi()
11083 phba->sli4_hba.hba_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msi()
11106 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
11116 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
11119 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
11126 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
11127 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
11130 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
11136 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
11137 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
11138 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
11143 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
11146 for (idx = 0; idx < phba->cfg_irq_chann; idx++) { in lpfc_sli4_enable_intr()
11147 eqhdl = &phba->sli4_hba.hba_eq_hdl[idx]; in lpfc_sli4_enable_intr()
11149 eqhdl->phba = phba; in lpfc_sli4_enable_intr()
11166 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
11169 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
11173 for (index = 0; index < phba->cfg_irq_chann; index++) { in lpfc_sli4_disable_intr()
11175 pci_irq_vector(phba->pcidev, index), in lpfc_sli4_disable_intr()
11177 free_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_disable_intr()
11178 &phba->sli4_hba.hba_eq_hdl[index]); in lpfc_sli4_disable_intr()
11181 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
11184 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
11187 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
11188 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
11199 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
11201 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
11208 kfree(phba->vpi_bmask); in lpfc_unset_hba()
11209 kfree(phba->vpi_ids); in lpfc_unset_hba()
11211 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
11213 phba->pport->work_port_events = 0; in lpfc_unset_hba()
11215 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
11217 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
11219 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
11238 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
11245 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
11254 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
11255 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
11258 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
11259 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
11267 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
11269 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
11275 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
11280 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
11285 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
11297 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_xri_exchange_busy_wait()
11298 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_xri_exchange_busy_wait()
11307 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
11309 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
11312 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
11328 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
11332 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
11334 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
11335 if (phba->pport) in lpfc_sli4_hba_unset()
11336 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
11344 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11345 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
11346 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11348 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
11354 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
11355 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11356 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
11358 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
11359 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
11360 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
11361 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
11365 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
11368 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
11371 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
11374 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
11378 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
11381 lpfc_ras_stop_fwlog(phba); in lpfc_sli4_hba_unset()
11386 lpfc_sli4_queue_unset(phba); in lpfc_sli4_hba_unset()
11387 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
11390 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
11393 if (phba->ras_fwlog.ras_enabled) in lpfc_sli4_hba_unset()
11394 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_hba_unset()
11397 if (phba->pport) in lpfc_sli4_hba_unset()
11398 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
11414 lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_pc_sli4_params_get() argument
11426 if (!phba->sli4_hba.intr_enable) in lpfc_pc_sli4_params_get()
11427 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pc_sli4_params_get()
11429 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_pc_sli4_params_get()
11430 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_pc_sli4_params_get()
11436 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_pc_sli4_params_get()
11486 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
11501 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
11506 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
11509 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
11510 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
11512 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
11513 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
11517 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
11527 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
11529 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
11546 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
11547 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
11550 phba->cfg_xpsgl = bf_get(cfg_xpsgl, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
11561 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) { in lpfc_get_sli4_parameters()
11562 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
11565 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
11571 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
11572 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
11577 phba->cfg_enable_fc4_type); in lpfc_get_sli4_parameters()
11579 phba->nvme_support = 0; in lpfc_get_sli4_parameters()
11580 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
11581 phba->cfg_nvmet_mrq = 0; in lpfc_get_sli4_parameters()
11582 phba->cfg_nvme_seg_cnt = 0; in lpfc_get_sli4_parameters()
11585 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
11587 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
11595 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_get_sli4_parameters()
11596 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; in lpfc_get_sli4_parameters()
11597 phba->cfg_iocb_cnt = 5; in lpfc_get_sli4_parameters()
11601 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_get_sli4_parameters()
11603 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
11613 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
11615 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
11617 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
11620 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
11632 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
11634 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
11636 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
11639 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
11640 phba->fcp_embed_io, phba->nvme_support, in lpfc_get_sli4_parameters()
11641 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
11643 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
11645 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
11653 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
11655 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
11660 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
11662 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
11668 phba->nsler = 1; in lpfc_get_sli4_parameters()
11670 phba->nsler = 0; in lpfc_get_sli4_parameters()
11695 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
11702 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
11703 if (!phba) in lpfc_pci_probe_one_s3()
11707 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
11712 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
11717 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
11719 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
11725 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
11727 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
11734 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
11736 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
11742 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
11744 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
11750 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
11753 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
11755 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
11761 vport = phba->pport; in lpfc_pci_probe_one_s3()
11764 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
11771 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
11774 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
11776 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
11778 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
11784 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
11785 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
11795 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
11797 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
11798 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
11801 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
11806 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
11813 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
11816 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
11821 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
11825 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
11827 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
11829 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
11831 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
11833 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
11835 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
11839 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
11858 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
11861 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
11863 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
11868 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
11870 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
11875 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
11890 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
11892 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
11894 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
11896 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
11897 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
11899 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
11900 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
11902 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s3()
11907 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
11911 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
11919 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
11920 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s3()
11922 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
11925 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
11929 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
11932 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
11933 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
11935 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
11966 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
11968 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
11972 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
11973 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
11974 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
11977 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
12009 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
12013 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
12030 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
12031 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
12032 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
12033 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
12034 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
12041 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
12043 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
12047 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
12050 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
12051 lpfc_online(phba); in lpfc_pci_resume_one_s3()
12054 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
12067 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
12069 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_recover()
12076 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
12088 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
12090 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_reset()
12094 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
12097 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
12100 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_reset()
12103 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
12106 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
12107 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
12119 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
12121 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_perm_failure()
12124 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
12127 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
12130 lpfc_sli_flush_io_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
12155 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
12160 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
12164 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
12168 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
12172 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s3()
12174 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
12201 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
12202 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
12223 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
12225 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
12228 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
12230 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset_s3()
12235 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
12238 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
12239 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
12240 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
12243 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
12262 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
12265 lpfc_online(phba); in lpfc_io_resume_s3()
12275 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
12277 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
12279 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
12305 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
12307 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
12309 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
12316 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
12321 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC && in lpfc_log_write_firmware_error()
12323 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC && in lpfc_log_write_firmware_error()
12325 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_log_write_firmware_error()
12329 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
12332 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_log_write_firmware_error()
12335 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
12349 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
12371 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
12373 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
12384 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
12409 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
12412 lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
12419 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
12427 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
12433 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
12446 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
12453 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
12457 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
12461 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
12462 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
12465 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
12467 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
12496 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
12503 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
12504 if (!phba) in lpfc_pci_probe_one_s4()
12508 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
12513 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
12518 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
12520 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
12526 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
12528 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
12533 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
12534 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
12537 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
12539 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
12545 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
12548 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
12551 phba->pport = NULL; in lpfc_pci_probe_one_s4()
12552 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
12555 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
12557 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
12563 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
12564 phba->cfg_irq_chann = 1; in lpfc_pci_probe_one_s4()
12565 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
12566 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
12567 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
12570 lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); in lpfc_pci_probe_one_s4()
12573 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
12575 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
12579 vport = phba->pport; in lpfc_pci_probe_one_s4()
12585 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
12591 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
12592 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
12599 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
12600 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
12603 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
12608 if (phba->nvmet_support == 0) { in lpfc_pci_probe_one_s4()
12609 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
12617 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
12626 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
12627 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
12630 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
12633 lpfc_sli4_ras_setup(phba); in lpfc_pci_probe_one_s4()
12640 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
12642 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
12644 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
12646 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
12648 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
12650 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
12654 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
12673 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
12677 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
12679 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
12685 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
12687 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
12692 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
12702 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
12706 if (phba->cfg_xri_rebalancing) in lpfc_pci_remove_one_s4()
12707 lpfc_destroy_multixri_pools(phba); in lpfc_pci_remove_one_s4()
12716 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
12717 spin_lock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
12719 spin_unlock_irq(&phba->port_list_lock); in lpfc_pci_remove_one_s4()
12724 lpfc_io_free(phba); in lpfc_pci_remove_one_s4()
12725 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
12726 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
12728 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
12729 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
12732 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
12736 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
12739 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
12769 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
12771 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
12775 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
12776 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
12777 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
12780 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
12781 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
12813 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
12817 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
12834 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
12835 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
12836 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
12837 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
12838 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
12845 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
12847 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
12851 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
12854 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
12855 lpfc_online(phba); in lpfc_pci_resume_one_s4()
12858 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
12871 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
12873 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_recover()
12879 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
12891 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
12893 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_reset()
12897 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
12900 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_reset()
12903 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_reset()
12906 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
12909 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
12910 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
12911 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
12923 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
12925 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_perm_failure()
12929 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
12932 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
12935 lpfc_sli_flush_io_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
12958 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
12963 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
12967 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
12971 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
12975 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s4()
12977 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
13004 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
13005 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
13026 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
13028 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
13031 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
13033 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset_s4()
13038 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
13041 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
13060 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
13068 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
13070 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_resume_s4()
13071 lpfc_offline(phba); in lpfc_io_resume_s4()
13072 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
13074 lpfc_online(phba); in lpfc_io_resume_s4()
13128 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
13130 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
13138 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_remove_one()
13140 phba->pci_dev_grp); in lpfc_pci_remove_one()
13164 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
13167 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
13175 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_suspend_one()
13177 phba->pci_dev_grp); in lpfc_pci_suspend_one()
13200 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
13203 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
13211 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one()
13213 phba->pci_dev_grp); in lpfc_pci_resume_one()
13238 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
13241 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
13249 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected()
13251 phba->pci_dev_grp); in lpfc_io_error_detected()
13275 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
13278 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
13286 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset()
13288 phba->pci_dev_grp); in lpfc_io_slot_reset()
13308 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
13310 switch (phba->pci_dev_grp) { in lpfc_io_resume()
13318 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_resume()
13320 phba->pci_dev_grp); in lpfc_io_resume()
13337 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
13340 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
13343 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
13344 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
13346 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
13347 if (phba->device_data_mem_pool) in lpfc_sli4_oas_verify()
13348 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
13349 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
13363 lpfc_sli4_ras_init(struct lpfc_hba *phba) in lpfc_sli4_ras_init() argument
13365 switch (phba->pcidev->device) { in lpfc_sli4_ras_init()
13368 phba->ras_fwlog.ras_hwsupport = true; in lpfc_sli4_ras_init()
13369 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && in lpfc_sli4_ras_init()
13370 phba->cfg_ras_fwlog_buffsize) in lpfc_sli4_ras_init()
13371 phba->ras_fwlog.ras_enabled = true; in lpfc_sli4_ras_init()
13373 phba->ras_fwlog.ras_enabled = false; in lpfc_sli4_ras_init()
13376 phba->ras_fwlog.ras_hwsupport = false; in lpfc_sli4_ras_init()