Lines Matching refs:phba
88 static int lpfc_hba_down_post_s3(struct lpfc_hba *phba);
89 static int lpfc_hba_down_post_s4(struct lpfc_hba *phba);
95 static void lpfc_sli4_oas_verify(struct lpfc_hba *phba);
117 lpfc_config_port_prep(struct lpfc_hba *phba) in lpfc_config_port_prep() argument
119 lpfc_vpd_t *vp = &phba->vpd; in lpfc_config_port_prep()
129 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_prep()
131 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_prep()
136 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_config_port_prep()
138 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port_prep()
147 lpfc_read_nv(phba, pmb); in lpfc_config_port_prep()
153 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
156 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_config_port_prep()
161 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
164 memcpy(phba->wwnn, (char *)mb->un.varRDnvp.nodename, in lpfc_config_port_prep()
165 sizeof(phba->wwnn)); in lpfc_config_port_prep()
166 memcpy(phba->wwpn, (char *)mb->un.varRDnvp.portname, in lpfc_config_port_prep()
167 sizeof(phba->wwpn)); in lpfc_config_port_prep()
170 phba->sli3_options = 0x0; in lpfc_config_port_prep()
173 lpfc_read_rev(phba, pmb); in lpfc_config_port_prep()
174 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
176 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_prep()
180 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
191 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_prep()
194 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
198 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) { in lpfc_config_port_prep()
199 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
226 phba->sli3_options |= LPFC_SLI3_VPORT_TEARDOWN; in lpfc_config_port_prep()
228 if (lpfc_is_LC_HBA(phba->pcidev->device)) in lpfc_config_port_prep()
229 memcpy(phba->RandomData, (char *)&mb->un.varWords[24], in lpfc_config_port_prep()
230 sizeof (phba->RandomData)); in lpfc_config_port_prep()
237 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD); in lpfc_config_port_prep()
238 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_prep()
241 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_config_port_prep()
259 lpfc_parse_vpd(phba, lpfc_vpd_data, offset); in lpfc_config_port_prep()
263 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_prep()
278 lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_config_async_cmpl() argument
281 phba->temp_sensor_support = 1; in lpfc_config_async_cmpl()
283 phba->temp_sensor_support = 0; in lpfc_config_async_cmpl()
284 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_config_async_cmpl()
299 lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_dump_wakeup_param_cmpl() argument
308 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
322 snprintf(phba->OptionROMVersion, 32, "%d.%d%d", in lpfc_dump_wakeup_param_cmpl()
325 snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", in lpfc_dump_wakeup_param_cmpl()
328 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_dump_wakeup_param_cmpl()
348 if (vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
349 u64_to_wwn(vport->phba->cfg_soft_wwnn, in lpfc_update_vport_wwn()
351 if (vport->phba->cfg_soft_wwpn) in lpfc_update_vport_wwn()
352 u64_to_wwn(vport->phba->cfg_soft_wwpn, in lpfc_update_vport_wwn()
359 if (vport->fc_nodename.u.wwn[0] == 0 || vport->phba->cfg_soft_wwnn) in lpfc_update_vport_wwn()
376 vport->phba->cfg_soft_wwpn || in lpfc_update_vport_wwn()
404 lpfc_config_port_post(struct lpfc_hba *phba) in lpfc_config_port_post() argument
406 struct lpfc_vport *vport = phba->pport; in lpfc_config_port_post()
411 struct lpfc_sli *psli = &phba->sli; in lpfc_config_port_post()
416 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
421 if (phba->over_temp_state == HBA_OVER_TEMP) in lpfc_config_port_post()
422 phba->over_temp_state = HBA_NORMAL_TEMP; in lpfc_config_port_post()
423 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
425 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
427 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
433 rc = lpfc_read_sparam(phba, pmb, 0); in lpfc_config_port_post()
435 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
440 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
441 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_post()
445 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
447 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
448 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
456 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_config_port_post()
464 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_config_port_post()
468 if (phba->SerialNumber[0] == 0) { in lpfc_config_port_post()
476 phba->SerialNumber[i] = in lpfc_config_port_post()
479 phba->SerialNumber[i] = in lpfc_config_port_post()
484 phba->SerialNumber[i] = in lpfc_config_port_post()
487 phba->SerialNumber[i] = in lpfc_config_port_post()
492 lpfc_read_config(phba, pmb); in lpfc_config_port_post()
494 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_config_port_post()
495 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_config_port_post()
499 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
500 mempool_free( pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
505 lpfc_sli_read_link_ste(phba); in lpfc_config_port_post()
509 if (phba->cfg_hba_queue_depth > i) { in lpfc_config_port_post()
510 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
512 phba->cfg_hba_queue_depth, i); in lpfc_config_port_post()
513 phba->cfg_hba_queue_depth = i; in lpfc_config_port_post()
518 if (phba->pport->cfg_lun_queue_depth > i) { in lpfc_config_port_post()
519 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_config_port_post()
521 phba->pport->cfg_lun_queue_depth, i); in lpfc_config_port_post()
522 phba->pport->cfg_lun_queue_depth = i; in lpfc_config_port_post()
525 phba->lmt = mb->un.varRdConfig.lmt; in lpfc_config_port_post()
528 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_config_port_post()
530 phba->link_state = LPFC_LINK_DOWN; in lpfc_config_port_post()
539 if (phba->sli_rev != 3) in lpfc_config_port_post()
540 lpfc_post_rcv_buf(phba); in lpfc_config_port_post()
545 if (phba->intr_type == MSIX) { in lpfc_config_port_post()
546 rc = lpfc_config_msi(phba, pmb); in lpfc_config_port_post()
548 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
551 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_config_port_post()
553 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_config_port_post()
558 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
563 spin_lock_irq(&phba->hbalock); in lpfc_config_port_post()
565 phba->hba_flag &= ~HBA_ERATT_HANDLED; in lpfc_config_port_post()
568 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_config_port_post()
569 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
582 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) && in lpfc_config_port_post()
583 (phba->cfg_poll & DISABLE_FCP_RING_INT)) in lpfc_config_port_post()
586 writel(status, phba->HCregaddr); in lpfc_config_port_post()
587 readl(phba->HCregaddr); /* flush */ in lpfc_config_port_post()
588 spin_unlock_irq(&phba->hbalock); in lpfc_config_port_post()
591 timeout = phba->fc_ratov * 2; in lpfc_config_port_post()
595 mod_timer(&phba->hb_tmofunc, in lpfc_config_port_post()
597 phba->hb_outstanding = 0; in lpfc_config_port_post()
598 phba->last_completion_time = jiffies; in lpfc_config_port_post()
600 mod_timer(&phba->eratt_poll, in lpfc_config_port_post()
601 jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); in lpfc_config_port_post()
603 if (phba->hba_flag & LINK_DISABLED) { in lpfc_config_port_post()
604 lpfc_printf_log(phba, in lpfc_config_port_post()
607 lpfc_down_link(phba, pmb); in lpfc_config_port_post()
609 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
611 lpfc_printf_log(phba, in lpfc_config_port_post()
616 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
619 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_config_port_post()
620 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
621 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_config_port_post()
626 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
628 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
632 lpfc_config_async(phba, pmb, LPFC_ELS_RING); in lpfc_config_port_post()
634 pmb->vport = phba->pport; in lpfc_config_port_post()
635 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
638 lpfc_printf_log(phba, in lpfc_config_port_post()
644 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
648 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_config_port_post()
650 phba->link_state = LPFC_HBA_ERROR; in lpfc_config_port_post()
654 lpfc_dump_wakeup_param(phba, pmb); in lpfc_config_port_post()
656 pmb->vport = phba->pport; in lpfc_config_port_post()
657 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_config_port_post()
660 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0435 Adapter failed " in lpfc_config_port_post()
662 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_config_port_post()
683 lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_init_link() argument
685 return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); in lpfc_hba_init_link()
704 lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, in lpfc_hba_init_link_fc_topology() argument
707 struct lpfc_vport *vport = phba->pport; in lpfc_hba_init_link_fc_topology()
712 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_init_link_fc_topology()
714 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
720 if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || in lpfc_hba_init_link_fc_topology()
721 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && in lpfc_hba_init_link_fc_topology()
722 !(phba->lmt & LMT_1Gb)) || in lpfc_hba_init_link_fc_topology()
723 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && in lpfc_hba_init_link_fc_topology()
724 !(phba->lmt & LMT_2Gb)) || in lpfc_hba_init_link_fc_topology()
725 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && in lpfc_hba_init_link_fc_topology()
726 !(phba->lmt & LMT_4Gb)) || in lpfc_hba_init_link_fc_topology()
727 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && in lpfc_hba_init_link_fc_topology()
728 !(phba->lmt & LMT_8Gb)) || in lpfc_hba_init_link_fc_topology()
729 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && in lpfc_hba_init_link_fc_topology()
730 !(phba->lmt & LMT_10Gb)) || in lpfc_hba_init_link_fc_topology()
731 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && in lpfc_hba_init_link_fc_topology()
732 !(phba->lmt & LMT_16Gb)) || in lpfc_hba_init_link_fc_topology()
733 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) && in lpfc_hba_init_link_fc_topology()
734 !(phba->lmt & LMT_32Gb)) || in lpfc_hba_init_link_fc_topology()
735 ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_64G) && in lpfc_hba_init_link_fc_topology()
736 !(phba->lmt & LMT_64Gb))) { in lpfc_hba_init_link_fc_topology()
738 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, in lpfc_hba_init_link_fc_topology()
741 phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
742 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_hba_init_link_fc_topology()
744 lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); in lpfc_hba_init_link_fc_topology()
746 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_hba_init_link_fc_topology()
747 lpfc_set_loopback_flag(phba); in lpfc_hba_init_link_fc_topology()
748 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_init_link_fc_topology()
750 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_hba_init_link_fc_topology()
754 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_init_link_fc_topology()
756 writel(0, phba->HCregaddr); in lpfc_hba_init_link_fc_topology()
757 readl(phba->HCregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
759 writel(0xffffffff, phba->HAregaddr); in lpfc_hba_init_link_fc_topology()
760 readl(phba->HAregaddr); /* flush */ in lpfc_hba_init_link_fc_topology()
762 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_init_link_fc_topology()
764 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
767 phba->cfg_suppress_link_up = LPFC_INITIALIZE_LINK; in lpfc_hba_init_link_fc_topology()
769 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_init_link_fc_topology()
788 lpfc_hba_down_link(struct lpfc_hba *phba, uint32_t flag) in lpfc_hba_down_link() argument
793 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_hba_down_link()
795 phba->link_state = LPFC_HBA_ERROR; in lpfc_hba_down_link()
799 lpfc_printf_log(phba, in lpfc_hba_down_link()
802 lpfc_down_link(phba, pmb); in lpfc_hba_down_link()
804 rc = lpfc_sli_issue_mbox(phba, pmb, flag); in lpfc_hba_down_link()
806 lpfc_printf_log(phba, in lpfc_hba_down_link()
811 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
815 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_hba_down_link()
832 lpfc_hba_down_prep(struct lpfc_hba *phba) in lpfc_hba_down_prep() argument
837 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_hba_down_prep()
839 writel(0, phba->HCregaddr); in lpfc_hba_down_prep()
840 readl(phba->HCregaddr); /* flush */ in lpfc_hba_down_prep()
843 if (phba->pport->load_flag & FC_UNLOADING) in lpfc_hba_down_prep()
844 lpfc_cleanup_discovery_resources(phba->pport); in lpfc_hba_down_prep()
846 vports = lpfc_create_vport_work_array(phba); in lpfc_hba_down_prep()
848 for (i = 0; i <= phba->max_vports && in lpfc_hba_down_prep()
851 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hba_down_prep()
870 lpfc_sli4_free_sp_events(struct lpfc_hba *phba) in lpfc_sli4_free_sp_events() argument
876 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
877 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli4_free_sp_events()
878 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
880 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli4_free_sp_events()
882 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
883 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli4_free_sp_events()
885 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_sp_events()
891 lpfc_sli_release_iocbq(phba, rspiocbq); in lpfc_sli4_free_sp_events()
897 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_free_sp_events()
914 lpfc_hba_free_post_buf(struct lpfc_hba *phba) in lpfc_hba_free_post_buf() argument
916 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_free_post_buf()
922 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) in lpfc_hba_free_post_buf()
923 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_free_post_buf()
927 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
929 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
935 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_hba_free_post_buf()
939 spin_lock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
941 spin_unlock_irq(&phba->hbalock); in lpfc_hba_free_post_buf()
956 lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) in lpfc_hba_clean_txcmplq() argument
958 struct lpfc_sli *psli = &phba->sli; in lpfc_hba_clean_txcmplq()
965 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_hba_clean_txcmplq()
968 spin_lock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
975 spin_unlock_irq(&phba->hbalock); in lpfc_hba_clean_txcmplq()
977 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
980 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
984 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_hba_clean_txcmplq()
995 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_hba_clean_txcmplq()
998 lpfc_sli_cancel_iocbs(phba, &completions, in lpfc_hba_clean_txcmplq()
1015 lpfc_hba_down_post_s3(struct lpfc_hba *phba) in lpfc_hba_down_post_s3() argument
1017 lpfc_hba_free_post_buf(phba); in lpfc_hba_down_post_s3()
1018 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s3()
1034 lpfc_hba_down_post_s4(struct lpfc_hba *phba) in lpfc_hba_down_post_s4() argument
1046 lpfc_sli_hbqbuf_free_all(phba); in lpfc_hba_down_post_s4()
1047 lpfc_hba_clean_txcmplq(phba); in lpfc_hba_down_post_s4()
1055 spin_lock_irq(&phba->hbalock); /* required for lpfc_els_sgl_list and */ in lpfc_hba_down_post_s4()
1060 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1062 &phba->sli4_hba.lpfc_abts_els_sgl_list, list) in lpfc_hba_down_post_s4()
1065 list_splice_init(&phba->sli4_hba.lpfc_abts_els_sgl_list, in lpfc_hba_down_post_s4()
1066 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_hba_down_post_s4()
1069 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_hba_down_post_s4()
1073 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_hba_down_post_s4()
1074 spin_lock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_hba_down_post_s4()
1075 list_splice_init(&phba->sli4_hba.lpfc_abts_scsi_buf_list, in lpfc_hba_down_post_s4()
1077 spin_unlock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_hba_down_post_s4()
1080 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_hba_down_post_s4()
1081 spin_lock(&phba->sli4_hba.abts_nvme_buf_list_lock); in lpfc_hba_down_post_s4()
1082 list_splice_init(&phba->sli4_hba.lpfc_abts_nvme_buf_list, in lpfc_hba_down_post_s4()
1084 list_splice_init(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list, in lpfc_hba_down_post_s4()
1086 spin_unlock(&phba->sli4_hba.abts_nvme_buf_list_lock); in lpfc_hba_down_post_s4()
1089 spin_unlock_irq(&phba->hbalock); in lpfc_hba_down_post_s4()
1095 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); in lpfc_hba_down_post_s4()
1096 list_splice(&aborts, &phba->lpfc_scsi_buf_list_put); in lpfc_hba_down_post_s4()
1097 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); in lpfc_hba_down_post_s4()
1099 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_hba_down_post_s4()
1106 spin_lock_irqsave(&phba->nvme_buf_list_put_lock, iflag); in lpfc_hba_down_post_s4()
1107 phba->put_nvme_bufs += cnt; in lpfc_hba_down_post_s4()
1108 list_splice(&nvme_aborts, &phba->lpfc_nvme_buf_list_put); in lpfc_hba_down_post_s4()
1109 spin_unlock_irqrestore(&phba->nvme_buf_list_put_lock, iflag); in lpfc_hba_down_post_s4()
1113 lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf); in lpfc_hba_down_post_s4()
1117 lpfc_sli4_free_sp_events(phba); in lpfc_hba_down_post_s4()
1133 lpfc_hba_down_post(struct lpfc_hba *phba) in lpfc_hba_down_post() argument
1135 return (*phba->lpfc_hba_down_post)(phba); in lpfc_hba_down_post()
1153 struct lpfc_hba *phba; in lpfc_hb_timeout() local
1157 phba = from_timer(phba, t, hb_tmofunc); in lpfc_hb_timeout()
1160 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1161 tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; in lpfc_hb_timeout()
1163 phba->pport->work_port_events |= WORKER_HB_TMO; in lpfc_hb_timeout()
1164 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_hb_timeout()
1168 lpfc_worker_wake_up(phba); in lpfc_hb_timeout()
1187 struct lpfc_hba *phba; in lpfc_rrq_timeout() local
1190 phba = from_timer(phba, t, rrq_tmr); in lpfc_rrq_timeout()
1191 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1192 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1193 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1195 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_rrq_timeout()
1196 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_rrq_timeout()
1198 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_rrq_timeout()
1199 lpfc_worker_wake_up(phba); in lpfc_rrq_timeout()
1219 lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) in lpfc_hb_mbox_cmpl() argument
1223 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1224 phba->hb_outstanding = 0; in lpfc_hb_mbox_cmpl()
1225 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_hb_mbox_cmpl()
1228 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_hb_mbox_cmpl()
1229 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && in lpfc_hb_mbox_cmpl()
1230 !(phba->link_state == LPFC_HBA_ERROR) && in lpfc_hb_mbox_cmpl()
1231 !(phba->pport->load_flag & FC_UNLOADING)) in lpfc_hb_mbox_cmpl()
1232 mod_timer(&phba->hb_tmofunc, in lpfc_hb_mbox_cmpl()
1255 lpfc_hb_timeout_handler(struct lpfc_hba *phba) in lpfc_hb_timeout_handler() argument
1261 struct lpfc_sli *psli = &phba->sli; in lpfc_hb_timeout_handler()
1272 void __iomem *eqdreg = phba->sli4_hba.u.if_type2.EQDregaddr; in lpfc_hb_timeout_handler()
1274 vports = lpfc_create_vport_work_array(phba); in lpfc_hb_timeout_handler()
1276 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_hb_timeout_handler()
1280 lpfc_destroy_vport_work_array(phba, vports); in lpfc_hb_timeout_handler()
1282 if ((phba->link_state == LPFC_HBA_ERROR) || in lpfc_hb_timeout_handler()
1283 (phba->pport->load_flag & FC_UNLOADING) || in lpfc_hb_timeout_handler()
1284 (phba->pport->fc_flag & FC_OFFLINE_MODE)) in lpfc_hb_timeout_handler()
1287 if (phba->cfg_auto_imax) { in lpfc_hb_timeout_handler()
1288 if (!phba->last_eqdelay_time) { in lpfc_hb_timeout_handler()
1289 phba->last_eqdelay_time = jiffies; in lpfc_hb_timeout_handler()
1292 time_elapsed = jiffies - phba->last_eqdelay_time; in lpfc_hb_timeout_handler()
1293 phba->last_eqdelay_time = jiffies; in lpfc_hb_timeout_handler()
1297 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_hb_timeout_handler()
1298 if (phba->nvmet_support) { in lpfc_hb_timeout_handler()
1299 tgtp = phba->targetport->private; in lpfc_hb_timeout_handler()
1305 localport = phba->pport->localport; in lpfc_hb_timeout_handler()
1312 i < phba->cfg_nvme_io_channel; i++) { in lpfc_hb_timeout_handler()
1328 val = phba->cfg_fcp_imax / phba->io_channel_irqs; in lpfc_hb_timeout_handler()
1334 for (i = 0; i < phba->io_channel_irqs; i++) { in lpfc_hb_timeout_handler()
1336 qp = phba->sli4_hba.hba_eq[i]; in lpfc_hb_timeout_handler()
1349 val = phba->cfg_fcp_imax; in lpfc_hb_timeout_handler()
1351 if (phba->sli.sli_flag & LPFC_SLI_USE_EQDR) { in lpfc_hb_timeout_handler()
1357 val = phba->cfg_fcp_imax / in lpfc_hb_timeout_handler()
1358 phba->io_channel_irqs; in lpfc_hb_timeout_handler()
1374 lpfc_modify_hba_eq_delay(phba, i, in lpfc_hb_timeout_handler()
1388 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1390 if (time_after(phba->last_completion_time + in lpfc_hb_timeout_handler()
1393 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1394 if (!phba->hb_outstanding) in lpfc_hb_timeout_handler()
1395 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1399 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1404 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_hb_timeout_handler()
1406 if (phba->elsbuf_cnt && in lpfc_hb_timeout_handler()
1407 (phba->elsbuf_cnt == phba->elsbuf_prev_cnt)) { in lpfc_hb_timeout_handler()
1408 spin_lock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1409 list_splice_init(&phba->elsbuf, &completions); in lpfc_hb_timeout_handler()
1410 phba->elsbuf_cnt = 0; in lpfc_hb_timeout_handler()
1411 phba->elsbuf_prev_cnt = 0; in lpfc_hb_timeout_handler()
1412 spin_unlock_irq(&phba->hbalock); in lpfc_hb_timeout_handler()
1417 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_hb_timeout_handler()
1421 phba->elsbuf_prev_cnt = phba->elsbuf_cnt; in lpfc_hb_timeout_handler()
1424 if (phba->cfg_enable_hba_heartbeat) { in lpfc_hb_timeout_handler()
1425 if (!phba->hb_outstanding) { in lpfc_hb_timeout_handler()
1428 pmboxq = mempool_alloc(phba->mbox_mem_pool, in lpfc_hb_timeout_handler()
1431 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1438 lpfc_heart_beat(phba, pmboxq); in lpfc_hb_timeout_handler()
1440 pmboxq->vport = phba->pport; in lpfc_hb_timeout_handler()
1441 retval = lpfc_sli_issue_mbox(phba, pmboxq, in lpfc_hb_timeout_handler()
1447 phba->mbox_mem_pool); in lpfc_hb_timeout_handler()
1448 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1454 phba->skipped_hb = 0; in lpfc_hb_timeout_handler()
1455 phba->hb_outstanding = 1; in lpfc_hb_timeout_handler()
1456 } else if (time_before_eq(phba->last_completion_time, in lpfc_hb_timeout_handler()
1457 phba->skipped_hb)) { in lpfc_hb_timeout_handler()
1458 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_hb_timeout_handler()
1462 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1464 phba->skipped_hb = jiffies; in lpfc_hb_timeout_handler()
1466 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1476 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_hb_timeout_handler()
1480 - phba->last_completion_time)); in lpfc_hb_timeout_handler()
1481 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1486 mod_timer(&phba->hb_tmofunc, in lpfc_hb_timeout_handler()
1500 lpfc_offline_eratt(struct lpfc_hba *phba) in lpfc_offline_eratt() argument
1502 struct lpfc_sli *psli = &phba->sli; in lpfc_offline_eratt()
1504 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1506 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1507 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_offline_eratt()
1509 lpfc_offline(phba); in lpfc_offline_eratt()
1510 lpfc_reset_barrier(phba); in lpfc_offline_eratt()
1511 spin_lock_irq(&phba->hbalock); in lpfc_offline_eratt()
1512 lpfc_sli_brdreset(phba); in lpfc_offline_eratt()
1513 spin_unlock_irq(&phba->hbalock); in lpfc_offline_eratt()
1514 lpfc_hba_down_post(phba); in lpfc_offline_eratt()
1515 lpfc_sli_brdready(phba, HS_MBRDY); in lpfc_offline_eratt()
1516 lpfc_unblock_mgmt_io(phba); in lpfc_offline_eratt()
1517 phba->link_state = LPFC_HBA_ERROR; in lpfc_offline_eratt()
1529 lpfc_sli4_offline_eratt(struct lpfc_hba *phba) in lpfc_sli4_offline_eratt() argument
1531 spin_lock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1532 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_offline_eratt()
1533 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_offline_eratt()
1535 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_offline_eratt()
1536 lpfc_offline(phba); in lpfc_sli4_offline_eratt()
1537 lpfc_hba_down_post(phba); in lpfc_sli4_offline_eratt()
1538 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_offline_eratt()
1551 lpfc_handle_deferred_eratt(struct lpfc_hba *phba) in lpfc_handle_deferred_eratt() argument
1553 uint32_t old_host_status = phba->work_hs; in lpfc_handle_deferred_eratt()
1554 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_deferred_eratt()
1559 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_deferred_eratt()
1560 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1561 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1562 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1566 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_deferred_eratt()
1569 phba->work_hs, in lpfc_handle_deferred_eratt()
1570 phba->work_status[0], phba->work_status[1]); in lpfc_handle_deferred_eratt()
1572 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1574 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1582 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_deferred_eratt()
1588 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_handle_deferred_eratt()
1589 lpfc_offline(phba); in lpfc_handle_deferred_eratt()
1592 while (phba->work_hs & HS_FFER1) { in lpfc_handle_deferred_eratt()
1594 if (lpfc_readl(phba->HSregaddr, &phba->work_hs)) { in lpfc_handle_deferred_eratt()
1595 phba->work_hs = UNPLUG_ERR ; in lpfc_handle_deferred_eratt()
1599 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_handle_deferred_eratt()
1600 phba->work_hs = 0; in lpfc_handle_deferred_eratt()
1610 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_deferred_eratt()
1611 phba->work_hs = old_host_status & ~HS_FFER1; in lpfc_handle_deferred_eratt()
1613 spin_lock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1614 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_deferred_eratt()
1615 spin_unlock_irq(&phba->hbalock); in lpfc_handle_deferred_eratt()
1616 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8); in lpfc_handle_deferred_eratt()
1617 phba->work_status[1] = readl(phba->MBslimaddr + 0xac); in lpfc_handle_deferred_eratt()
1621 lpfc_board_errevt_to_mgmt(struct lpfc_hba *phba) in lpfc_board_errevt_to_mgmt() argument
1628 shost = lpfc_shost_from_vport(phba->pport); in lpfc_board_errevt_to_mgmt()
1646 lpfc_handle_eratt_s3(struct lpfc_hba *phba) in lpfc_handle_eratt_s3() argument
1648 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s3()
1649 struct lpfc_sli *psli = &phba->sli; in lpfc_handle_eratt_s3()
1658 if (pci_channel_offline(phba->pcidev)) { in lpfc_handle_eratt_s3()
1659 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1660 phba->hba_flag &= ~DEFER_ERATT; in lpfc_handle_eratt_s3()
1661 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1666 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s3()
1670 lpfc_board_errevt_to_mgmt(phba); in lpfc_handle_eratt_s3()
1672 if (phba->hba_flag & DEFER_ERATT) in lpfc_handle_eratt_s3()
1673 lpfc_handle_deferred_eratt(phba); in lpfc_handle_eratt_s3()
1675 if ((phba->work_hs & HS_FFER6) || (phba->work_hs & HS_FFER8)) { in lpfc_handle_eratt_s3()
1676 if (phba->work_hs & HS_FFER6) in lpfc_handle_eratt_s3()
1678 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1681 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1682 phba->work_status[1]); in lpfc_handle_eratt_s3()
1683 if (phba->work_hs & HS_FFER8) in lpfc_handle_eratt_s3()
1685 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, in lpfc_handle_eratt_s3()
1688 phba->work_hs, phba->work_status[0], in lpfc_handle_eratt_s3()
1689 phba->work_status[1]); in lpfc_handle_eratt_s3()
1691 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1693 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1701 lpfc_sli_abort_fcp_rings(phba); in lpfc_handle_eratt_s3()
1707 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_handle_eratt_s3()
1708 lpfc_offline(phba); in lpfc_handle_eratt_s3()
1709 lpfc_sli_brdrestart(phba); in lpfc_handle_eratt_s3()
1710 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ in lpfc_handle_eratt_s3()
1711 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1714 lpfc_unblock_mgmt_io(phba); in lpfc_handle_eratt_s3()
1715 } else if (phba->work_hs & HS_CRIT_TEMP) { in lpfc_handle_eratt_s3()
1716 temperature = readl(phba->MBslimaddr + TEMPERATURE_OFFSET); in lpfc_handle_eratt_s3()
1721 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s3()
1725 temperature, phba->work_hs, in lpfc_handle_eratt_s3()
1726 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1728 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s3()
1735 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1736 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s3()
1737 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s3()
1738 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1745 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s3()
1748 phba->work_hs, in lpfc_handle_eratt_s3()
1749 phba->work_status[0], phba->work_status[1]); in lpfc_handle_eratt_s3()
1757 lpfc_offline_eratt(phba); in lpfc_handle_eratt_s3()
1774 lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action, in lpfc_sli4_port_sta_fn_reset() argument
1780 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_port_sta_fn_reset()
1786 rc = lpfc_sli4_pdev_status_reg_wait(phba); in lpfc_sli4_port_sta_fn_reset()
1793 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1796 lpfc_offline_prep(phba, mbx_action); in lpfc_sli4_port_sta_fn_reset()
1797 lpfc_offline(phba); in lpfc_sli4_port_sta_fn_reset()
1799 lpfc_sli4_disable_intr(phba); in lpfc_sli4_port_sta_fn_reset()
1800 lpfc_sli_brdrestart(phba); in lpfc_sli4_port_sta_fn_reset()
1802 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_sli4_port_sta_fn_reset()
1804 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_port_sta_fn_reset()
1808 phba->intr_mode = intr_mode; in lpfc_sli4_port_sta_fn_reset()
1809 rc = lpfc_online(phba); in lpfc_sli4_port_sta_fn_reset()
1811 lpfc_unblock_mgmt_io(phba); in lpfc_sli4_port_sta_fn_reset()
1824 lpfc_handle_eratt_s4(struct lpfc_hba *phba) in lpfc_handle_eratt_s4() argument
1826 struct lpfc_vport *vport = phba->pport; in lpfc_handle_eratt_s4()
1842 if (pci_channel_offline(phba->pcidev)) 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 lpfc_sli4_offline_eratt(phba); 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()
1922 reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_handle_eratt_s4()
1923 reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_handle_eratt_s4()
1925 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1930 phba->sfp_alarm |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_handle_eratt_s4()
1935 shost = lpfc_shost_from_vport(phba->pport); in lpfc_handle_eratt_s4()
1942 spin_lock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1943 phba->over_temp_state = HBA_OVER_TEMP; in lpfc_handle_eratt_s4()
1944 spin_unlock_irq(&phba->hbalock); in lpfc_handle_eratt_s4()
1945 lpfc_sli4_offline_eratt(phba); in lpfc_handle_eratt_s4()
1950 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1956 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1960 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1964 if (!phba->cfg_enable_hba_reset) in lpfc_handle_eratt_s4()
1968 rc = lpfc_sli4_port_sta_fn_reset(phba, LPFC_MBX_NO_WAIT, in lpfc_handle_eratt_s4()
1979 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_handle_eratt_s4()
1982 lpfc_sli4_offline_eratt(phba); 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 lpfc_stop_vport_timers(phba->pport); in lpfc_stop_hba_timers()
2938 del_timer_sync(&phba->sli.mbox_tmo); in lpfc_stop_hba_timers()
2939 del_timer_sync(&phba->fabric_block_timer); in lpfc_stop_hba_timers()
2940 del_timer_sync(&phba->eratt_poll); in lpfc_stop_hba_timers()
2941 del_timer_sync(&phba->hb_tmofunc); in lpfc_stop_hba_timers()
2942 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_stop_hba_timers()
2943 del_timer_sync(&phba->rrq_tmr); in lpfc_stop_hba_timers()
2944 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_stop_hba_timers()
2946 phba->hb_outstanding = 0; in lpfc_stop_hba_timers()
2948 switch (phba->pci_dev_grp) { in lpfc_stop_hba_timers()
2951 del_timer_sync(&phba->fcp_poll_timer); in lpfc_stop_hba_timers()
2955 lpfc_sli4_stop_fcf_redisc_wait_timer(phba); in lpfc_stop_hba_timers()
2958 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_stop_hba_timers()
2960 phba->pci_dev_grp); in lpfc_stop_hba_timers()
2977 lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) in lpfc_block_mgmt_io() argument
2983 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2984 phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; in lpfc_block_mgmt_io()
2985 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2989 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
2990 if (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
2991 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; in lpfc_block_mgmt_io()
2995 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_block_mgmt_io()
2996 phba->sli.mbox_active) * 1000) + jiffies; in lpfc_block_mgmt_io()
2998 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_block_mgmt_io()
3001 while (phba->sli.mbox_active) { in lpfc_block_mgmt_io()
3005 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_block_mgmt_io()
3008 phba->sli.sli_flag, actcmd); in lpfc_block_mgmt_io()
3023 lpfc_sli4_node_prep(struct lpfc_hba *phba) in lpfc_sli4_node_prep() argument
3030 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_sli4_node_prep()
3033 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_node_prep()
3037 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_sli4_node_prep()
3046 rpi = lpfc_sli4_alloc_rpi(phba); in lpfc_sli4_node_prep()
3048 spin_lock_irqsave(&phba->ndlp_lock, flags); in lpfc_sli4_node_prep()
3050 spin_unlock_irqrestore(&phba->ndlp_lock, flags); in lpfc_sli4_node_prep()
3061 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_node_prep()
3077 lpfc_online(struct lpfc_hba *phba) in lpfc_online() argument
3084 if (!phba) in lpfc_online()
3086 vport = phba->pport; in lpfc_online()
3091 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_online()
3094 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_online()
3096 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3097 if (lpfc_sli4_hba_setup(phba)) { /* Initialize SLI4 HBA */ in lpfc_online()
3098 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3101 spin_lock_irq(&phba->hbalock); in lpfc_online()
3102 if (!phba->sli4_hba.max_cfg_param.vpi_used) in lpfc_online()
3104 spin_unlock_irq(&phba->hbalock); in lpfc_online()
3109 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_online()
3110 !phba->nvmet_support) { in lpfc_online()
3111 error = lpfc_nvme_create_localport(phba->pport); in lpfc_online()
3113 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_online()
3118 lpfc_sli_queue_init(phba); in lpfc_online()
3119 if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */ in lpfc_online()
3120 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3125 vports = lpfc_create_vport_work_array(phba); in lpfc_online()
3127 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_online()
3132 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) in lpfc_online()
3134 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_online()
3144 lpfc_destroy_vport_work_array(phba, vports); in lpfc_online()
3146 lpfc_unblock_mgmt_io(phba); in lpfc_online()
3162 lpfc_unblock_mgmt_io(struct lpfc_hba * phba) in lpfc_unblock_mgmt_io() argument
3166 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3167 phba->sli.sli_flag &= ~LPFC_BLOCK_MGMT_IO; in lpfc_unblock_mgmt_io()
3168 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_unblock_mgmt_io()
3180 lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) in lpfc_offline_prep() argument
3182 struct lpfc_vport *vport = phba->pport; in lpfc_offline_prep()
3191 lpfc_block_mgmt_io(phba, mbx_action); in lpfc_offline_prep()
3193 lpfc_linkdown(phba); in lpfc_offline_prep()
3196 vports = lpfc_create_vport_work_array(phba); in lpfc_offline_prep()
3198 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline_prep()
3230 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_offline_prep()
3240 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); in lpfc_offline_prep()
3246 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline_prep()
3248 lpfc_sli_mbox_sys_shutdown(phba, mbx_action); in lpfc_offline_prep()
3250 if (phba->wq) in lpfc_offline_prep()
3251 flush_workqueue(phba->wq); in lpfc_offline_prep()
3263 lpfc_offline(struct lpfc_hba *phba) in lpfc_offline() argument
3269 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_offline()
3273 lpfc_stop_port(phba); in lpfc_offline()
3278 lpfc_nvmet_destroy_targetport(phba); in lpfc_offline()
3279 lpfc_nvme_destroy_localport(phba->pport); in lpfc_offline()
3281 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3283 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_offline()
3285 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3286 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_offline()
3290 lpfc_sli_hba_down(phba); in lpfc_offline()
3291 spin_lock_irq(&phba->hbalock); in lpfc_offline()
3292 phba->work_ha = 0; in lpfc_offline()
3293 spin_unlock_irq(&phba->hbalock); in lpfc_offline()
3294 vports = lpfc_create_vport_work_array(phba); in lpfc_offline()
3296 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_offline()
3303 lpfc_destroy_vport_work_array(phba, vports); in lpfc_offline()
3315 lpfc_scsi_free(struct lpfc_hba *phba) in lpfc_scsi_free() argument
3319 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_scsi_free()
3322 spin_lock_irq(&phba->hbalock); in lpfc_scsi_free()
3326 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3327 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, in lpfc_scsi_free()
3330 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3333 phba->total_scsi_bufs--; in lpfc_scsi_free()
3335 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_scsi_free()
3337 spin_lock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3338 list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, in lpfc_scsi_free()
3341 dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, in lpfc_scsi_free()
3344 phba->total_scsi_bufs--; in lpfc_scsi_free()
3346 spin_unlock(&phba->scsi_buf_list_get_lock); in lpfc_scsi_free()
3347 spin_unlock_irq(&phba->hbalock); in lpfc_scsi_free()
3358 lpfc_nvme_free(struct lpfc_hba *phba) in lpfc_nvme_free() argument
3362 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) in lpfc_nvme_free()
3365 spin_lock_irq(&phba->hbalock); in lpfc_nvme_free()
3368 spin_lock(&phba->nvme_buf_list_put_lock); in lpfc_nvme_free()
3370 &phba->lpfc_nvme_buf_list_put, list) { in lpfc_nvme_free()
3372 phba->put_nvme_bufs--; in lpfc_nvme_free()
3373 dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data, in lpfc_nvme_free()
3376 phba->total_nvme_bufs--; in lpfc_nvme_free()
3378 spin_unlock(&phba->nvme_buf_list_put_lock); in lpfc_nvme_free()
3380 spin_lock(&phba->nvme_buf_list_get_lock); in lpfc_nvme_free()
3382 &phba->lpfc_nvme_buf_list_get, list) { in lpfc_nvme_free()
3384 phba->get_nvme_bufs--; in lpfc_nvme_free()
3385 dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data, in lpfc_nvme_free()
3388 phba->total_nvme_bufs--; in lpfc_nvme_free()
3390 spin_unlock(&phba->nvme_buf_list_get_lock); in lpfc_nvme_free()
3391 spin_unlock_irq(&phba->hbalock); in lpfc_nvme_free()
3406 lpfc_sli4_els_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_els_sgl_update() argument
3416 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_els_sgl_update()
3418 if (els_xri_cnt > phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
3420 xri_cnt = els_xri_cnt - phba->sli4_hba.els_xri_cnt; in lpfc_sli4_els_sgl_update()
3421 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3423 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
3430 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_els_sgl_update()
3437 sglq_entry->virt = lpfc_mbuf_alloc(phba, 0, in lpfc_sli4_els_sgl_update()
3441 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_els_sgl_update()
3452 spin_lock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3453 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3455 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
3456 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3457 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3458 } else if (els_xri_cnt < phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_els_sgl_update()
3460 xri_cnt = phba->sli4_hba.els_xri_cnt - els_xri_cnt; in lpfc_sli4_els_sgl_update()
3461 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3463 "%d to %d\n", phba->sli4_hba.els_xri_cnt, in lpfc_sli4_els_sgl_update()
3465 spin_lock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3466 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3467 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, in lpfc_sli4_els_sgl_update()
3474 __lpfc_mbuf_free(phba, sglq_entry->virt, in lpfc_sli4_els_sgl_update()
3480 &phba->sli4_hba.lpfc_els_sgl_list); in lpfc_sli4_els_sgl_update()
3481 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_els_sgl_update()
3482 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_els_sgl_update()
3484 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_els_sgl_update()
3487 phba->sli4_hba.els_xri_cnt = els_xri_cnt; in lpfc_sli4_els_sgl_update()
3493 &phba->sli4_hba.lpfc_els_sgl_list, list) { in lpfc_sli4_els_sgl_update()
3494 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_els_sgl_update()
3496 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_els_sgl_update()
3503 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_els_sgl_update()
3508 lpfc_free_els_sgl_list(phba); in lpfc_sli4_els_sgl_update()
3525 lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_nvmet_sgl_update() argument
3536 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_nvmet_sgl_update()
3539 nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3540 if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
3542 xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3543 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3545 phba->sli4_hba.nvmet_xri_cnt, nvmet_xri_cnt); in lpfc_sli4_nvmet_sgl_update()
3551 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3558 sglq_entry->virt = lpfc_nvmet_buf_alloc(phba, 0, in lpfc_sli4_nvmet_sgl_update()
3562 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3570 phba->cfg_sg_dma_buf_size); in lpfc_sli4_nvmet_sgl_update()
3574 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3575 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3577 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
3578 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3579 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3580 } else if (nvmet_xri_cnt < phba->sli4_hba.nvmet_xri_cnt) { in lpfc_sli4_nvmet_sgl_update()
3582 xri_cnt = phba->sli4_hba.nvmet_xri_cnt - nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3583 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3585 "%d to %d\n", phba->sli4_hba.nvmet_xri_cnt, in lpfc_sli4_nvmet_sgl_update()
3587 spin_lock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3588 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3589 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, in lpfc_sli4_nvmet_sgl_update()
3596 lpfc_nvmet_buf_free(phba, sglq_entry->virt, in lpfc_sli4_nvmet_sgl_update()
3602 &phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_sli4_nvmet_sgl_update()
3603 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_nvmet_sgl_update()
3604 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_nvmet_sgl_update()
3606 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3609 phba->sli4_hba.nvmet_xri_cnt = nvmet_xri_cnt; in lpfc_sli4_nvmet_sgl_update()
3615 &phba->sli4_hba.lpfc_nvmet_sgl_list, list) { in lpfc_sli4_nvmet_sgl_update()
3616 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_nvmet_sgl_update()
3618 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_nvmet_sgl_update()
3625 sglq_entry->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_nvmet_sgl_update()
3630 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_nvmet_sgl_update()
3647 lpfc_sli4_scsi_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_scsi_sgl_update() argument
3657 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_scsi_sgl_update()
3658 phba->total_scsi_bufs = 0; in lpfc_sli4_scsi_sgl_update()
3664 phba->sli4_hba.scsi_xri_max = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_scsi_sgl_update()
3667 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_sli4_scsi_sgl_update()
3670 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_scsi_sgl_update()
3671 phba->sli4_hba.scsi_xri_max = /* Split them up */ in lpfc_sli4_scsi_sgl_update()
3672 (phba->sli4_hba.scsi_xri_max * in lpfc_sli4_scsi_sgl_update()
3673 phba->cfg_xri_split) / 100; in lpfc_sli4_scsi_sgl_update()
3675 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_scsi_sgl_update()
3676 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_scsi_sgl_update()
3677 list_splice_init(&phba->lpfc_scsi_buf_list_get, &scsi_sgl_list); in lpfc_sli4_scsi_sgl_update()
3678 list_splice(&phba->lpfc_scsi_buf_list_put, &scsi_sgl_list); in lpfc_sli4_scsi_sgl_update()
3679 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_scsi_sgl_update()
3680 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_scsi_sgl_update()
3682 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_scsi_sgl_update()
3685 phba->sli4_hba.scsi_xri_cnt, in lpfc_sli4_scsi_sgl_update()
3686 phba->sli4_hba.scsi_xri_max, phba->cfg_xri_split); in lpfc_sli4_scsi_sgl_update()
3688 if (phba->sli4_hba.scsi_xri_cnt > phba->sli4_hba.scsi_xri_max) { in lpfc_sli4_scsi_sgl_update()
3690 scsi_xri_cnt = phba->sli4_hba.scsi_xri_cnt - in lpfc_sli4_scsi_sgl_update()
3691 phba->sli4_hba.scsi_xri_max; in lpfc_sli4_scsi_sgl_update()
3697 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_sli4_scsi_sgl_update()
3702 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_scsi_sgl_update()
3703 phba->sli4_hba.scsi_xri_cnt -= scsi_xri_cnt; in lpfc_sli4_scsi_sgl_update()
3704 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_scsi_sgl_update()
3711 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_scsi_sgl_update()
3713 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_scsi_sgl_update()
3720 psb->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_scsi_sgl_update()
3722 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_scsi_sgl_update()
3723 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_scsi_sgl_update()
3724 list_splice_init(&scsi_sgl_list, &phba->lpfc_scsi_buf_list_get); in lpfc_sli4_scsi_sgl_update()
3725 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_sli4_scsi_sgl_update()
3726 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_scsi_sgl_update()
3727 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_scsi_sgl_update()
3731 lpfc_scsi_free(phba); in lpfc_sli4_scsi_sgl_update()
3736 lpfc_get_wwpn(struct lpfc_hba *phba) in lpfc_get_wwpn() argument
3743 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_get_wwpn()
3749 lpfc_read_nv(phba, mboxq); in lpfc_get_wwpn()
3750 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_wwpn()
3752 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_get_wwpn()
3757 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
3763 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_get_wwpn()
3764 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_wwpn()
3783 lpfc_sli4_nvme_sgl_update(struct lpfc_hba *phba) in lpfc_sli4_nvme_sgl_update() argument
3791 phba->total_nvme_bufs = 0; in lpfc_sli4_nvme_sgl_update()
3792 phba->get_nvme_bufs = 0; in lpfc_sli4_nvme_sgl_update()
3793 phba->put_nvme_bufs = 0; in lpfc_sli4_nvme_sgl_update()
3795 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) in lpfc_sli4_nvme_sgl_update()
3802 els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_nvme_sgl_update()
3803 nvme_xri_max = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; in lpfc_sli4_nvme_sgl_update()
3804 phba->sli4_hba.nvme_xri_max = nvme_xri_max; in lpfc_sli4_nvme_sgl_update()
3805 phba->sli4_hba.nvme_xri_max -= phba->sli4_hba.scsi_xri_max; in lpfc_sli4_nvme_sgl_update()
3807 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_nvme_sgl_update()
3810 phba->sli4_hba.nvme_xri_cnt, in lpfc_sli4_nvme_sgl_update()
3811 phba->sli4_hba.nvme_xri_max); in lpfc_sli4_nvme_sgl_update()
3813 spin_lock_irq(&phba->nvme_buf_list_get_lock); in lpfc_sli4_nvme_sgl_update()
3814 spin_lock(&phba->nvme_buf_list_put_lock); in lpfc_sli4_nvme_sgl_update()
3815 list_splice_init(&phba->lpfc_nvme_buf_list_get, &nvme_sgl_list); in lpfc_sli4_nvme_sgl_update()
3816 list_splice(&phba->lpfc_nvme_buf_list_put, &nvme_sgl_list); in lpfc_sli4_nvme_sgl_update()
3817 cnt = phba->get_nvme_bufs + phba->put_nvme_bufs; in lpfc_sli4_nvme_sgl_update()
3818 phba->get_nvme_bufs = 0; in lpfc_sli4_nvme_sgl_update()
3819 phba->put_nvme_bufs = 0; in lpfc_sli4_nvme_sgl_update()
3820 spin_unlock(&phba->nvme_buf_list_put_lock); in lpfc_sli4_nvme_sgl_update()
3821 spin_unlock_irq(&phba->nvme_buf_list_get_lock); in lpfc_sli4_nvme_sgl_update()
3823 if (phba->sli4_hba.nvme_xri_cnt > phba->sli4_hba.nvme_xri_max) { in lpfc_sli4_nvme_sgl_update()
3825 spin_lock_irq(&phba->nvme_buf_list_get_lock); in lpfc_sli4_nvme_sgl_update()
3826 nvme_xri_cnt = phba->sli4_hba.nvme_xri_cnt - in lpfc_sli4_nvme_sgl_update()
3827 phba->sli4_hba.nvme_xri_max; in lpfc_sli4_nvme_sgl_update()
3828 spin_unlock_irq(&phba->nvme_buf_list_get_lock); in lpfc_sli4_nvme_sgl_update()
3834 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_sli4_nvme_sgl_update()
3840 spin_lock_irq(&phba->nvme_buf_list_get_lock); in lpfc_sli4_nvme_sgl_update()
3841 phba->sli4_hba.nvme_xri_cnt -= nvme_xri_cnt; in lpfc_sli4_nvme_sgl_update()
3842 spin_unlock_irq(&phba->nvme_buf_list_get_lock); in lpfc_sli4_nvme_sgl_update()
3850 lxri = lpfc_sli4_next_xritag(phba); in lpfc_sli4_nvme_sgl_update()
3852 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_nvme_sgl_update()
3859 lpfc_ncmd->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_sli4_nvme_sgl_update()
3861 spin_lock_irq(&phba->nvme_buf_list_get_lock); in lpfc_sli4_nvme_sgl_update()
3862 spin_lock(&phba->nvme_buf_list_put_lock); in lpfc_sli4_nvme_sgl_update()
3863 list_splice_init(&nvme_sgl_list, &phba->lpfc_nvme_buf_list_get); in lpfc_sli4_nvme_sgl_update()
3864 phba->get_nvme_bufs = cnt; in lpfc_sli4_nvme_sgl_update()
3865 INIT_LIST_HEAD(&phba->lpfc_nvme_buf_list_put); in lpfc_sli4_nvme_sgl_update()
3866 spin_unlock(&phba->nvme_buf_list_put_lock); in lpfc_sli4_nvme_sgl_update()
3867 spin_unlock_irq(&phba->nvme_buf_list_get_lock); in lpfc_sli4_nvme_sgl_update()
3871 lpfc_nvme_free(phba); in lpfc_sli4_nvme_sgl_update()
3892 lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) in lpfc_create_port() argument
3903 if (phba->sli_rev < LPFC_SLI_REV4 && in lpfc_create_port()
3904 dev == &phba->pcidev->dev) { in lpfc_create_port()
3906 lpfc_sli_brdrestart(phba); in lpfc_create_port()
3907 rc = lpfc_sli_chipset_init(phba); in lpfc_create_port()
3911 wwn = lpfc_get_wwpn(phba); in lpfc_create_port()
3916 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_create_port()
3924 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_create_port()
3925 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
3936 } else if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_create_port()
3944 vport->phba = phba; in lpfc_create_port()
3955 shost->nr_hw_queues = phba->cfg_fcp_io_channel; in lpfc_create_port()
3956 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_create_port()
3958 phba->sli4_hba.pc_sli4_params.sge_supp_len-1; in lpfc_create_port()
3959 shost->sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_create_port()
3967 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_create_port()
3968 if (dev != &phba->pcidev->dev) { in lpfc_create_port()
3987 error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); in lpfc_create_port()
3991 spin_lock_irq(&phba->hbalock); in lpfc_create_port()
3992 list_add_tail(&vport->listentry, &phba->port_list); in lpfc_create_port()
3993 spin_unlock_irq(&phba->hbalock); in lpfc_create_port()
4013 struct lpfc_hba *phba = vport->phba; in destroy_port() local
4019 spin_lock_irq(&phba->hbalock); in destroy_port()
4021 spin_unlock_irq(&phba->hbalock); in destroy_port()
4064 struct lpfc_hba *phba = vport->phba; in lpfc_scan_finished() local
4074 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4081 phba->link_state <= LPFC_LINK_DOWN) { in lpfc_scan_finished()
4082 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_scan_finished()
4095 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) in lpfc_scan_finished()
4115 struct lpfc_hba *phba = vport->phba; in lpfc_host_attrib_init() local
4133 if (phba->lmt & LMT_64Gb) in lpfc_host_attrib_init()
4135 if (phba->lmt & LMT_32Gb) in lpfc_host_attrib_init()
4137 if (phba->lmt & LMT_16Gb) in lpfc_host_attrib_init()
4139 if (phba->lmt & LMT_10Gb) in lpfc_host_attrib_init()
4141 if (phba->lmt & LMT_8Gb) in lpfc_host_attrib_init()
4143 if (phba->lmt & LMT_4Gb) in lpfc_host_attrib_init()
4145 if (phba->lmt & LMT_2Gb) in lpfc_host_attrib_init()
4147 if (phba->lmt & LMT_1Gb) in lpfc_host_attrib_init()
4162 fc_host_max_npiv_vports(shost) = phba->max_vpi; in lpfc_host_attrib_init()
4177 lpfc_stop_port_s3(struct lpfc_hba *phba) in lpfc_stop_port_s3() argument
4180 writel(0, phba->HCregaddr); in lpfc_stop_port_s3()
4181 readl(phba->HCregaddr); /* flush */ in lpfc_stop_port_s3()
4183 writel(0xffffffff, phba->HAregaddr); in lpfc_stop_port_s3()
4184 readl(phba->HAregaddr); /* flush */ in lpfc_stop_port_s3()
4187 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s3()
4188 phba->pport->work_port_events = 0; in lpfc_stop_port_s3()
4200 lpfc_stop_port_s4(struct lpfc_hba *phba) in lpfc_stop_port_s4() argument
4203 lpfc_stop_hba_timers(phba); in lpfc_stop_port_s4()
4204 phba->pport->work_port_events = 0; in lpfc_stop_port_s4()
4205 phba->sli4_hba.intr_enable = 0; in lpfc_stop_port_s4()
4216 lpfc_stop_port(struct lpfc_hba *phba) in lpfc_stop_port() argument
4218 phba->lpfc_stop_port(phba); in lpfc_stop_port()
4220 if (phba->wq) in lpfc_stop_port()
4221 flush_workqueue(phba->wq); in lpfc_stop_port()
4231 lpfc_fcf_redisc_wait_start_timer(struct lpfc_hba *phba) in lpfc_fcf_redisc_wait_start_timer() argument
4236 mod_timer(&phba->fcf.redisc_wait, fcf_redisc_wait_tmo); in lpfc_fcf_redisc_wait_start_timer()
4237 spin_lock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
4239 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE); in lpfc_fcf_redisc_wait_start_timer()
4241 phba->fcf.fcf_flag |= FCF_REDISC_PEND; in lpfc_fcf_redisc_wait_start_timer()
4242 spin_unlock_irq(&phba->hbalock); in lpfc_fcf_redisc_wait_start_timer()
4258 struct lpfc_hba *phba = from_timer(phba, t, fcf.redisc_wait); in lpfc_sli4_fcf_redisc_wait_tmo() local
4261 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4262 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND)) { in lpfc_sli4_fcf_redisc_wait_tmo()
4263 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4267 phba->fcf.fcf_flag &= ~FCF_REDISC_PEND; in lpfc_sli4_fcf_redisc_wait_tmo()
4269 phba->fcf.fcf_flag |= FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_wait_tmo()
4270 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_wait_tmo()
4271 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_redisc_wait_tmo()
4274 lpfc_worker_wake_up(phba); in lpfc_sli4_fcf_redisc_wait_tmo()
4285 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_fault() argument
4295 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_fault()
4313 lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, in lpfc_sli4_parse_latt_type() argument
4331 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_parse_latt_type()
4349 lpfc_sli_port_speed_get(struct lpfc_hba *phba) in lpfc_sli_port_speed_get() argument
4353 if (!lpfc_is_link_up(phba)) in lpfc_sli_port_speed_get()
4356 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_sli_port_speed_get()
4357 switch (phba->fc_linkspeed) { in lpfc_sli_port_speed_get()
4380 if (phba->sli4_hba.link_state.logical_speed) in lpfc_sli_port_speed_get()
4382 phba->sli4_hba.link_state.logical_speed; in lpfc_sli_port_speed_get()
4384 link_speed = phba->sli4_hba.link_state.speed; in lpfc_sli_port_speed_get()
4401 lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code, in lpfc_sli4_port_speed_parse() argument
4484 lpfc_sli4_async_link_evt(struct lpfc_hba *phba, in lpfc_sli4_async_link_evt() argument
4494 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); in lpfc_sli4_async_link_evt()
4497 phba->fcoe_eventtag = acqe_link->event_tag; in lpfc_sli4_async_link_evt()
4498 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_link_evt()
4500 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
4506 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
4510 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_link_evt()
4512 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_link_evt()
4518 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_link_evt()
4521 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_link_evt()
4524 phba->sli.slistat.link_event++; in lpfc_sli4_async_link_evt()
4527 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_link_evt()
4529 pmb->vport = phba->pport; in lpfc_sli4_async_link_evt()
4532 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_link_evt()
4533 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_LINK, in lpfc_sli4_async_link_evt()
4535 phba->sli4_hba.link_state.duplex = in lpfc_sli4_async_link_evt()
4537 phba->sli4_hba.link_state.status = in lpfc_sli4_async_link_evt()
4539 phba->sli4_hba.link_state.type = in lpfc_sli4_async_link_evt()
4541 phba->sli4_hba.link_state.number = in lpfc_sli4_async_link_evt()
4543 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_link_evt()
4545 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_link_evt()
4548 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_link_evt()
4552 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_link_evt()
4553 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_link_evt()
4554 phba->sli4_hba.link_state.status, in lpfc_sli4_async_link_evt()
4555 phba->sli4_hba.link_state.type, in lpfc_sli4_async_link_evt()
4556 phba->sli4_hba.link_state.number, in lpfc_sli4_async_link_evt()
4557 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_link_evt()
4558 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_link_evt()
4563 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_async_link_evt()
4564 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_link_evt()
4579 lpfc_sli4_parse_latt_fault(phba, acqe_link); in lpfc_sli4_async_link_evt()
4597 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_link_evt()
4604 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_link_evt()
4617 lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc) in lpfc_sli4_async_fc_evt() argument
4627 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4633 phba->sli4_hba.link_state.speed = in lpfc_sli4_async_fc_evt()
4634 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, in lpfc_sli4_async_fc_evt()
4636 phba->sli4_hba.link_state.duplex = LPFC_ASYNC_LINK_DUPLEX_FULL; in lpfc_sli4_async_fc_evt()
4637 phba->sli4_hba.link_state.topology = in lpfc_sli4_async_fc_evt()
4639 phba->sli4_hba.link_state.status = in lpfc_sli4_async_fc_evt()
4641 phba->sli4_hba.link_state.type = in lpfc_sli4_async_fc_evt()
4643 phba->sli4_hba.link_state.number = in lpfc_sli4_async_fc_evt()
4645 phba->sli4_hba.link_state.fault = in lpfc_sli4_async_fc_evt()
4647 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_fc_evt()
4649 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_fc_evt()
4653 phba->sli4_hba.link_state.speed, in lpfc_sli4_async_fc_evt()
4654 phba->sli4_hba.link_state.topology, in lpfc_sli4_async_fc_evt()
4655 phba->sli4_hba.link_state.status, in lpfc_sli4_async_fc_evt()
4656 phba->sli4_hba.link_state.type, in lpfc_sli4_async_fc_evt()
4657 phba->sli4_hba.link_state.number, in lpfc_sli4_async_fc_evt()
4658 phba->sli4_hba.link_state.logical_speed, in lpfc_sli4_async_fc_evt()
4659 phba->sli4_hba.link_state.fault); in lpfc_sli4_async_fc_evt()
4660 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_async_fc_evt()
4662 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4668 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4672 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_async_fc_evt()
4674 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fc_evt()
4680 lpfc_els_flush_all_cmd(phba); in lpfc_sli4_async_fc_evt()
4683 phba->sli4_hba.els_wq->pring->flag |= LPFC_STOP_IOCB_EVENT; in lpfc_sli4_async_fc_evt()
4686 phba->sli.slistat.link_event++; in lpfc_sli4_async_fc_evt()
4689 lpfc_read_topology(phba, pmb, mp); in lpfc_sli4_async_fc_evt()
4691 pmb->vport = phba->pport; in lpfc_sli4_async_fc_evt()
4693 if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) { in lpfc_sli4_async_fc_evt()
4694 phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK); in lpfc_sli4_async_fc_evt()
4696 switch (phba->sli4_hba.link_state.status) { in lpfc_sli4_async_fc_evt()
4698 phba->link_flag |= LS_MDS_LINK_DOWN; in lpfc_sli4_async_fc_evt()
4701 phba->link_flag |= LS_MDS_LOOPBACK; in lpfc_sli4_async_fc_evt()
4712 lpfc_sli4_parse_latt_fault(phba, (void *)acqe_fc); in lpfc_sli4_async_fc_evt()
4718 if (phba->sli4_hba.link_state.status == in lpfc_sli4_async_fc_evt()
4727 lpfc_mbx_cmpl_read_topology(phba, pmb); in lpfc_sli4_async_fc_evt()
4732 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_async_fc_evt()
4740 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_async_fc_evt()
4751 lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli) in lpfc_sli4_async_sli_evt() argument
4764 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4770 port_name = phba->Port[0]; in lpfc_sli4_async_sli_evt()
4780 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_async_sli_evt()
4784 phba->sfp_warning |= LPFC_TRANSGRESSION_HIGH_TEMPERATURE; in lpfc_sli4_async_sli_evt()
4785 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
4797 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4801 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_async_sli_evt()
4813 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_async_sli_evt()
4839 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
4843 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_async_sli_evt()
4848 if (phba->sli4_hba.lnk_info.optic_state == status) in lpfc_sli4_async_sli_evt()
4886 phba->sli4_hba.lnk_info.optic_state = status; in lpfc_sli4_async_sli_evt()
4887 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_sli_evt()
4891 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4897 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_sli_evt()
4921 struct lpfc_hba *phba; in lpfc_sli4_perform_vport_cvl() local
4925 phba = vport->phba; in lpfc_sli4_perform_vport_cvl()
4926 if (!phba) in lpfc_sli4_perform_vport_cvl()
4944 if ((phba->pport->port_state < LPFC_FLOGI) && in lpfc_sli4_perform_vport_cvl()
4945 (phba->pport->port_state != LPFC_VPORT_FAILED)) in lpfc_sli4_perform_vport_cvl()
4948 if ((vport != phba->pport) && (vport->port_state < LPFC_FDISC) in lpfc_sli4_perform_vport_cvl()
4971 lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) in lpfc_sli4_perform_all_vport_cvl() argument
4976 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_perform_all_vport_cvl()
4978 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) in lpfc_sli4_perform_all_vport_cvl()
4980 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_perform_all_vport_cvl()
4991 lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, in lpfc_sli4_async_fip_evt() argument
5003 phba->fc_eventTag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5004 phba->fcoe_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5009 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
5016 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | in lpfc_sli4_async_fip_evt()
5022 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
5028 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
5033 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
5037 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5038 if (phba->hba_flag & FCF_TS_INPROG) { in lpfc_sli4_async_fip_evt()
5039 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5043 if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { in lpfc_sli4_async_fip_evt()
5044 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5049 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) { in lpfc_sli4_async_fip_evt()
5050 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5053 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5056 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5060 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, in lpfc_sli4_async_fip_evt()
5063 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5069 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fip_evt()
5076 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5077 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5084 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5085 if ((phba->fcf.fcf_flag & FCF_DISCOVERY) && in lpfc_sli4_async_fip_evt()
5086 (phba->fcf.current_rec.fcf_indx != acqe_fip->index)) { in lpfc_sli4_async_fip_evt()
5087 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5089 lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index); in lpfc_sli4_async_fip_evt()
5092 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5095 if (phba->fcf.current_rec.fcf_indx != acqe_fip->index) in lpfc_sli4_async_fip_evt()
5104 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5106 phba->fcf.fcf_flag |= FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
5107 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5109 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5113 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
5115 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
5120 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5121 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_sli4_async_fip_evt()
5122 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5127 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_sli4_async_fip_evt()
5130 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
5135 lpfc_sli4_perform_all_vport_cvl(phba); in lpfc_sli4_async_fip_evt()
5139 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; in lpfc_sli4_async_fip_evt()
5140 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_async_fip_evt()
5144 vport = lpfc_find_vport_by_vpid(phba, in lpfc_sli4_async_fip_evt()
5151 vports = lpfc_create_vport_work_array(phba); in lpfc_sli4_async_fip_evt()
5153 for (i = 0; i <= phba->max_vports && vports[i] != NULL; in lpfc_sli4_async_fip_evt()
5162 lpfc_destroy_vport_work_array(phba, vports); in lpfc_sli4_async_fip_evt()
5192 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5193 if (phba->fcf.fcf_flag & FCF_DISCOVERY) { in lpfc_sli4_async_fip_evt()
5194 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5198 phba->fcf.fcf_flag |= FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
5199 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5200 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | in lpfc_sli4_async_fip_evt()
5204 rc = lpfc_sli4_redisc_fcf_table(phba); in lpfc_sli4_async_fip_evt()
5206 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | in lpfc_sli4_async_fip_evt()
5211 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5212 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_sli4_async_fip_evt()
5213 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_fip_evt()
5218 lpfc_retry_pport_discovery(phba); in lpfc_sli4_async_fip_evt()
5224 lpfc_sli4_clear_fcf_rr_bmask(phba); in lpfc_sli4_async_fip_evt()
5228 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_fip_evt()
5243 lpfc_sli4_async_dcbx_evt(struct lpfc_hba *phba, in lpfc_sli4_async_dcbx_evt() argument
5246 phba->fc_eventTag = acqe_dcbx->event_tag; in lpfc_sli4_async_dcbx_evt()
5247 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_dcbx_evt()
5262 lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, in lpfc_sli4_async_grp5_evt() argument
5267 phba->fc_eventTag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
5268 phba->fcoe_eventtag = acqe_grp5->event_tag; in lpfc_sli4_async_grp5_evt()
5269 prev_ll_spd = phba->sli4_hba.link_state.logical_speed; in lpfc_sli4_async_grp5_evt()
5270 phba->sli4_hba.link_state.logical_speed = in lpfc_sli4_async_grp5_evt()
5272 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_async_grp5_evt()
5275 phba->sli4_hba.link_state.logical_speed); in lpfc_sli4_async_grp5_evt()
5285 void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) in lpfc_sli4_async_event_proc() argument
5290 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5291 phba->hba_flag &= ~ASYNC_EVENT; in lpfc_sli4_async_event_proc()
5292 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5294 while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { in lpfc_sli4_async_event_proc()
5296 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5297 list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_async_event_proc()
5299 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_event_proc()
5303 lpfc_sli4_async_link_evt(phba, in lpfc_sli4_async_event_proc()
5307 lpfc_sli4_async_fip_evt(phba, &cq_event->cqe.acqe_fip); in lpfc_sli4_async_event_proc()
5310 lpfc_sli4_async_dcbx_evt(phba, in lpfc_sli4_async_event_proc()
5314 lpfc_sli4_async_grp5_evt(phba, in lpfc_sli4_async_event_proc()
5318 lpfc_sli4_async_fc_evt(phba, &cq_event->cqe.acqe_fc); in lpfc_sli4_async_event_proc()
5321 lpfc_sli4_async_sli_evt(phba, &cq_event->cqe.acqe_sli); in lpfc_sli4_async_event_proc()
5324 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_async_event_proc()
5331 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_async_event_proc()
5342 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcf_redisc_event_proc() argument
5346 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
5348 phba->fcf.fcf_flag &= ~FCF_REDISC_EVT; in lpfc_sli4_fcf_redisc_event_proc()
5350 phba->fcf.failover_rec.flag = 0; in lpfc_sli4_fcf_redisc_event_proc()
5352 phba->fcf.fcf_flag |= FCF_REDISC_FOV; in lpfc_sli4_fcf_redisc_event_proc()
5353 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_redisc_event_proc()
5356 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
5358 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba, LPFC_FCOE_FCF_GET_FIRST); in lpfc_sli4_fcf_redisc_event_proc()
5360 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY, in lpfc_sli4_fcf_redisc_event_proc()
5376 lpfc_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_api_table_setup() argument
5381 phba->pci_dev_grp = dev_grp; in lpfc_api_table_setup()
5385 phba->sli_rev = LPFC_SLI_REV4; in lpfc_api_table_setup()
5388 rc = lpfc_init_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
5392 rc = lpfc_scsi_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
5396 rc = lpfc_sli_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
5400 rc = lpfc_mbox_api_table_setup(phba, dev_grp); in lpfc_api_table_setup()
5415 static void lpfc_log_intr_mode(struct lpfc_hba *phba, uint32_t intr_mode) in lpfc_log_intr_mode() argument
5419 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
5423 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
5427 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_log_intr_mode()
5431 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_log_intr_mode()
5450 lpfc_enable_pci_dev(struct lpfc_hba *phba) in lpfc_enable_pci_dev() argument
5455 if (!phba->pcidev) in lpfc_enable_pci_dev()
5458 pdev = phba->pcidev; in lpfc_enable_pci_dev()
5479 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_enable_pci_dev()
5492 lpfc_disable_pci_dev(struct lpfc_hba *phba) in lpfc_disable_pci_dev() argument
5497 if (!phba->pcidev) in lpfc_disable_pci_dev()
5500 pdev = phba->pcidev; in lpfc_disable_pci_dev()
5518 lpfc_reset_hba(struct lpfc_hba *phba) in lpfc_reset_hba() argument
5521 if (!phba->cfg_enable_hba_reset) { in lpfc_reset_hba()
5522 phba->link_state = LPFC_HBA_ERROR; in lpfc_reset_hba()
5525 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_reset_hba()
5526 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_reset_hba()
5528 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); in lpfc_reset_hba()
5529 lpfc_offline(phba); in lpfc_reset_hba()
5530 lpfc_sli_brdrestart(phba); in lpfc_reset_hba()
5531 lpfc_online(phba); in lpfc_reset_hba()
5532 lpfc_unblock_mgmt_io(phba); in lpfc_reset_hba()
5546 lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *phba) in lpfc_sli_sriov_nr_virtfn_get() argument
5548 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_sriov_nr_virtfn_get()
5572 lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *phba, int nr_vfn) in lpfc_sli_probe_sriov_nr_virtfn() argument
5574 struct pci_dev *pdev = phba->pcidev; in lpfc_sli_probe_sriov_nr_virtfn()
5578 max_nr_vfn = lpfc_sli_sriov_nr_virtfn_get(phba); in lpfc_sli_probe_sriov_nr_virtfn()
5580 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
5588 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
5593 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_probe_sriov_nr_virtfn()
5611 lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase1() argument
5613 struct lpfc_sli *psli = &phba->sli; in lpfc_setup_driver_resource_phase1()
5618 atomic_set(&phba->fast_event_count, 0); in lpfc_setup_driver_resource_phase1()
5619 spin_lock_init(&phba->hbalock); in lpfc_setup_driver_resource_phase1()
5622 spin_lock_init(&phba->ndlp_lock); in lpfc_setup_driver_resource_phase1()
5624 INIT_LIST_HEAD(&phba->port_list); in lpfc_setup_driver_resource_phase1()
5625 INIT_LIST_HEAD(&phba->work_list); in lpfc_setup_driver_resource_phase1()
5626 init_waitqueue_head(&phba->wait_4_mlo_m_q); in lpfc_setup_driver_resource_phase1()
5629 init_waitqueue_head(&phba->work_waitq); in lpfc_setup_driver_resource_phase1()
5631 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_driver_resource_phase1()
5633 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ? in lpfc_setup_driver_resource_phase1()
5635 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? in lpfc_setup_driver_resource_phase1()
5637 (phba->nvmet_support ? "NVMET" : " ")); in lpfc_setup_driver_resource_phase1()
5639 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_setup_driver_resource_phase1()
5641 spin_lock_init(&phba->scsi_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
5642 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_get); in lpfc_setup_driver_resource_phase1()
5643 spin_lock_init(&phba->scsi_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
5644 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_setup_driver_resource_phase1()
5647 if ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) && in lpfc_setup_driver_resource_phase1()
5648 (phba->nvmet_support == 0)) { in lpfc_setup_driver_resource_phase1()
5650 spin_lock_init(&phba->nvme_buf_list_get_lock); in lpfc_setup_driver_resource_phase1()
5651 INIT_LIST_HEAD(&phba->lpfc_nvme_buf_list_get); in lpfc_setup_driver_resource_phase1()
5652 phba->get_nvme_bufs = 0; in lpfc_setup_driver_resource_phase1()
5653 spin_lock_init(&phba->nvme_buf_list_put_lock); in lpfc_setup_driver_resource_phase1()
5654 INIT_LIST_HEAD(&phba->lpfc_nvme_buf_list_put); in lpfc_setup_driver_resource_phase1()
5655 phba->put_nvme_bufs = 0; in lpfc_setup_driver_resource_phase1()
5659 INIT_LIST_HEAD(&phba->fabric_iocb_list); in lpfc_setup_driver_resource_phase1()
5662 INIT_LIST_HEAD(&phba->elsbuf); in lpfc_setup_driver_resource_phase1()
5665 INIT_LIST_HEAD(&phba->fcf_conn_rec_list); in lpfc_setup_driver_resource_phase1()
5668 spin_lock_init(&phba->devicelock); in lpfc_setup_driver_resource_phase1()
5669 INIT_LIST_HEAD(&phba->luns); in lpfc_setup_driver_resource_phase1()
5674 timer_setup(&phba->fabric_block_timer, lpfc_fabric_block_timeout, 0); in lpfc_setup_driver_resource_phase1()
5676 timer_setup(&phba->eratt_poll, lpfc_poll_eratt, 0); in lpfc_setup_driver_resource_phase1()
5678 timer_setup(&phba->hb_tmofunc, lpfc_hb_timeout, 0); in lpfc_setup_driver_resource_phase1()
5695 lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli_driver_resource_setup() argument
5704 timer_setup(&phba->fcp_poll_timer, lpfc_poll_timeout, 0); in lpfc_sli_driver_resource_setup()
5707 phba->work_ha_mask = (HA_ERATT | HA_MBATT | HA_LATT); in lpfc_sli_driver_resource_setup()
5708 phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); in lpfc_sli_driver_resource_setup()
5711 lpfc_get_cfgparam(phba); in lpfc_sli_driver_resource_setup()
5714 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli_driver_resource_setup()
5718 if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { in lpfc_sli_driver_resource_setup()
5719 phba->menlo_flag |= HBA_MENLO_SUPPORT; in lpfc_sli_driver_resource_setup()
5721 if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) in lpfc_sli_driver_resource_setup()
5722 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
5725 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
5726 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, in lpfc_sli_driver_resource_setup()
5729 if (!phba->sli.sli3_ring) in lpfc_sli_driver_resource_setup()
5738 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
5739 lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
5740 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli_driver_resource_setup()
5743 if (phba->cfg_enable_bg) { in lpfc_sli_driver_resource_setup()
5753 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
5757 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SEG_CNT_DIF) in lpfc_sli_driver_resource_setup()
5758 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT_DIF; in lpfc_sli_driver_resource_setup()
5761 phba->cfg_total_seg_cnt = LPFC_MAX_SG_SEG_CNT; in lpfc_sli_driver_resource_setup()
5768 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli_driver_resource_setup()
5770 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); in lpfc_sli_driver_resource_setup()
5773 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + 2; in lpfc_sli_driver_resource_setup()
5776 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli_driver_resource_setup()
5778 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli_driver_resource_setup()
5779 phba->cfg_total_seg_cnt); in lpfc_sli_driver_resource_setup()
5781 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli_driver_resource_setup()
5783 phba->max_vports = 0; in lpfc_sli_driver_resource_setup()
5788 lpfc_sli_setup(phba); in lpfc_sli_driver_resource_setup()
5789 lpfc_sli_queue_init(phba); in lpfc_sli_driver_resource_setup()
5792 if (lpfc_mem_alloc(phba, BPL_ALIGN_SZ)) in lpfc_sli_driver_resource_setup()
5799 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli_driver_resource_setup()
5800 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli_driver_resource_setup()
5801 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
5803 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_driver_resource_setup()
5807 phba->cfg_sriov_nr_virtfn); in lpfc_sli_driver_resource_setup()
5808 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli_driver_resource_setup()
5823 lpfc_sli_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli_driver_resource_unset() argument
5826 lpfc_mem_free_all(phba); in lpfc_sli_driver_resource_unset()
5843 lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_setup() argument
5857 phba->sli4_hba.num_online_cpu = num_online_cpus(); in lpfc_sli4_driver_resource_setup()
5858 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; in lpfc_sli4_driver_resource_setup()
5859 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_setup()
5862 lpfc_get_cfgparam(phba); in lpfc_sli4_driver_resource_setup()
5865 rc = lpfc_setup_driver_resource_phase1(phba); in lpfc_sli4_driver_resource_setup()
5870 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_driver_resource_setup()
5878 timer_setup(&phba->rrq_tmr, lpfc_rrq_timeout, 0); in lpfc_sli4_driver_resource_setup()
5881 timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0); in lpfc_sli4_driver_resource_setup()
5887 memset((uint8_t *)&phba->mbox_ext_buf_ctx, 0, in lpfc_sli4_driver_resource_setup()
5889 INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list); in lpfc_sli4_driver_resource_setup()
5891 phba->max_vpi = LPFC_MAX_VPI; in lpfc_sli4_driver_resource_setup()
5894 phba->max_vports = 0; in lpfc_sli4_driver_resource_setup()
5897 phba->valid_vlan = 0; in lpfc_sli4_driver_resource_setup()
5898 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_driver_resource_setup()
5899 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_driver_resource_setup()
5900 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_driver_resource_setup()
5913 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_driver_resource_setup()
5922 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SGL_SEG_CNT - extra) in lpfc_sli4_driver_resource_setup()
5923 phba->cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - extra; in lpfc_sli4_driver_resource_setup()
5929 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_driver_resource_setup()
5939 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
5943 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; in lpfc_sli4_driver_resource_setup()
5945 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SLI4_SEG_CNT_DIF) in lpfc_sli4_driver_resource_setup()
5946 phba->cfg_sg_seg_cnt = in lpfc_sli4_driver_resource_setup()
5954 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + in lpfc_sli4_driver_resource_setup()
5956 ((phba->cfg_sg_seg_cnt + extra) * in lpfc_sli4_driver_resource_setup()
5960 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; in lpfc_sli4_driver_resource_setup()
5969 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
5970 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
5971 lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt; in lpfc_sli4_driver_resource_setup()
5973 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) in lpfc_sli4_driver_resource_setup()
5974 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; in lpfc_sli4_driver_resource_setup()
5976 phba->cfg_sg_dma_buf_size = in lpfc_sli4_driver_resource_setup()
5977 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); in lpfc_sli4_driver_resource_setup()
5979 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, in lpfc_sli4_driver_resource_setup()
5981 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, in lpfc_sli4_driver_resource_setup()
5982 phba->cfg_total_seg_cnt); in lpfc_sli4_driver_resource_setup()
5985 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); in lpfc_sli4_driver_resource_setup()
5986 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_sli4_rb_alloc; in lpfc_sli4_driver_resource_setup()
5987 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_sli4_rb_free; in lpfc_sli4_driver_resource_setup()
5992 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { in lpfc_sli4_driver_resource_setup()
5994 spin_lock_init(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_sli4_driver_resource_setup()
5995 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_driver_resource_setup()
5998 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_driver_resource_setup()
6000 spin_lock_init(&phba->sli4_hba.abts_nvme_buf_list_lock); in lpfc_sli4_driver_resource_setup()
6001 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvme_buf_list); in lpfc_sli4_driver_resource_setup()
6002 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_driver_resource_setup()
6003 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list); in lpfc_sli4_driver_resource_setup()
6007 spin_lock_init(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_driver_resource_setup()
6008 spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); in lpfc_sli4_driver_resource_setup()
6015 INIT_LIST_HEAD(&phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_driver_resource_setup()
6017 INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); in lpfc_sli4_driver_resource_setup()
6019 INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_driver_resource_setup()
6021 INIT_LIST_HEAD(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
6023 INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_driver_resource_setup()
6025 INIT_LIST_HEAD(&phba->sli4_hba.sp_unsol_work_queue); in lpfc_sli4_driver_resource_setup()
6028 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_blk_list); in lpfc_sli4_driver_resource_setup()
6029 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); in lpfc_sli4_driver_resource_setup()
6030 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); in lpfc_sli4_driver_resource_setup()
6031 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); in lpfc_sli4_driver_resource_setup()
6036 INIT_LIST_HEAD(&phba->sli.mboxq); in lpfc_sli4_driver_resource_setup()
6037 INIT_LIST_HEAD(&phba->sli.mboxq_cmpl); in lpfc_sli4_driver_resource_setup()
6040 phba->sli4_hba.lnk_info.optic_state = 0xff; in lpfc_sli4_driver_resource_setup()
6043 rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); in lpfc_sli4_driver_resource_setup()
6048 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= in lpfc_sli4_driver_resource_setup()
6050 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
6055 phba->temp_sensor_support = 1; in lpfc_sli4_driver_resource_setup()
6059 rc = lpfc_create_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
6064 rc = lpfc_setup_endian_order(phba); in lpfc_sli4_driver_resource_setup()
6069 rc = lpfc_sli4_read_config(phba); in lpfc_sli4_driver_resource_setup()
6072 rc = lpfc_mem_alloc_active_rrq_pool_s4(phba); in lpfc_sli4_driver_resource_setup()
6077 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_driver_resource_setup()
6079 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_driver_resource_setup()
6084 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_sli4_driver_resource_setup()
6092 phba->nvmet_support = 0; in lpfc_sli4_driver_resource_setup()
6096 lpfc_read_nv(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6097 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
6099 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_driver_resource_setup()
6104 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6112 phba->sli4_hba.wwnn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
6117 phba->sli4_hba.wwpn.u.name = wwn; in lpfc_sli4_driver_resource_setup()
6123 if (lpfc_nvmet_mem_alloc(phba)) in lpfc_sli4_driver_resource_setup()
6126 phba->nvmet_support = 1; /* a match */ in lpfc_sli4_driver_resource_setup()
6128 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6132 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6142 lpfc_nvme_mod_param_dep(phba); in lpfc_sli4_driver_resource_setup()
6146 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_driver_resource_setup()
6154 phba->sli4_hba.pc_sli4_params.supported = 1; in lpfc_sli4_driver_resource_setup()
6161 if (phba->sli4_hba.pc_sli4_params.supported) in lpfc_sli4_driver_resource_setup()
6162 rc = lpfc_pc_sli4_params_get(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6164 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6175 rc = lpfc_get_sli4_parameters(phba, mboxq); in lpfc_sli4_driver_resource_setup()
6178 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
6180 &phba->sli4_hba.sli_intf); in lpfc_sli4_driver_resource_setup()
6181 if (phba->sli4_hba.extents_in_use && in lpfc_sli4_driver_resource_setup()
6182 phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_driver_resource_setup()
6183 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6188 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6195 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6201 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_driver_resource_setup()
6204 lpfc_sli4_oas_verify(phba); in lpfc_sli4_driver_resource_setup()
6205 if (phba->cfg_fof) in lpfc_sli4_driver_resource_setup()
6209 rc = lpfc_sli4_queue_verify(phba); in lpfc_sli4_driver_resource_setup()
6214 rc = lpfc_sli4_cq_event_pool_create(phba); in lpfc_sli4_driver_resource_setup()
6219 lpfc_init_sgl_list(phba); in lpfc_sli4_driver_resource_setup()
6222 rc = lpfc_init_active_sgl_array(phba); in lpfc_sli4_driver_resource_setup()
6224 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6228 rc = lpfc_sli4_init_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
6230 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6237 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_driver_resource_setup()
6239 if (!phba->fcf.fcf_rr_bmask) { in lpfc_sli4_driver_resource_setup()
6240 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6247 phba->sli4_hba.hba_eq_hdl = kcalloc(fof_vectors + phba->io_channel_irqs, in lpfc_sli4_driver_resource_setup()
6250 if (!phba->sli4_hba.hba_eq_hdl) { in lpfc_sli4_driver_resource_setup()
6251 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6258 phba->sli4_hba.cpu_map = kcalloc(phba->sli4_hba.num_present_cpu, in lpfc_sli4_driver_resource_setup()
6261 if (!phba->sli4_hba.cpu_map) { in lpfc_sli4_driver_resource_setup()
6262 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6272 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6275 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_setup()
6287 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sli4_driver_resource_setup()
6288 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, in lpfc_sli4_driver_resource_setup()
6289 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
6291 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_driver_resource_setup()
6295 phba->cfg_sriov_nr_virtfn); in lpfc_sli4_driver_resource_setup()
6296 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_driver_resource_setup()
6303 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_setup()
6305 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_setup()
6307 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_setup()
6309 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_setup()
6311 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_setup()
6313 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_setup()
6315 lpfc_mem_free(phba); in lpfc_sli4_driver_resource_setup()
6327 lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) in lpfc_sli4_driver_resource_unset() argument
6332 kfree(phba->sli4_hba.cpu_map); in lpfc_sli4_driver_resource_unset()
6333 phba->sli4_hba.num_present_cpu = 0; in lpfc_sli4_driver_resource_unset()
6334 phba->sli4_hba.num_online_cpu = 0; in lpfc_sli4_driver_resource_unset()
6335 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_sli4_driver_resource_unset()
6338 kfree(phba->sli4_hba.hba_eq_hdl); in lpfc_sli4_driver_resource_unset()
6341 lpfc_sli4_remove_rpi_hdrs(phba); in lpfc_sli4_driver_resource_unset()
6342 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_driver_resource_unset()
6345 kfree(phba->fcf.fcf_rr_bmask); in lpfc_sli4_driver_resource_unset()
6348 lpfc_free_active_sgl(phba); in lpfc_sli4_driver_resource_unset()
6349 lpfc_free_els_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
6350 lpfc_free_nvmet_sgl_list(phba); in lpfc_sli4_driver_resource_unset()
6353 lpfc_sli4_cq_event_release_all(phba); in lpfc_sli4_driver_resource_unset()
6354 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_driver_resource_unset()
6357 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_driver_resource_unset()
6360 lpfc_destroy_bootstrap_mbox(phba); in lpfc_sli4_driver_resource_unset()
6363 lpfc_mem_free_all(phba); in lpfc_sli4_driver_resource_unset()
6367 &phba->fcf_conn_rec_list, list) { in lpfc_sli4_driver_resource_unset()
6386 lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_init_api_table_setup() argument
6388 phba->lpfc_hba_init_link = lpfc_hba_init_link; in lpfc_init_api_table_setup()
6389 phba->lpfc_hba_down_link = lpfc_hba_down_link; in lpfc_init_api_table_setup()
6390 phba->lpfc_selective_reset = lpfc_selective_reset; in lpfc_init_api_table_setup()
6393 phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; in lpfc_init_api_table_setup()
6394 phba->lpfc_handle_eratt = lpfc_handle_eratt_s3; in lpfc_init_api_table_setup()
6395 phba->lpfc_stop_port = lpfc_stop_port_s3; in lpfc_init_api_table_setup()
6398 phba->lpfc_hba_down_post = lpfc_hba_down_post_s4; in lpfc_init_api_table_setup()
6399 phba->lpfc_handle_eratt = lpfc_handle_eratt_s4; in lpfc_init_api_table_setup()
6400 phba->lpfc_stop_port = lpfc_stop_port_s4; in lpfc_init_api_table_setup()
6403 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_init_api_table_setup()
6424 lpfc_setup_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_setup_driver_resource_phase2() argument
6429 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_setup_driver_resource_phase2()
6430 "lpfc_worker_%d", phba->brd_no); in lpfc_setup_driver_resource_phase2()
6431 if (IS_ERR(phba->worker_thread)) { in lpfc_setup_driver_resource_phase2()
6432 error = PTR_ERR(phba->worker_thread); in lpfc_setup_driver_resource_phase2()
6437 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_setup_driver_resource_phase2()
6438 phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0); in lpfc_setup_driver_resource_phase2()
6440 phba->wq = NULL; in lpfc_setup_driver_resource_phase2()
6454 lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba) in lpfc_unset_driver_resource_phase2() argument
6456 if (phba->wq) { in lpfc_unset_driver_resource_phase2()
6457 flush_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
6458 destroy_workqueue(phba->wq); in lpfc_unset_driver_resource_phase2()
6459 phba->wq = NULL; in lpfc_unset_driver_resource_phase2()
6463 if (phba->worker_thread) in lpfc_unset_driver_resource_phase2()
6464 kthread_stop(phba->worker_thread); in lpfc_unset_driver_resource_phase2()
6474 lpfc_free_iocb_list(struct lpfc_hba *phba) in lpfc_free_iocb_list() argument
6478 spin_lock_irq(&phba->hbalock); in lpfc_free_iocb_list()
6480 &phba->lpfc_iocb_list, list) { in lpfc_free_iocb_list()
6483 phba->total_iocbq_bufs--; in lpfc_free_iocb_list()
6485 spin_unlock_irq(&phba->hbalock); in lpfc_free_iocb_list()
6502 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count) in lpfc_init_iocb_list() argument
6509 INIT_LIST_HEAD(&phba->lpfc_iocb_list); in lpfc_init_iocb_list()
6519 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); in lpfc_init_iocb_list()
6529 spin_lock_irq(&phba->hbalock); in lpfc_init_iocb_list()
6530 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); in lpfc_init_iocb_list()
6531 phba->total_iocbq_bufs++; in lpfc_init_iocb_list()
6532 spin_unlock_irq(&phba->hbalock); in lpfc_init_iocb_list()
6538 lpfc_free_iocb_list(phba); in lpfc_init_iocb_list()
6551 lpfc_free_sgl_list(struct lpfc_hba *phba, struct list_head *sglq_list) in lpfc_free_sgl_list() argument
6557 lpfc_mbuf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_sgl_list()
6569 lpfc_free_els_sgl_list(struct lpfc_hba *phba) in lpfc_free_els_sgl_list() argument
6574 spin_lock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
6575 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
6576 list_splice_init(&phba->sli4_hba.lpfc_els_sgl_list, &sglq_list); in lpfc_free_els_sgl_list()
6577 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_els_sgl_list()
6578 spin_unlock_irq(&phba->hbalock); in lpfc_free_els_sgl_list()
6581 lpfc_free_sgl_list(phba, &sglq_list); in lpfc_free_els_sgl_list()
6591 lpfc_free_nvmet_sgl_list(struct lpfc_hba *phba) in lpfc_free_nvmet_sgl_list() argument
6597 spin_lock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
6598 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
6599 list_splice_init(&phba->sli4_hba.lpfc_nvmet_sgl_list, &sglq_list); in lpfc_free_nvmet_sgl_list()
6600 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_free_nvmet_sgl_list()
6601 spin_unlock_irq(&phba->hbalock); in lpfc_free_nvmet_sgl_list()
6606 lpfc_nvmet_buf_free(phba, sglq_entry->virt, sglq_entry->phys); in lpfc_free_nvmet_sgl_list()
6614 phba->sli4_hba.nvmet_xri_cnt = 0; in lpfc_free_nvmet_sgl_list()
6625 lpfc_init_active_sgl_array(struct lpfc_hba *phba) in lpfc_init_active_sgl_array() argument
6629 size *= phba->sli4_hba.max_cfg_param.max_xri; in lpfc_init_active_sgl_array()
6631 phba->sli4_hba.lpfc_sglq_active_list = in lpfc_init_active_sgl_array()
6633 if (!phba->sli4_hba.lpfc_sglq_active_list) in lpfc_init_active_sgl_array()
6647 lpfc_free_active_sgl(struct lpfc_hba *phba) in lpfc_free_active_sgl() argument
6649 kfree(phba->sli4_hba.lpfc_sglq_active_list); in lpfc_free_active_sgl()
6661 lpfc_init_sgl_list(struct lpfc_hba *phba) in lpfc_init_sgl_list() argument
6664 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_els_sgl_list); in lpfc_init_sgl_list()
6665 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_init_sgl_list()
6666 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_sgl_list); in lpfc_init_sgl_list()
6667 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_init_sgl_list()
6670 phba->sli4_hba.els_xri_cnt = 0; in lpfc_init_sgl_list()
6673 phba->sli4_hba.scsi_xri_cnt = 0; in lpfc_init_sgl_list()
6676 phba->sli4_hba.nvme_xri_cnt = 0; in lpfc_init_sgl_list()
6694 lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_init_rpi_hdrs() argument
6699 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_init_rpi_hdrs()
6700 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_init_rpi_hdrs()
6702 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_init_rpi_hdrs()
6705 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_init_rpi_hdrs()
6707 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_init_rpi_hdrs()
6709 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_init_rpi_hdrs()
6730 lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba) in lpfc_sli4_create_rpi_hdr() argument
6741 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_create_rpi_hdr()
6743 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_create_rpi_hdr()
6747 rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_create_rpi_hdr()
6749 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
6755 curr_rpi_range = phba->sli4_hba.next_rpi; in lpfc_sli4_create_rpi_hdr()
6756 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
6770 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, in lpfc_sli4_create_rpi_hdr()
6791 spin_lock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
6795 rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT; in lpfc_sli4_create_rpi_hdr()
6796 list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list); in lpfc_sli4_create_rpi_hdr()
6798 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_create_rpi_hdr()
6802 dma_free_coherent(&phba->pcidev->dev, LPFC_HDR_TEMPLATE_SIZE, in lpfc_sli4_create_rpi_hdr()
6819 lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_remove_rpi_hdrs() argument
6823 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_remove_rpi_hdrs()
6827 &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_remove_rpi_hdrs()
6829 dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, in lpfc_sli4_remove_rpi_hdrs()
6836 phba->sli4_hba.next_rpi = 0; in lpfc_sli4_remove_rpi_hdrs()
6854 struct lpfc_hba *phba; in lpfc_hba_alloc() local
6857 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); in lpfc_hba_alloc()
6858 if (!phba) { in lpfc_hba_alloc()
6864 phba->pcidev = pdev; in lpfc_hba_alloc()
6867 phba->brd_no = lpfc_get_instance(); in lpfc_hba_alloc()
6868 if (phba->brd_no < 0) { in lpfc_hba_alloc()
6869 kfree(phba); in lpfc_hba_alloc()
6872 phba->eratt_poll_interval = LPFC_ERATT_POLL_INTERVAL; in lpfc_hba_alloc()
6874 spin_lock_init(&phba->ct_ev_lock); in lpfc_hba_alloc()
6875 INIT_LIST_HEAD(&phba->ct_ev_waiters); in lpfc_hba_alloc()
6877 return phba; in lpfc_hba_alloc()
6888 lpfc_hba_free(struct lpfc_hba *phba) in lpfc_hba_free() argument
6891 idr_remove(&lpfc_hba_index, phba->brd_no); in lpfc_hba_free()
6894 kfree(phba->sli.sli3_ring); in lpfc_hba_free()
6895 phba->sli.sli3_ring = NULL; in lpfc_hba_free()
6897 kfree(phba); in lpfc_hba_free()
6913 lpfc_create_shost(struct lpfc_hba *phba) in lpfc_create_shost() argument
6919 phba->fc_edtov = FF_DEF_EDTOV; in lpfc_create_shost()
6920 phba->fc_ratov = FF_DEF_RATOV; in lpfc_create_shost()
6921 phba->fc_altov = FF_DEF_ALTOV; in lpfc_create_shost()
6922 phba->fc_arbtov = FF_DEF_ARBTOV; in lpfc_create_shost()
6924 atomic_set(&phba->sdev_cnt, 0); in lpfc_create_shost()
6925 atomic_set(&phba->fc4ScsiInputRequests, 0); in lpfc_create_shost()
6926 atomic_set(&phba->fc4ScsiOutputRequests, 0); in lpfc_create_shost()
6927 atomic_set(&phba->fc4ScsiControlRequests, 0); in lpfc_create_shost()
6928 atomic_set(&phba->fc4ScsiIoCmpls, 0); in lpfc_create_shost()
6929 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); in lpfc_create_shost()
6934 phba->pport = vport; in lpfc_create_shost()
6936 if (phba->nvmet_support) { in lpfc_create_shost()
6938 if (phba->txrdy_payload_pool == NULL) { in lpfc_create_shost()
6939 phba->txrdy_payload_pool = dma_pool_create( in lpfc_create_shost()
6940 "txrdy_pool", &phba->pcidev->dev, in lpfc_create_shost()
6942 if (phba->txrdy_payload_pool) { in lpfc_create_shost()
6943 phba->targetport = NULL; in lpfc_create_shost()
6944 phba->cfg_enable_fc4_type = LPFC_ENABLE_NVME; in lpfc_create_shost()
6945 lpfc_printf_log(phba, KERN_INFO, in lpfc_create_shost()
6954 pci_set_drvdata(phba->pcidev, shost); in lpfc_create_shost()
6961 if (phba->cfg_enable_SmartSAN || in lpfc_create_shost()
6962 (phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT)) { in lpfc_create_shost()
6966 if (phba->cfg_enable_SmartSAN) in lpfc_create_shost()
6982 lpfc_destroy_shost(struct lpfc_hba *phba) in lpfc_destroy_shost() argument
6984 struct lpfc_vport *vport = phba->pport; in lpfc_destroy_shost()
7001 lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost) in lpfc_setup_bg() argument
7007 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
7008 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_setup_bg()
7012 old_mask = phba->cfg_prot_mask; in lpfc_setup_bg()
7013 old_guard = phba->cfg_prot_guard; in lpfc_setup_bg()
7016 phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION | in lpfc_setup_bg()
7019 phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP | in lpfc_setup_bg()
7023 if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION) in lpfc_setup_bg()
7024 phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION; in lpfc_setup_bg()
7026 if (phba->cfg_prot_mask && phba->cfg_prot_guard) { in lpfc_setup_bg()
7027 if ((old_mask != phba->cfg_prot_mask) || in lpfc_setup_bg()
7028 (old_guard != phba->cfg_prot_guard)) in lpfc_setup_bg()
7029 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_bg()
7032 phba->cfg_prot_mask, in lpfc_setup_bg()
7033 phba->cfg_prot_guard); in lpfc_setup_bg()
7035 scsi_host_set_prot(shost, phba->cfg_prot_mask); in lpfc_setup_bg()
7036 scsi_host_set_guard(shost, phba->cfg_prot_guard); in lpfc_setup_bg()
7038 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_bg()
7050 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
7062 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
7066 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
7074 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
7086 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
7090 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_setup_bg()
7103 lpfc_post_init_setup(struct lpfc_hba *phba) in lpfc_post_init_setup() argument
7109 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_post_init_setup()
7115 shost = pci_get_drvdata(phba->pcidev); in lpfc_post_init_setup()
7116 shost->can_queue = phba->cfg_hba_queue_depth - 10; in lpfc_post_init_setup()
7117 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_post_init_setup()
7118 lpfc_setup_bg(phba, shost); in lpfc_post_init_setup()
7122 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_post_init_setup()
7124 lpfc_poll_start_timer(phba); in lpfc_post_init_setup()
7128 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_post_init_setup()
7152 lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli_pci_mem_setup() argument
7161 if (!phba->pcidev) in lpfc_sli_pci_mem_setup()
7164 pdev = phba->pcidev; in lpfc_sli_pci_mem_setup()
7178 phba->pci_bar0_map = pci_resource_start(pdev, 0); in lpfc_sli_pci_mem_setup()
7181 phba->pci_bar2_map = pci_resource_start(pdev, 2); in lpfc_sli_pci_mem_setup()
7185 phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli_pci_mem_setup()
7186 if (!phba->slim_memmap_p) { in lpfc_sli_pci_mem_setup()
7193 phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli_pci_mem_setup()
7194 if (!phba->ctrl_regs_memmap_p) { in lpfc_sli_pci_mem_setup()
7201 phba->slim2p.virt = dma_zalloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, in lpfc_sli_pci_mem_setup()
7202 &phba->slim2p.phys, GFP_KERNEL); in lpfc_sli_pci_mem_setup()
7203 if (!phba->slim2p.virt) in lpfc_sli_pci_mem_setup()
7206 phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); in lpfc_sli_pci_mem_setup()
7207 phba->mbox_ext = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
7209 phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); in lpfc_sli_pci_mem_setup()
7210 phba->IOCBs = (phba->slim2p.virt + in lpfc_sli_pci_mem_setup()
7213 phba->hbqslimp.virt = dma_alloc_coherent(&pdev->dev, in lpfc_sli_pci_mem_setup()
7215 &phba->hbqslimp.phys, in lpfc_sli_pci_mem_setup()
7217 if (!phba->hbqslimp.virt) in lpfc_sli_pci_mem_setup()
7221 ptr = phba->hbqslimp.virt; in lpfc_sli_pci_mem_setup()
7223 phba->hbqs[i].hbq_virt = ptr; in lpfc_sli_pci_mem_setup()
7224 INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); in lpfc_sli_pci_mem_setup()
7228 phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; in lpfc_sli_pci_mem_setup()
7229 phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; in lpfc_sli_pci_mem_setup()
7231 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); in lpfc_sli_pci_mem_setup()
7233 phba->MBslimaddr = phba->slim_memmap_p; in lpfc_sli_pci_mem_setup()
7234 phba->HAregaddr = phba->ctrl_regs_memmap_p + HA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7235 phba->CAregaddr = phba->ctrl_regs_memmap_p + CA_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7236 phba->HSregaddr = phba->ctrl_regs_memmap_p + HS_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7237 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; in lpfc_sli_pci_mem_setup()
7243 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_setup()
7245 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_setup()
7247 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_setup()
7260 lpfc_sli_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli_pci_mem_unset() argument
7265 if (!phba->pcidev) in lpfc_sli_pci_mem_unset()
7268 pdev = phba->pcidev; in lpfc_sli_pci_mem_unset()
7272 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_sli_pci_mem_unset()
7274 phba->slim2p.virt, phba->slim2p.phys); in lpfc_sli_pci_mem_unset()
7277 iounmap(phba->ctrl_regs_memmap_p); in lpfc_sli_pci_mem_unset()
7278 iounmap(phba->slim_memmap_p); in lpfc_sli_pci_mem_unset()
7293 lpfc_sli4_post_status_check(struct lpfc_hba *phba) in lpfc_sli4_post_status_check() argument
7302 if (!phba->sli4_hba.PSMPHRregaddr) in lpfc_sli4_post_status_check()
7307 if (lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_post_status_check()
7325 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
7339 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_post_status_check()
7344 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7346 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7348 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7350 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7352 &phba->sli4_hba.sli_intf), in lpfc_sli4_post_status_check()
7354 &phba->sli4_hba.sli_intf)); in lpfc_sli4_post_status_check()
7361 &phba->sli4_hba.sli_intf); in lpfc_sli4_post_status_check()
7364 phba->sli4_hba.ue_mask_lo = in lpfc_sli4_post_status_check()
7365 readl(phba->sli4_hba.u.if_type0.UEMASKLOregaddr); in lpfc_sli4_post_status_check()
7366 phba->sli4_hba.ue_mask_hi = in lpfc_sli4_post_status_check()
7367 readl(phba->sli4_hba.u.if_type0.UEMASKHIregaddr); in lpfc_sli4_post_status_check()
7369 readl(phba->sli4_hba.u.if_type0.UERRLOregaddr); in lpfc_sli4_post_status_check()
7371 readl(phba->sli4_hba.u.if_type0.UERRHIregaddr); in lpfc_sli4_post_status_check()
7372 if ((~phba->sli4_hba.ue_mask_lo & uerrlo_reg.word0) || in lpfc_sli4_post_status_check()
7373 (~phba->sli4_hba.ue_mask_hi & uerrhi_reg.word0)) { in lpfc_sli4_post_status_check()
7374 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
7383 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_post_status_check()
7384 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_post_status_check()
7391 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_post_status_check()
7395 phba->work_status[0] = in lpfc_sli4_post_status_check()
7396 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
7398 phba->work_status[1] = in lpfc_sli4_post_status_check()
7399 readl(phba->sli4_hba.u.if_type2. in lpfc_sli4_post_status_check()
7401 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_status_check()
7408 phba->work_status[0], in lpfc_sli4_post_status_check()
7409 phba->work_status[1]); in lpfc_sli4_post_status_check()
7430 lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar0_register_memmap() argument
7434 phba->sli4_hba.u.if_type0.UERRLOregaddr = in lpfc_sli4_bar0_register_memmap()
7435 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_LO; in lpfc_sli4_bar0_register_memmap()
7436 phba->sli4_hba.u.if_type0.UERRHIregaddr = in lpfc_sli4_bar0_register_memmap()
7437 phba->sli4_hba.conf_regs_memmap_p + LPFC_UERR_STATUS_HI; in lpfc_sli4_bar0_register_memmap()
7438 phba->sli4_hba.u.if_type0.UEMASKLOregaddr = in lpfc_sli4_bar0_register_memmap()
7439 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_LO; in lpfc_sli4_bar0_register_memmap()
7440 phba->sli4_hba.u.if_type0.UEMASKHIregaddr = in lpfc_sli4_bar0_register_memmap()
7441 phba->sli4_hba.conf_regs_memmap_p + LPFC_UE_MASK_HI; in lpfc_sli4_bar0_register_memmap()
7442 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
7443 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
7446 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
7447 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7449 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
7450 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7452 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
7453 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7455 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
7456 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7458 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
7459 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7461 phba->sli4_hba.SLIINTFregaddr = in lpfc_sli4_bar0_register_memmap()
7462 phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; in lpfc_sli4_bar0_register_memmap()
7463 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
7464 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7466 phba->sli4_hba.RQDBregaddr = in lpfc_sli4_bar0_register_memmap()
7467 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7469 phba->sli4_hba.WQDBregaddr = in lpfc_sli4_bar0_register_memmap()
7470 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7472 phba->sli4_hba.CQDBregaddr = in lpfc_sli4_bar0_register_memmap()
7473 phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
7474 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar0_register_memmap()
7475 phba->sli4_hba.MQDBregaddr = in lpfc_sli4_bar0_register_memmap()
7476 phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; in lpfc_sli4_bar0_register_memmap()
7477 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
7478 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
7481 phba->sli4_hba.u.if_type2.EQDregaddr = in lpfc_sli4_bar0_register_memmap()
7482 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7484 phba->sli4_hba.u.if_type2.ERR1regaddr = in lpfc_sli4_bar0_register_memmap()
7485 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7487 phba->sli4_hba.u.if_type2.ERR2regaddr = in lpfc_sli4_bar0_register_memmap()
7488 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7490 phba->sli4_hba.u.if_type2.CTRLregaddr = in lpfc_sli4_bar0_register_memmap()
7491 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7493 phba->sli4_hba.u.if_type2.STATUSregaddr = in lpfc_sli4_bar0_register_memmap()
7494 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7496 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar0_register_memmap()
7497 phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_bar0_register_memmap()
7499 phba->sli4_hba.BMBXregaddr = in lpfc_sli4_bar0_register_memmap()
7500 phba->sli4_hba.conf_regs_memmap_p + LPFC_BMBX; in lpfc_sli4_bar0_register_memmap()
7504 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_bar0_register_memmap()
7518 lpfc_sli4_bar1_register_memmap(struct lpfc_hba *phba, uint32_t if_type) in lpfc_sli4_bar1_register_memmap() argument
7522 phba->sli4_hba.PSMPHRregaddr = in lpfc_sli4_bar1_register_memmap()
7523 phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7525 phba->sli4_hba.ISRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7527 phba->sli4_hba.IMRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7529 phba->sli4_hba.ISCRregaddr = phba->sli4_hba.ctrl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7533 phba->sli4_hba.RQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7535 phba->sli4_hba.WQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7537 phba->sli4_hba.CQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7539 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7541 phba->sli4_hba.MQDBregaddr = phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar1_register_memmap()
7547 dev_err(&phba->pcidev->dev, in lpfc_sli4_bar1_register_memmap()
7565 lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) in lpfc_sli4_bar2_register_memmap() argument
7570 phba->sli4_hba.RQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
7573 phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
7576 phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
7579 phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; in lpfc_sli4_bar2_register_memmap()
7580 phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
7582 phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + in lpfc_sli4_bar2_register_memmap()
7603 lpfc_create_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_create_bootstrap_mbox() argument
7620 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, bmbx_size, in lpfc_create_bootstrap_mbox()
7634 phba->sli4_hba.bmbx.dmabuf = dmabuf; in lpfc_create_bootstrap_mbox()
7635 phba->sli4_hba.bmbx.bmbx_size = bmbx_size; in lpfc_create_bootstrap_mbox()
7637 phba->sli4_hba.bmbx.avirt = PTR_ALIGN(dmabuf->virt, in lpfc_create_bootstrap_mbox()
7639 phba->sli4_hba.bmbx.aphys = ALIGN(dmabuf->phys, in lpfc_create_bootstrap_mbox()
7650 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_create_bootstrap_mbox()
7651 phys_addr = (uint64_t)phba->sli4_hba.bmbx.aphys; in lpfc_create_bootstrap_mbox()
7656 pa_addr = (uint32_t) ((phba->sli4_hba.bmbx.aphys >> 4) & 0x3fffffff); in lpfc_create_bootstrap_mbox()
7674 lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) in lpfc_destroy_bootstrap_mbox() argument
7676 dma_free_coherent(&phba->pcidev->dev, in lpfc_destroy_bootstrap_mbox()
7677 phba->sli4_hba.bmbx.bmbx_size, in lpfc_destroy_bootstrap_mbox()
7678 phba->sli4_hba.bmbx.dmabuf->virt, in lpfc_destroy_bootstrap_mbox()
7679 phba->sli4_hba.bmbx.dmabuf->phys); in lpfc_destroy_bootstrap_mbox()
7681 kfree(phba->sli4_hba.bmbx.dmabuf); in lpfc_destroy_bootstrap_mbox()
7682 memset(&phba->sli4_hba.bmbx, 0, sizeof(struct lpfc_bmbx)); in lpfc_destroy_bootstrap_mbox()
7700 lpfc_sli4_read_config(struct lpfc_hba *phba) in lpfc_sli4_read_config() argument
7713 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_config()
7715 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
7721 lpfc_read_config(phba, pmb); in lpfc_sli4_read_config()
7723 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
7725 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
7734 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_read_config()
7735 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_read_config()
7737 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_read_config()
7739 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
7741 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_read_config()
7742 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_read_config()
7744 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_read_config()
7748 phba->bbcredit_support = 1; in lpfc_sli4_read_config()
7749 phba->sli4_hba.bbscn_params.word0 = rd_config->word8; in lpfc_sli4_read_config()
7752 phba->sli4_hba.extents_in_use = in lpfc_sli4_read_config()
7754 phba->sli4_hba.max_cfg_param.max_xri = in lpfc_sli4_read_config()
7756 phba->sli4_hba.max_cfg_param.xri_base = in lpfc_sli4_read_config()
7758 phba->sli4_hba.max_cfg_param.max_vpi = in lpfc_sli4_read_config()
7760 phba->sli4_hba.max_cfg_param.vpi_base = in lpfc_sli4_read_config()
7762 phba->sli4_hba.max_cfg_param.max_rpi = in lpfc_sli4_read_config()
7764 phba->sli4_hba.max_cfg_param.rpi_base = in lpfc_sli4_read_config()
7766 phba->sli4_hba.max_cfg_param.max_vfi = in lpfc_sli4_read_config()
7768 phba->sli4_hba.max_cfg_param.vfi_base = in lpfc_sli4_read_config()
7770 phba->sli4_hba.max_cfg_param.max_fcfi = in lpfc_sli4_read_config()
7772 phba->sli4_hba.max_cfg_param.max_eq = in lpfc_sli4_read_config()
7774 phba->sli4_hba.max_cfg_param.max_rq = in lpfc_sli4_read_config()
7776 phba->sli4_hba.max_cfg_param.max_wq = in lpfc_sli4_read_config()
7778 phba->sli4_hba.max_cfg_param.max_cq = in lpfc_sli4_read_config()
7780 phba->lmt = bf_get(lpfc_mbx_rd_conf_lmt, rd_config); in lpfc_sli4_read_config()
7781 phba->sli4_hba.next_xri = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_read_config()
7782 phba->vpi_base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_read_config()
7783 phba->vfi_base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_read_config()
7784 phba->max_vpi = (phba->sli4_hba.max_cfg_param.max_vpi > 0) ? in lpfc_sli4_read_config()
7785 (phba->sli4_hba.max_cfg_param.max_vpi - 1) : 0; in lpfc_sli4_read_config()
7786 phba->max_vports = phba->max_vpi; in lpfc_sli4_read_config()
7787 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
7794 phba->sli4_hba.extents_in_use, in lpfc_sli4_read_config()
7795 phba->sli4_hba.max_cfg_param.xri_base, in lpfc_sli4_read_config()
7796 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_read_config()
7797 phba->sli4_hba.max_cfg_param.vpi_base, in lpfc_sli4_read_config()
7798 phba->sli4_hba.max_cfg_param.max_vpi, in lpfc_sli4_read_config()
7799 phba->sli4_hba.max_cfg_param.vfi_base, in lpfc_sli4_read_config()
7800 phba->sli4_hba.max_cfg_param.max_vfi, in lpfc_sli4_read_config()
7801 phba->sli4_hba.max_cfg_param.rpi_base, in lpfc_sli4_read_config()
7802 phba->sli4_hba.max_cfg_param.max_rpi, in lpfc_sli4_read_config()
7803 phba->sli4_hba.max_cfg_param.max_fcfi, in lpfc_sli4_read_config()
7804 phba->sli4_hba.max_cfg_param.max_eq, in lpfc_sli4_read_config()
7805 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
7806 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
7807 phba->sli4_hba.max_cfg_param.max_rq); in lpfc_sli4_read_config()
7813 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_read_config()
7814 length = phba->sli4_hba.max_cfg_param.max_wq; in lpfc_sli4_read_config()
7815 if (phba->sli4_hba.max_cfg_param.max_cq < in lpfc_sli4_read_config()
7816 phba->sli4_hba.max_cfg_param.max_wq) in lpfc_sli4_read_config()
7817 length = phba->sli4_hba.max_cfg_param.max_cq; in lpfc_sli4_read_config()
7826 if (!phba->nvmet_support) in lpfc_sli4_read_config()
7827 length -= phba->cfg_fcp_io_channel; in lpfc_sli4_read_config()
7829 if (phba->cfg_nvme_io_channel > length) { in lpfc_sli4_read_config()
7831 phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
7835 phba->sli4_hba.max_cfg_param.max_wq, in lpfc_sli4_read_config()
7836 phba->sli4_hba.max_cfg_param.max_cq, in lpfc_sli4_read_config()
7837 phba->cfg_nvme_io_channel, in lpfc_sli4_read_config()
7838 phba->cfg_fcp_io_channel); in lpfc_sli4_read_config()
7840 phba->cfg_nvme_io_channel = length; in lpfc_sli4_read_config()
7849 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_read_config()
7854 phba->hba_flag |= HBA_FORCED_LINK_SPEED; in lpfc_sli4_read_config()
7858 phba->cfg_link_speed = in lpfc_sli4_read_config()
7862 phba->cfg_link_speed = in lpfc_sli4_read_config()
7866 phba->cfg_link_speed = in lpfc_sli4_read_config()
7870 phba->cfg_link_speed = in lpfc_sli4_read_config()
7874 phba->cfg_link_speed = in lpfc_sli4_read_config()
7878 phba->cfg_link_speed = in lpfc_sli4_read_config()
7882 phba->cfg_link_speed = in lpfc_sli4_read_config()
7886 phba->cfg_link_speed = in lpfc_sli4_read_config()
7890 phba->cfg_link_speed = in lpfc_sli4_read_config()
7894 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
7898 phba->cfg_link_speed = in lpfc_sli4_read_config()
7905 length = phba->sli4_hba.max_cfg_param.max_xri - in lpfc_sli4_read_config()
7906 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_read_config()
7907 if (phba->cfg_hba_queue_depth > length) { in lpfc_sli4_read_config()
7908 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_read_config()
7910 phba->cfg_hba_queue_depth, length); in lpfc_sli4_read_config()
7911 phba->cfg_hba_queue_depth = length; in lpfc_sli4_read_config()
7914 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_read_config()
7921 lpfc_sli4_config(phba, pmb, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_read_config()
7925 rc2 = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli4_read_config()
7931 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
7954 phba->sli4_hba.iov.pf_number = in lpfc_sli4_read_config()
7956 phba->sli4_hba.iov.vf_number = in lpfc_sli4_read_config()
7963 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_read_config()
7965 "vf_number:%d\n", phba->sli4_hba.iov.pf_number, in lpfc_sli4_read_config()
7966 phba->sli4_hba.iov.vf_number); in lpfc_sli4_read_config()
7968 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_read_config()
7974 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_read_config()
7992 lpfc_setup_endian_order(struct lpfc_hba *phba) in lpfc_setup_endian_order() argument
7999 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_setup_endian_order()
8002 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_setup_endian_order()
8005 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_endian_order()
8018 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_setup_endian_order()
8020 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_setup_endian_order()
8026 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_setup_endian_order()
8051 lpfc_sli4_queue_verify(struct lpfc_hba *phba) in lpfc_sli4_queue_verify() argument
8054 int fof_vectors = phba->cfg_fof ? 1 : 0; in lpfc_sli4_queue_verify()
8062 io_channel = phba->io_channel_irqs; in lpfc_sli4_queue_verify()
8064 if (phba->sli4_hba.num_online_cpu < io_channel) { in lpfc_sli4_queue_verify()
8065 lpfc_printf_log(phba, in lpfc_sli4_queue_verify()
8069 io_channel, phba->sli4_hba.num_online_cpu); in lpfc_sli4_queue_verify()
8070 io_channel = phba->sli4_hba.num_online_cpu; in lpfc_sli4_queue_verify()
8073 if (io_channel + fof_vectors > phba->sli4_hba.max_cfg_param.max_eq) { in lpfc_sli4_queue_verify()
8074 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
8078 phba->sli4_hba.max_cfg_param.max_eq); in lpfc_sli4_queue_verify()
8079 io_channel = phba->sli4_hba.max_cfg_param.max_eq - fof_vectors; in lpfc_sli4_queue_verify()
8083 if (io_channel != phba->io_channel_irqs) in lpfc_sli4_queue_verify()
8084 phba->io_channel_irqs = io_channel; in lpfc_sli4_queue_verify()
8085 if (phba->cfg_fcp_io_channel > io_channel) in lpfc_sli4_queue_verify()
8086 phba->cfg_fcp_io_channel = io_channel; in lpfc_sli4_queue_verify()
8087 if (phba->cfg_nvme_io_channel > io_channel) in lpfc_sli4_queue_verify()
8088 phba->cfg_nvme_io_channel = io_channel; in lpfc_sli4_queue_verify()
8089 if (phba->nvmet_support) { in lpfc_sli4_queue_verify()
8090 if (phba->cfg_nvme_io_channel < phba->cfg_nvmet_mrq) in lpfc_sli4_queue_verify()
8091 phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel; in lpfc_sli4_queue_verify()
8093 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_sli4_queue_verify()
8094 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_sli4_queue_verify()
8096 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_verify()
8098 phba->io_channel_irqs, phba->cfg_fcp_io_channel, in lpfc_sli4_queue_verify()
8099 phba->cfg_nvme_io_channel, phba->cfg_nvmet_mrq); in lpfc_sli4_queue_verify()
8102 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_verify()
8103 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_verify()
8106 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_verify()
8107 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_verify()
8112 lpfc_alloc_nvme_wq_cq(struct lpfc_hba *phba, int wqidx) in lpfc_alloc_nvme_wq_cq() argument
8116 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_nvme_wq_cq()
8117 phba->sli4_hba.cq_esize, in lpfc_alloc_nvme_wq_cq()
8120 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_alloc_nvme_wq_cq()
8126 phba->sli4_hba.nvme_cq[wqidx] = qdesc; in lpfc_alloc_nvme_wq_cq()
8128 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_nvme_wq_cq()
8131 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_alloc_nvme_wq_cq()
8136 phba->sli4_hba.nvme_wq[wqidx] = qdesc; in lpfc_alloc_nvme_wq_cq()
8137 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_nvme_wq_cq()
8142 lpfc_alloc_fcp_wq_cq(struct lpfc_hba *phba, int wqidx) in lpfc_alloc_fcp_wq_cq() argument
8148 if (phba->enab_exp_wqcq_pages) in lpfc_alloc_fcp_wq_cq()
8150 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_fcp_wq_cq()
8151 phba->sli4_hba.cq_esize, in lpfc_alloc_fcp_wq_cq()
8155 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_fcp_wq_cq()
8156 phba->sli4_hba.cq_esize, in lpfc_alloc_fcp_wq_cq()
8157 phba->sli4_hba.cq_ecount); in lpfc_alloc_fcp_wq_cq()
8159 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_alloc_fcp_wq_cq()
8164 phba->sli4_hba.fcp_cq[wqidx] = qdesc; in lpfc_alloc_fcp_wq_cq()
8167 if (phba->enab_exp_wqcq_pages) { in lpfc_alloc_fcp_wq_cq()
8169 wqesize = (phba->fcp_embed_io) ? in lpfc_alloc_fcp_wq_cq()
8170 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_alloc_fcp_wq_cq()
8171 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, in lpfc_alloc_fcp_wq_cq()
8175 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_alloc_fcp_wq_cq()
8176 phba->sli4_hba.wq_esize, in lpfc_alloc_fcp_wq_cq()
8177 phba->sli4_hba.wq_ecount); in lpfc_alloc_fcp_wq_cq()
8180 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_alloc_fcp_wq_cq()
8185 phba->sli4_hba.fcp_wq[wqidx] = qdesc; in lpfc_alloc_fcp_wq_cq()
8186 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_alloc_fcp_wq_cq()
8205 lpfc_sli4_queue_create(struct lpfc_hba *phba) in lpfc_sli4_queue_create() argument
8214 io_channel = phba->io_channel_irqs; in lpfc_sli4_queue_create()
8218 phba->sli4_hba.mq_esize = LPFC_MQE_SIZE; in lpfc_sli4_queue_create()
8219 phba->sli4_hba.mq_ecount = LPFC_MQE_DEF_COUNT; in lpfc_sli4_queue_create()
8220 phba->sli4_hba.wq_esize = LPFC_WQE_SIZE; in lpfc_sli4_queue_create()
8221 phba->sli4_hba.wq_ecount = LPFC_WQE_DEF_COUNT; in lpfc_sli4_queue_create()
8222 phba->sli4_hba.rq_esize = LPFC_RQE_SIZE; in lpfc_sli4_queue_create()
8223 phba->sli4_hba.rq_ecount = LPFC_RQE_DEF_COUNT; in lpfc_sli4_queue_create()
8224 phba->sli4_hba.eq_esize = LPFC_EQE_SIZE_4B; in lpfc_sli4_queue_create()
8225 phba->sli4_hba.eq_ecount = LPFC_EQE_DEF_COUNT; in lpfc_sli4_queue_create()
8226 phba->sli4_hba.cq_esize = LPFC_CQE_SIZE; in lpfc_sli4_queue_create()
8227 phba->sli4_hba.cq_ecount = LPFC_CQE_DEF_COUNT; in lpfc_sli4_queue_create()
8229 phba->sli4_hba.hba_eq = kcalloc(io_channel, in lpfc_sli4_queue_create()
8232 if (!phba->sli4_hba.hba_eq) { in lpfc_sli4_queue_create()
8233 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8239 if (phba->cfg_fcp_io_channel) { in lpfc_sli4_queue_create()
8240 phba->sli4_hba.fcp_cq = kcalloc(phba->cfg_fcp_io_channel, in lpfc_sli4_queue_create()
8243 if (!phba->sli4_hba.fcp_cq) { in lpfc_sli4_queue_create()
8244 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8249 phba->sli4_hba.fcp_wq = kcalloc(phba->cfg_fcp_io_channel, in lpfc_sli4_queue_create()
8252 if (!phba->sli4_hba.fcp_wq) { in lpfc_sli4_queue_create()
8253 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8263 phba->sli4_hba.fcp_cq_map = kcalloc(phba->cfg_fcp_io_channel, in lpfc_sli4_queue_create()
8266 if (!phba->sli4_hba.fcp_cq_map) { in lpfc_sli4_queue_create()
8267 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8274 if (phba->cfg_nvme_io_channel) { in lpfc_sli4_queue_create()
8275 phba->sli4_hba.nvme_cq = kcalloc(phba->cfg_nvme_io_channel, in lpfc_sli4_queue_create()
8278 if (!phba->sli4_hba.nvme_cq) { in lpfc_sli4_queue_create()
8279 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8285 phba->sli4_hba.nvme_wq = kcalloc(phba->cfg_nvme_io_channel, in lpfc_sli4_queue_create()
8288 if (!phba->sli4_hba.nvme_wq) { in lpfc_sli4_queue_create()
8289 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8300 phba->sli4_hba.nvme_cq_map = kcalloc(phba->cfg_nvme_io_channel, in lpfc_sli4_queue_create()
8303 if (!phba->sli4_hba.nvme_cq_map) { in lpfc_sli4_queue_create()
8304 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8310 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
8311 phba->sli4_hba.nvmet_cqset = kcalloc( in lpfc_sli4_queue_create()
8312 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
8315 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_create()
8316 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8321 phba->sli4_hba.nvmet_mrq_hdr = kcalloc( in lpfc_sli4_queue_create()
8322 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
8325 if (!phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_create()
8326 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8331 phba->sli4_hba.nvmet_mrq_data = kcalloc( in lpfc_sli4_queue_create()
8332 phba->cfg_nvmet_mrq, in lpfc_sli4_queue_create()
8335 if (!phba->sli4_hba.nvmet_mrq_data) { in lpfc_sli4_queue_create()
8336 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8344 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
8349 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8350 phba->sli4_hba.eq_esize, in lpfc_sli4_queue_create()
8351 phba->sli4_hba.eq_ecount); in lpfc_sli4_queue_create()
8353 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8358 phba->sli4_hba.hba_eq[idx] = qdesc; in lpfc_sli4_queue_create()
8363 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++) in lpfc_sli4_queue_create()
8364 if (lpfc_alloc_fcp_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
8367 for (idx = 0; idx < phba->cfg_nvme_io_channel; idx++) in lpfc_sli4_queue_create()
8368 if (lpfc_alloc_nvme_wq_cq(phba, idx)) in lpfc_sli4_queue_create()
8371 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
8372 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
8373 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
8375 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
8376 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
8378 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8384 phba->sli4_hba.nvmet_cqset[idx] = qdesc; in lpfc_sli4_queue_create()
8393 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8394 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
8395 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
8397 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8402 phba->sli4_hba.mbx_cq = qdesc; in lpfc_sli4_queue_create()
8405 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8406 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
8407 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
8409 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8414 phba->sli4_hba.els_cq = qdesc; in lpfc_sli4_queue_create()
8423 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8424 phba->sli4_hba.mq_esize, in lpfc_sli4_queue_create()
8425 phba->sli4_hba.mq_ecount); in lpfc_sli4_queue_create()
8427 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8431 phba->sli4_hba.mbx_wq = qdesc; in lpfc_sli4_queue_create()
8438 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8439 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
8440 phba->sli4_hba.wq_ecount); in lpfc_sli4_queue_create()
8442 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8446 phba->sli4_hba.els_wq = qdesc; in lpfc_sli4_queue_create()
8447 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
8449 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_create()
8451 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8452 phba->sli4_hba.cq_esize, in lpfc_sli4_queue_create()
8453 phba->sli4_hba.cq_ecount); in lpfc_sli4_queue_create()
8455 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8460 phba->sli4_hba.nvmels_cq = qdesc; in lpfc_sli4_queue_create()
8463 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8464 phba->sli4_hba.wq_esize, in lpfc_sli4_queue_create()
8465 phba->sli4_hba.wq_ecount); in lpfc_sli4_queue_create()
8467 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8471 phba->sli4_hba.nvmels_wq = qdesc; in lpfc_sli4_queue_create()
8472 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_create()
8480 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8481 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
8482 phba->sli4_hba.rq_ecount); in lpfc_sli4_queue_create()
8484 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8488 phba->sli4_hba.hdr_rq = qdesc; in lpfc_sli4_queue_create()
8491 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_sli4_queue_create()
8492 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
8493 phba->sli4_hba.rq_ecount); in lpfc_sli4_queue_create()
8495 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8499 phba->sli4_hba.dat_rq = qdesc; in lpfc_sli4_queue_create()
8501 if (phba->nvmet_support) { in lpfc_sli4_queue_create()
8502 for (idx = 0; idx < phba->cfg_nvmet_mrq; idx++) { in lpfc_sli4_queue_create()
8504 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
8506 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
8509 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8514 phba->sli4_hba.nvmet_mrq_hdr[idx] = qdesc; in lpfc_sli4_queue_create()
8520 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8530 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_sli4_queue_create()
8532 phba->sli4_hba.rq_esize, in lpfc_sli4_queue_create()
8535 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_create()
8540 phba->sli4_hba.nvmet_mrq_data[idx] = qdesc; in lpfc_sli4_queue_create()
8545 if (phba->cfg_fof) in lpfc_sli4_queue_create()
8546 lpfc_fof_queue_create(phba); in lpfc_sli4_queue_create()
8550 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_queue_create()
8600 lpfc_sli4_queue_destroy(struct lpfc_hba *phba) in lpfc_sli4_queue_destroy() argument
8602 if (phba->cfg_fof) in lpfc_sli4_queue_destroy()
8603 lpfc_fof_queue_destroy(phba); in lpfc_sli4_queue_destroy()
8606 lpfc_sli4_release_queues(&phba->sli4_hba.hba_eq, phba->io_channel_irqs); in lpfc_sli4_queue_destroy()
8609 lpfc_sli4_release_queues(&phba->sli4_hba.fcp_cq, in lpfc_sli4_queue_destroy()
8610 phba->cfg_fcp_io_channel); in lpfc_sli4_queue_destroy()
8613 lpfc_sli4_release_queues(&phba->sli4_hba.fcp_wq, in lpfc_sli4_queue_destroy()
8614 phba->cfg_fcp_io_channel); in lpfc_sli4_queue_destroy()
8617 lpfc_sli4_release_queue_map(&phba->sli4_hba.fcp_cq_map); in lpfc_sli4_queue_destroy()
8620 lpfc_sli4_release_queues(&phba->sli4_hba.nvme_cq, in lpfc_sli4_queue_destroy()
8621 phba->cfg_nvme_io_channel); in lpfc_sli4_queue_destroy()
8624 lpfc_sli4_release_queues(&phba->sli4_hba.nvme_wq, in lpfc_sli4_queue_destroy()
8625 phba->cfg_nvme_io_channel); in lpfc_sli4_queue_destroy()
8628 lpfc_sli4_release_queue_map(&phba->sli4_hba.nvme_cq_map); in lpfc_sli4_queue_destroy()
8630 if (phba->nvmet_support) { in lpfc_sli4_queue_destroy()
8631 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_destroy()
8632 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
8634 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_destroy()
8635 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
8636 lpfc_sli4_release_queues(&phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_destroy()
8637 phba->cfg_nvmet_mrq); in lpfc_sli4_queue_destroy()
8641 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_destroy()
8644 __lpfc_sli4_release_queue(&phba->sli4_hba.els_wq); in lpfc_sli4_queue_destroy()
8647 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_destroy()
8650 __lpfc_sli4_release_queue(&phba->sli4_hba.hdr_rq); in lpfc_sli4_queue_destroy()
8651 __lpfc_sli4_release_queue(&phba->sli4_hba.dat_rq); in lpfc_sli4_queue_destroy()
8654 __lpfc_sli4_release_queue(&phba->sli4_hba.els_cq); in lpfc_sli4_queue_destroy()
8657 __lpfc_sli4_release_queue(&phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_destroy()
8660 __lpfc_sli4_release_queue(&phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_destroy()
8663 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list); in lpfc_sli4_queue_destroy()
8667 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq) in lpfc_free_rq_buffer() argument
8679 (rqbp->rqb_free_buffer)(phba, rqb_buffer); in lpfc_free_rq_buffer()
8686 lpfc_create_wq_cq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_create_wq_cq() argument
8694 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_create_wq_cq()
8701 rc = lpfc_cq_create(phba, cq, eq, in lpfc_create_wq_cq()
8704 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_create_wq_cq()
8716 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
8721 rc = lpfc_wq_create(phba, wq, cq, qtype); in lpfc_create_wq_cq()
8723 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_create_wq_cq()
8736 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
8740 rc = lpfc_mq_create(phba, wq, cq, LPFC_MBOX); in lpfc_create_wq_cq()
8742 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_create_wq_cq()
8749 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_create_wq_cq()
8751 phba->sli4_hba.mbx_wq->queue_id, in lpfc_create_wq_cq()
8752 phba->sli4_hba.mbx_cq->queue_id); in lpfc_create_wq_cq()
8771 lpfc_sli4_queue_setup(struct lpfc_hba *phba) in lpfc_sli4_queue_setup() argument
8781 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_queue_setup()
8783 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8790 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_queue_setup()
8794 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_queue_setup()
8801 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8806 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
8811 phba->sli4_hba.fw_func_mode = in lpfc_sli4_queue_setup()
8813 phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode; in lpfc_sli4_queue_setup()
8814 phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode; in lpfc_sli4_queue_setup()
8815 phba->sli4_hba.physical_port = in lpfc_sli4_queue_setup()
8817 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
8819 "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode, in lpfc_sli4_queue_setup()
8820 phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); in lpfc_sli4_queue_setup()
8823 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_queue_setup()
8828 io_channel = phba->io_channel_irqs; in lpfc_sli4_queue_setup()
8831 if (io_channel && !phba->sli4_hba.hba_eq) { in lpfc_sli4_queue_setup()
8832 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8838 if (!phba->sli4_hba.hba_eq[qidx]) { in lpfc_sli4_queue_setup()
8839 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8845 rc = lpfc_eq_create(phba, phba->sli4_hba.hba_eq[qidx], in lpfc_sli4_queue_setup()
8846 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
8848 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8854 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
8856 qidx, phba->sli4_hba.hba_eq[qidx]->queue_id); in lpfc_sli4_queue_setup()
8859 if (phba->cfg_nvme_io_channel) { in lpfc_sli4_queue_setup()
8860 if (!phba->sli4_hba.nvme_cq || !phba->sli4_hba.nvme_wq) { in lpfc_sli4_queue_setup()
8861 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8863 (phba->sli4_hba.nvme_cq) ? "CQ" : "WQ"); in lpfc_sli4_queue_setup()
8868 for (qidx = 0; qidx < phba->cfg_nvme_io_channel; qidx++) { in lpfc_sli4_queue_setup()
8869 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
8870 phba->sli4_hba.hba_eq[ in lpfc_sli4_queue_setup()
8872 phba->sli4_hba.nvme_cq[qidx], in lpfc_sli4_queue_setup()
8873 phba->sli4_hba.nvme_wq[qidx], in lpfc_sli4_queue_setup()
8874 &phba->sli4_hba.nvme_cq_map[qidx], in lpfc_sli4_queue_setup()
8877 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8886 if (phba->cfg_fcp_io_channel) { in lpfc_sli4_queue_setup()
8888 if (!phba->sli4_hba.fcp_cq || !phba->sli4_hba.fcp_wq) { in lpfc_sli4_queue_setup()
8889 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8891 phba->sli4_hba.fcp_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
8896 for (qidx = 0; qidx < phba->cfg_fcp_io_channel; qidx++) { in lpfc_sli4_queue_setup()
8897 rc = lpfc_create_wq_cq(phba, in lpfc_sli4_queue_setup()
8898 phba->sli4_hba.hba_eq[ in lpfc_sli4_queue_setup()
8900 phba->sli4_hba.fcp_cq[qidx], in lpfc_sli4_queue_setup()
8901 phba->sli4_hba.fcp_wq[qidx], in lpfc_sli4_queue_setup()
8902 &phba->sli4_hba.fcp_cq_map[qidx], in lpfc_sli4_queue_setup()
8905 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8920 if (!phba->sli4_hba.mbx_cq || !phba->sli4_hba.mbx_wq) { in lpfc_sli4_queue_setup()
8921 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8923 phba->sli4_hba.mbx_cq ? in lpfc_sli4_queue_setup()
8929 rc = lpfc_create_wq_cq(phba, phba->sli4_hba.hba_eq[0], in lpfc_sli4_queue_setup()
8930 phba->sli4_hba.mbx_cq, in lpfc_sli4_queue_setup()
8931 phba->sli4_hba.mbx_wq, in lpfc_sli4_queue_setup()
8934 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8939 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
8940 if (!phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_setup()
8941 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8947 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
8948 rc = lpfc_cq_create_set(phba, in lpfc_sli4_queue_setup()
8949 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
8950 phba->sli4_hba.hba_eq, in lpfc_sli4_queue_setup()
8953 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8961 rc = lpfc_cq_create(phba, phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
8962 phba->sli4_hba.hba_eq[0], in lpfc_sli4_queue_setup()
8965 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8970 phba->sli4_hba.nvmet_cqset[0]->chann = 0; in lpfc_sli4_queue_setup()
8972 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
8975 phba->sli4_hba.nvmet_cqset[0]->queue_id, in lpfc_sli4_queue_setup()
8976 phba->sli4_hba.hba_eq[0]->queue_id); in lpfc_sli4_queue_setup()
8981 if (!phba->sli4_hba.els_cq || !phba->sli4_hba.els_wq) { in lpfc_sli4_queue_setup()
8982 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8984 phba->sli4_hba.els_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
8988 rc = lpfc_create_wq_cq(phba, phba->sli4_hba.hba_eq[0], in lpfc_sli4_queue_setup()
8989 phba->sli4_hba.els_cq, in lpfc_sli4_queue_setup()
8990 phba->sli4_hba.els_wq, in lpfc_sli4_queue_setup()
8993 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
8998 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9000 phba->sli4_hba.els_wq->queue_id, in lpfc_sli4_queue_setup()
9001 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
9003 if (phba->cfg_nvme_io_channel) { in lpfc_sli4_queue_setup()
9005 if (!phba->sli4_hba.nvmels_cq || !phba->sli4_hba.nvmels_wq) { in lpfc_sli4_queue_setup()
9006 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9008 phba->sli4_hba.nvmels_cq ? "WQ" : "CQ"); in lpfc_sli4_queue_setup()
9012 rc = lpfc_create_wq_cq(phba, phba->sli4_hba.hba_eq[0], in lpfc_sli4_queue_setup()
9013 phba->sli4_hba.nvmels_cq, in lpfc_sli4_queue_setup()
9014 phba->sli4_hba.nvmels_wq, in lpfc_sli4_queue_setup()
9017 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9023 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9026 phba->sli4_hba.nvmels_wq->queue_id, in lpfc_sli4_queue_setup()
9027 phba->sli4_hba.nvmels_cq->queue_id); in lpfc_sli4_queue_setup()
9033 if (phba->nvmet_support) { in lpfc_sli4_queue_setup()
9034 if ((!phba->sli4_hba.nvmet_cqset) || in lpfc_sli4_queue_setup()
9035 (!phba->sli4_hba.nvmet_mrq_hdr) || in lpfc_sli4_queue_setup()
9036 (!phba->sli4_hba.nvmet_mrq_data)) { in lpfc_sli4_queue_setup()
9037 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9043 if (phba->cfg_nvmet_mrq > 1) { in lpfc_sli4_queue_setup()
9044 rc = lpfc_mrq_create(phba, in lpfc_sli4_queue_setup()
9045 phba->sli4_hba.nvmet_mrq_hdr, in lpfc_sli4_queue_setup()
9046 phba->sli4_hba.nvmet_mrq_data, in lpfc_sli4_queue_setup()
9047 phba->sli4_hba.nvmet_cqset, in lpfc_sli4_queue_setup()
9050 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9058 rc = lpfc_rq_create(phba, in lpfc_sli4_queue_setup()
9059 phba->sli4_hba.nvmet_mrq_hdr[0], in lpfc_sli4_queue_setup()
9060 phba->sli4_hba.nvmet_mrq_data[0], in lpfc_sli4_queue_setup()
9061 phba->sli4_hba.nvmet_cqset[0], in lpfc_sli4_queue_setup()
9064 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9072 phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9075 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id, in lpfc_sli4_queue_setup()
9076 phba->sli4_hba.nvmet_mrq_data[0]->queue_id, in lpfc_sli4_queue_setup()
9077 phba->sli4_hba.nvmet_cqset[0]->queue_id); in lpfc_sli4_queue_setup()
9082 if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { in lpfc_sli4_queue_setup()
9083 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9089 rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli4_queue_setup()
9090 phba->sli4_hba.els_cq, LPFC_USOL); in lpfc_sli4_queue_setup()
9092 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9098 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_queue_setup()
9101 phba->sli4_hba.hdr_rq->queue_id, in lpfc_sli4_queue_setup()
9102 phba->sli4_hba.dat_rq->queue_id, in lpfc_sli4_queue_setup()
9103 phba->sli4_hba.els_cq->queue_id); in lpfc_sli4_queue_setup()
9105 if (phba->cfg_fof) { in lpfc_sli4_queue_setup()
9106 rc = lpfc_fof_queue_setup(phba); in lpfc_sli4_queue_setup()
9108 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_queue_setup()
9116 lpfc_modify_hba_eq_delay(phba, qidx, LPFC_MAX_EQ_DELAY_EQID_CNT, in lpfc_sli4_queue_setup()
9117 phba->cfg_fcp_imax); in lpfc_sli4_queue_setup()
9122 lpfc_sli4_queue_unset(phba); in lpfc_sli4_queue_setup()
9140 lpfc_sli4_queue_unset(struct lpfc_hba *phba) in lpfc_sli4_queue_unset() argument
9145 if (phba->cfg_fof) in lpfc_sli4_queue_unset()
9146 lpfc_fof_queue_destroy(phba); in lpfc_sli4_queue_unset()
9149 if (phba->sli4_hba.mbx_wq) in lpfc_sli4_queue_unset()
9150 lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); in lpfc_sli4_queue_unset()
9153 if (phba->sli4_hba.nvmels_wq) in lpfc_sli4_queue_unset()
9154 lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); in lpfc_sli4_queue_unset()
9157 if (phba->sli4_hba.els_wq) in lpfc_sli4_queue_unset()
9158 lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); in lpfc_sli4_queue_unset()
9161 if (phba->sli4_hba.hdr_rq) in lpfc_sli4_queue_unset()
9162 lpfc_rq_destroy(phba, phba->sli4_hba.hdr_rq, in lpfc_sli4_queue_unset()
9163 phba->sli4_hba.dat_rq); in lpfc_sli4_queue_unset()
9166 if (phba->sli4_hba.fcp_wq) in lpfc_sli4_queue_unset()
9167 for (qidx = 0; qidx < phba->cfg_fcp_io_channel; qidx++) in lpfc_sli4_queue_unset()
9168 lpfc_wq_destroy(phba, phba->sli4_hba.fcp_wq[qidx]); in lpfc_sli4_queue_unset()
9171 if (phba->sli4_hba.nvme_wq) { in lpfc_sli4_queue_unset()
9172 for (qidx = 0; qidx < phba->cfg_nvme_io_channel; qidx++) in lpfc_sli4_queue_unset()
9173 lpfc_wq_destroy(phba, phba->sli4_hba.nvme_wq[qidx]); in lpfc_sli4_queue_unset()
9177 if (phba->sli4_hba.mbx_cq) in lpfc_sli4_queue_unset()
9178 lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); in lpfc_sli4_queue_unset()
9181 if (phba->sli4_hba.els_cq) in lpfc_sli4_queue_unset()
9182 lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); in lpfc_sli4_queue_unset()
9185 if (phba->sli4_hba.nvmels_cq) in lpfc_sli4_queue_unset()
9186 lpfc_cq_destroy(phba, phba->sli4_hba.nvmels_cq); in lpfc_sli4_queue_unset()
9189 if (phba->sli4_hba.nvme_cq) in lpfc_sli4_queue_unset()
9190 for (qidx = 0; qidx < phba->cfg_nvme_io_channel; qidx++) in lpfc_sli4_queue_unset()
9191 lpfc_cq_destroy(phba, phba->sli4_hba.nvme_cq[qidx]); in lpfc_sli4_queue_unset()
9193 if (phba->nvmet_support) { in lpfc_sli4_queue_unset()
9195 if (phba->sli4_hba.nvmet_mrq_hdr) { in lpfc_sli4_queue_unset()
9196 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
9198 phba, in lpfc_sli4_queue_unset()
9199 phba->sli4_hba.nvmet_mrq_hdr[qidx], in lpfc_sli4_queue_unset()
9200 phba->sli4_hba.nvmet_mrq_data[qidx]); in lpfc_sli4_queue_unset()
9204 if (phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_queue_unset()
9205 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) in lpfc_sli4_queue_unset()
9207 phba, phba->sli4_hba.nvmet_cqset[qidx]); in lpfc_sli4_queue_unset()
9212 if (phba->sli4_hba.fcp_cq) in lpfc_sli4_queue_unset()
9213 for (qidx = 0; qidx < phba->cfg_fcp_io_channel; qidx++) in lpfc_sli4_queue_unset()
9214 lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[qidx]); in lpfc_sli4_queue_unset()
9217 if (phba->sli4_hba.hba_eq) in lpfc_sli4_queue_unset()
9218 for (qidx = 0; qidx < phba->io_channel_irqs; qidx++) in lpfc_sli4_queue_unset()
9219 lpfc_eq_destroy(phba, phba->sli4_hba.hba_eq[qidx]); in lpfc_sli4_queue_unset()
9239 lpfc_sli4_cq_event_pool_create(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_create() argument
9244 for (i = 0; i < (4 * phba->sli4_hba.cq_ecount); i++) { in lpfc_sli4_cq_event_pool_create()
9249 &phba->sli4_hba.sp_cqe_event_pool); in lpfc_sli4_cq_event_pool_create()
9254 lpfc_sli4_cq_event_pool_destroy(phba); in lpfc_sli4_cq_event_pool_create()
9269 lpfc_sli4_cq_event_pool_destroy(struct lpfc_hba *phba) in lpfc_sli4_cq_event_pool_destroy() argument
9274 &phba->sli4_hba.sp_cqe_event_pool, list) { in lpfc_sli4_cq_event_pool_destroy()
9291 __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in __lpfc_sli4_cq_event_alloc() argument
9295 list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, in __lpfc_sli4_cq_event_alloc()
9311 lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba) in lpfc_sli4_cq_event_alloc() argument
9316 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
9317 cq_event = __lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_cq_event_alloc()
9318 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_alloc()
9331 __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in __lpfc_sli4_cq_event_release() argument
9334 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); in __lpfc_sli4_cq_event_release()
9346 lpfc_sli4_cq_event_release(struct lpfc_hba *phba, in lpfc_sli4_cq_event_release() argument
9350 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
9351 __lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_cq_event_release()
9352 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release()
9363 lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) in lpfc_sli4_cq_event_release_all() argument
9370 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
9372 list_splice_init(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
9375 list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_cq_event_release_all()
9378 list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, in lpfc_sli4_cq_event_release_all()
9380 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_cq_event_release_all()
9384 lpfc_sli4_cq_event_release(phba, cqe); in lpfc_sli4_cq_event_release_all()
9401 lpfc_pci_function_reset(struct lpfc_hba *phba) in lpfc_pci_function_reset() argument
9412 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_pci_function_reset()
9415 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, in lpfc_pci_function_reset()
9418 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
9426 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_pci_function_reset()
9429 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pci_function_reset()
9436 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_pci_function_reset()
9438 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
9455 if (lpfc_readl(phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
9466 phba->work_status[0] = readl( in lpfc_pci_function_reset()
9467 phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_pci_function_reset()
9468 phba->work_status[1] = readl( in lpfc_pci_function_reset()
9469 phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_pci_function_reset()
9470 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
9474 phba->work_status[0], in lpfc_pci_function_reset()
9475 phba->work_status[1]); in lpfc_pci_function_reset()
9489 writel(reg_data.word0, phba->sli4_hba.u.if_type2. in lpfc_pci_function_reset()
9492 pci_read_config_word(phba->pcidev, in lpfc_pci_function_reset()
9512 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_function_reset()
9533 lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_setup() argument
9541 if (!phba->pcidev) in lpfc_sli4_pci_mem_setup()
9544 pdev = phba->pcidev; in lpfc_sli4_pci_mem_setup()
9560 &phba->sli4_hba.sli_intf.word0)) { in lpfc_sli4_pci_mem_setup()
9565 if (bf_get(lpfc_sli_intf_valid, &phba->sli4_hba.sli_intf) != in lpfc_sli4_pci_mem_setup()
9567 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_pci_mem_setup()
9570 phba->sli4_hba.sli_intf.word0); in lpfc_sli4_pci_mem_setup()
9574 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_setup()
9582 phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0); in lpfc_sli4_pci_mem_setup()
9589 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
9590 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
9591 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
9597 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
9599 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
9601 phba->pci_bar0_map = pci_resource_start(pdev, 1); in lpfc_sli4_pci_mem_setup()
9608 phba->sli4_hba.conf_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
9609 ioremap(phba->pci_bar0_map, bar0map_len); in lpfc_sli4_pci_mem_setup()
9610 if (!phba->sli4_hba.conf_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
9616 lpfc_sli4_bar0_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
9625 phba->pci_bar1_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
9628 phba->sli4_hba.ctrl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
9629 ioremap(phba->pci_bar1_map, in lpfc_sli4_pci_mem_setup()
9631 if (!phba->sli4_hba.ctrl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
9638 phba->pci_bar2_memmap_p = in lpfc_sli4_pci_mem_setup()
9639 phba->sli4_hba.ctrl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
9640 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
9653 phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2); in lpfc_sli4_pci_mem_setup()
9655 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
9656 ioremap(phba->pci_bar1_map, bar1map_len); in lpfc_sli4_pci_mem_setup()
9657 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
9662 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
9663 lpfc_sli4_bar1_register_memmap(phba, if_type); in lpfc_sli4_pci_mem_setup()
9672 phba->pci_bar2_map = pci_resource_start(pdev, in lpfc_sli4_pci_mem_setup()
9675 phba->sli4_hba.drbl_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
9676 ioremap(phba->pci_bar2_map, in lpfc_sli4_pci_mem_setup()
9678 if (!phba->sli4_hba.drbl_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
9685 phba->pci_bar4_memmap_p = in lpfc_sli4_pci_mem_setup()
9686 phba->sli4_hba.drbl_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
9687 error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0); in lpfc_sli4_pci_mem_setup()
9702 phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4); in lpfc_sli4_pci_mem_setup()
9704 phba->sli4_hba.dpp_regs_memmap_p = in lpfc_sli4_pci_mem_setup()
9705 ioremap(phba->pci_bar2_map, bar2map_len); in lpfc_sli4_pci_mem_setup()
9706 if (!phba->sli4_hba.dpp_regs_memmap_p) { in lpfc_sli4_pci_mem_setup()
9711 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; in lpfc_sli4_pci_mem_setup()
9718 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
9719 phba->sli4_hba.sli4_eq_release = lpfc_sli4_eq_release; in lpfc_sli4_pci_mem_setup()
9720 phba->sli4_hba.sli4_cq_release = lpfc_sli4_cq_release; in lpfc_sli4_pci_mem_setup()
9723 phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_if6_eq_clr_intr; in lpfc_sli4_pci_mem_setup()
9724 phba->sli4_hba.sli4_eq_release = lpfc_sli4_if6_eq_release; in lpfc_sli4_pci_mem_setup()
9725 phba->sli4_hba.sli4_cq_release = lpfc_sli4_if6_cq_release; in lpfc_sli4_pci_mem_setup()
9734 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
9736 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
9738 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_setup()
9751 lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) in lpfc_sli4_pci_mem_unset() argument
9754 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_pci_mem_unset()
9758 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
9759 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
9760 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
9763 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
9766 iounmap(phba->sli4_hba.drbl_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
9767 iounmap(phba->sli4_hba.conf_regs_memmap_p); in lpfc_sli4_pci_mem_unset()
9771 dev_printk(KERN_ERR, &phba->pcidev->dev, in lpfc_sli4_pci_mem_unset()
9790 lpfc_sli_enable_msix(struct lpfc_hba *phba) in lpfc_sli_enable_msix() argument
9796 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli_enable_msix()
9799 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msix()
9809 rc = request_irq(pci_irq_vector(phba->pcidev, 0), in lpfc_sli_enable_msix()
9811 LPFC_SP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
9813 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
9820 rc = request_irq(pci_irq_vector(phba->pcidev, 1), in lpfc_sli_enable_msix()
9822 LPFC_FP_DRIVER_HANDLER_NAME, phba); in lpfc_sli_enable_msix()
9825 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msix()
9834 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_enable_msix()
9838 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_enable_msix()
9843 rc = lpfc_config_msi(phba, pmb); in lpfc_sli_enable_msix()
9846 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_enable_msix()
9848 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, in lpfc_sli_enable_msix()
9856 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
9861 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_enable_msix()
9865 free_irq(pci_irq_vector(phba->pcidev, 1), phba); in lpfc_sli_enable_msix()
9869 free_irq(pci_irq_vector(phba->pcidev, 0), phba); in lpfc_sli_enable_msix()
9873 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_enable_msix()
9894 lpfc_sli_enable_msi(struct lpfc_hba *phba) in lpfc_sli_enable_msi() argument
9898 rc = pci_enable_msi(phba->pcidev); in lpfc_sli_enable_msi()
9900 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
9903 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_enable_msi()
9908 rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_msi()
9909 0, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_msi()
9911 pci_disable_msi(phba->pcidev); in lpfc_sli_enable_msi()
9912 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_enable_msi()
9935 lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli_enable_intr() argument
9942 retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); in lpfc_sli_enable_intr()
9945 retval = lpfc_sli_enable_msix(phba); in lpfc_sli_enable_intr()
9948 phba->intr_type = MSIX; in lpfc_sli_enable_intr()
9955 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli_enable_intr()
9956 retval = lpfc_sli_enable_msi(phba); in lpfc_sli_enable_intr()
9959 phba->intr_type = MSI; in lpfc_sli_enable_intr()
9965 if (phba->intr_type == NONE) { in lpfc_sli_enable_intr()
9966 retval = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, in lpfc_sli_enable_intr()
9967 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli_enable_intr()
9970 phba->intr_type = INTx; in lpfc_sli_enable_intr()
9987 lpfc_sli_disable_intr(struct lpfc_hba *phba) in lpfc_sli_disable_intr() argument
9991 if (phba->intr_type == MSIX) in lpfc_sli_disable_intr()
9997 free_irq(pci_irq_vector(phba->pcidev, i), phba); in lpfc_sli_disable_intr()
9998 pci_free_irq_vectors(phba->pcidev); in lpfc_sli_disable_intr()
10001 phba->intr_type = NONE; in lpfc_sli_disable_intr()
10002 phba->sli.slistat.sli_intr = 0; in lpfc_sli_disable_intr()
10019 lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) in lpfc_cpu_affinity_check() argument
10030 memset(phba->sli4_hba.cpu_map, 0xff, in lpfc_cpu_affinity_check()
10032 phba->sli4_hba.num_present_cpu)); in lpfc_cpu_affinity_check()
10035 cpup = phba->sli4_hba.cpu_map; in lpfc_cpu_affinity_check()
10036 for (cpu = 0; cpu < phba->sli4_hba.num_present_cpu; cpu++) { in lpfc_cpu_affinity_check()
10047 cpup->irq = pci_irq_vector(phba->pcidev, vec); in lpfc_cpu_affinity_check()
10052 if (index >= phba->cfg_fcp_io_channel) in lpfc_cpu_affinity_check()
10071 lpfc_sli4_enable_msix(struct lpfc_hba *phba) in lpfc_sli4_enable_msix() argument
10077 vectors = phba->io_channel_irqs; in lpfc_sli4_enable_msix()
10078 if (phba->cfg_fof) in lpfc_sli4_enable_msix()
10081 rc = pci_alloc_irq_vectors(phba->pcidev, in lpfc_sli4_enable_msix()
10082 (phba->nvmet_support) ? 1 : 2, in lpfc_sli4_enable_msix()
10085 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msix()
10093 name = phba->sli4_hba.hba_eq_hdl[index].handler_name; in lpfc_sli4_enable_msix()
10098 phba->sli4_hba.hba_eq_hdl[index].idx = index; in lpfc_sli4_enable_msix()
10099 phba->sli4_hba.hba_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msix()
10100 atomic_set(&phba->sli4_hba.hba_eq_hdl[index].hba_eq_in_use, 1); in lpfc_sli4_enable_msix()
10101 if (phba->cfg_fof && (index == (vectors - 1))) in lpfc_sli4_enable_msix()
10102 rc = request_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_enable_msix()
10105 &phba->sli4_hba.hba_eq_hdl[index]); in lpfc_sli4_enable_msix()
10107 rc = request_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_enable_msix()
10110 &phba->sli4_hba.hba_eq_hdl[index]); in lpfc_sli4_enable_msix()
10112 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msix()
10119 if (phba->cfg_fof) in lpfc_sli4_enable_msix()
10122 if (vectors != phba->io_channel_irqs) { in lpfc_sli4_enable_msix()
10123 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_enable_msix()
10126 phba->io_channel_irqs, vectors); in lpfc_sli4_enable_msix()
10127 if (phba->cfg_fcp_io_channel > vectors) in lpfc_sli4_enable_msix()
10128 phba->cfg_fcp_io_channel = vectors; in lpfc_sli4_enable_msix()
10129 if (phba->cfg_nvme_io_channel > vectors) in lpfc_sli4_enable_msix()
10130 phba->cfg_nvme_io_channel = vectors; in lpfc_sli4_enable_msix()
10131 if (phba->cfg_fcp_io_channel > phba->cfg_nvme_io_channel) in lpfc_sli4_enable_msix()
10132 phba->io_channel_irqs = phba->cfg_fcp_io_channel; in lpfc_sli4_enable_msix()
10134 phba->io_channel_irqs = phba->cfg_nvme_io_channel; in lpfc_sli4_enable_msix()
10136 lpfc_cpu_affinity_check(phba, vectors); in lpfc_sli4_enable_msix()
10143 free_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_enable_msix()
10144 &phba->sli4_hba.hba_eq_hdl[index]); in lpfc_sli4_enable_msix()
10147 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_enable_msix()
10168 lpfc_sli4_enable_msi(struct lpfc_hba *phba) in lpfc_sli4_enable_msi() argument
10172 rc = pci_enable_msi(phba->pcidev); in lpfc_sli4_enable_msi()
10174 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
10177 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_enable_msi()
10182 rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_msi()
10183 0, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_msi()
10185 pci_disable_msi(phba->pcidev); in lpfc_sli4_enable_msi()
10186 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_enable_msi()
10191 for (index = 0; index < phba->io_channel_irqs; index++) { in lpfc_sli4_enable_msi()
10192 phba->sli4_hba.hba_eq_hdl[index].idx = index; in lpfc_sli4_enable_msi()
10193 phba->sli4_hba.hba_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msi()
10196 if (phba->cfg_fof) { in lpfc_sli4_enable_msi()
10197 phba->sli4_hba.hba_eq_hdl[index].idx = index; in lpfc_sli4_enable_msi()
10198 phba->sli4_hba.hba_eq_hdl[index].phba = phba; in lpfc_sli4_enable_msi()
10220 lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) in lpfc_sli4_enable_intr() argument
10230 retval = lpfc_sli4_enable_msix(phba); in lpfc_sli4_enable_intr()
10233 phba->intr_type = MSIX; in lpfc_sli4_enable_intr()
10240 if (cfg_mode >= 1 && phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
10241 retval = lpfc_sli4_enable_msi(phba); in lpfc_sli4_enable_intr()
10244 phba->intr_type = MSI; in lpfc_sli4_enable_intr()
10250 if (phba->intr_type == NONE) { in lpfc_sli4_enable_intr()
10251 retval = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler, in lpfc_sli4_enable_intr()
10252 IRQF_SHARED, LPFC_DRIVER_NAME, phba); in lpfc_sli4_enable_intr()
10257 phba->intr_type = INTx; in lpfc_sli4_enable_intr()
10260 for (idx = 0; idx < phba->io_channel_irqs; idx++) { in lpfc_sli4_enable_intr()
10261 eqhdl = &phba->sli4_hba.hba_eq_hdl[idx]; in lpfc_sli4_enable_intr()
10263 eqhdl->phba = phba; in lpfc_sli4_enable_intr()
10266 if (phba->cfg_fof) { in lpfc_sli4_enable_intr()
10267 eqhdl = &phba->sli4_hba.hba_eq_hdl[idx]; in lpfc_sli4_enable_intr()
10269 eqhdl->phba = phba; in lpfc_sli4_enable_intr()
10287 lpfc_sli4_disable_intr(struct lpfc_hba *phba) in lpfc_sli4_disable_intr() argument
10290 if (phba->intr_type == MSIX) { in lpfc_sli4_disable_intr()
10294 for (index = 0; index < phba->io_channel_irqs; index++) in lpfc_sli4_disable_intr()
10295 free_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_disable_intr()
10296 &phba->sli4_hba.hba_eq_hdl[index]); in lpfc_sli4_disable_intr()
10298 if (phba->cfg_fof) in lpfc_sli4_disable_intr()
10299 free_irq(pci_irq_vector(phba->pcidev, index), in lpfc_sli4_disable_intr()
10300 &phba->sli4_hba.hba_eq_hdl[index]); in lpfc_sli4_disable_intr()
10302 free_irq(phba->pcidev->irq, phba); in lpfc_sli4_disable_intr()
10305 pci_free_irq_vectors(phba->pcidev); in lpfc_sli4_disable_intr()
10308 phba->intr_type = NONE; in lpfc_sli4_disable_intr()
10309 phba->sli.slistat.sli_intr = 0; in lpfc_sli4_disable_intr()
10320 lpfc_unset_hba(struct lpfc_hba *phba) in lpfc_unset_hba() argument
10322 struct lpfc_vport *vport = phba->pport; in lpfc_unset_hba()
10329 kfree(phba->vpi_bmask); in lpfc_unset_hba()
10330 kfree(phba->vpi_ids); in lpfc_unset_hba()
10332 lpfc_stop_hba_timers(phba); in lpfc_unset_hba()
10334 phba->pport->work_port_events = 0; in lpfc_unset_hba()
10336 lpfc_sli_hba_down(phba); in lpfc_unset_hba()
10338 lpfc_sli_brdrestart(phba); in lpfc_unset_hba()
10340 lpfc_sli_disable_intr(phba); in lpfc_unset_hba()
10359 lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba) in lpfc_sli4_xri_exchange_busy_wait() argument
10365 int els_xri_cmpl = list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
10374 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_xri_exchange_busy_wait()
10375 lpfc_nvme_wait_for_io_drain(phba); in lpfc_sli4_xri_exchange_busy_wait()
10377 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) in lpfc_sli4_xri_exchange_busy_wait()
10379 list_empty(&phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_xri_exchange_busy_wait()
10380 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
10382 list_empty(&phba->sli4_hba.lpfc_abts_nvme_buf_list); in lpfc_sli4_xri_exchange_busy_wait()
10384 list_empty(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
10391 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
10396 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
10401 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
10406 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_xri_exchange_busy_wait()
10416 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_xri_exchange_busy_wait()
10418 &phba->sli4_hba.lpfc_abts_nvme_buf_list); in lpfc_sli4_xri_exchange_busy_wait()
10420 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list); in lpfc_sli4_xri_exchange_busy_wait()
10423 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) in lpfc_sli4_xri_exchange_busy_wait()
10425 &phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_sli4_xri_exchange_busy_wait()
10428 list_empty(&phba->sli4_hba.lpfc_abts_els_sgl_list); in lpfc_sli4_xri_exchange_busy_wait()
10444 lpfc_sli4_hba_unset(struct lpfc_hba *phba) in lpfc_sli4_hba_unset() argument
10448 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_hba_unset()
10450 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_unset()
10451 phba->sli4_hba.intr_enable = 0; in lpfc_sli4_hba_unset()
10459 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
10460 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_unset()
10461 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
10463 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
10469 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) { in lpfc_sli4_hba_unset()
10470 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
10471 mboxq = phba->sli.mbox_active; in lpfc_sli4_hba_unset()
10473 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_hba_unset()
10474 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_hba_unset()
10475 phba->sli.mbox_active = NULL; in lpfc_sli4_hba_unset()
10476 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_unset()
10480 lpfc_sli_hba_iocb_abort(phba); in lpfc_sli4_hba_unset()
10483 lpfc_sli4_xri_exchange_busy_wait(phba); in lpfc_sli4_hba_unset()
10486 lpfc_sli4_disable_intr(phba); in lpfc_sli4_hba_unset()
10489 if (phba->cfg_sriov_nr_virtfn) in lpfc_sli4_hba_unset()
10493 kthread_stop(phba->worker_thread); in lpfc_sli4_hba_unset()
10498 lpfc_sli4_queue_unset(phba); in lpfc_sli4_hba_unset()
10499 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_unset()
10502 lpfc_pci_function_reset(phba); in lpfc_sli4_hba_unset()
10505 phba->pport->work_port_events = 0; in lpfc_sli4_hba_unset()
10521 lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_pc_sli4_params_get() argument
10533 if (!phba->sli4_hba.intr_enable) in lpfc_pc_sli4_params_get()
10534 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_pc_sli4_params_get()
10536 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_pc_sli4_params_get()
10537 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_pc_sli4_params_get()
10543 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_pc_sli4_params_get()
10593 lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_get_sli4_parameters() argument
10608 phba->sli4_hba.rpi_hdrs_in_use = 1; in lpfc_get_sli4_parameters()
10613 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_get_sli4_parameters()
10616 if (!phba->sli4_hba.intr_enable) in lpfc_get_sli4_parameters()
10617 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_get_sli4_parameters()
10619 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_get_sli4_parameters()
10620 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_get_sli4_parameters()
10624 sli4_params = &phba->sli4_hba.pc_sli4_params; in lpfc_get_sli4_parameters()
10634 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
10636 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED; in lpfc_get_sli4_parameters()
10653 phba->sli4_hba.extents_in_use = bf_get(cfg_ext, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
10654 phba->sli4_hba.rpi_hdrs_in_use = bf_get(cfg_hdrr, mbx_sli4_parameters); in lpfc_get_sli4_parameters()
10655 phba->nvme_support = (bf_get(cfg_nvme, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
10658 if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) || in lpfc_get_sli4_parameters()
10659 !phba->nvme_support) { in lpfc_get_sli4_parameters()
10660 phba->nvme_support = 0; in lpfc_get_sli4_parameters()
10661 phba->nvmet_support = 0; in lpfc_get_sli4_parameters()
10662 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_OFF; in lpfc_get_sli4_parameters()
10663 phba->cfg_nvme_io_channel = 0; in lpfc_get_sli4_parameters()
10664 phba->io_channel_irqs = phba->cfg_fcp_io_channel; in lpfc_get_sli4_parameters()
10665 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
10672 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_sli4_parameters()
10674 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_sli4_parameters()
10678 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != in lpfc_get_sli4_parameters()
10680 phba->cfg_enable_pbde = 0; in lpfc_get_sli4_parameters()
10690 if (phba->cfg_suppress_rsp && bf_get(cfg_xib, mbx_sli4_parameters) && in lpfc_get_sli4_parameters()
10692 phba->sli.sli_flag |= LPFC_SLI_SUPPRESS_RSP; in lpfc_get_sli4_parameters()
10694 phba->cfg_suppress_rsp = 0; in lpfc_get_sli4_parameters()
10697 phba->sli.sli_flag |= LPFC_SLI_USE_EQDR; in lpfc_get_sli4_parameters()
10709 phba->fcp_embed_io = 1; in lpfc_get_sli4_parameters()
10711 phba->fcp_embed_io = 0; in lpfc_get_sli4_parameters()
10713 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, in lpfc_get_sli4_parameters()
10716 phba->cfg_enable_pbde, in lpfc_get_sli4_parameters()
10717 phba->fcp_embed_io, phba->nvme_support, in lpfc_get_sli4_parameters()
10718 phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); in lpfc_get_sli4_parameters()
10720 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
10722 (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == in lpfc_get_sli4_parameters()
10730 phba->enab_exp_wqcq_pages = 1; in lpfc_get_sli4_parameters()
10732 phba->enab_exp_wqcq_pages = 0; in lpfc_get_sli4_parameters()
10737 phba->mds_diags_support = 1; in lpfc_get_sli4_parameters()
10739 phba->mds_diags_support = 0; in lpfc_get_sli4_parameters()
10763 struct lpfc_hba *phba; in lpfc_pci_probe_one_s3() local
10770 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s3()
10771 if (!phba) in lpfc_pci_probe_one_s3()
10775 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s3()
10780 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); in lpfc_pci_probe_one_s3()
10785 error = lpfc_sli_pci_mem_setup(phba); in lpfc_pci_probe_one_s3()
10787 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
10793 error = lpfc_sli_driver_resource_setup(phba); in lpfc_pci_probe_one_s3()
10795 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
10802 error = lpfc_init_iocb_list(phba, LPFC_IOCB_LIST_CNT); in lpfc_pci_probe_one_s3()
10804 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
10810 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
10812 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
10818 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s3()
10821 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s3()
10823 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
10829 vport = phba->pport; in lpfc_pci_probe_one_s3()
10832 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
10839 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s3()
10842 lpfc_stop_port(phba); in lpfc_pci_probe_one_s3()
10844 intr_mode = lpfc_sli_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s3()
10846 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
10852 if (lpfc_sli_hba_setup(phba)) { in lpfc_pci_probe_one_s3()
10853 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s3()
10863 phba->sli.slistat.sli_intr > LPFC_MSIX_VECTORS) { in lpfc_pci_probe_one_s3()
10865 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s3()
10866 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s3()
10869 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_probe_one_s3()
10874 lpfc_sli_disable_intr(phba); in lpfc_pci_probe_one_s3()
10881 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s3()
10884 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s3()
10889 lpfc_unset_hba(phba); in lpfc_pci_probe_one_s3()
10893 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s3()
10895 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s3()
10897 lpfc_free_iocb_list(phba); in lpfc_pci_probe_one_s3()
10899 lpfc_sli_driver_resource_unset(phba); in lpfc_pci_probe_one_s3()
10901 lpfc_sli_pci_mem_unset(phba); in lpfc_pci_probe_one_s3()
10903 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s3()
10907 lpfc_hba_free(phba); in lpfc_pci_probe_one_s3()
10926 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s3() local
10929 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
10931 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
10936 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s3()
10938 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s3()
10943 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s3()
10958 lpfc_sli_hba_down(phba); in lpfc_pci_remove_one_s3()
10960 kthread_stop(phba->worker_thread); in lpfc_pci_remove_one_s3()
10962 lpfc_sli_brdrestart(phba); in lpfc_pci_remove_one_s3()
10964 kfree(phba->vpi_bmask); in lpfc_pci_remove_one_s3()
10965 kfree(phba->vpi_ids); in lpfc_pci_remove_one_s3()
10967 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s3()
10968 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
10970 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s3()
10975 if (phba->cfg_sriov_nr_virtfn) in lpfc_pci_remove_one_s3()
10979 lpfc_sli_disable_intr(phba); in lpfc_pci_remove_one_s3()
10987 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s3()
10988 lpfc_mem_free_all(phba); in lpfc_pci_remove_one_s3()
10991 phba->hbqslimp.virt, phba->hbqslimp.phys); in lpfc_pci_remove_one_s3()
10995 phba->slim2p.virt, phba->slim2p.phys); in lpfc_pci_remove_one_s3()
10998 iounmap(phba->ctrl_regs_memmap_p); in lpfc_pci_remove_one_s3()
10999 iounmap(phba->slim_memmap_p); in lpfc_pci_remove_one_s3()
11001 lpfc_hba_free(phba); in lpfc_pci_remove_one_s3()
11032 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s3() local
11034 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s3()
11038 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s3()
11039 lpfc_offline(phba); in lpfc_pci_suspend_one_s3()
11040 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s3()
11043 lpfc_sli_disable_intr(phba); in lpfc_pci_suspend_one_s3()
11075 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s3() local
11079 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s3()
11096 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s3()
11097 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s3()
11098 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s3()
11099 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s3()
11100 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
11107 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
11109 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s3()
11113 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s3()
11116 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s3()
11117 lpfc_online(phba); in lpfc_pci_resume_one_s3()
11120 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s3()
11133 lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_recover() argument
11135 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_recover()
11142 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli_prep_dev_for_recover()
11154 lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_reset() argument
11156 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_reset()
11160 lpfc_block_mgmt_io(phba, LPFC_MBX_WAIT); in lpfc_sli_prep_dev_for_reset()
11163 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_reset()
11166 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli_prep_dev_for_reset()
11169 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_reset()
11172 lpfc_sli_disable_intr(phba); in lpfc_sli_prep_dev_for_reset()
11173 pci_disable_device(phba->pcidev); in lpfc_sli_prep_dev_for_reset()
11185 lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli_prep_dev_for_perm_failure() argument
11187 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_prep_dev_for_perm_failure()
11190 lpfc_scsi_dev_block(phba); in lpfc_sli_prep_dev_for_perm_failure()
11193 lpfc_stop_hba_timers(phba); in lpfc_sli_prep_dev_for_perm_failure()
11196 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli_prep_dev_for_perm_failure()
11221 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s3() local
11226 lpfc_sli_prep_dev_for_recover(phba); in lpfc_io_error_detected_s3()
11230 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
11234 lpfc_sli_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s3()
11238 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s3()
11240 lpfc_sli_prep_dev_for_reset(phba); in lpfc_io_error_detected_s3()
11267 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s3() local
11268 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s3()
11289 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
11291 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s3()
11294 intr_mode = lpfc_sli_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
11296 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset_s3()
11301 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s3()
11304 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_slot_reset_s3()
11305 lpfc_offline(phba); in lpfc_io_slot_reset_s3()
11306 lpfc_sli_brdrestart(phba); in lpfc_io_slot_reset_s3()
11309 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s3()
11328 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s3() local
11331 lpfc_online(phba); in lpfc_io_resume_s3()
11334 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_io_resume_s3()
11345 lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_els_iocb_cnt() argument
11347 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_get_els_iocb_cnt()
11349 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli4_get_els_iocb_cnt()
11375 lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) in lpfc_sli4_get_iocb_cnt() argument
11377 int max_xri = lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_get_iocb_cnt()
11379 if (phba->nvmet_support) in lpfc_sli4_get_iocb_cnt()
11386 lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, in lpfc_log_write_firmware_error() argument
11391 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC && in lpfc_log_write_firmware_error()
11393 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC && in lpfc_log_write_firmware_error()
11395 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_log_write_firmware_error()
11399 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
11402 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_log_write_firmware_error()
11405 phba->pcidev->device, magic_number, ftype, fid, in lpfc_log_write_firmware_error()
11419 struct lpfc_hba *phba = (struct lpfc_hba *)context; in lpfc_write_firmware() local
11441 lpfc_decode_firmware_rev(phba, fwrev, 1); in lpfc_write_firmware()
11443 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
11454 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_write_firmware()
11479 rc = lpfc_wr_object(phba, &dma_buffer_list, in lpfc_write_firmware()
11482 lpfc_log_write_firmware_error(phba, offset, in lpfc_write_firmware()
11489 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
11497 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_write_firmware()
11503 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_write_firmware()
11516 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) in lpfc_sli4_request_firmware_update() argument
11523 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_request_firmware_update()
11527 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName); in lpfc_sli4_request_firmware_update()
11531 file_name, &phba->pcidev->dev, in lpfc_sli4_request_firmware_update()
11532 GFP_KERNEL, (void *)phba, in lpfc_sli4_request_firmware_update()
11535 ret = request_firmware(&fw, file_name, &phba->pcidev->dev); in lpfc_sli4_request_firmware_update()
11537 lpfc_write_firmware(fw, (void *)phba); in lpfc_sli4_request_firmware_update()
11566 struct lpfc_hba *phba; in lpfc_pci_probe_one_s4() local
11573 phba = lpfc_hba_alloc(pdev); in lpfc_pci_probe_one_s4()
11574 if (!phba) in lpfc_pci_probe_one_s4()
11578 error = lpfc_enable_pci_dev(phba); in lpfc_pci_probe_one_s4()
11583 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); in lpfc_pci_probe_one_s4()
11588 error = lpfc_sli4_pci_mem_setup(phba); in lpfc_pci_probe_one_s4()
11590 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
11596 error = lpfc_sli4_driver_resource_setup(phba); in lpfc_pci_probe_one_s4()
11598 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
11603 INIT_LIST_HEAD(&phba->active_rrq_list); in lpfc_pci_probe_one_s4()
11604 INIT_LIST_HEAD(&phba->fcf.fcf_pri_list); in lpfc_pci_probe_one_s4()
11607 error = lpfc_setup_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
11609 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
11615 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); in lpfc_pci_probe_one_s4()
11618 error = lpfc_create_shost(phba); in lpfc_pci_probe_one_s4()
11620 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
11626 vport = phba->pport; in lpfc_pci_probe_one_s4()
11629 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
11636 cfg_mode = phba->cfg_use_msi; in lpfc_pci_probe_one_s4()
11639 lpfc_stop_port(phba); in lpfc_pci_probe_one_s4()
11642 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode); in lpfc_pci_probe_one_s4()
11644 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
11650 if (phba->intr_type != MSIX) { in lpfc_pci_probe_one_s4()
11651 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) in lpfc_pci_probe_one_s4()
11652 phba->cfg_fcp_io_channel = 1; in lpfc_pci_probe_one_s4()
11653 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_pci_probe_one_s4()
11654 phba->cfg_nvme_io_channel = 1; in lpfc_pci_probe_one_s4()
11655 if (phba->nvmet_support) in lpfc_pci_probe_one_s4()
11656 phba->cfg_nvmet_mrq = 1; in lpfc_pci_probe_one_s4()
11658 phba->io_channel_irqs = 1; in lpfc_pci_probe_one_s4()
11662 if (lpfc_sli4_hba_setup(phba)) { in lpfc_pci_probe_one_s4()
11663 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
11670 phba->intr_mode = intr_mode; in lpfc_pci_probe_one_s4()
11671 lpfc_log_intr_mode(phba, intr_mode); in lpfc_pci_probe_one_s4()
11674 lpfc_post_init_setup(phba); in lpfc_pci_probe_one_s4()
11679 if ((phba->nvmet_support == 0) && in lpfc_pci_probe_one_s4()
11680 (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { in lpfc_pci_probe_one_s4()
11688 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_probe_one_s4()
11696 if (phba->cfg_request_firmware_upgrade) in lpfc_pci_probe_one_s4()
11697 lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE); in lpfc_pci_probe_one_s4()
11700 lpfc_create_static_vport(phba); in lpfc_pci_probe_one_s4()
11704 lpfc_sli4_disable_intr(phba); in lpfc_pci_probe_one_s4()
11708 lpfc_destroy_shost(phba); in lpfc_pci_probe_one_s4()
11710 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_probe_one_s4()
11712 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_probe_one_s4()
11714 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_probe_one_s4()
11716 lpfc_disable_pci_dev(phba); in lpfc_pci_probe_one_s4()
11720 lpfc_hba_free(phba); in lpfc_pci_probe_one_s4()
11739 struct lpfc_hba *phba = vport->phba; in lpfc_pci_remove_one_s4() local
11743 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
11745 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
11751 vports = lpfc_create_vport_work_array(phba); in lpfc_pci_remove_one_s4()
11753 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_pci_remove_one_s4()
11758 lpfc_destroy_vport_work_array(phba, vports); in lpfc_pci_remove_one_s4()
11768 lpfc_nvmet_destroy_targetport(phba); in lpfc_pci_remove_one_s4()
11777 lpfc_sli4_hba_unset(phba); in lpfc_pci_remove_one_s4()
11779 lpfc_stop_hba_timers(phba); in lpfc_pci_remove_one_s4()
11780 spin_lock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
11782 spin_unlock_irq(&phba->hbalock); in lpfc_pci_remove_one_s4()
11787 lpfc_scsi_free(phba); in lpfc_pci_remove_one_s4()
11788 lpfc_nvme_free(phba); in lpfc_pci_remove_one_s4()
11789 lpfc_free_iocb_list(phba); in lpfc_pci_remove_one_s4()
11791 lpfc_unset_driver_resource_phase2(phba); in lpfc_pci_remove_one_s4()
11792 lpfc_sli4_driver_resource_unset(phba); in lpfc_pci_remove_one_s4()
11795 lpfc_sli4_pci_mem_unset(phba); in lpfc_pci_remove_one_s4()
11799 lpfc_disable_pci_dev(phba); in lpfc_pci_remove_one_s4()
11802 lpfc_hba_free(phba); in lpfc_pci_remove_one_s4()
11832 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one_s4() local
11834 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_suspend_one_s4()
11838 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_pci_suspend_one_s4()
11839 lpfc_offline(phba); in lpfc_pci_suspend_one_s4()
11840 kthread_stop(phba->worker_thread); in lpfc_pci_suspend_one_s4()
11843 lpfc_sli4_disable_intr(phba); in lpfc_pci_suspend_one_s4()
11844 lpfc_sli4_queue_destroy(phba); in lpfc_pci_suspend_one_s4()
11876 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one_s4() local
11880 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_pci_resume_one_s4()
11897 phba->worker_thread = kthread_run(lpfc_do_work, phba, in lpfc_pci_resume_one_s4()
11898 "lpfc_worker_%d", phba->brd_no); in lpfc_pci_resume_one_s4()
11899 if (IS_ERR(phba->worker_thread)) { in lpfc_pci_resume_one_s4()
11900 error = PTR_ERR(phba->worker_thread); in lpfc_pci_resume_one_s4()
11901 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
11908 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
11910 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one_s4()
11914 phba->intr_mode = intr_mode; in lpfc_pci_resume_one_s4()
11917 lpfc_sli_brdrestart(phba); in lpfc_pci_resume_one_s4()
11918 lpfc_online(phba); in lpfc_pci_resume_one_s4()
11921 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_pci_resume_one_s4()
11934 lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_recover() argument
11936 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_recover()
11942 lpfc_sli_abort_fcp_rings(phba); in lpfc_sli4_prep_dev_for_recover()
11954 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_reset() argument
11956 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_reset()
11960 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); in lpfc_sli4_prep_dev_for_reset()
11963 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_reset()
11966 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli4_prep_dev_for_reset()
11969 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_prep_dev_for_reset()
11970 lpfc_sli_flush_nvme_rings(phba); in lpfc_sli4_prep_dev_for_reset()
11973 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_reset()
11976 lpfc_sli4_disable_intr(phba); in lpfc_sli4_prep_dev_for_reset()
11977 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_prep_dev_for_reset()
11978 pci_disable_device(phba->pcidev); in lpfc_sli4_prep_dev_for_reset()
11990 lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba) in lpfc_sli4_prep_dev_for_perm_failure() argument
11992 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_prep_dev_for_perm_failure()
11996 lpfc_scsi_dev_block(phba); in lpfc_sli4_prep_dev_for_perm_failure()
11999 lpfc_stop_hba_timers(phba); in lpfc_sli4_prep_dev_for_perm_failure()
12002 lpfc_sli_flush_fcp_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
12005 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_sli4_prep_dev_for_perm_failure()
12006 lpfc_sli_flush_nvme_rings(phba); in lpfc_sli4_prep_dev_for_perm_failure()
12029 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected_s4() local
12034 lpfc_sli4_prep_dev_for_recover(phba); in lpfc_io_error_detected_s4()
12038 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
12042 lpfc_sli4_prep_dev_for_perm_failure(phba); in lpfc_io_error_detected_s4()
12046 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected_s4()
12048 lpfc_sli4_prep_dev_for_reset(phba); in lpfc_io_error_detected_s4()
12075 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset_s4() local
12076 struct lpfc_sli *psli = &phba->sli; in lpfc_io_slot_reset_s4()
12097 spin_lock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
12099 spin_unlock_irq(&phba->hbalock); in lpfc_io_slot_reset_s4()
12102 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
12104 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset_s4()
12109 phba->intr_mode = intr_mode; in lpfc_io_slot_reset_s4()
12112 lpfc_log_intr_mode(phba, phba->intr_mode); in lpfc_io_slot_reset_s4()
12131 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume_s4() local
12139 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_io_resume_s4()
12141 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_io_resume_s4()
12142 lpfc_offline(phba); in lpfc_io_resume_s4()
12143 lpfc_sli_brdrestart(phba); in lpfc_io_resume_s4()
12145 lpfc_online(phba); in lpfc_io_resume_s4()
12149 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_io_resume_s4()
12203 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_remove_one() local
12205 switch (phba->pci_dev_grp) { in lpfc_pci_remove_one()
12213 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_remove_one()
12215 phba->pci_dev_grp); in lpfc_pci_remove_one()
12239 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_suspend_one() local
12242 switch (phba->pci_dev_grp) { in lpfc_pci_suspend_one()
12250 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_suspend_one()
12252 phba->pci_dev_grp); in lpfc_pci_suspend_one()
12275 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pci_resume_one() local
12278 switch (phba->pci_dev_grp) { in lpfc_pci_resume_one()
12286 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_pci_resume_one()
12288 phba->pci_dev_grp); in lpfc_pci_resume_one()
12313 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_error_detected() local
12316 switch (phba->pci_dev_grp) { in lpfc_io_error_detected()
12324 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_error_detected()
12326 phba->pci_dev_grp); in lpfc_io_error_detected()
12350 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_slot_reset() local
12353 switch (phba->pci_dev_grp) { in lpfc_io_slot_reset()
12361 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_slot_reset()
12363 phba->pci_dev_grp); in lpfc_io_slot_reset()
12383 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_io_resume() local
12385 switch (phba->pci_dev_grp) { in lpfc_io_resume()
12393 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_io_resume()
12395 phba->pci_dev_grp); in lpfc_io_resume()
12412 lpfc_sli4_oas_verify(struct lpfc_hba *phba) in lpfc_sli4_oas_verify() argument
12415 if (!phba->cfg_EnableXLane) in lpfc_sli4_oas_verify()
12418 if (phba->sli4_hba.pc_sli4_params.oas_supported) { in lpfc_sli4_oas_verify()
12419 phba->cfg_fof = 1; in lpfc_sli4_oas_verify()
12421 phba->cfg_fof = 0; in lpfc_sli4_oas_verify()
12422 if (phba->device_data_mem_pool) in lpfc_sli4_oas_verify()
12423 mempool_destroy(phba->device_data_mem_pool); in lpfc_sli4_oas_verify()
12424 phba->device_data_mem_pool = NULL; in lpfc_sli4_oas_verify()
12442 lpfc_fof_queue_setup(struct lpfc_hba *phba) in lpfc_fof_queue_setup() argument
12447 rc = lpfc_eq_create(phba, phba->sli4_hba.fof_eq, LPFC_MAX_IMAX); in lpfc_fof_queue_setup()
12451 if (phba->cfg_fof) { in lpfc_fof_queue_setup()
12453 rc = lpfc_cq_create(phba, phba->sli4_hba.oas_cq, in lpfc_fof_queue_setup()
12454 phba->sli4_hba.fof_eq, LPFC_WCQ, LPFC_FCP); in lpfc_fof_queue_setup()
12458 rc = lpfc_wq_create(phba, phba->sli4_hba.oas_wq, in lpfc_fof_queue_setup()
12459 phba->sli4_hba.oas_cq, LPFC_FCP); in lpfc_fof_queue_setup()
12464 pring = phba->sli4_hba.oas_wq->pring; in lpfc_fof_queue_setup()
12466 (void *)phba->sli4_hba.oas_wq; in lpfc_fof_queue_setup()
12467 phba->sli4_hba.oas_cq->pring = pring; in lpfc_fof_queue_setup()
12473 lpfc_cq_destroy(phba, phba->sli4_hba.oas_cq); in lpfc_fof_queue_setup()
12475 lpfc_eq_destroy(phba, phba->sli4_hba.fof_eq); in lpfc_fof_queue_setup()
12495 lpfc_fof_queue_create(struct lpfc_hba *phba) in lpfc_fof_queue_create() argument
12501 qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE, in lpfc_fof_queue_create()
12502 phba->sli4_hba.eq_esize, in lpfc_fof_queue_create()
12503 phba->sli4_hba.eq_ecount); in lpfc_fof_queue_create()
12508 phba->sli4_hba.fof_eq = qdesc; in lpfc_fof_queue_create()
12510 if (phba->cfg_fof) { in lpfc_fof_queue_create()
12513 if (phba->enab_exp_wqcq_pages) in lpfc_fof_queue_create()
12514 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_fof_queue_create()
12516 phba->sli4_hba.cq_esize, in lpfc_fof_queue_create()
12519 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_fof_queue_create()
12521 phba->sli4_hba.cq_esize, in lpfc_fof_queue_create()
12522 phba->sli4_hba.cq_ecount); in lpfc_fof_queue_create()
12527 phba->sli4_hba.oas_cq = qdesc; in lpfc_fof_queue_create()
12530 if (phba->enab_exp_wqcq_pages) { in lpfc_fof_queue_create()
12531 wqesize = (phba->fcp_embed_io) ? in lpfc_fof_queue_create()
12532 LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize; in lpfc_fof_queue_create()
12533 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_fof_queue_create()
12538 qdesc = lpfc_sli4_queue_alloc(phba, in lpfc_fof_queue_create()
12540 phba->sli4_hba.wq_esize, in lpfc_fof_queue_create()
12541 phba->sli4_hba.wq_ecount); in lpfc_fof_queue_create()
12546 phba->sli4_hba.oas_wq = qdesc; in lpfc_fof_queue_create()
12547 list_add_tail(&qdesc->wq_list, &phba->sli4_hba.lpfc_wq_list); in lpfc_fof_queue_create()
12553 lpfc_fof_queue_destroy(phba); in lpfc_fof_queue_create()
12568 lpfc_fof_queue_destroy(struct lpfc_hba *phba) in lpfc_fof_queue_destroy() argument
12571 if (phba->sli4_hba.fof_eq != NULL) { in lpfc_fof_queue_destroy()
12572 lpfc_sli4_queue_free(phba->sli4_hba.fof_eq); in lpfc_fof_queue_destroy()
12573 phba->sli4_hba.fof_eq = NULL; in lpfc_fof_queue_destroy()
12577 if (phba->sli4_hba.oas_cq != NULL) { in lpfc_fof_queue_destroy()
12578 lpfc_sli4_queue_free(phba->sli4_hba.oas_cq); in lpfc_fof_queue_destroy()
12579 phba->sli4_hba.oas_cq = NULL; in lpfc_fof_queue_destroy()
12583 if (phba->sli4_hba.oas_wq != NULL) { in lpfc_fof_queue_destroy()
12584 lpfc_sli4_queue_free(phba->sli4_hba.oas_wq); in lpfc_fof_queue_destroy()
12585 phba->sli4_hba.oas_wq = NULL; in lpfc_fof_queue_destroy()