Lines Matching refs:phba

79 static bool lpfc_sli4_fp_handle_cqe(struct lpfc_hba *phba,
83 static void lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba,
86 static bool lpfc_sli4_mbox_completions_pending(struct lpfc_hba *phba);
87 static bool lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba);
89 static void __lpfc_sli4_consume_cqe(struct lpfc_hba *phba,
167 if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED) in lpfc_sli4_wq_put()
170 if (q->dpp_enable && q->phba->cfg_enable_dpp) { in lpfc_sli4_wq_put()
194 if (q->dpp_enable && q->phba->cfg_enable_dpp) { in lpfc_sli4_wq_put()
207 &q->phba->sli4_hba.sli_intf); in lpfc_sli4_wq_put()
271 q->phba->mbox = (MAILBOX_t *)temp_mqe; in lpfc_sli4_mq_put()
280 writel(doorbell.word0, q->phba->sli4_hba.MQDBregaddr); in lpfc_sli4_mq_put()
302 q->phba->mbox = NULL; in lpfc_sli4_mq_release()
359 writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr); in lpfc_sli4_eq_clr_intr()
374 writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr); in lpfc_sli4_if6_eq_clr_intr()
389 lpfc_sli4_write_eq_db(struct lpfc_hba *phba, struct lpfc_queue *q, in lpfc_sli4_write_eq_db() argument
409 writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr); in lpfc_sli4_write_eq_db()
411 if ((q->phba->intr_type == INTx) && (arm == LPFC_QUEUE_REARM)) in lpfc_sli4_write_eq_db()
412 readl(q->phba->sli4_hba.EQDBregaddr); in lpfc_sli4_write_eq_db()
427 lpfc_sli4_if6_write_eq_db(struct lpfc_hba *phba, struct lpfc_queue *q, in lpfc_sli4_if6_write_eq_db() argument
442 writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr); in lpfc_sli4_if6_write_eq_db()
444 if ((q->phba->intr_type == INTx) && (arm == LPFC_QUEUE_REARM)) in lpfc_sli4_if6_write_eq_db()
445 readl(q->phba->sli4_hba.EQDBregaddr); in lpfc_sli4_if6_write_eq_db()
449 __lpfc_sli4_consume_eqe(struct lpfc_hba *phba, struct lpfc_queue *eq, in __lpfc_sli4_consume_eqe() argument
452 if (!phba->sli4_hba.pc_sli4_params.eqav) in __lpfc_sli4_consume_eqe()
458 if (phba->sli4_hba.pc_sli4_params.eqav && !eq->host_index) in __lpfc_sli4_consume_eqe()
463 lpfc_sli4_eqcq_flush(struct lpfc_hba *phba, struct lpfc_queue *eq) in lpfc_sli4_eqcq_flush() argument
488 __lpfc_sli4_consume_cqe(phba, cq, cqe); in lpfc_sli4_eqcq_flush()
493 phba->sli4_hba.sli4_write_cq_db(phba, cq, cq_count, in lpfc_sli4_eqcq_flush()
497 __lpfc_sli4_consume_eqe(phba, eq, eqe); in lpfc_sli4_eqcq_flush()
503 phba->sli4_hba.sli4_write_eq_db(phba, eq, eq_count, LPFC_QUEUE_REARM); in lpfc_sli4_eqcq_flush()
507 lpfc_sli4_process_eq(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_sli4_process_eq() argument
518 lpfc_sli4_hba_handle_eqe(phba, eq, eqe); in lpfc_sli4_process_eq()
519 __lpfc_sli4_consume_eqe(phba, eq, eqe); in lpfc_sli4_process_eq()
526 phba->sli4_hba.sli4_write_eq_db(phba, eq, consumed, in lpfc_sli4_process_eq()
543 phba->sli4_hba.sli4_write_eq_db(phba, eq, consumed, rearm); in lpfc_sli4_process_eq()
584 __lpfc_sli4_consume_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in __lpfc_sli4_consume_cqe() argument
587 if (!phba->sli4_hba.pc_sli4_params.cqav) in __lpfc_sli4_consume_cqe()
593 if (phba->sli4_hba.pc_sli4_params.cqav && !cq->host_index) in __lpfc_sli4_consume_cqe()
609 lpfc_sli4_write_cq_db(struct lpfc_hba *phba, struct lpfc_queue *q, in lpfc_sli4_write_cq_db() argument
627 writel(doorbell.word0, q->phba->sli4_hba.CQDBregaddr); in lpfc_sli4_write_cq_db()
642 lpfc_sli4_if6_write_cq_db(struct lpfc_hba *phba, struct lpfc_queue *q, in lpfc_sli4_if6_write_cq_db() argument
657 writel(doorbell.word0, q->phba->sli4_hba.CQDBregaddr); in lpfc_sli4_if6_write_cq_db()
758 lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_cmd_iocb() argument
761 pring->sli.sli3.cmdidx * phba->iocb_cmd_size); in lpfc_cmd_iocb()
775 lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_resp_iocb() argument
778 pring->sli.sli3.rspidx * phba->iocb_rsp_size); in lpfc_resp_iocb()
791 __lpfc_sli_get_iocbq(struct lpfc_hba *phba) in __lpfc_sli_get_iocbq() argument
793 struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list; in __lpfc_sli_get_iocbq()
796 lockdep_assert_held(&phba->hbalock); in __lpfc_sli_get_iocbq()
800 phba->iocb_cnt++; in __lpfc_sli_get_iocbq()
801 if (phba->iocb_cnt > phba->iocb_max) in __lpfc_sli_get_iocbq()
802 phba->iocb_max = phba->iocb_cnt; in __lpfc_sli_get_iocbq()
819 __lpfc_clear_active_sglq(struct lpfc_hba *phba, uint16_t xritag) in __lpfc_clear_active_sglq() argument
823 sglq = phba->sli4_hba.lpfc_sglq_active_list[xritag]; in __lpfc_clear_active_sglq()
824 phba->sli4_hba.lpfc_sglq_active_list[xritag] = NULL; in __lpfc_clear_active_sglq()
841 __lpfc_get_active_sglq(struct lpfc_hba *phba, uint16_t xritag) in __lpfc_get_active_sglq() argument
845 sglq = phba->sli4_hba.lpfc_sglq_active_list[xritag]; in __lpfc_get_active_sglq()
857 lpfc_clr_rrq_active(struct lpfc_hba *phba, in lpfc_clr_rrq_active() argument
882 mempool_free(rrq, phba->rrq_pool); in lpfc_clr_rrq_active()
900 lpfc_handle_rrq_active(struct lpfc_hba *phba) in lpfc_handle_rrq_active() argument
908 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_handle_rrq_active()
909 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_handle_rrq_active()
910 next_time = jiffies + msecs_to_jiffies(1000 * (phba->fc_ratov + 1)); in lpfc_handle_rrq_active()
912 &phba->active_rrq_list, list) { in lpfc_handle_rrq_active()
918 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_handle_rrq_active()
919 if ((!list_empty(&phba->active_rrq_list)) && in lpfc_handle_rrq_active()
920 (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_rrq_active()
921 mod_timer(&phba->rrq_tmr, next_time); in lpfc_handle_rrq_active()
926 lpfc_clr_rrq_active(phba, rrq->xritag, rrq); in lpfc_handle_rrq_active()
927 } else if (lpfc_send_rrq(phba, rrq)) { in lpfc_handle_rrq_active()
931 lpfc_clr_rrq_active(phba, rrq->xritag, in lpfc_handle_rrq_active()
949 struct lpfc_hba *phba = vport->phba; in lpfc_get_active_rrq() local
954 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_active_rrq()
956 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_get_active_rrq()
957 list_for_each_entry_safe(rrq, nextrrq, &phba->active_rrq_list, list) { in lpfc_get_active_rrq()
961 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_get_active_rrq()
965 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_get_active_rrq()
981 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup_vports_rrqs() local
987 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cleanup_vports_rrqs()
993 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_cleanup_vports_rrqs()
994 list_for_each_entry_safe(rrq, nextrrq, &phba->active_rrq_list, list) in lpfc_cleanup_vports_rrqs()
997 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_cleanup_vports_rrqs()
1001 lpfc_clr_rrq_active(phba, rrq->xritag, rrq); in lpfc_cleanup_vports_rrqs()
1016 lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_test_rrq_active() argument
1045 lpfc_set_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_set_rrq_active() argument
1055 if (!phba->cfg_enable_rrq) in lpfc_set_rrq_active()
1058 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_set_rrq_active()
1059 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_set_rrq_active()
1060 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_set_rrq_active()
1079 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_set_rrq_active()
1080 rrq = mempool_alloc(phba->rrq_pool, GFP_ATOMIC); in lpfc_set_rrq_active()
1082 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_set_rrq_active()
1088 if (phba->cfg_enable_rrq == 1) in lpfc_set_rrq_active()
1094 msecs_to_jiffies(1000 * (phba->fc_ratov + 1)); in lpfc_set_rrq_active()
1099 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_set_rrq_active()
1100 empty = list_empty(&phba->active_rrq_list); in lpfc_set_rrq_active()
1101 list_add_tail(&rrq->list, &phba->active_rrq_list); in lpfc_set_rrq_active()
1102 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_set_rrq_active()
1104 lpfc_worker_wake_up(phba); in lpfc_set_rrq_active()
1105 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_set_rrq_active()
1108 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_set_rrq_active()
1109 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_set_rrq_active()
1128 __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq) in __lpfc_sli_get_els_sglq() argument
1130 struct list_head *lpfc_els_sgl_list = &phba->sli4_hba.lpfc_els_sgl_list; in __lpfc_sli_get_els_sglq()
1139 pring = phba->sli4_hba.nvmels_wq->pring; in __lpfc_sli_get_els_sglq()
1141 pring = lpfc_phba_elsring(phba); in __lpfc_sli_get_els_sglq()
1160 spin_lock(&phba->sli4_hba.sgl_list_lock); in __lpfc_sli_get_els_sglq()
1185 phba->sli4_hba.lpfc_sglq_active_list[sglq->sli4_lxritag] = sglq; in __lpfc_sli_get_els_sglq()
1188 spin_unlock(&phba->sli4_hba.sgl_list_lock); in __lpfc_sli_get_els_sglq()
1203 __lpfc_sli_get_nvmet_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq) in __lpfc_sli_get_nvmet_sglq() argument
1208 lpfc_nvmet_sgl_list = &phba->sli4_hba.lpfc_nvmet_sgl_list; in __lpfc_sli_get_nvmet_sglq()
1210 lockdep_assert_held(&phba->sli4_hba.sgl_list_lock); in __lpfc_sli_get_nvmet_sglq()
1215 phba->sli4_hba.lpfc_sglq_active_list[sglq->sli4_lxritag] = sglq; in __lpfc_sli_get_nvmet_sglq()
1230 lpfc_sli_get_iocbq(struct lpfc_hba *phba) in lpfc_sli_get_iocbq() argument
1235 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_get_iocbq()
1236 iocbq = __lpfc_sli_get_iocbq(phba); in lpfc_sli_get_iocbq()
1237 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_get_iocbq()
1261 __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in __lpfc_sli_release_iocbq_s4() argument
1271 sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_lxritag); in __lpfc_sli_release_iocbq_s4()
1276 spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, in __lpfc_sli_release_iocbq_s4()
1281 &phba->sli4_hba.lpfc_nvmet_sgl_list); in __lpfc_sli_release_iocbq_s4()
1283 &phba->sli4_hba.sgl_list_lock, iflag); in __lpfc_sli_release_iocbq_s4()
1287 pring = phba->sli4_hba.els_wq->pring; in __lpfc_sli_release_iocbq_s4()
1290 spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, in __lpfc_sli_release_iocbq_s4()
1293 &phba->sli4_hba.lpfc_abts_els_sgl_list); in __lpfc_sli_release_iocbq_s4()
1295 &phba->sli4_hba.sgl_list_lock, iflag); in __lpfc_sli_release_iocbq_s4()
1297 spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, in __lpfc_sli_release_iocbq_s4()
1302 &phba->sli4_hba.lpfc_els_sgl_list); in __lpfc_sli_release_iocbq_s4()
1304 &phba->sli4_hba.sgl_list_lock, iflag); in __lpfc_sli_release_iocbq_s4()
1308 lpfc_worker_wake_up(phba); in __lpfc_sli_release_iocbq_s4()
1321 list_add_tail(&iocbq->list, &phba->lpfc_iocb_list); in __lpfc_sli_release_iocbq_s4()
1337 __lpfc_sli_release_iocbq_s3(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in __lpfc_sli_release_iocbq_s3() argument
1346 list_add_tail(&iocbq->list, &phba->lpfc_iocb_list); in __lpfc_sli_release_iocbq_s3()
1360 __lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in __lpfc_sli_release_iocbq() argument
1362 lockdep_assert_held(&phba->hbalock); in __lpfc_sli_release_iocbq()
1364 phba->__lpfc_sli_release_iocbq(phba, iocbq); in __lpfc_sli_release_iocbq()
1365 phba->iocb_cnt--; in __lpfc_sli_release_iocbq()
1377 lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in lpfc_sli_release_iocbq() argument
1384 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_release_iocbq()
1385 __lpfc_sli_release_iocbq(phba, iocbq); in lpfc_sli_release_iocbq()
1386 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_release_iocbq()
1402 lpfc_sli_cancel_iocbs(struct lpfc_hba *phba, struct list_head *iocblist, in lpfc_sli_cancel_iocbs() argument
1411 lpfc_nvme_cancel_iocb(phba, piocb); in lpfc_sli_cancel_iocbs()
1413 lpfc_sli_release_iocbq(phba, piocb); in lpfc_sli_cancel_iocbs()
1417 (piocb->iocb_cmpl) (phba, piocb, piocb); in lpfc_sli_cancel_iocbs()
1551 lpfc_sli_ring_map(struct lpfc_hba *phba) in lpfc_sli_ring_map() argument
1553 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_ring_map()
1558 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_ring_map()
1562 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_sli_ring_map()
1564 lpfc_config_ring(phba, i, pmb); in lpfc_sli_ring_map()
1565 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_ring_map()
1567 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_ring_map()
1573 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_ring_map()
1578 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_ring_map()
1596 lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_ringtxcmpl_put() argument
1599 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_ringtxcmpl_put()
1602 lockdep_assert_held(&phba->hbalock); in lpfc_sli_ringtxcmpl_put()
1617 msecs_to_jiffies(1000 * (phba->fc_ratov << 1))); in lpfc_sli_ringtxcmpl_put()
1634 lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_ringtx_get() argument
1638 lockdep_assert_held(&phba->hbalock); in lpfc_sli_ringtx_get()
1659 lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_next_iocb_slot() argument
1661 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; in lpfc_sli_next_iocb_slot()
1664 lockdep_assert_held(&phba->hbalock); in lpfc_sli_next_iocb_slot()
1676 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_next_iocb_slot()
1683 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_next_iocb_slot()
1688 phba->work_ha |= HA_ERATT; in lpfc_sli_next_iocb_slot()
1689 phba->work_hs = HS_FFER3; in lpfc_sli_next_iocb_slot()
1691 lpfc_worker_wake_up(phba); in lpfc_sli_next_iocb_slot()
1700 return lpfc_cmd_iocb(phba, pring); in lpfc_sli_next_iocb_slot()
1716 lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in lpfc_sli_next_iotag() argument
1721 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_next_iotag()
1724 spin_lock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1729 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1735 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1739 spin_lock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1748 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1752 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1763 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1769 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1771 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_next_iotag()
1794 lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_submit_iocb() argument
1804 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_submit_iocb()
1814 lpfc_sli_pcimem_bcopy(&nextiocb->iocb, iocb, phba->iocb_cmd_size); in lpfc_sli_submit_iocb()
1824 lpfc_sli_ringtxcmpl_put(phba, pring, nextiocb); in lpfc_sli_submit_iocb()
1826 __lpfc_sli_release_iocbq(phba, nextiocb); in lpfc_sli_submit_iocb()
1833 writel(pring->sli.sli3.cmdidx, &phba->host_gp[pring->ringno].cmdPutInx); in lpfc_sli_submit_iocb()
1849 lpfc_sli_update_full_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_update_full_ring() argument
1861 writel((CA_R0ATT|CA_R0CE_REQ) << (ringno*4), phba->CAregaddr); in lpfc_sli_update_full_ring()
1862 readl(phba->CAregaddr); /* flush */ in lpfc_sli_update_full_ring()
1877 lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_update_ring() argument
1884 if (!(phba->sli3_options & LPFC_SLI3_CRP_ENABLED)) { in lpfc_sli_update_ring()
1886 writel(CA_R0ATT << (ringno * 4), phba->CAregaddr); in lpfc_sli_update_ring()
1887 readl(phba->CAregaddr); /* flush */ in lpfc_sli_update_ring()
1901 lpfc_sli_resume_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_resume_iocb() argument
1906 lockdep_assert_held(&phba->hbalock); in lpfc_sli_resume_iocb()
1916 if (lpfc_is_link_up(phba) && in lpfc_sli_resume_iocb()
1919 phba->sli.sli_flag & LPFC_PROCESS_LA)) { in lpfc_sli_resume_iocb()
1921 while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) && in lpfc_sli_resume_iocb()
1922 (nextiocb = lpfc_sli_ringtx_get(phba, pring))) in lpfc_sli_resume_iocb()
1923 lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb); in lpfc_sli_resume_iocb()
1926 lpfc_sli_update_ring(phba, pring); in lpfc_sli_resume_iocb()
1928 lpfc_sli_update_full_ring(phba, pring); in lpfc_sli_resume_iocb()
1945 lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) in lpfc_sli_next_hbq_slot() argument
1947 struct hbq_s *hbqp = &phba->hbqs[hbqno]; in lpfc_sli_next_hbq_slot()
1949 lockdep_assert_held(&phba->hbalock); in lpfc_sli_next_hbq_slot()
1956 uint32_t raw_index = phba->hbq_get[hbqno]; in lpfc_sli_next_hbq_slot()
1962 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_next_hbq_slot()
1968 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_next_hbq_slot()
1976 return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt + in lpfc_sli_next_hbq_slot()
1990 lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba) in lpfc_sli_hbqbuf_free_all() argument
1999 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_hbqbuf_free_all()
2002 &phba->hbqs[i].hbq_buffer_list, list) { in lpfc_sli_hbqbuf_free_all()
2005 (phba->hbqs[i].hbq_free_buffer)(phba, hbq_buf); in lpfc_sli_hbqbuf_free_all()
2007 phba->hbqs[i].buffer_count = 0; in lpfc_sli_hbqbuf_free_all()
2011 phba->hbq_in_use = 0; in lpfc_sli_hbqbuf_free_all()
2012 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hbqbuf_free_all()
2028 lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, in lpfc_sli_hbq_to_firmware() argument
2031 lockdep_assert_held(&phba->hbalock); in lpfc_sli_hbq_to_firmware()
2032 return phba->lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buf); in lpfc_sli_hbq_to_firmware()
2047 lpfc_sli_hbq_to_firmware_s3(struct lpfc_hba *phba, uint32_t hbqno, in lpfc_sli_hbq_to_firmware_s3() argument
2053 lockdep_assert_held(&phba->hbalock); in lpfc_sli_hbq_to_firmware_s3()
2055 hbqe = lpfc_sli_next_hbq_slot(phba, hbqno); in lpfc_sli_hbq_to_firmware_s3()
2057 struct hbq_s *hbqp = &phba->hbqs[hbqno]; in lpfc_sli_hbq_to_firmware_s3()
2067 writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); in lpfc_sli_hbq_to_firmware_s3()
2069 readl(phba->hbq_put + hbqno); in lpfc_sli_hbq_to_firmware_s3()
2087 lpfc_sli_hbq_to_firmware_s4(struct lpfc_hba *phba, uint32_t hbqno, in lpfc_sli_hbq_to_firmware_s4() argument
2098 hrq = phba->sli4_hba.hdr_rq; in lpfc_sli_hbq_to_firmware_s4()
2099 drq = phba->sli4_hba.dat_rq; in lpfc_sli_hbq_to_firmware_s4()
2101 lockdep_assert_held(&phba->hbalock); in lpfc_sli_hbq_to_firmware_s4()
2110 list_add_tail(&hbq_buf->dbuf.list, &phba->hbqs[hbqno].hbq_buffer_list); in lpfc_sli_hbq_to_firmware_s4()
2142 lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) in lpfc_sli_hbqbuf_fill_hbqs() argument
2148 if (!phba->hbqs[hbqno].hbq_alloc_buffer) in lpfc_sli_hbqbuf_fill_hbqs()
2151 if ((phba->hbqs[hbqno].buffer_count + count) > in lpfc_sli_hbqbuf_fill_hbqs()
2154 phba->hbqs[hbqno].buffer_count; in lpfc_sli_hbqbuf_fill_hbqs()
2159 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); in lpfc_sli_hbqbuf_fill_hbqs()
2165 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_hbqbuf_fill_hbqs()
2166 if (!phba->hbq_in_use) in lpfc_sli_hbqbuf_fill_hbqs()
2171 hbq_buffer->tag = (phba->hbqs[hbqno].buffer_count | in lpfc_sli_hbqbuf_fill_hbqs()
2173 if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) { in lpfc_sli_hbqbuf_fill_hbqs()
2174 phba->hbqs[hbqno].buffer_count++; in lpfc_sli_hbqbuf_fill_hbqs()
2177 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); in lpfc_sli_hbqbuf_fill_hbqs()
2179 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hbqbuf_fill_hbqs()
2182 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hbqbuf_fill_hbqs()
2186 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); in lpfc_sli_hbqbuf_fill_hbqs()
2201 lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno) in lpfc_sli_hbqbuf_add_hbqs() argument
2203 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_hbqbuf_add_hbqs()
2206 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, in lpfc_sli_hbqbuf_add_hbqs()
2220 lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno) in lpfc_sli_hbqbuf_init_hbqs() argument
2222 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_hbqbuf_init_hbqs()
2223 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, in lpfc_sli_hbqbuf_init_hbqs()
2226 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, in lpfc_sli_hbqbuf_init_hbqs()
2256 lpfc_sli_rqbuf_get(struct lpfc_hba *phba, struct lpfc_queue *hrq) in lpfc_sli_rqbuf_get() argument
2280 lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) in lpfc_sli_hbqbuf_find() argument
2290 spin_lock_irq(&phba->hbalock); in lpfc_sli_hbqbuf_find()
2291 list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) { in lpfc_sli_hbqbuf_find()
2294 spin_unlock_irq(&phba->hbalock); in lpfc_sli_hbqbuf_find()
2298 spin_unlock_irq(&phba->hbalock); in lpfc_sli_hbqbuf_find()
2299 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_hbqbuf_find()
2301 tag, phba->hbqs[tag >> 16].buffer_count); in lpfc_sli_hbqbuf_find()
2315 lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer) in lpfc_sli_free_hbq() argument
2321 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) in lpfc_sli_free_hbq()
2322 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); in lpfc_sli_free_hbq()
2427 lpfc_sli_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_sli_wake_mbox_wait() argument
2437 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_sli_wake_mbox_wait()
2441 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_wake_mbox_wait()
2451 lpfc_sli4_free_rpi(vport->phba, ndlp->nlp_rpi); in __lpfc_sli_rpi_release()
2452 spin_lock_irqsave(&vport->phba->ndlp_lock, iflags); in __lpfc_sli_rpi_release()
2455 spin_unlock_irqrestore(&vport->phba->ndlp_lock, iflags); in __lpfc_sli_rpi_release()
2471 lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) in lpfc_sli_def_mbox_cmpl() argument
2483 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli_def_mbox_cmpl()
2491 if (!(phba->pport->load_flag & FC_UNLOADING) && in lpfc_sli_def_mbox_cmpl()
2496 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_def_mbox_cmpl()
2497 vpi -= phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli_def_mbox_cmpl()
2498 lpfc_unreg_login(phba, vpi, rpi, pmb); in lpfc_sli_def_mbox_cmpl()
2501 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli_def_mbox_cmpl()
2507 !(phba->pport->load_flag & FC_UNLOADING) && in lpfc_sli_def_mbox_cmpl()
2553 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_def_mbox_cmpl()
2558 lpfc_sli4_mbox_cmd_free(phba, pmb); in lpfc_sli_def_mbox_cmpl()
2560 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_def_mbox_cmpl()
2576 lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) in lpfc_sli4_unreg_rpi_cmpl_clr() argument
2583 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_sli4_unreg_rpi_cmpl_clr()
2585 &phba->sli4_hba.sli_intf) >= in lpfc_sli4_unreg_rpi_cmpl_clr()
2625 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_unreg_rpi_cmpl_clr()
2642 lpfc_sli_handle_mb_event(struct lpfc_hba *phba) in lpfc_sli_handle_mb_event() argument
2649 phba->sli.slistat.mbox_event++; in lpfc_sli_handle_mb_event()
2652 spin_lock_irq(&phba->hbalock); in lpfc_sli_handle_mb_event()
2653 list_splice_init(&phba->sli.mboxq_cmpl, &cmplq); in lpfc_sli_handle_mb_event()
2654 spin_unlock_irq(&phba->hbalock); in lpfc_sli_handle_mb_event()
2674 lpfc_debugfs_disc_trc(phba->pport, in lpfc_sli_handle_mb_event()
2689 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_handle_mb_event()
2695 lpfc_sli_config_mbox_subsys_get(phba, in lpfc_sli_handle_mb_event()
2697 lpfc_sli_config_mbox_opcode_get(phba, in lpfc_sli_handle_mb_event()
2699 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_handle_mb_event()
2700 phba->work_hs = HS_FFER3; in lpfc_sli_handle_mb_event()
2701 lpfc_handle_eratt(phba); in lpfc_sli_handle_mb_event()
2706 phba->sli.slistat.mbox_stat_err++; in lpfc_sli_handle_mb_event()
2709 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli_handle_mb_event()
2717 lpfc_sli_config_mbox_subsys_get(phba, in lpfc_sli_handle_mb_event()
2719 lpfc_sli_config_mbox_opcode_get(phba, in lpfc_sli_handle_mb_event()
2727 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli_handle_mb_event()
2734 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli_handle_mb_event()
2740 lpfc_sli_config_mbox_subsys_get(phba, pmb), in lpfc_sli_handle_mb_event()
2741 lpfc_sli_config_mbox_opcode_get(phba, pmb), in lpfc_sli_handle_mb_event()
2757 pmb->mbox_cmpl(phba,pmb); in lpfc_sli_handle_mb_event()
2775 lpfc_sli_get_buff(struct lpfc_hba *phba, in lpfc_sli_get_buff() argument
2782 return lpfc_sli_ring_taggedbuf_get(phba, pring, tag); in lpfc_sli_get_buff()
2783 hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); in lpfc_sli_get_buff()
2801 lpfc_nvme_unsol_ls_handler(struct lpfc_hba *phba, struct lpfc_iocbq *piocb) in lpfc_nvme_unsol_ls_handler() argument
2824 lpfc_nvmeio_data(phba, "NVME LS RCV: xri x%x sz %d from %06x\n", in lpfc_nvme_unsol_ls_handler()
2827 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_nvme_unsol_ls_handler()
2829 } else if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { in lpfc_nvme_unsol_ls_handler()
2831 } else if (!phba->nvmet_support && !phba->pport->localport) { in lpfc_nvme_unsol_ls_handler()
2833 } else if (phba->nvmet_support && !phba->targetport) { in lpfc_nvme_unsol_ls_handler()
2847 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_nvme_unsol_ls_handler()
2854 ndlp = lpfc_findnode_did(phba->pport, sid); in lpfc_nvme_unsol_ls_handler()
2858 lpfc_printf_log(phba, KERN_ERR, LOG_NVME_DISC, in lpfc_nvme_unsol_ls_handler()
2865 axchg->phba = phba; in lpfc_nvme_unsol_ls_handler()
2874 axchg->hdwq = &phba->sli4_hba.hdwq[0]; in lpfc_nvme_unsol_ls_handler()
2878 if (phba->nvmet_support) in lpfc_nvme_unsol_ls_handler()
2879 ret = lpfc_nvmet_handle_lsreq(phba, axchg); in lpfc_nvme_unsol_ls_handler()
2881 ret = lpfc_nvme_handle_lsreq(phba, axchg); in lpfc_nvme_unsol_ls_handler()
2887 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_nvme_unsol_ls_handler()
2891 (phba->nvmet_support) ? "T" : "I", ret); in lpfc_nvme_unsol_ls_handler()
2896 lpfc_in_buf_free(phba, &nvmebuf->dbuf); in lpfc_nvme_unsol_ls_handler()
2900 ret = lpfc_nvme_unsol_ls_issue_abort(phba, axchg, sid, oxid); in lpfc_nvme_unsol_ls_handler()
2919 lpfc_complete_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_complete_unsol_iocb() argument
2927 lpfc_nvme_unsol_ls_handler(phba, saveq); in lpfc_complete_unsol_iocb()
2936 (pring->prt[0].lpfc_sli_rcv_unsol_event) (phba, pring, in lpfc_complete_unsol_iocb()
2947 (phba, pring, saveq); in lpfc_complete_unsol_iocb()
2969 lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_process_unsol_iocb() argument
2982 pring->lpfc_sli_rcv_async_status(phba, pring, saveq); in lpfc_sli_process_unsol_iocb()
2984 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
2996 (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)) { in lpfc_sli_process_unsol_iocb()
2998 dmzbuf = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
3000 lpfc_in_buf_free(phba, dmzbuf); in lpfc_sli_process_unsol_iocb()
3004 dmzbuf = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
3006 lpfc_in_buf_free(phba, dmzbuf); in lpfc_sli_process_unsol_iocb()
3010 dmzbuf = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
3012 lpfc_in_buf_free(phba, dmzbuf); in lpfc_sli_process_unsol_iocb()
3018 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { in lpfc_sli_process_unsol_iocb()
3020 saveq->context2 = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
3023 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
3032 saveq->context3 = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
3035 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
3046 iocbq->context2 = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
3049 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
3058 iocbq->context3 = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
3061 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
3117 if (!lpfc_complete_unsol_iocb(phba, pring, saveq, Rctl, Type)) in lpfc_sli_process_unsol_iocb()
3118 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_process_unsol_iocb()
3140 lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, in lpfc_sli_iocbq_lookup() argument
3149 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_iocbq_lookup()
3152 temp_lock = &phba->hbalock; in lpfc_sli_iocbq_lookup()
3157 if (iotag != 0 && iotag <= phba->sli.last_iotag) { in lpfc_sli_iocbq_lookup()
3158 cmd_iocb = phba->sli.iocbq_lookup[iotag]; in lpfc_sli_iocbq_lookup()
3170 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_iocbq_lookup()
3173 iotag, phba->sli.last_iotag, in lpfc_sli_iocbq_lookup()
3191 lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, in lpfc_sli_iocbq_lookup_by_tag() argument
3198 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_iocbq_lookup_by_tag()
3201 temp_lock = &phba->hbalock; in lpfc_sli_iocbq_lookup_by_tag()
3204 if (iotag != 0 && iotag <= phba->sli.last_iotag) { in lpfc_sli_iocbq_lookup_by_tag()
3205 cmd_iocb = phba->sli.iocbq_lookup[iotag]; in lpfc_sli_iocbq_lookup_by_tag()
3217 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_iocbq_lookup_by_tag()
3220 iotag, phba->sli.last_iotag, in lpfc_sli_iocbq_lookup_by_tag()
3243 lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_process_sol_iocb() argument
3250 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); in lpfc_sli_process_sol_iocb()
3261 lpfc_send_els_failure_event(phba, in lpfc_sli_process_sol_iocb()
3269 if ((phba->sli_rev < LPFC_SLI_REV4) && in lpfc_sli_process_sol_iocb()
3272 spin_lock_irqsave(&phba->hbalock, in lpfc_sli_process_sol_iocb()
3276 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_process_sol_iocb()
3287 spin_lock_irqsave(&phba->hbalock, in lpfc_sli_process_sol_iocb()
3290 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_process_sol_iocb()
3293 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_process_sol_iocb()
3303 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
3307 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
3317 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
3321 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
3337 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
3341 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
3345 (cmdiocbp->iocb_cmpl) (phba, cmdiocbp, saveq); in lpfc_sli_process_sol_iocb()
3347 lpfc_sli_release_iocbq(phba, cmdiocbp); in lpfc_sli_process_sol_iocb()
3359 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_process_sol_iocb()
3386 lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_rsp_pointers_error() argument
3388 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; in lpfc_sli_rsp_pointers_error()
3393 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_rsp_pointers_error()
3399 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_rsp_pointers_error()
3405 phba->work_ha |= HA_ERATT; in lpfc_sli_rsp_pointers_error()
3406 phba->work_hs = HS_FFER3; in lpfc_sli_rsp_pointers_error()
3408 lpfc_worker_wake_up(phba); in lpfc_sli_rsp_pointers_error()
3425 struct lpfc_hba *phba; in lpfc_poll_eratt() local
3429 phba = from_timer(phba, t, eratt_poll); in lpfc_poll_eratt()
3432 sli_intr = phba->sli.slistat.sli_intr; in lpfc_poll_eratt()
3434 if (phba->sli.slistat.sli_prev_intr > sli_intr) in lpfc_poll_eratt()
3435 cnt = (((uint64_t)(-1) - phba->sli.slistat.sli_prev_intr) + in lpfc_poll_eratt()
3438 cnt = (sli_intr - phba->sli.slistat.sli_prev_intr); in lpfc_poll_eratt()
3441 do_div(cnt, phba->eratt_poll_interval); in lpfc_poll_eratt()
3442 phba->sli.slistat.sli_ips = cnt; in lpfc_poll_eratt()
3444 phba->sli.slistat.sli_prev_intr = sli_intr; in lpfc_poll_eratt()
3447 eratt = lpfc_sli_check_eratt(phba); in lpfc_poll_eratt()
3451 lpfc_worker_wake_up(phba); in lpfc_poll_eratt()
3454 mod_timer(&phba->eratt_poll, in lpfc_poll_eratt()
3456 msecs_to_jiffies(1000 * phba->eratt_poll_interval)); in lpfc_poll_eratt()
3479 lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, in lpfc_sli_handle_fast_ring_event() argument
3482 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; in lpfc_sli_handle_fast_ring_event()
3494 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3504 lpfc_sli_rsp_pointers_error(phba, pring); in lpfc_sli_handle_fast_ring_event()
3505 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3508 if (phba->fcp_ring_in_use) { in lpfc_sli_handle_fast_ring_event()
3509 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3512 phba->fcp_ring_in_use = 1; in lpfc_sli_handle_fast_ring_event()
3521 entry = lpfc_resp_iocb(phba, pring); in lpfc_sli_handle_fast_ring_event()
3522 phba->last_completion_time = jiffies; in lpfc_sli_handle_fast_ring_event()
3529 phba->iocb_rsp_size); in lpfc_sli_handle_fast_ring_event()
3545 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3546 phba->lpfc_rampdown_queue_depth(phba); in lpfc_sli_handle_fast_ring_event()
3547 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3551 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_handle_fast_ring_event()
3573 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_handle_fast_ring_event()
3581 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3582 cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, in lpfc_sli_handle_fast_ring_event()
3584 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3590 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3591 (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, in lpfc_sli_handle_fast_ring_event()
3593 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3597 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3598 lpfc_sli_process_unsol_iocb(phba, pring, &rspiocbq); in lpfc_sli_handle_fast_ring_event()
3599 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3607 dev_warn(&((phba->pcidev)->dev), in lpfc_sli_handle_fast_ring_event()
3609 phba->brd_no, adaptermsg); in lpfc_sli_handle_fast_ring_event()
3612 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_handle_fast_ring_event()
3630 &phba->host_gp[pring->ringno].rspGetInx); in lpfc_sli_handle_fast_ring_event()
3639 writel(status, phba->CAregaddr); in lpfc_sli_handle_fast_ring_event()
3640 readl(phba->CAregaddr); in lpfc_sli_handle_fast_ring_event()
3648 lpfc_sli_resume_iocb(phba, pring); in lpfc_sli_handle_fast_ring_event()
3651 (pring->lpfc_sli_cmd_available) (phba, pring); in lpfc_sli_handle_fast_ring_event()
3655 phba->fcp_ring_in_use = 0; in lpfc_sli_handle_fast_ring_event()
3656 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3679 lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_sp_handle_rspiocb() argument
3692 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3720 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3721 phba->lpfc_rampdown_queue_depth(phba); in lpfc_sli_sp_handle_rspiocb()
3722 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3727 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_sp_handle_rspiocb()
3763 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3764 rc = lpfc_sli_process_sol_iocb(phba, pring, saveq); in lpfc_sli_sp_handle_rspiocb()
3765 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3769 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3770 rc = lpfc_sli_process_unsol_iocb(phba, pring, saveq); in lpfc_sli_sp_handle_rspiocb()
3771 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3779 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3780 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, in lpfc_sli_sp_handle_rspiocb()
3782 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3787 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_sp_handle_rspiocb()
3789 (cmdiocbp->iocb_cmpl)(phba, cmdiocbp, in lpfc_sli_sp_handle_rspiocb()
3791 spin_lock_irqsave(&phba->hbalock, in lpfc_sli_sp_handle_rspiocb()
3794 __lpfc_sli_release_iocbq(phba, in lpfc_sli_sp_handle_rspiocb()
3805 dev_warn(&((phba->pcidev)->dev), in lpfc_sli_sp_handle_rspiocb()
3807 phba->brd_no, adaptermsg); in lpfc_sli_sp_handle_rspiocb()
3810 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_sp_handle_rspiocb()
3826 __lpfc_sli_release_iocbq(phba, rspiocbp); in lpfc_sli_sp_handle_rspiocb()
3828 __lpfc_sli_release_iocbq(phba, saveq); in lpfc_sli_sp_handle_rspiocb()
3832 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3846 lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, in lpfc_sli_handle_slow_ring_event() argument
3849 phba->lpfc_sli_handle_slow_ring_event(phba, pring, mask); in lpfc_sli_handle_slow_ring_event()
3864 lpfc_sli_handle_slow_ring_event_s3(struct lpfc_hba *phba, in lpfc_sli_handle_slow_ring_event_s3() argument
3875 pgp = &phba->port_gp[pring->ringno]; in lpfc_sli_handle_slow_ring_event_s3()
3876 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3890 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_handle_slow_ring_event_s3()
3895 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_handle_slow_ring_event_s3()
3896 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3898 phba->work_hs = HS_FFER3; in lpfc_sli_handle_slow_ring_event_s3()
3899 lpfc_handle_eratt(phba); in lpfc_sli_handle_slow_ring_event_s3()
3919 entry = lpfc_resp_iocb(phba, pring); in lpfc_sli_handle_slow_ring_event_s3()
3921 phba->last_completion_time = jiffies; in lpfc_sli_handle_slow_ring_event_s3()
3922 rspiocbp = __lpfc_sli_get_iocbq(phba); in lpfc_sli_handle_slow_ring_event_s3()
3930 phba->iocb_rsp_size); in lpfc_sli_handle_slow_ring_event_s3()
3937 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_handle_slow_ring_event_s3()
3945 &phba->host_gp[pring->ringno].rspGetInx); in lpfc_sli_handle_slow_ring_event_s3()
3947 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3949 rspiocbp = lpfc_sli_sp_handle_rspiocb(phba, pring, rspiocbp); in lpfc_sli_handle_slow_ring_event_s3()
3950 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3967 writel(status, phba->CAregaddr); in lpfc_sli_handle_slow_ring_event_s3()
3968 readl(phba->CAregaddr); /* flush */ in lpfc_sli_handle_slow_ring_event_s3()
3976 lpfc_sli_resume_iocb(phba, pring); in lpfc_sli_handle_slow_ring_event_s3()
3979 (pring->lpfc_sli_cmd_available) (phba, pring); in lpfc_sli_handle_slow_ring_event_s3()
3983 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
4000 lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, in lpfc_sli_handle_slow_ring_event_s4() argument
4009 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s4()
4010 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli_handle_slow_ring_event_s4()
4011 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s4()
4012 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli_handle_slow_ring_event_s4()
4014 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s4()
4015 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli_handle_slow_ring_event_s4()
4017 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s4()
4024 irspiocbq = lpfc_sli4_els_wcqe_to_rspiocbq(phba, in lpfc_sli_handle_slow_ring_event_s4()
4027 lpfc_sli_sp_handle_rspiocb(phba, pring, in lpfc_sli_handle_slow_ring_event_s4()
4035 lpfc_sli4_handle_received_buffer(phba, dmabuf); in lpfc_sli_handle_slow_ring_event_s4()
4059 lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_abort_iocb_ring() argument
4065 lpfc_fabric_abort_hba(phba); in lpfc_sli_abort_iocb_ring()
4071 if (phba->sli_rev >= LPFC_SLI_REV4) { in lpfc_sli_abort_iocb_ring()
4077 spin_lock_irq(&phba->hbalock); in lpfc_sli_abort_iocb_ring()
4080 lpfc_sli_issue_abort_iotag(phba, pring, iocb); in lpfc_sli_abort_iocb_ring()
4081 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_iocb_ring()
4083 spin_lock_irq(&phba->hbalock); in lpfc_sli_abort_iocb_ring()
4089 lpfc_sli_issue_abort_iotag(phba, pring, iocb); in lpfc_sli_abort_iocb_ring()
4090 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_iocb_ring()
4094 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_sli_abort_iocb_ring()
4108 lpfc_sli_abort_fcp_rings(struct lpfc_hba *phba) in lpfc_sli_abort_fcp_rings() argument
4110 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_abort_fcp_rings()
4115 if (phba->sli_rev >= LPFC_SLI_REV4) { in lpfc_sli_abort_fcp_rings()
4116 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_sli_abort_fcp_rings()
4117 pring = phba->sli4_hba.hdwq[i].io_wq->pring; in lpfc_sli_abort_fcp_rings()
4118 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_sli_abort_fcp_rings()
4122 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_sli_abort_fcp_rings()
4137 lpfc_sli_flush_io_rings(struct lpfc_hba *phba) in lpfc_sli_flush_io_rings() argument
4141 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_flush_io_rings()
4146 spin_lock_irq(&phba->hbalock); in lpfc_sli_flush_io_rings()
4147 if (phba->hba_flag & HBA_IOQ_FLUSH || in lpfc_sli_flush_io_rings()
4148 !phba->sli4_hba.hdwq) { in lpfc_sli_flush_io_rings()
4149 spin_unlock_irq(&phba->hbalock); in lpfc_sli_flush_io_rings()
4153 phba->hba_flag |= HBA_IOQ_FLUSH; in lpfc_sli_flush_io_rings()
4154 spin_unlock_irq(&phba->hbalock); in lpfc_sli_flush_io_rings()
4157 if (phba->sli_rev >= LPFC_SLI_REV4) { in lpfc_sli_flush_io_rings()
4158 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_sli_flush_io_rings()
4159 pring = phba->sli4_hba.hdwq[i].io_wq->pring; in lpfc_sli_flush_io_rings()
4174 lpfc_sli_cancel_iocbs(phba, &txq, in lpfc_sli_flush_io_rings()
4178 lpfc_sli_cancel_iocbs(phba, &txcmplq, in lpfc_sli_flush_io_rings()
4185 spin_lock_irq(&phba->hbalock); in lpfc_sli_flush_io_rings()
4195 spin_unlock_irq(&phba->hbalock); in lpfc_sli_flush_io_rings()
4198 lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT, in lpfc_sli_flush_io_rings()
4201 lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT, in lpfc_sli_flush_io_rings()
4220 lpfc_sli_brdready_s3(struct lpfc_hba *phba, uint32_t mask) in lpfc_sli_brdready_s3() argument
4227 if (lpfc_readl(phba->HSregaddr, &status)) in lpfc_sli_brdready_s3()
4249 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli_brdready_s3()
4250 lpfc_sli_brdrestart(phba); in lpfc_sli_brdready_s3()
4253 if (lpfc_readl(phba->HSregaddr, &status)) { in lpfc_sli_brdready_s3()
4261 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_brdready_s3()
4265 readl(phba->MBslimaddr + 0xa8), in lpfc_sli_brdready_s3()
4266 readl(phba->MBslimaddr + 0xac)); in lpfc_sli_brdready_s3()
4267 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_brdready_s3()
4286 lpfc_sli_brdready_s4(struct lpfc_hba *phba, uint32_t mask) in lpfc_sli_brdready_s4() argument
4292 status = lpfc_sli4_post_status_check(phba); in lpfc_sli_brdready_s4()
4295 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli_brdready_s4()
4296 lpfc_sli_brdrestart(phba); in lpfc_sli_brdready_s4()
4297 status = lpfc_sli4_post_status_check(phba); in lpfc_sli_brdready_s4()
4302 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_brdready_s4()
4305 phba->sli4_hba.intr_enable = 0; in lpfc_sli_brdready_s4()
4319 lpfc_sli_brdready(struct lpfc_hba *phba, uint32_t mask) in lpfc_sli_brdready() argument
4321 return phba->lpfc_sli_brdready(phba, mask); in lpfc_sli_brdready()
4333 void lpfc_reset_barrier(struct lpfc_hba *phba) in lpfc_reset_barrier() argument
4342 lockdep_assert_held(&phba->hbalock); in lpfc_reset_barrier()
4344 pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype); in lpfc_reset_barrier()
4346 (FC_JEDEC_ID(phba->vpd.rev.biuRev) != HELIOS_JEDEC_ID && in lpfc_reset_barrier()
4347 FC_JEDEC_ID(phba->vpd.rev.biuRev) != THOR_JEDEC_ID)) in lpfc_reset_barrier()
4354 resp_buf = phba->MBslimaddr; in lpfc_reset_barrier()
4357 if (lpfc_readl(phba->HCregaddr, &hc_copy)) in lpfc_reset_barrier()
4359 writel((hc_copy & ~HC_ERINT_ENA), phba->HCregaddr); in lpfc_reset_barrier()
4360 readl(phba->HCregaddr); /* flush */ in lpfc_reset_barrier()
4361 phba->link_flag |= LS_IGNORE_ERATT; in lpfc_reset_barrier()
4363 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_reset_barrier()
4367 writel(HA_ERATT, phba->HAregaddr); in lpfc_reset_barrier()
4368 phba->pport->stopped = 1; in lpfc_reset_barrier()
4376 mbox_buf = phba->MBslimaddr; in lpfc_reset_barrier()
4391 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE || in lpfc_reset_barrier()
4392 phba->pport->stopped) in lpfc_reset_barrier()
4412 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_reset_barrier()
4420 if (readl(phba->HAregaddr) & HA_ERATT) { in lpfc_reset_barrier()
4421 writel(HA_ERATT, phba->HAregaddr); in lpfc_reset_barrier()
4422 phba->pport->stopped = 1; in lpfc_reset_barrier()
4426 phba->link_flag &= ~LS_IGNORE_ERATT; in lpfc_reset_barrier()
4427 writel(hc_copy, phba->HCregaddr); in lpfc_reset_barrier()
4428 readl(phba->HCregaddr); /* flush */ in lpfc_reset_barrier()
4443 lpfc_sli_brdkill(struct lpfc_hba *phba) in lpfc_sli_brdkill() argument
4452 psli = &phba->sli; in lpfc_sli_brdkill()
4455 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_brdkill()
4457 phba->pport->port_state, psli->sli_flag); in lpfc_sli_brdkill()
4459 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_brdkill()
4464 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4465 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_sli_brdkill()
4466 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4467 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_brdkill()
4471 writel(status, phba->HCregaddr); in lpfc_sli_brdkill()
4472 readl(phba->HCregaddr); /* flush */ in lpfc_sli_brdkill()
4473 phba->link_flag |= LS_IGNORE_ERATT; in lpfc_sli_brdkill()
4474 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4476 lpfc_kill_board(phba, pmb); in lpfc_sli_brdkill()
4478 retval = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli_brdkill()
4482 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_brdkill()
4483 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_brdkill()
4486 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4487 phba->link_flag &= ~LS_IGNORE_ERATT; in lpfc_sli_brdkill()
4488 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4492 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4494 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4496 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_brdkill()
4503 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_brdkill()
4507 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_brdkill()
4513 writel(HA_ERATT, phba->HAregaddr); in lpfc_sli_brdkill()
4514 phba->pport->stopped = 1; in lpfc_sli_brdkill()
4516 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4519 phba->link_flag &= ~LS_IGNORE_ERATT; in lpfc_sli_brdkill()
4520 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
4522 lpfc_hba_down_post(phba); in lpfc_sli_brdkill()
4523 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_brdkill()
4540 lpfc_sli_brdreset(struct lpfc_hba *phba) in lpfc_sli_brdreset() argument
4547 psli = &phba->sli; in lpfc_sli_brdreset()
4550 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_brdreset()
4552 (phba->pport) ? phba->pport->port_state : 0, in lpfc_sli_brdreset()
4556 phba->fc_eventTag = 0; in lpfc_sli_brdreset()
4557 phba->link_events = 0; in lpfc_sli_brdreset()
4558 if (phba->pport) { in lpfc_sli_brdreset()
4559 phba->pport->fc_myDID = 0; in lpfc_sli_brdreset()
4560 phba->pport->fc_prevDID = 0; in lpfc_sli_brdreset()
4564 if (pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value)) in lpfc_sli_brdreset()
4567 pci_write_config_word(phba->pcidev, PCI_COMMAND, in lpfc_sli_brdreset()
4574 writel(HC_INITFF, phba->HCregaddr); in lpfc_sli_brdreset()
4576 readl(phba->HCregaddr); /* flush */ in lpfc_sli_brdreset()
4577 writel(0, phba->HCregaddr); in lpfc_sli_brdreset()
4578 readl(phba->HCregaddr); /* flush */ in lpfc_sli_brdreset()
4581 pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value); in lpfc_sli_brdreset()
4594 phba->link_state = LPFC_WARM_START; in lpfc_sli_brdreset()
4609 lpfc_sli4_brdreset(struct lpfc_hba *phba) in lpfc_sli4_brdreset() argument
4611 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_brdreset()
4616 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_brdreset()
4618 phba->pport->port_state, psli->sli_flag, in lpfc_sli4_brdreset()
4619 phba->hba_flag); in lpfc_sli4_brdreset()
4622 phba->fc_eventTag = 0; in lpfc_sli4_brdreset()
4623 phba->link_events = 0; in lpfc_sli4_brdreset()
4624 phba->pport->fc_myDID = 0; in lpfc_sli4_brdreset()
4625 phba->pport->fc_prevDID = 0; in lpfc_sli4_brdreset()
4627 spin_lock_irq(&phba->hbalock); in lpfc_sli4_brdreset()
4629 phba->fcf.fcf_flag = 0; in lpfc_sli4_brdreset()
4630 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_brdreset()
4633 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_brdreset()
4637 if (pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value)) { in lpfc_sli4_brdreset()
4638 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_brdreset()
4643 pci_write_config_word(phba->pcidev, PCI_COMMAND, (cfg_value & in lpfc_sli4_brdreset()
4647 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_brdreset()
4650 pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value); in lpfc_sli4_brdreset()
4669 lpfc_sli_brdrestart_s3(struct lpfc_hba *phba) in lpfc_sli_brdrestart_s3() argument
4677 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdrestart_s3()
4680 hba_aer_enabled = phba->hba_flag & HBA_AER_ENABLED; in lpfc_sli_brdrestart_s3()
4682 psli = &phba->sli; in lpfc_sli_brdrestart_s3()
4685 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_brdrestart_s3()
4687 (phba->pport) ? phba->pport->port_state : 0, in lpfc_sli_brdrestart_s3()
4695 lpfc_reset_barrier(phba); in lpfc_sli_brdrestart_s3()
4697 to_slim = phba->MBslimaddr; in lpfc_sli_brdrestart_s3()
4702 if (phba->pport && phba->pport->port_state) in lpfc_sli_brdrestart_s3()
4706 to_slim = phba->MBslimaddr + sizeof (uint32_t); in lpfc_sli_brdrestart_s3()
4710 lpfc_sli_brdreset(phba); in lpfc_sli_brdrestart_s3()
4711 if (phba->pport) in lpfc_sli_brdrestart_s3()
4712 phba->pport->stopped = 0; in lpfc_sli_brdrestart_s3()
4713 phba->link_state = LPFC_INIT_START; in lpfc_sli_brdrestart_s3()
4714 phba->hba_flag = 0; in lpfc_sli_brdrestart_s3()
4715 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdrestart_s3()
4725 pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_sli_brdrestart_s3()
4727 lpfc_hba_down_post(phba); in lpfc_sli_brdrestart_s3()
4742 lpfc_sli_brdrestart_s4(struct lpfc_hba *phba) in lpfc_sli_brdrestart_s4() argument
4744 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_brdrestart_s4()
4749 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_brdrestart_s4()
4751 phba->pport->port_state, psli->sli_flag); in lpfc_sli_brdrestart_s4()
4754 hba_aer_enabled = phba->hba_flag & HBA_AER_ENABLED; in lpfc_sli_brdrestart_s4()
4756 rc = lpfc_sli4_brdreset(phba); in lpfc_sli_brdrestart_s4()
4758 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_brdrestart_s4()
4762 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdrestart_s4()
4763 phba->pport->stopped = 0; in lpfc_sli_brdrestart_s4()
4764 phba->link_state = LPFC_INIT_START; in lpfc_sli_brdrestart_s4()
4765 phba->hba_flag = 0; in lpfc_sli_brdrestart_s4()
4766 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdrestart_s4()
4773 pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_sli_brdrestart_s4()
4776 lpfc_hba_down_post(phba); in lpfc_sli_brdrestart_s4()
4777 lpfc_sli4_queue_destroy(phba); in lpfc_sli_brdrestart_s4()
4790 lpfc_sli_brdrestart(struct lpfc_hba *phba) in lpfc_sli_brdrestart() argument
4792 return phba->lpfc_sli_brdrestart(phba); in lpfc_sli_brdrestart()
4806 lpfc_sli_chipset_init(struct lpfc_hba *phba) in lpfc_sli_chipset_init() argument
4811 if (lpfc_readl(phba->HSregaddr, &status)) in lpfc_sli_chipset_init()
4829 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_chipset_init()
4833 readl(phba->MBslimaddr + 0xa8), in lpfc_sli_chipset_init()
4834 readl(phba->MBslimaddr + 0xac)); in lpfc_sli_chipset_init()
4835 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_chipset_init()
4844 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_chipset_init()
4848 readl(phba->MBslimaddr + 0xa8), in lpfc_sli_chipset_init()
4849 readl(phba->MBslimaddr + 0xac)); in lpfc_sli_chipset_init()
4850 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_chipset_init()
4863 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli_chipset_init()
4864 lpfc_sli_brdrestart(phba); in lpfc_sli_chipset_init()
4867 if (lpfc_readl(phba->HSregaddr, &status)) in lpfc_sli_chipset_init()
4875 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_chipset_init()
4879 readl(phba->MBslimaddr + 0xa8), in lpfc_sli_chipset_init()
4880 readl(phba->MBslimaddr + 0xac)); in lpfc_sli_chipset_init()
4881 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_chipset_init()
4886 writel(0, phba->HCregaddr); in lpfc_sli_chipset_init()
4887 readl(phba->HCregaddr); /* flush */ in lpfc_sli_chipset_init()
4890 writel(0xffffffff, phba->HAregaddr); in lpfc_sli_chipset_init()
4891 readl(phba->HAregaddr); /* flush */ in lpfc_sli_chipset_init()
4948 lpfc_sli_hbq_setup(struct lpfc_hba *phba) in lpfc_sli_hbq_setup() argument
4959 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_hbq_setup()
4967 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_sli_hbq_setup()
4968 phba->hbq_in_use = 1; in lpfc_sli_hbq_setup()
4972 phba->hbqs[hbqno].next_hbqPutIdx = 0; in lpfc_sli_hbq_setup()
4973 phba->hbqs[hbqno].hbqPutIdx = 0; in lpfc_sli_hbq_setup()
4974 phba->hbqs[hbqno].local_hbqGetIdx = 0; in lpfc_sli_hbq_setup()
4975 phba->hbqs[hbqno].entry_count = in lpfc_sli_hbq_setup()
4977 lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno], in lpfc_sli_hbq_setup()
4979 hbq_entry_index += phba->hbqs[hbqno].entry_count; in lpfc_sli_hbq_setup()
4981 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_sli_hbq_setup()
4985 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli_hbq_setup()
4992 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_hbq_setup()
4993 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_hbq_setup()
4997 phba->hbq_count = hbq_count; in lpfc_sli_hbq_setup()
4999 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_hbq_setup()
5003 lpfc_sli_hbqbuf_init_hbqs(phba, hbqno); in lpfc_sli_hbq_setup()
5017 lpfc_sli4_rb_setup(struct lpfc_hba *phba) in lpfc_sli4_rb_setup() argument
5019 phba->hbq_in_use = 1; in lpfc_sli4_rb_setup()
5025 if (phba->cfg_enable_mds_diags && phba->mds_diags_support) in lpfc_sli4_rb_setup()
5026 phba->hbqs[LPFC_ELS_HBQ].entry_count = in lpfc_sli4_rb_setup()
5029 phba->hbqs[LPFC_ELS_HBQ].entry_count = in lpfc_sli4_rb_setup()
5031 phba->hbq_count = 1; in lpfc_sli4_rb_setup()
5032 lpfc_sli_hbqbuf_init_hbqs(phba, LPFC_ELS_HBQ); in lpfc_sli4_rb_setup()
5051 lpfc_sli_config_port(struct lpfc_hba *phba, int sli_mode) in lpfc_sli_config_port() argument
5056 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_config_port()
5058 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_config_port()
5062 phba->sli_rev = sli_mode; in lpfc_sli_config_port()
5064 spin_lock_irq(&phba->hbalock); in lpfc_sli_config_port()
5065 phba->sli.sli_flag |= LPFC_SLI_MBOX_ACTIVE; in lpfc_sli_config_port()
5066 spin_unlock_irq(&phba->hbalock); in lpfc_sli_config_port()
5067 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli_config_port()
5068 lpfc_sli_brdrestart(phba); in lpfc_sli_config_port()
5069 rc = lpfc_sli_chipset_init(phba); in lpfc_sli_config_port()
5073 spin_lock_irq(&phba->hbalock); in lpfc_sli_config_port()
5074 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli_config_port()
5075 spin_unlock_irq(&phba->hbalock); in lpfc_sli_config_port()
5083 rc = lpfc_config_port_prep(phba); in lpfc_sli_config_port()
5085 phba->link_state = LPFC_LINK_UNKNOWN; in lpfc_sli_config_port()
5090 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_sli_config_port()
5091 lpfc_config_port(phba, pmb); in lpfc_sli_config_port()
5092 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_config_port()
5093 phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED | in lpfc_sli_config_port()
5098 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_config_port()
5102 spin_lock_irq(&phba->hbalock); in lpfc_sli_config_port()
5103 phba->sli.sli_flag &= ~LPFC_SLI_ACTIVE; in lpfc_sli_config_port()
5104 spin_unlock_irq(&phba->hbalock); in lpfc_sli_config_port()
5108 spin_lock_irq(&phba->hbalock); in lpfc_sli_config_port()
5109 phba->sli.sli_flag &= ~LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli_config_port()
5110 spin_unlock_irq(&phba->hbalock); in lpfc_sli_config_port()
5115 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_config_port()
5128 if (phba->max_vpi && pmb->u.mb.un.varCfgPort.gmv) { in lpfc_sli_config_port()
5129 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; in lpfc_sli_config_port()
5130 phba->max_vpi = pmb->u.mb.un.varCfgPort.max_vpi; in lpfc_sli_config_port()
5131 phba->max_vports = (phba->max_vpi > phba->max_vports) ? in lpfc_sli_config_port()
5132 phba->max_vpi : phba->max_vports; in lpfc_sli_config_port()
5135 phba->max_vpi = 0; in lpfc_sli_config_port()
5137 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED; in lpfc_sli_config_port()
5139 phba->sli3_options |= LPFC_SLI3_CRP_ENABLED; in lpfc_sli_config_port()
5141 phba->hbq_get = phba->mbox->us.s3_pgp.hbq_get; in lpfc_sli_config_port()
5142 phba->port_gp = phba->mbox->us.s3_pgp.port; in lpfc_sli_config_port()
5144 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli_config_port()
5146 phba->cfg_enable_bg = 0; in lpfc_sli_config_port()
5147 phba->sli3_options &= ~LPFC_SLI3_BG_ENABLED; in lpfc_sli_config_port()
5148 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_config_port()
5154 phba->hbq_get = NULL; in lpfc_sli_config_port()
5155 phba->port_gp = phba->mbox->us.s2.port; in lpfc_sli_config_port()
5156 phba->max_vpi = 0; in lpfc_sli_config_port()
5159 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_config_port()
5178 lpfc_sli_hba_setup(struct lpfc_hba *phba) in lpfc_sli_hba_setup() argument
5184 switch (phba->cfg_sli_mode) { in lpfc_sli_hba_setup()
5186 if (phba->cfg_enable_npiv) { in lpfc_sli_hba_setup()
5187 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_hba_setup()
5190 phba->cfg_sli_mode); in lpfc_sli_hba_setup()
5199 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_hba_setup()
5201 phba->cfg_sli_mode); in lpfc_sli_hba_setup()
5205 phba->fcp_embed_io = 0; /* SLI4 FC support only */ in lpfc_sli_hba_setup()
5207 rc = lpfc_sli_config_port(phba, mode); in lpfc_sli_hba_setup()
5209 if (rc && phba->cfg_sli_mode == 3) in lpfc_sli_hba_setup()
5210 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_hba_setup()
5214 rc = lpfc_sli_config_port(phba, 2); in lpfc_sli_hba_setup()
5216 rc = lpfc_sli_config_port(phba, 3); in lpfc_sli_hba_setup()
5221 if (phba->cfg_aer_support == 1 && !(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_sli_hba_setup()
5222 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_sli_hba_setup()
5224 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_hba_setup()
5227 spin_lock_irq(&phba->hbalock); in lpfc_sli_hba_setup()
5228 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_sli_hba_setup()
5229 spin_unlock_irq(&phba->hbalock); in lpfc_sli_hba_setup()
5231 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_hba_setup()
5235 phba->cfg_aer_support = 0; in lpfc_sli_hba_setup()
5239 if (phba->sli_rev == 3) { in lpfc_sli_hba_setup()
5240 phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE; in lpfc_sli_hba_setup()
5241 phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE; in lpfc_sli_hba_setup()
5243 phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE; in lpfc_sli_hba_setup()
5244 phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE; in lpfc_sli_hba_setup()
5245 phba->sli3_options = 0; in lpfc_sli_hba_setup()
5248 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_hba_setup()
5250 phba->sli_rev, phba->max_vpi); in lpfc_sli_hba_setup()
5251 rc = lpfc_sli_ring_map(phba); in lpfc_sli_hba_setup()
5257 if (phba->sli_rev == LPFC_SLI_REV3) { in lpfc_sli_hba_setup()
5263 if ((phba->vpi_bmask == NULL) && (phba->vpi_ids == NULL)) { in lpfc_sli_hba_setup()
5264 longs = (phba->max_vpi + BITS_PER_LONG) / BITS_PER_LONG; in lpfc_sli_hba_setup()
5265 phba->vpi_bmask = kcalloc(longs, in lpfc_sli_hba_setup()
5268 if (!phba->vpi_bmask) { in lpfc_sli_hba_setup()
5273 phba->vpi_ids = kcalloc(phba->max_vpi + 1, in lpfc_sli_hba_setup()
5276 if (!phba->vpi_ids) { in lpfc_sli_hba_setup()
5277 kfree(phba->vpi_bmask); in lpfc_sli_hba_setup()
5281 for (i = 0; i < phba->max_vpi; i++) in lpfc_sli_hba_setup()
5282 phba->vpi_ids[i] = i; in lpfc_sli_hba_setup()
5287 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { in lpfc_sli_hba_setup()
5288 rc = lpfc_sli_hbq_setup(phba); in lpfc_sli_hba_setup()
5292 spin_lock_irq(&phba->hbalock); in lpfc_sli_hba_setup()
5293 phba->sli.sli_flag |= LPFC_PROCESS_LA; in lpfc_sli_hba_setup()
5294 spin_unlock_irq(&phba->hbalock); in lpfc_sli_hba_setup()
5296 rc = lpfc_config_port_post(phba); in lpfc_sli_hba_setup()
5303 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_hba_setup()
5304 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_hba_setup()
5318 lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba) in lpfc_sli4_read_fcoe_params() argument
5327 phba->valid_vlan = 0; in lpfc_sli4_read_fcoe_params()
5328 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_read_fcoe_params()
5329 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_read_fcoe_params()
5330 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_read_fcoe_params()
5332 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_fcoe_params()
5337 if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) { in lpfc_sli4_read_fcoe_params()
5343 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_read_fcoe_params()
5345 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_read_fcoe_params()
5367 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_read_fcoe_params()
5374 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_read_fcoe_params()
5380 lpfc_parse_fcoe_conf(phba, mp->virt, data_length); in lpfc_sli4_read_fcoe_params()
5381 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_read_fcoe_params()
5386 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_read_fcoe_params()
5406 lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, in lpfc_sli4_read_rev() argument
5423 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, dma_size, in lpfc_sli4_read_rev()
5435 lpfc_read_rev(phba, mboxq); in lpfc_sli4_read_rev()
5443 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_read_rev()
5445 dma_free_coherent(&phba->pcidev->dev, dma_size, in lpfc_sli4_read_rev()
5461 dma_free_coherent(&phba->pcidev->dev, dma_size, in lpfc_sli4_read_rev()
5479 lpfc_sli4_get_ctl_attr(struct lpfc_hba *phba) in lpfc_sli4_get_ctl_attr() argument
5490 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_get_ctl_attr()
5496 alloclen = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_get_ctl_attr()
5501 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_get_ctl_attr()
5508 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_get_ctl_attr()
5515 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_get_ctl_attr()
5519 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_get_ctl_attr()
5520 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_get_ctl_attr()
5527 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_get_ctl_attr()
5528 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_get_ctl_attr()
5530 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_get_ctl_attr()
5533 memset(phba->BIOSVersion, 0, sizeof(phba->BIOSVersion)); in lpfc_sli4_get_ctl_attr()
5534 strlcat(phba->BIOSVersion, (char *)cntl_attr->bios_ver_str, in lpfc_sli4_get_ctl_attr()
5535 sizeof(phba->BIOSVersion)); in lpfc_sli4_get_ctl_attr()
5537 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_get_ctl_attr()
5539 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_get_ctl_attr()
5540 phba->sli4_hba.lnk_info.lnk_no, in lpfc_sli4_get_ctl_attr()
5541 phba->BIOSVersion); in lpfc_sli4_get_ctl_attr()
5544 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_get_ctl_attr()
5546 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_get_ctl_attr()
5562 lpfc_sli4_retrieve_pport_name(struct lpfc_hba *phba) in lpfc_sli4_retrieve_pport_name() argument
5572 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL; in lpfc_sli4_retrieve_pport_name()
5573 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_NON; in lpfc_sli4_retrieve_pport_name()
5575 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_retrieve_pport_name()
5579 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL; in lpfc_sli4_retrieve_pport_name()
5580 lpfc_sli4_read_config(phba); in lpfc_sli4_retrieve_pport_name()
5581 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) in lpfc_sli4_retrieve_pport_name()
5585 rc = lpfc_sli4_get_ctl_attr(phba); in lpfc_sli4_retrieve_pport_name()
5590 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_retrieve_pport_name()
5599 phba->sli4_hba.lnk_info.lnk_tp); in lpfc_sli4_retrieve_pport_name()
5600 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_retrieve_pport_name()
5604 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_retrieve_pport_name()
5608 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_retrieve_pport_name()
5609 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_retrieve_pport_name()
5614 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_retrieve_pport_name()
5618 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; in lpfc_sli4_retrieve_pport_name()
5623 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; in lpfc_sli4_retrieve_pport_name()
5628 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; in lpfc_sli4_retrieve_pport_name()
5633 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; in lpfc_sli4_retrieve_pport_name()
5639 if (phba->sli4_hba.pport_name_sta == LPFC_SLI4_PPNAME_GET) { in lpfc_sli4_retrieve_pport_name()
5640 phba->Port[0] = cport_name; in lpfc_sli4_retrieve_pport_name()
5641 phba->Port[1] = '\0'; in lpfc_sli4_retrieve_pport_name()
5642 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_retrieve_pport_name()
5643 "3091 SLI get port name: %s\n", phba->Port); in lpfc_sli4_retrieve_pport_name()
5648 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_retrieve_pport_name()
5650 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_retrieve_pport_name()
5662 lpfc_sli4_arm_cqeq_intr(struct lpfc_hba *phba) in lpfc_sli4_arm_cqeq_intr() argument
5665 struct lpfc_sli4_hba *sli4_hba = &phba->sli4_hba; in lpfc_sli4_arm_cqeq_intr()
5669 sli4_hba->sli4_write_cq_db(phba, sli4_hba->mbx_cq, 0, LPFC_QUEUE_REARM); in lpfc_sli4_arm_cqeq_intr()
5670 sli4_hba->sli4_write_cq_db(phba, sli4_hba->els_cq, 0, LPFC_QUEUE_REARM); in lpfc_sli4_arm_cqeq_intr()
5672 sli4_hba->sli4_write_cq_db(phba, sli4_hba->nvmels_cq, 0, in lpfc_sli4_arm_cqeq_intr()
5677 for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) { in lpfc_sli4_arm_cqeq_intr()
5680 sli4_hba->sli4_write_cq_db(phba, qp->io_cq, 0, in lpfc_sli4_arm_cqeq_intr()
5685 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_arm_cqeq_intr()
5688 sli4_hba->sli4_write_eq_db(phba, eq, in lpfc_sli4_arm_cqeq_intr()
5693 if (phba->nvmet_support) { in lpfc_sli4_arm_cqeq_intr()
5694 for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) { in lpfc_sli4_arm_cqeq_intr()
5695 sli4_hba->sli4_write_cq_db(phba, in lpfc_sli4_arm_cqeq_intr()
5715 lpfc_sli4_get_avail_extnt_rsrc(struct lpfc_hba *phba, uint16_t type, in lpfc_sli4_get_avail_extnt_rsrc() argument
5724 mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_get_avail_extnt_rsrc()
5731 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_get_avail_extnt_rsrc()
5736 rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, 0, type, in lpfc_sli4_get_avail_extnt_rsrc()
5743 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_get_avail_extnt_rsrc()
5744 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_get_avail_extnt_rsrc()
5746 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_get_avail_extnt_rsrc()
5747 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_get_avail_extnt_rsrc()
5757 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_get_avail_extnt_rsrc()
5773 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_get_avail_extnt_rsrc()
5778 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_get_avail_extnt_rsrc()
5798 lpfc_sli4_chk_avail_extnt_rsrc(struct lpfc_hba *phba, uint16_t type) in lpfc_sli4_chk_avail_extnt_rsrc() argument
5808 rc = lpfc_sli4_get_avail_extnt_rsrc(phba, type, in lpfc_sli4_chk_avail_extnt_rsrc()
5816 rsrc_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list; in lpfc_sli4_chk_avail_extnt_rsrc()
5819 rsrc_blk_list = &phba->lpfc_vpi_blk_list; in lpfc_sli4_chk_avail_extnt_rsrc()
5822 rsrc_blk_list = &phba->sli4_hba.lpfc_xri_blk_list; in lpfc_sli4_chk_avail_extnt_rsrc()
5825 rsrc_blk_list = &phba->sli4_hba.lpfc_vfi_blk_list; in lpfc_sli4_chk_avail_extnt_rsrc()
5861 lpfc_sli4_cfg_post_extnts(struct lpfc_hba *phba, uint16_t extnt_cnt, in lpfc_sli4_cfg_post_extnts() argument
5891 alloc_len = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_cfg_post_extnts()
5895 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_cfg_post_extnts()
5901 rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, extnt_cnt, type, *emb); in lpfc_sli4_cfg_post_extnts()
5905 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_cfg_post_extnts()
5906 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_cfg_post_extnts()
5908 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_cfg_post_extnts()
5909 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_cfg_post_extnts()
5926 lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type) in lpfc_sli4_alloc_extent() argument
5944 rc = lpfc_sli4_get_avail_extnt_rsrc(phba, type, in lpfc_sli4_alloc_extent()
5951 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_alloc_extent()
5959 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_INIT | LOG_SLI, in lpfc_sli4_alloc_extent()
5963 mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_alloc_extent()
5967 rc = lpfc_sli4_cfg_post_extnts(phba, rsrc_cnt, type, &emb, mbox); in lpfc_sli4_alloc_extent()
6000 phba->sli4_hba.rpi_bmask = kcalloc(longs, in lpfc_sli4_alloc_extent()
6003 if (unlikely(!phba->sli4_hba.rpi_bmask)) { in lpfc_sli4_alloc_extent()
6007 phba->sli4_hba.rpi_ids = kcalloc(rsrc_id_cnt, in lpfc_sli4_alloc_extent()
6010 if (unlikely(!phba->sli4_hba.rpi_ids)) { in lpfc_sli4_alloc_extent()
6011 kfree(phba->sli4_hba.rpi_bmask); in lpfc_sli4_alloc_extent()
6021 phba->sli4_hba.next_rpi = rsrc_id_cnt; in lpfc_sli4_alloc_extent()
6024 bmask = phba->sli4_hba.rpi_bmask; in lpfc_sli4_alloc_extent()
6025 ids = phba->sli4_hba.rpi_ids; in lpfc_sli4_alloc_extent()
6026 ext_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list; in lpfc_sli4_alloc_extent()
6029 phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_alloc_extent()
6031 if (unlikely(!phba->vpi_bmask)) { in lpfc_sli4_alloc_extent()
6035 phba->vpi_ids = kcalloc(rsrc_id_cnt, sizeof(uint16_t), in lpfc_sli4_alloc_extent()
6037 if (unlikely(!phba->vpi_ids)) { in lpfc_sli4_alloc_extent()
6038 kfree(phba->vpi_bmask); in lpfc_sli4_alloc_extent()
6044 bmask = phba->vpi_bmask; in lpfc_sli4_alloc_extent()
6045 ids = phba->vpi_ids; in lpfc_sli4_alloc_extent()
6046 ext_blk_list = &phba->lpfc_vpi_blk_list; in lpfc_sli4_alloc_extent()
6049 phba->sli4_hba.xri_bmask = kcalloc(longs, in lpfc_sli4_alloc_extent()
6052 if (unlikely(!phba->sli4_hba.xri_bmask)) { in lpfc_sli4_alloc_extent()
6056 phba->sli4_hba.max_cfg_param.xri_used = 0; in lpfc_sli4_alloc_extent()
6057 phba->sli4_hba.xri_ids = kcalloc(rsrc_id_cnt, in lpfc_sli4_alloc_extent()
6060 if (unlikely(!phba->sli4_hba.xri_ids)) { in lpfc_sli4_alloc_extent()
6061 kfree(phba->sli4_hba.xri_bmask); in lpfc_sli4_alloc_extent()
6067 bmask = phba->sli4_hba.xri_bmask; in lpfc_sli4_alloc_extent()
6068 ids = phba->sli4_hba.xri_ids; in lpfc_sli4_alloc_extent()
6069 ext_blk_list = &phba->sli4_hba.lpfc_xri_blk_list; in lpfc_sli4_alloc_extent()
6072 phba->sli4_hba.vfi_bmask = kcalloc(longs, in lpfc_sli4_alloc_extent()
6075 if (unlikely(!phba->sli4_hba.vfi_bmask)) { in lpfc_sli4_alloc_extent()
6079 phba->sli4_hba.vfi_ids = kcalloc(rsrc_id_cnt, in lpfc_sli4_alloc_extent()
6082 if (unlikely(!phba->sli4_hba.vfi_ids)) { in lpfc_sli4_alloc_extent()
6083 kfree(phba->sli4_hba.vfi_bmask); in lpfc_sli4_alloc_extent()
6089 bmask = phba->sli4_hba.vfi_bmask; in lpfc_sli4_alloc_extent()
6090 ids = phba->sli4_hba.vfi_ids; in lpfc_sli4_alloc_extent()
6091 ext_blk_list = &phba->sli4_hba.lpfc_vfi_blk_list; in lpfc_sli4_alloc_extent()
6128 phba->sli4_hba.io_xri_start = rsrc_start + in lpfc_sli4_alloc_extent()
6129 lpfc_sli4_get_iocb_cnt(phba); in lpfc_sli4_alloc_extent()
6142 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_alloc_extent()
6158 lpfc_sli4_dealloc_extent(struct lpfc_hba *phba, uint16_t type) in lpfc_sli4_dealloc_extent() argument
6166 mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_dealloc_extent()
6177 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_dealloc_extent()
6182 rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, 0, type, in lpfc_sli4_dealloc_extent()
6188 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_dealloc_extent()
6189 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_dealloc_extent()
6191 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_dealloc_extent()
6192 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_dealloc_extent()
6202 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_dealloc_extent()
6218 kfree(phba->vpi_bmask); in lpfc_sli4_dealloc_extent()
6219 kfree(phba->vpi_ids); in lpfc_sli4_dealloc_extent()
6220 bf_set(lpfc_vpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_extent()
6222 &phba->lpfc_vpi_blk_list, list) { in lpfc_sli4_dealloc_extent()
6226 phba->sli4_hba.max_cfg_param.vpi_used = 0; in lpfc_sli4_dealloc_extent()
6229 kfree(phba->sli4_hba.xri_bmask); in lpfc_sli4_dealloc_extent()
6230 kfree(phba->sli4_hba.xri_ids); in lpfc_sli4_dealloc_extent()
6232 &phba->sli4_hba.lpfc_xri_blk_list, list) { in lpfc_sli4_dealloc_extent()
6238 kfree(phba->sli4_hba.vfi_bmask); in lpfc_sli4_dealloc_extent()
6239 kfree(phba->sli4_hba.vfi_ids); in lpfc_sli4_dealloc_extent()
6240 bf_set(lpfc_vfi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_extent()
6242 &phba->sli4_hba.lpfc_vfi_blk_list, list) { in lpfc_sli4_dealloc_extent()
6250 &phba->sli4_hba.lpfc_rpi_blk_list, list) { in lpfc_sli4_dealloc_extent()
6259 bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_extent()
6262 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_dealloc_extent()
6267 lpfc_set_features(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox, in lpfc_set_features() argument
6274 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_set_features()
6314 lpfc_ras_stop_fwlog(struct lpfc_hba *phba) in lpfc_ras_stop_fwlog() argument
6316 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; in lpfc_ras_stop_fwlog()
6318 spin_lock_irq(&phba->hbalock); in lpfc_ras_stop_fwlog()
6320 spin_unlock_irq(&phba->hbalock); in lpfc_ras_stop_fwlog()
6324 phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); in lpfc_ras_stop_fwlog()
6338 lpfc_sli4_ras_dma_free(struct lpfc_hba *phba) in lpfc_sli4_ras_dma_free() argument
6340 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; in lpfc_sli4_ras_dma_free()
6348 dma_free_coherent(&phba->pcidev->dev, in lpfc_sli4_ras_dma_free()
6356 dma_free_coherent(&phba->pcidev->dev, in lpfc_sli4_ras_dma_free()
6363 spin_lock_irq(&phba->hbalock); in lpfc_sli4_ras_dma_free()
6365 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_ras_dma_free()
6380 lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba, in lpfc_sli4_ras_dma_alloc() argument
6383 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; in lpfc_sli4_ras_dma_alloc()
6391 ras_fwlog->lwpd.virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_ras_dma_alloc()
6396 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_ras_dma_alloc()
6408 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_ras_dma_alloc()
6413 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_ras_dma_alloc()
6419 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_ras_dma_alloc()
6429 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_ras_dma_alloc()
6442 lpfc_sli4_ras_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) in lpfc_sli4_ras_mbox_cmpl() argument
6447 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; in lpfc_sli4_ras_mbox_cmpl()
6457 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_ras_mbox_cmpl()
6467 spin_lock_irq(&phba->hbalock); in lpfc_sli4_ras_mbox_cmpl()
6469 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_ras_mbox_cmpl()
6470 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_ras_mbox_cmpl()
6476 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_ras_mbox_cmpl()
6477 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_ras_mbox_cmpl()
6490 lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba, in lpfc_sli4_ras_fwlog_init() argument
6494 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; in lpfc_sli4_ras_fwlog_init()
6501 spin_lock_irq(&phba->hbalock); in lpfc_sli4_ras_fwlog_init()
6503 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_ras_fwlog_init()
6506 phba->cfg_ras_fwlog_buffsize); in lpfc_sli4_ras_fwlog_init()
6514 rc = lpfc_sli4_ras_dma_alloc(phba, fwlog_entry_count); in lpfc_sli4_ras_fwlog_init()
6516 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_ras_fwlog_init()
6523 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_ras_fwlog_init()
6525 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_ras_fwlog_init()
6535 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_LOWLEVEL, in lpfc_sli4_ras_fwlog_init()
6564 spin_lock_irq(&phba->hbalock); in lpfc_sli4_ras_fwlog_init()
6566 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_ras_fwlog_init()
6567 mbox->vport = phba->pport; in lpfc_sli4_ras_fwlog_init()
6570 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); in lpfc_sli4_ras_fwlog_init()
6573 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_ras_fwlog_init()
6577 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_ras_fwlog_init()
6584 lpfc_sli4_ras_dma_free(phba); in lpfc_sli4_ras_fwlog_init()
6596 lpfc_sli4_ras_setup(struct lpfc_hba *phba) in lpfc_sli4_ras_setup() argument
6599 if (lpfc_check_fwlog_support(phba)) in lpfc_sli4_ras_setup()
6602 lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level, in lpfc_sli4_ras_setup()
6613 lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) in lpfc_sli4_alloc_resource_identifiers() argument
6619 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_alloc_resource_identifiers()
6620 phba->sli4_hba.next_rpi = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_alloc_resource_identifiers()
6621 if (phba->sli4_hba.extents_in_use) { in lpfc_sli4_alloc_resource_identifiers()
6627 if (bf_get(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags) == in lpfc_sli4_alloc_resource_identifiers()
6634 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba, in lpfc_sli4_alloc_resource_identifiers()
6638 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba, in lpfc_sli4_alloc_resource_identifiers()
6642 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba, in lpfc_sli4_alloc_resource_identifiers()
6646 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba, in lpfc_sli4_alloc_resource_identifiers()
6658 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_alloc_resource_identifiers()
6663 rc = lpfc_sli4_dealloc_extent(phba, in lpfc_sli4_alloc_resource_identifiers()
6665 rc = lpfc_sli4_dealloc_extent(phba, in lpfc_sli4_alloc_resource_identifiers()
6667 rc = lpfc_sli4_dealloc_extent(phba, in lpfc_sli4_alloc_resource_identifiers()
6669 rc = lpfc_sli4_dealloc_extent(phba, in lpfc_sli4_alloc_resource_identifiers()
6675 rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_VFI); in lpfc_sli4_alloc_resource_identifiers()
6679 rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_VPI); in lpfc_sli4_alloc_resource_identifiers()
6683 rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_RPI); in lpfc_sli4_alloc_resource_identifiers()
6687 rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_XRI); in lpfc_sli4_alloc_resource_identifiers()
6690 bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, in lpfc_sli4_alloc_resource_identifiers()
6701 if (bf_get(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags) == in lpfc_sli4_alloc_resource_identifiers()
6703 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_alloc_resource_identifiers()
6704 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_alloc_resource_identifiers()
6707 count = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_alloc_resource_identifiers()
6709 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_alloc_resource_identifiers()
6715 base = phba->sli4_hba.max_cfg_param.rpi_base; in lpfc_sli4_alloc_resource_identifiers()
6717 phba->sli4_hba.rpi_bmask = kcalloc(longs, in lpfc_sli4_alloc_resource_identifiers()
6720 if (unlikely(!phba->sli4_hba.rpi_bmask)) { in lpfc_sli4_alloc_resource_identifiers()
6724 phba->sli4_hba.rpi_ids = kcalloc(count, sizeof(uint16_t), in lpfc_sli4_alloc_resource_identifiers()
6726 if (unlikely(!phba->sli4_hba.rpi_ids)) { in lpfc_sli4_alloc_resource_identifiers()
6732 phba->sli4_hba.rpi_ids[i] = base + i; in lpfc_sli4_alloc_resource_identifiers()
6735 count = phba->sli4_hba.max_cfg_param.max_vpi; in lpfc_sli4_alloc_resource_identifiers()
6737 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_alloc_resource_identifiers()
6743 base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_alloc_resource_identifiers()
6745 phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long), in lpfc_sli4_alloc_resource_identifiers()
6747 if (unlikely(!phba->vpi_bmask)) { in lpfc_sli4_alloc_resource_identifiers()
6751 phba->vpi_ids = kcalloc(count, sizeof(uint16_t), in lpfc_sli4_alloc_resource_identifiers()
6753 if (unlikely(!phba->vpi_ids)) { in lpfc_sli4_alloc_resource_identifiers()
6759 phba->vpi_ids[i] = base + i; in lpfc_sli4_alloc_resource_identifiers()
6762 count = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_alloc_resource_identifiers()
6764 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_alloc_resource_identifiers()
6770 base = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_alloc_resource_identifiers()
6772 phba->sli4_hba.xri_bmask = kcalloc(longs, in lpfc_sli4_alloc_resource_identifiers()
6775 if (unlikely(!phba->sli4_hba.xri_bmask)) { in lpfc_sli4_alloc_resource_identifiers()
6779 phba->sli4_hba.max_cfg_param.xri_used = 0; in lpfc_sli4_alloc_resource_identifiers()
6780 phba->sli4_hba.xri_ids = kcalloc(count, sizeof(uint16_t), in lpfc_sli4_alloc_resource_identifiers()
6782 if (unlikely(!phba->sli4_hba.xri_ids)) { in lpfc_sli4_alloc_resource_identifiers()
6788 phba->sli4_hba.xri_ids[i] = base + i; in lpfc_sli4_alloc_resource_identifiers()
6791 count = phba->sli4_hba.max_cfg_param.max_vfi; in lpfc_sli4_alloc_resource_identifiers()
6793 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_alloc_resource_identifiers()
6799 base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_alloc_resource_identifiers()
6801 phba->sli4_hba.vfi_bmask = kcalloc(longs, in lpfc_sli4_alloc_resource_identifiers()
6804 if (unlikely(!phba->sli4_hba.vfi_bmask)) { in lpfc_sli4_alloc_resource_identifiers()
6808 phba->sli4_hba.vfi_ids = kcalloc(count, sizeof(uint16_t), in lpfc_sli4_alloc_resource_identifiers()
6810 if (unlikely(!phba->sli4_hba.vfi_ids)) { in lpfc_sli4_alloc_resource_identifiers()
6816 phba->sli4_hba.vfi_ids[i] = base + i; in lpfc_sli4_alloc_resource_identifiers()
6822 bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, in lpfc_sli4_alloc_resource_identifiers()
6828 kfree(phba->sli4_hba.vfi_bmask); in lpfc_sli4_alloc_resource_identifiers()
6829 phba->sli4_hba.vfi_bmask = NULL; in lpfc_sli4_alloc_resource_identifiers()
6831 kfree(phba->sli4_hba.xri_ids); in lpfc_sli4_alloc_resource_identifiers()
6832 phba->sli4_hba.xri_ids = NULL; in lpfc_sli4_alloc_resource_identifiers()
6834 kfree(phba->sli4_hba.xri_bmask); in lpfc_sli4_alloc_resource_identifiers()
6835 phba->sli4_hba.xri_bmask = NULL; in lpfc_sli4_alloc_resource_identifiers()
6837 kfree(phba->vpi_ids); in lpfc_sli4_alloc_resource_identifiers()
6838 phba->vpi_ids = NULL; in lpfc_sli4_alloc_resource_identifiers()
6840 kfree(phba->vpi_bmask); in lpfc_sli4_alloc_resource_identifiers()
6841 phba->vpi_bmask = NULL; in lpfc_sli4_alloc_resource_identifiers()
6843 kfree(phba->sli4_hba.rpi_ids); in lpfc_sli4_alloc_resource_identifiers()
6844 phba->sli4_hba.rpi_ids = NULL; in lpfc_sli4_alloc_resource_identifiers()
6846 kfree(phba->sli4_hba.rpi_bmask); in lpfc_sli4_alloc_resource_identifiers()
6847 phba->sli4_hba.rpi_bmask = NULL; in lpfc_sli4_alloc_resource_identifiers()
6860 lpfc_sli4_dealloc_resource_identifiers(struct lpfc_hba *phba) in lpfc_sli4_dealloc_resource_identifiers() argument
6862 if (phba->sli4_hba.extents_in_use) { in lpfc_sli4_dealloc_resource_identifiers()
6863 lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_VPI); in lpfc_sli4_dealloc_resource_identifiers()
6864 lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_RPI); in lpfc_sli4_dealloc_resource_identifiers()
6865 lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_XRI); in lpfc_sli4_dealloc_resource_identifiers()
6866 lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_VFI); in lpfc_sli4_dealloc_resource_identifiers()
6868 kfree(phba->vpi_bmask); in lpfc_sli4_dealloc_resource_identifiers()
6869 phba->sli4_hba.max_cfg_param.vpi_used = 0; in lpfc_sli4_dealloc_resource_identifiers()
6870 kfree(phba->vpi_ids); in lpfc_sli4_dealloc_resource_identifiers()
6871 bf_set(lpfc_vpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_resource_identifiers()
6872 kfree(phba->sli4_hba.xri_bmask); in lpfc_sli4_dealloc_resource_identifiers()
6873 kfree(phba->sli4_hba.xri_ids); in lpfc_sli4_dealloc_resource_identifiers()
6874 kfree(phba->sli4_hba.vfi_bmask); in lpfc_sli4_dealloc_resource_identifiers()
6875 kfree(phba->sli4_hba.vfi_ids); in lpfc_sli4_dealloc_resource_identifiers()
6876 bf_set(lpfc_vfi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_resource_identifiers()
6877 bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_resource_identifiers()
6894 lpfc_sli4_get_allocated_extnts(struct lpfc_hba *phba, uint16_t type, in lpfc_sli4_get_allocated_extnts() argument
6912 blk_list_head = &phba->lpfc_vpi_blk_list; in lpfc_sli4_get_allocated_extnts()
6915 blk_list_head = &phba->sli4_hba.lpfc_xri_blk_list; in lpfc_sli4_get_allocated_extnts()
6918 blk_list_head = &phba->sli4_hba.lpfc_vfi_blk_list; in lpfc_sli4_get_allocated_extnts()
6921 blk_list_head = &phba->sli4_hba.lpfc_rpi_blk_list; in lpfc_sli4_get_allocated_extnts()
6962 mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_get_allocated_extnts()
6967 alloc_len = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_get_allocated_extnts()
6971 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_get_allocated_extnts()
6978 rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, curr_blks, type, emb); in lpfc_sli4_get_allocated_extnts()
6984 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_get_allocated_extnts()
6985 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_get_allocated_extnts()
6987 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_get_allocated_extnts()
6988 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_get_allocated_extnts()
7014 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_get_allocated_extnts()
7024 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_get_allocated_extnts()
7045 lpfc_sli4_repost_sgl_list(struct lpfc_hba *phba, in lpfc_sli4_repost_sgl_list() argument
7060 spin_lock_irq(&phba->hbalock); in lpfc_sli4_repost_sgl_list()
7061 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_repost_sgl_list()
7063 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_repost_sgl_list()
7064 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_repost_sgl_list()
7102 status = lpfc_sli4_post_sgl(phba, in lpfc_sli4_repost_sgl_list()
7111 lpfc_printf_log(phba, KERN_WARNING, in lpfc_sli4_repost_sgl_list()
7128 status = lpfc_sli4_post_sgl_list(phba, &blck_sgl_list, in lpfc_sli4_repost_sgl_list()
7139 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_repost_sgl_list()
7158 lpfc_free_sgl_list(phba, &free_sgl_list); in lpfc_sli4_repost_sgl_list()
7162 spin_lock_irq(&phba->hbalock); in lpfc_sli4_repost_sgl_list()
7163 spin_lock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_repost_sgl_list()
7165 spin_unlock(&phba->sli4_hba.sgl_list_lock); in lpfc_sli4_repost_sgl_list()
7166 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_repost_sgl_list()
7168 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_repost_sgl_list()
7190 lpfc_sli4_repost_io_sgl_list(struct lpfc_hba *phba) in lpfc_sli4_repost_io_sgl_list() argument
7196 lpfc_io_buf_flush(phba, &post_nblist); in lpfc_sli4_repost_io_sgl_list()
7201 phba, &post_nblist, phba->sli4_hba.io_xri_cnt); in lpfc_sli4_repost_io_sgl_list()
7210 lpfc_set_host_data(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) in lpfc_set_host_data() argument
7216 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_set_host_data()
7226 (phba->hba_flag & HBA_FCOE_MODE) ? "FCoE" : "FC"); in lpfc_set_host_data()
7230 lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq, in lpfc_post_rq_buffer() argument
7243 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_post_rq_buffer()
7246 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_post_rq_buffer()
7249 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_post_rq_buffer()
7251 rqb_buffer = rqbp->rqb_alloc_buffer(phba); in lpfc_post_rq_buffer()
7260 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_post_rq_buffer()
7271 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_post_rq_buffer()
7280 rqbp->rqb_free_buffer(phba, rqb_buffer); in lpfc_post_rq_buffer()
7287 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_post_rq_buffer()
7301 static void lpfc_init_idle_stat_hb(struct lpfc_hba *phba) in lpfc_init_idle_stat_hb() argument
7310 hdwq = &phba->sli4_hba.hdwq[phba->sli4_hba.cpu_map[i].hdwq]; in lpfc_init_idle_stat_hb()
7317 idle_stat = &phba->sli4_hba.idle_stat[i]; in lpfc_init_idle_stat_hb()
7322 if (phba->nvmet_support) in lpfc_init_idle_stat_hb()
7328 if (!phba->nvmet_support) in lpfc_init_idle_stat_hb()
7329 schedule_delayed_work(&phba->idle_stat_delay_work, in lpfc_init_idle_stat_hb()
7333 static void lpfc_sli4_dip(struct lpfc_hba *phba) in lpfc_sli4_dip() argument
7337 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_dip()
7342 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_dip()
7347 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_dip()
7363 lpfc_sli4_hba_setup(struct lpfc_hba *phba) in lpfc_sli4_hba_setup() argument
7371 struct Scsi_Host *shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_hba_setup()
7372 struct lpfc_vport *vport = phba->pport; in lpfc_sli4_hba_setup()
7378 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_hba_setup()
7383 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_hba_setup()
7387 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7388 phba->sli.sli_flag |= LPFC_SLI_ACTIVE; in lpfc_sli4_hba_setup()
7389 flg = phba->sli.sli_flag; in lpfc_sli4_hba_setup()
7390 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7396 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7397 flg = phba->sli.sli_flag; in lpfc_sli4_hba_setup()
7398 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7402 lpfc_sli4_dip(phba); in lpfc_sli4_hba_setup()
7408 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_hba_setup()
7420 rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size); in lpfc_sli4_hba_setup()
7427 phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev); in lpfc_sli4_hba_setup()
7429 phba->hba_flag |= HBA_FCOE_MODE; in lpfc_sli4_hba_setup()
7430 phba->fcp_embed_io = 0; /* SLI4 FC support only */ in lpfc_sli4_hba_setup()
7432 phba->hba_flag &= ~HBA_FCOE_MODE; in lpfc_sli4_hba_setup()
7437 phba->hba_flag |= HBA_FIP_SUPPORT; in lpfc_sli4_hba_setup()
7439 phba->hba_flag &= ~HBA_FIP_SUPPORT; in lpfc_sli4_hba_setup()
7441 phba->hba_flag &= ~HBA_IOQ_FLUSH; in lpfc_sli4_hba_setup()
7443 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_sli4_hba_setup()
7444 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7447 phba->sli_rev, phba->hba_flag & HBA_FCOE_MODE); in lpfc_sli4_hba_setup()
7458 if (phba->hba_flag & HBA_FCOE_MODE && in lpfc_sli4_hba_setup()
7459 lpfc_sli4_read_fcoe_params(phba)) in lpfc_sli4_hba_setup()
7460 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_INIT, in lpfc_sli4_hba_setup()
7467 rc = lpfc_sli4_retrieve_pport_name(phba); in lpfc_sli4_hba_setup()
7469 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
7471 "physical port name: %s.\n", phba->Port); in lpfc_sli4_hba_setup()
7473 rc = lpfc_sli4_get_ctl_attr(phba); in lpfc_sli4_hba_setup()
7475 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
7484 rc = lpfc_parse_vpd(phba, vpd, vpd_size); in lpfc_sli4_hba_setup()
7486 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7494 phba->vpd.rev.biuRev = mqe->un.read_rev.first_hw_rev; in lpfc_sli4_hba_setup()
7495 phba->vpd.rev.smRev = mqe->un.read_rev.second_hw_rev; in lpfc_sli4_hba_setup()
7501 if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_hba_setup()
7503 (phba->vpd.rev.biuRev == LPFC_G7_ASIC_1) && in lpfc_sli4_hba_setup()
7504 (phba->vpd.rev.smRev == 0) && in lpfc_sli4_hba_setup()
7505 (phba->cfg_nvme_embed_cmd == 1)) in lpfc_sli4_hba_setup()
7506 phba->cfg_nvme_embed_cmd = 0; in lpfc_sli4_hba_setup()
7508 phba->vpd.rev.endecRev = mqe->un.read_rev.third_hw_rev; in lpfc_sli4_hba_setup()
7509 phba->vpd.rev.fcphHigh = bf_get(lpfc_mbx_rd_rev_fcph_high, in lpfc_sli4_hba_setup()
7511 phba->vpd.rev.fcphLow = bf_get(lpfc_mbx_rd_rev_fcph_low, in lpfc_sli4_hba_setup()
7513 phba->vpd.rev.feaLevelHigh = bf_get(lpfc_mbx_rd_rev_ftr_lvl_high, in lpfc_sli4_hba_setup()
7515 phba->vpd.rev.feaLevelLow = bf_get(lpfc_mbx_rd_rev_ftr_lvl_low, in lpfc_sli4_hba_setup()
7517 phba->vpd.rev.sli1FwRev = mqe->un.read_rev.fw_id_rev; in lpfc_sli4_hba_setup()
7518 memcpy(phba->vpd.rev.sli1FwName, mqe->un.read_rev.fw_name, 16); in lpfc_sli4_hba_setup()
7519 phba->vpd.rev.sli2FwRev = mqe->un.read_rev.ulp_fw_id_rev; in lpfc_sli4_hba_setup()
7520 memcpy(phba->vpd.rev.sli2FwName, mqe->un.read_rev.ulp_fw_name, 16); in lpfc_sli4_hba_setup()
7521 phba->vpd.rev.opFwRev = mqe->un.read_rev.fw_id_rev; in lpfc_sli4_hba_setup()
7522 memcpy(phba->vpd.rev.opFwName, mqe->un.read_rev.fw_name, 16); in lpfc_sli4_hba_setup()
7523 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
7528 phba->vpd.rev.opFwName, in lpfc_sli4_hba_setup()
7529 phba->vpd.rev.fcphHigh, phba->vpd.rev.fcphLow, in lpfc_sli4_hba_setup()
7530 phba->vpd.rev.feaLevelHigh, phba->vpd.rev.feaLevelLow); in lpfc_sli4_hba_setup()
7532 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == in lpfc_sli4_hba_setup()
7534 lpfc_set_features(phba, mboxq, LPFC_SET_UE_RECOVERY); in lpfc_sli4_hba_setup()
7535 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7537 phba->hba_flag |= HBA_RECOVERABLE_UE; in lpfc_sli4_hba_setup()
7539 phba->eratt_poll_interval = 1; in lpfc_sli4_hba_setup()
7540 phba->sli4_hba.ue_to_sr = bf_get( in lpfc_sli4_hba_setup()
7543 phba->sli4_hba.ue_to_rp = bf_get( in lpfc_sli4_hba_setup()
7549 if (phba->cfg_enable_mds_diags && phba->mds_diags_support) { in lpfc_sli4_hba_setup()
7551 lpfc_set_features(phba, mboxq, LPFC_SET_MDS_DIAGS); in lpfc_sli4_hba_setup()
7552 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7554 phba->mds_diags_support = 0; in lpfc_sli4_hba_setup()
7561 lpfc_request_features(phba, mboxq); in lpfc_sli4_hba_setup()
7562 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7573 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
7579 if (phba->hba_flag & HBA_FCOE_MODE) { in lpfc_sli4_hba_setup()
7581 phba->sli3_options |= LPFC_SLI4_PERFH_ENABLED; in lpfc_sli4_hba_setup()
7583 phba->sli3_options &= ~LPFC_SLI4_PERFH_ENABLED; in lpfc_sli4_hba_setup()
7591 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { in lpfc_sli4_hba_setup()
7593 phba->cfg_enable_bg = 0; in lpfc_sli4_hba_setup()
7594 phba->sli3_options &= ~LPFC_SLI3_BG_ENABLED; in lpfc_sli4_hba_setup()
7599 if (phba->max_vpi && phba->cfg_enable_npiv && in lpfc_sli4_hba_setup()
7604 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
7607 mqe->un.req_ftrs.word3, phba->cfg_enable_bg, in lpfc_sli4_hba_setup()
7608 phba->cfg_enable_npiv, phba->max_vpi); in lpfc_sli4_hba_setup()
7610 phba->cfg_enable_bg = 0; in lpfc_sli4_hba_setup()
7612 phba->cfg_enable_npiv = 0; in lpfc_sli4_hba_setup()
7616 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7617 phba->sli3_options |= (LPFC_SLI3_NPIV_ENABLED | LPFC_SLI3_HBQ_ENABLED); in lpfc_sli4_hba_setup()
7618 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7621 lpfc_set_features(phba, mboxq, LPFC_SET_DUAL_DUMP); in lpfc_sli4_hba_setup()
7622 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7625 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_hba_setup()
7628 lpfc_printf_log(phba, KERN_INFO, LOG_SLI | LOG_INIT, in lpfc_sli4_hba_setup()
7633 phba, mboxq), in lpfc_sli4_hba_setup()
7635 phba, mboxq), in lpfc_sli4_hba_setup()
7641 rc = lpfc_sli4_alloc_resource_identifiers(phba); in lpfc_sli4_hba_setup()
7643 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7649 lpfc_set_host_data(phba, mboxq); in lpfc_sli4_hba_setup()
7651 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7653 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
7659 rc = lpfc_read_sparam(phba, mboxq, vport->vpi); in lpfc_sli4_hba_setup()
7661 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_hba_setup()
7667 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7678 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_hba_setup()
7682 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7686 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_hba_setup()
7698 rc = lpfc_sli4_queue_create(phba); in lpfc_sli4_hba_setup()
7700 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7706 rc = lpfc_sli4_queue_setup(phba); in lpfc_sli4_hba_setup()
7708 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7713 lpfc_sli4_setup(phba); in lpfc_sli4_hba_setup()
7714 lpfc_sli4_queue_init(phba); in lpfc_sli4_hba_setup()
7717 rc = lpfc_sli4_els_sgl_update(phba); in lpfc_sli4_hba_setup()
7719 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7726 rc = lpfc_sli4_repost_sgl_list(phba, &phba->sli4_hba.lpfc_els_sgl_list, in lpfc_sli4_hba_setup()
7727 phba->sli4_hba.els_xri_cnt); in lpfc_sli4_hba_setup()
7729 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7735 phba->sli4_hba.els_xri_cnt = rc; in lpfc_sli4_hba_setup()
7737 if (phba->nvmet_support) { in lpfc_sli4_hba_setup()
7739 rc = lpfc_sli4_nvmet_sgl_update(phba); in lpfc_sli4_hba_setup()
7741 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7749 phba, in lpfc_sli4_hba_setup()
7750 &phba->sli4_hba.lpfc_nvmet_sgl_list, in lpfc_sli4_hba_setup()
7751 phba->sli4_hba.nvmet_xri_cnt); in lpfc_sli4_hba_setup()
7753 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7759 phba->sli4_hba.nvmet_xri_cnt = rc; in lpfc_sli4_hba_setup()
7764 cnt = phba->sli4_hba.nvmet_xri_cnt + in lpfc_sli4_hba_setup()
7765 phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_hba_setup()
7768 rc = lpfc_sli4_io_sgl_update(phba); in lpfc_sli4_hba_setup()
7770 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7777 rc = lpfc_sli4_repost_io_sgl_list(phba); in lpfc_sli4_hba_setup()
7779 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7790 cnt = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_hba_setup()
7793 if (!phba->sli.iocbq_lookup) { in lpfc_sli4_hba_setup()
7795 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_hba_setup()
7798 rc = lpfc_init_iocb_list(phba, cnt); in lpfc_sli4_hba_setup()
7800 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7806 if (phba->nvmet_support) in lpfc_sli4_hba_setup()
7807 lpfc_nvmet_create_targetport(phba); in lpfc_sli4_hba_setup()
7809 if (phba->nvmet_support && phba->cfg_nvmet_mrq) { in lpfc_sli4_hba_setup()
7811 for (i = 0; i < phba->cfg_nvmet_mrq; i++) { in lpfc_sli4_hba_setup()
7812 rqbp = phba->sli4_hba.nvmet_mrq_hdr[i]->rqbp; in lpfc_sli4_hba_setup()
7820 phba, phba->sli4_hba.nvmet_mrq_hdr[i], in lpfc_sli4_hba_setup()
7821 phba->sli4_hba.nvmet_mrq_data[i], in lpfc_sli4_hba_setup()
7822 phba->cfg_nvmet_mrq_post, i); in lpfc_sli4_hba_setup()
7827 rc = lpfc_sli4_post_all_rpi_hdrs(phba); in lpfc_sli4_hba_setup()
7829 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7835 lpfc_sli4_node_prep(phba); in lpfc_sli4_hba_setup()
7837 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_hba_setup()
7838 if ((phba->nvmet_support == 0) || (phba->cfg_nvmet_mrq == 1)) { in lpfc_sli4_hba_setup()
7842 lpfc_reg_fcfi(phba, mboxq); in lpfc_sli4_hba_setup()
7843 mboxq->vport = phba->pport; in lpfc_sli4_hba_setup()
7844 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7848 phba->fcf.fcfi = bf_get(lpfc_reg_fcfi_fcfi, in lpfc_sli4_hba_setup()
7854 lpfc_reg_fcfi_mrq(phba, mboxq, 0); in lpfc_sli4_hba_setup()
7855 mboxq->vport = phba->pport; in lpfc_sli4_hba_setup()
7856 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7860 phba->fcf.fcfi = bf_get(lpfc_reg_fcfi_mrq_fcfi, in lpfc_sli4_hba_setup()
7864 lpfc_reg_fcfi_mrq(phba, mboxq, 1); in lpfc_sli4_hba_setup()
7865 mboxq->vport = phba->pport; in lpfc_sli4_hba_setup()
7866 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7872 lpfc_sli_read_link_ste(phba); in lpfc_sli4_hba_setup()
7878 if (phba->nvmet_support == 0) { in lpfc_sli4_hba_setup()
7879 if (phba->sli4_hba.io_xri_cnt == 0) { in lpfc_sli4_hba_setup()
7881 phba, phba->sli4_hba.io_xri_max); in lpfc_sli4_hba_setup()
7887 if (phba->cfg_xri_rebalancing) in lpfc_sli4_hba_setup()
7888 lpfc_create_multixri_pools(phba); in lpfc_sli4_hba_setup()
7891 phba->cfg_xri_rebalancing = 0; in lpfc_sli4_hba_setup()
7895 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7896 phba->sli.sli_flag &= ~LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_setup()
7897 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7900 lpfc_sli4_rb_setup(phba); in lpfc_sli4_hba_setup()
7903 phba->fcf.fcf_flag = 0; in lpfc_sli4_hba_setup()
7904 phba->fcf.current_rec.flag = 0; in lpfc_sli4_hba_setup()
7908 jiffies + msecs_to_jiffies(1000 * (phba->fc_ratov * 2))); in lpfc_sli4_hba_setup()
7911 mod_timer(&phba->hb_tmofunc, in lpfc_sli4_hba_setup()
7913 phba->hb_outstanding = 0; in lpfc_sli4_hba_setup()
7914 phba->last_completion_time = jiffies; in lpfc_sli4_hba_setup()
7917 if (phba->cfg_auto_imax) in lpfc_sli4_hba_setup()
7918 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_sli4_hba_setup()
7922 lpfc_init_idle_stat_hb(phba); in lpfc_sli4_hba_setup()
7925 mod_timer(&phba->eratt_poll, in lpfc_sli4_hba_setup()
7926 jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); in lpfc_sli4_hba_setup()
7929 if (phba->cfg_aer_support == 1 && !(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_sli4_hba_setup()
7930 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_sli4_hba_setup()
7932 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_hba_setup()
7935 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7936 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_sli4_hba_setup()
7937 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7939 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_hba_setup()
7942 phba->cfg_aer_support = 0; in lpfc_sli4_hba_setup()
7951 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7952 phba->link_state = LPFC_LINK_DOWN; in lpfc_sli4_hba_setup()
7955 if (bf_get(lpfc_conf_trunk_port0, &phba->sli4_hba)) in lpfc_sli4_hba_setup()
7956 phba->trunk_link.link0.state = LPFC_LINK_DOWN; in lpfc_sli4_hba_setup()
7957 if (bf_get(lpfc_conf_trunk_port1, &phba->sli4_hba)) in lpfc_sli4_hba_setup()
7958 phba->trunk_link.link1.state = LPFC_LINK_DOWN; in lpfc_sli4_hba_setup()
7959 if (bf_get(lpfc_conf_trunk_port2, &phba->sli4_hba)) in lpfc_sli4_hba_setup()
7960 phba->trunk_link.link2.state = LPFC_LINK_DOWN; in lpfc_sli4_hba_setup()
7961 if (bf_get(lpfc_conf_trunk_port3, &phba->sli4_hba)) in lpfc_sli4_hba_setup()
7962 phba->trunk_link.link3.state = LPFC_LINK_DOWN; in lpfc_sli4_hba_setup()
7963 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
7966 lpfc_sli4_arm_cqeq_intr(phba); in lpfc_sli4_hba_setup()
7969 phba->sli4_hba.intr_enable = 1; in lpfc_sli4_hba_setup()
7971 if (!(phba->hba_flag & HBA_FCOE_MODE) && in lpfc_sli4_hba_setup()
7972 (phba->hba_flag & LINK_DISABLED)) { in lpfc_sli4_hba_setup()
7973 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7975 lpfc_down_link(phba, mboxq); in lpfc_sli4_hba_setup()
7976 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
7978 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_setup()
7983 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_sli4_hba_setup()
7985 if (!(phba->link_flag & LS_LOOPBACK_MODE)) { in lpfc_sli4_hba_setup()
7986 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_sli4_hba_setup()
7991 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_hba_setup()
7995 lpfc_io_free(phba); in lpfc_sli4_hba_setup()
7998 lpfc_sli4_queue_unset(phba); in lpfc_sli4_hba_setup()
8000 lpfc_free_iocb_list(phba); in lpfc_sli4_hba_setup()
8002 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_setup()
8004 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_setup()
8006 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_hba_setup()
8025 struct lpfc_hba *phba = from_timer(phba, t, sli.mbox_tmo); in lpfc_mbox_timeout() local
8029 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_mbox_timeout()
8030 tmo_posted = phba->pport->work_port_events & WORKER_MBOX_TMO; in lpfc_mbox_timeout()
8032 phba->pport->work_port_events |= WORKER_MBOX_TMO; in lpfc_mbox_timeout()
8033 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_mbox_timeout()
8036 lpfc_worker_wake_up(phba); in lpfc_mbox_timeout()
8049 lpfc_sli4_mbox_completions_pending(struct lpfc_hba *phba) in lpfc_sli4_mbox_completions_pending() argument
8058 if (unlikely(!phba) || (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_sli4_mbox_completions_pending()
8063 mcq = phba->sli4_hba.mbx_cq; in lpfc_sli4_mbox_completions_pending()
8079 if (phba->sli4_hba.pc_sli4_params.cqav && !idx) in lpfc_sli4_mbox_completions_pending()
8098 lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba) in lpfc_sli4_process_missed_mbox_completions() argument
8100 struct lpfc_sli4_hba *sli4_hba = &phba->sli4_hba; in lpfc_sli4_process_missed_mbox_completions()
8106 if (unlikely(!phba) || (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_sli4_process_missed_mbox_completions()
8111 for (eqidx = 0; eqidx < phba->cfg_irq_chann; eqidx++) { in lpfc_sli4_process_missed_mbox_completions()
8112 eq = phba->sli4_hba.hba_eq_hdl[eqidx].eq; in lpfc_sli4_process_missed_mbox_completions()
8128 mbox_pending = lpfc_sli4_mbox_completions_pending(phba); in lpfc_sli4_process_missed_mbox_completions()
8139 lpfc_sli4_process_eq(phba, fpeq, LPFC_QUEUE_REARM); in lpfc_sli4_process_missed_mbox_completions()
8142 sli4_hba->sli4_write_eq_db(phba, fpeq, 0, LPFC_QUEUE_REARM); in lpfc_sli4_process_missed_mbox_completions()
8157 lpfc_mbox_timeout_handler(struct lpfc_hba *phba) in lpfc_mbox_timeout_handler() argument
8159 LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active; in lpfc_mbox_timeout_handler()
8162 struct lpfc_sli *psli = &phba->sli; in lpfc_mbox_timeout_handler()
8165 if (lpfc_sli4_process_missed_mbox_completions(phba)) in lpfc_mbox_timeout_handler()
8175 spin_lock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
8177 lpfc_printf_log(phba, KERN_WARNING, in lpfc_mbox_timeout_handler()
8181 spin_unlock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
8186 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mbox_timeout_handler()
8189 phba->pport->port_state, in lpfc_mbox_timeout_handler()
8190 phba->sli.sli_flag, in lpfc_mbox_timeout_handler()
8191 phba->sli.mbox_active); in lpfc_mbox_timeout_handler()
8192 spin_unlock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
8198 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_mbox_timeout_handler()
8199 phba->pport->work_port_events &= ~WORKER_MBOX_TMO; in lpfc_mbox_timeout_handler()
8200 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_mbox_timeout_handler()
8201 spin_lock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
8202 phba->link_state = LPFC_LINK_UNKNOWN; in lpfc_mbox_timeout_handler()
8204 spin_unlock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
8206 lpfc_sli_abort_fcp_rings(phba); in lpfc_mbox_timeout_handler()
8208 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mbox_timeout_handler()
8212 lpfc_reset_hba(phba); in lpfc_mbox_timeout_handler()
8242 lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, in lpfc_sli_issue_mbox_s3() argument
8246 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_issue_mbox_s3()
8256 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8258 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli_issue_mbox_s3()
8261 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8265 pmbox = lpfc_mbox_get(phba); in lpfc_sli_issue_mbox_s3()
8267 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8275 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8276 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli_issue_mbox_s3()
8286 if (unlikely(pci_channel_offline(phba->pcidev))) { in lpfc_sli_issue_mbox_s3()
8287 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8292 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_issue_mbox_s3()
8293 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8297 psli = &phba->sli; in lpfc_sli_issue_mbox_s3()
8302 if (phba->link_state == LPFC_HBA_ERROR) { in lpfc_sli_issue_mbox_s3()
8303 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8306 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_mbox_s3()
8315 if (lpfc_readl(phba->HCregaddr, &hc_copy) || in lpfc_sli_issue_mbox_s3()
8317 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8318 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_mbox_s3()
8334 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8337 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_mbox_s3()
8347 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8349 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_mbox_s3()
8361 lpfc_mbox_put(phba, pmbox); in lpfc_sli_issue_mbox_s3()
8364 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
8369 phba->pport ? phba->pport->port_state : 0xff, in lpfc_sli_issue_mbox_s3()
8373 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8383 lpfc_debugfs_disc_trc(phba->pport, in lpfc_sli_issue_mbox_s3()
8400 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8402 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_mbox_s3()
8411 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) * in lpfc_sli_issue_mbox_s3()
8417 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
8422 phba->pport ? phba->pport->port_state : 0xff, in lpfc_sli_issue_mbox_s3()
8434 lpfc_debugfs_disc_trc(phba->pport, in lpfc_sli_issue_mbox_s3()
8452 = (uint8_t *)phba->mbox_ext in lpfc_sli_issue_mbox_s3()
8453 - (uint8_t *)phba->mbox; in lpfc_sli_issue_mbox_s3()
8459 (uint8_t *)phba->mbox_ext, in lpfc_sli_issue_mbox_s3()
8463 lpfc_sli_pcimem_bcopy(mbx, phba->mbox, MAILBOX_CMD_SIZE); in lpfc_sli_issue_mbox_s3()
8472 lpfc_memcpy_to_slim(phba->MBslimaddr + in lpfc_sli_issue_mbox_s3()
8478 lpfc_sli_pcimem_bcopy(mbx, phba->mbox, in lpfc_sli_issue_mbox_s3()
8483 to_slim = phba->MBslimaddr + sizeof (uint32_t); in lpfc_sli_issue_mbox_s3()
8489 to_slim = phba->MBslimaddr; in lpfc_sli_issue_mbox_s3()
8505 writel(CA_MBATT, phba->CAregaddr); in lpfc_sli_issue_mbox_s3()
8506 readl(phba->CAregaddr); /* flush */ in lpfc_sli_issue_mbox_s3()
8514 writel(CA_MBATT, phba->CAregaddr); in lpfc_sli_issue_mbox_s3()
8515 readl(phba->CAregaddr); /* flush */ in lpfc_sli_issue_mbox_s3()
8519 word0 = *((uint32_t *)phba->mbox); in lpfc_sli_issue_mbox_s3()
8523 if (lpfc_readl(phba->MBslimaddr, &word0)) { in lpfc_sli_issue_mbox_s3()
8524 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
8531 if (lpfc_readl(phba->HAregaddr, &ha_copy)) { in lpfc_sli_issue_mbox_s3()
8532 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
8536 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) * in lpfc_sli_issue_mbox_s3()
8542 (phba->link_state > LPFC_WARM_START))) { in lpfc_sli_issue_mbox_s3()
8545 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
8557 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
8560 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8565 word0 = *((uint32_t *)phba->mbox); in lpfc_sli_issue_mbox_s3()
8571 slimword0 = readl(phba->MBslimaddr); in lpfc_sli_issue_mbox_s3()
8582 word0 = readl(phba->MBslimaddr); in lpfc_sli_issue_mbox_s3()
8585 if (lpfc_readl(phba->HAregaddr, &ha_copy)) { in lpfc_sli_issue_mbox_s3()
8586 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
8594 lpfc_sli_pcimem_bcopy(phba->mbox, mbx, in lpfc_sli_issue_mbox_s3()
8598 lpfc_sli_pcimem_bcopy(phba->mbox_ext, in lpfc_sli_issue_mbox_s3()
8604 lpfc_memcpy_from_slim(mbx, phba->MBslimaddr, in lpfc_sli_issue_mbox_s3()
8610 phba->MBslimaddr + in lpfc_sli_issue_mbox_s3()
8616 writel(HA_MBATT, phba->HAregaddr); in lpfc_sli_issue_mbox_s3()
8617 readl(phba->HAregaddr); /* flush */ in lpfc_sli_issue_mbox_s3()
8623 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
8629 lpfc_mbox_cmpl_put(phba, pmbox); in lpfc_sli_issue_mbox_s3()
8647 lpfc_sli4_async_mbox_block(struct lpfc_hba *phba) in lpfc_sli4_async_mbox_block() argument
8649 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_async_mbox_block()
8654 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_block()
8659 if (phba->sli.mbox_active) in lpfc_sli4_async_mbox_block()
8660 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_sli4_async_mbox_block()
8661 phba->sli.mbox_active) * in lpfc_sli4_async_mbox_block()
8663 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_block()
8667 lpfc_sli4_process_missed_mbox_completions(phba); in lpfc_sli4_async_mbox_block()
8670 while (phba->sli.mbox_active) { in lpfc_sli4_async_mbox_block()
8682 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_block()
8684 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_block()
8701 lpfc_sli4_async_mbox_unblock(struct lpfc_hba *phba) in lpfc_sli4_async_mbox_unblock() argument
8703 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_async_mbox_unblock()
8705 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_unblock()
8708 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_unblock()
8718 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_unblock()
8721 lpfc_worker_wake_up(phba); in lpfc_sli4_async_mbox_unblock()
8736 lpfc_sli4_wait_bmbx_ready(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_sli4_wait_bmbx_ready() argument
8742 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) in lpfc_sli4_wait_bmbx_ready()
8746 bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); in lpfc_sli4_wait_bmbx_ready()
8775 lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_sli4_post_sync_mbox() argument
8781 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_post_sync_mbox()
8790 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
8792 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
8793 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_sync_mbox()
8798 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_post_sync_mbox()
8799 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_post_sync_mbox()
8805 phba->sli.mbox_active = mboxq; in lpfc_sli4_post_sync_mbox()
8806 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
8809 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); in lpfc_sli4_post_sync_mbox()
8818 memset(phba->sli4_hba.bmbx.avirt, 0, sizeof(struct lpfc_bmbx_create)); in lpfc_sli4_post_sync_mbox()
8819 lpfc_sli4_pcimem_bcopy(mb, phba->sli4_hba.bmbx.avirt, in lpfc_sli4_post_sync_mbox()
8823 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_sli4_post_sync_mbox()
8824 writel(dma_address->addr_hi, phba->sli4_hba.BMBXregaddr); in lpfc_sli4_post_sync_mbox()
8827 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); in lpfc_sli4_post_sync_mbox()
8832 writel(dma_address->addr_lo, phba->sli4_hba.BMBXregaddr); in lpfc_sli4_post_sync_mbox()
8835 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); in lpfc_sli4_post_sync_mbox()
8844 lpfc_sli4_pcimem_bcopy(phba->sli4_hba.bmbx.avirt, mb, in lpfc_sli4_post_sync_mbox()
8846 mbox_rgn = (struct lpfc_bmbx_create *) phba->sli4_hba.bmbx.avirt; in lpfc_sli4_post_sync_mbox()
8861 lpfc_sli4_swap_str(phba, mboxq); in lpfc_sli4_post_sync_mbox()
8863 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_post_sync_mbox()
8868 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_post_sync_mbox()
8869 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_post_sync_mbox()
8882 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
8884 phba->sli.mbox_active = NULL; in lpfc_sli4_post_sync_mbox()
8885 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
8902 lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, in lpfc_sli_issue_mbox_s4() argument
8905 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_issue_mbox_s4()
8910 lpfc_idiag_mbxacc_dump_issue_mbox(phba, &mboxq->u.mb); in lpfc_sli_issue_mbox_s4()
8912 rc = lpfc_mbox_dev_check(phba); in lpfc_sli_issue_mbox_s4()
8914 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_mbox_s4()
8919 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
8920 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
8926 if (!phba->sli4_hba.intr_enable) { in lpfc_sli_issue_mbox_s4()
8928 rc = lpfc_sli4_post_sync_mbox(phba, mboxq); in lpfc_sli_issue_mbox_s4()
8932 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s4()
8939 lpfc_sli_config_mbox_subsys_get(phba, in lpfc_sli_issue_mbox_s4()
8941 lpfc_sli_config_mbox_opcode_get(phba, in lpfc_sli_issue_mbox_s4()
8950 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s4()
8956 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
8957 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
8960 rc = lpfc_sli4_async_mbox_block(phba); in lpfc_sli_issue_mbox_s4()
8963 rc = lpfc_sli4_post_sync_mbox(phba, mboxq); in lpfc_sli_issue_mbox_s4()
8965 lpfc_printf_log(phba, KERN_WARNING, in lpfc_sli_issue_mbox_s4()
8973 lpfc_sli_config_mbox_subsys_get(phba, in lpfc_sli_issue_mbox_s4()
8975 lpfc_sli_config_mbox_opcode_get(phba, in lpfc_sli_issue_mbox_s4()
8983 lpfc_sli4_async_mbox_unblock(phba); in lpfc_sli_issue_mbox_s4()
8989 rc = lpfc_mbox_cmd_check(phba, mboxq); in lpfc_sli_issue_mbox_s4()
8991 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_mbox_s4()
8996 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
8997 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
9004 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_issue_mbox_s4()
9005 lpfc_mbox_put(phba, mboxq); in lpfc_sli_issue_mbox_s4()
9006 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_issue_mbox_s4()
9007 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s4()
9012 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
9013 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
9014 phba->pport->port_state, in lpfc_sli_issue_mbox_s4()
9017 lpfc_worker_wake_up(phba); in lpfc_sli_issue_mbox_s4()
9034 lpfc_sli4_post_async_mbox(struct lpfc_hba *phba) in lpfc_sli4_post_async_mbox() argument
9036 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_post_async_mbox()
9044 if (unlikely(!phba->sli4_hba.intr_enable)) in lpfc_sli4_post_async_mbox()
9048 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
9050 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
9054 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
9057 if (unlikely(phba->sli.mbox_active)) { in lpfc_sli4_post_async_mbox()
9058 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
9059 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_async_mbox()
9067 mboxq = lpfc_mbox_get(phba); in lpfc_sli4_post_async_mbox()
9072 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
9075 phba->sli.mbox_active = mboxq; in lpfc_sli4_post_async_mbox()
9076 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
9079 rc = lpfc_mbox_dev_check(phba); in lpfc_sli4_post_async_mbox()
9090 msecs_to_jiffies(1000 * lpfc_mbox_tmo_val(phba, mboxq)))); in lpfc_sli4_post_async_mbox()
9092 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_post_async_mbox()
9096 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_post_async_mbox()
9097 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_post_async_mbox()
9098 phba->pport->port_state, psli->sli_flag); in lpfc_sli4_post_async_mbox()
9108 lpfc_debugfs_disc_trc(phba->pport, in lpfc_sli4_post_async_mbox()
9118 rc = lpfc_sli4_mq_put(phba->sli4_hba.mbx_wq, mqe); in lpfc_sli4_post_async_mbox()
9120 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_async_mbox()
9125 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_post_async_mbox()
9126 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_post_async_mbox()
9134 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
9135 if (phba->sli.mbox_active) { in lpfc_sli4_post_async_mbox()
9137 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_post_async_mbox()
9140 phba->sli.mbox_active = NULL; in lpfc_sli4_post_async_mbox()
9142 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
9160 lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) in lpfc_sli_issue_mbox() argument
9162 return phba->lpfc_sli_issue_mbox(phba, pmbox, flag); in lpfc_sli_issue_mbox()
9175 lpfc_mbox_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_mbox_api_table_setup() argument
9180 phba->lpfc_sli_issue_mbox = lpfc_sli_issue_mbox_s3; in lpfc_mbox_api_table_setup()
9181 phba->lpfc_sli_handle_slow_ring_event = in lpfc_mbox_api_table_setup()
9183 phba->lpfc_sli_hbq_to_firmware = lpfc_sli_hbq_to_firmware_s3; in lpfc_mbox_api_table_setup()
9184 phba->lpfc_sli_brdrestart = lpfc_sli_brdrestart_s3; in lpfc_mbox_api_table_setup()
9185 phba->lpfc_sli_brdready = lpfc_sli_brdready_s3; in lpfc_mbox_api_table_setup()
9188 phba->lpfc_sli_issue_mbox = lpfc_sli_issue_mbox_s4; in lpfc_mbox_api_table_setup()
9189 phba->lpfc_sli_handle_slow_ring_event = in lpfc_mbox_api_table_setup()
9191 phba->lpfc_sli_hbq_to_firmware = lpfc_sli_hbq_to_firmware_s4; in lpfc_mbox_api_table_setup()
9192 phba->lpfc_sli_brdrestart = lpfc_sli_brdrestart_s4; in lpfc_mbox_api_table_setup()
9193 phba->lpfc_sli_brdready = lpfc_sli_brdready_s4; in lpfc_mbox_api_table_setup()
9196 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mbox_api_table_setup()
9217 __lpfc_sli_ringtx_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in __lpfc_sli_ringtx_put() argument
9220 if (phba->sli_rev == LPFC_SLI_REV4) in __lpfc_sli_ringtx_put()
9223 lockdep_assert_held(&phba->hbalock); in __lpfc_sli_ringtx_put()
9246 lpfc_sli_next_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_next_iocb() argument
9251 lockdep_assert_held(&phba->hbalock); in lpfc_sli_next_iocb()
9253 nextiocb = lpfc_sli_ringtx_get(phba, pring); in lpfc_sli_next_iocb()
9285 __lpfc_sli_issue_iocb_s3(struct lpfc_hba *phba, uint32_t ring_number, in __lpfc_sli_issue_iocb_s3() argument
9290 struct lpfc_sli_ring *pring = &phba->sli.sli3_ring[ring_number]; in __lpfc_sli_issue_iocb_s3()
9292 lockdep_assert_held(&phba->hbalock); in __lpfc_sli_issue_iocb_s3()
9297 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in __lpfc_sli_issue_iocb_s3()
9306 if (unlikely(pci_channel_offline(phba->pcidev))) in __lpfc_sli_issue_iocb_s3()
9310 if (unlikely(phba->hba_flag & DEFER_ERATT)) in __lpfc_sli_issue_iocb_s3()
9316 if (unlikely(phba->link_state < LPFC_LINK_DOWN)) in __lpfc_sli_issue_iocb_s3()
9326 if (unlikely(phba->link_state == LPFC_LINK_DOWN)) { in __lpfc_sli_issue_iocb_s3()
9334 if (!(phba->sli.sli_flag & LPFC_MENLO_MAINT) || in __lpfc_sli_issue_iocb_s3()
9364 !(phba->sli.sli_flag & LPFC_PROCESS_LA))) { in __lpfc_sli_issue_iocb_s3()
9368 while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) && in __lpfc_sli_issue_iocb_s3()
9369 (nextiocb = lpfc_sli_next_iocb(phba, pring, &piocb))) in __lpfc_sli_issue_iocb_s3()
9370 lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb); in __lpfc_sli_issue_iocb_s3()
9373 lpfc_sli_update_ring(phba, pring); in __lpfc_sli_issue_iocb_s3()
9375 lpfc_sli_update_full_ring(phba, pring); in __lpfc_sli_issue_iocb_s3()
9388 __lpfc_sli_ringtx_put(phba, pring, piocb); in __lpfc_sli_issue_iocb_s3()
9413 lpfc_sli4_bpl2sgl(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq, in lpfc_sli4_bpl2sgl() argument
9518 lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, in lpfc_sli4_iocb2wqe() argument
9538 fip = phba->hba_flag & HBA_FIP_SUPPORT; in lpfc_sli4_iocb2wqe()
9547 if (phba->fcp_embed_io) in lpfc_sli4_iocb2wqe()
9592 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_iocb2wqe()
9619 &phba->sli4_hba.sli_intf); in lpfc_sli4_iocb2wqe()
9632 !(phba->fc_topology == in lpfc_sli4_iocb2wqe()
9637 phba->vpi_ids[iocbq->vport->vpi]); in lpfc_sli4_iocb2wqe()
9641 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_sli4_iocb2wqe()
9645 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_sli4_iocb2wqe()
9662 if (phba->link_flag & LS_LOOPBACK_MODE) in lpfc_sli4_iocb2wqe()
9721 (phba->cfg_XLanePriority << 1)); in lpfc_sli4_iocb2wqe()
9727 if (phba->cfg_enable_pbde) in lpfc_sli4_iocb2wqe()
9732 if (phba->fcp_embed_io) { in lpfc_sli4_iocb2wqe()
9785 (phba->cfg_XLanePriority << 1)); in lpfc_sli4_iocb2wqe()
9791 if (phba->cfg_enable_pbde) in lpfc_sli4_iocb2wqe()
9796 if (phba->fcp_embed_io) { in lpfc_sli4_iocb2wqe()
9848 (phba->cfg_XLanePriority << 1)); in lpfc_sli4_iocb2wqe()
9853 if (phba->fcp_embed_io) { in lpfc_sli4_iocb2wqe()
9900 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_iocb2wqe()
9928 &phba->sli4_hba.sli_intf); in lpfc_sli4_iocb2wqe()
9947 phba->vpi_ids[iocbq->vport->vpi]); in lpfc_sli4_iocb2wqe()
9955 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_sli4_iocb2wqe()
9958 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_sli4_iocb2wqe()
9964 phba->vpi_ids[phba->pport->vpi]); in lpfc_sli4_iocb2wqe()
9974 if (abrt_iotag != 0 && abrt_iotag <= phba->sli.last_iotag) { in lpfc_sli4_iocb2wqe()
9975 abrtiocbq = phba->sli.iocbq_lookup[abrt_iotag]; in lpfc_sli4_iocb2wqe()
10043 phba->vpi_ids[phba->pport->vpi]); in lpfc_sli4_iocb2wqe()
10079 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_iocb2wqe()
10119 __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, uint32_t ring_number, in __lpfc_sli_issue_iocb_s4() argument
10130 wq = phba->sli4_hba.hdwq[piocb->hba_wqidx].io_wq; in __lpfc_sli_issue_iocb_s4()
10132 wq = phba->sli4_hba.els_wq; in __lpfc_sli_issue_iocb_s4()
10151 __lpfc_sli_ringtx_put(phba, in __lpfc_sli_issue_iocb_s4()
10158 sglq = __lpfc_sli_get_els_sglq(phba, piocb); in __lpfc_sli_issue_iocb_s4()
10161 __lpfc_sli_ringtx_put(phba, in __lpfc_sli_issue_iocb_s4()
10178 sglq = __lpfc_get_active_sglq(phba, piocb->sli4_lxritag); in __lpfc_sli_issue_iocb_s4()
10186 if (NO_XRI == lpfc_sli4_bpl2sgl(phba, piocb, sglq)) in __lpfc_sli_issue_iocb_s4()
10190 if (lpfc_sli4_iocb2wqe(phba, piocb, &wqe)) in __lpfc_sli_issue_iocb_s4()
10195 lpfc_sli_ringtxcmpl_put(phba, pring, piocb); in __lpfc_sli_issue_iocb_s4()
10212 __lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number, in __lpfc_sli_issue_iocb() argument
10215 return phba->__lpfc_sli_issue_iocb(phba, ring_number, piocb, flag); in __lpfc_sli_issue_iocb()
10228 lpfc_sli_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_sli_api_table_setup() argument
10233 phba->__lpfc_sli_issue_iocb = __lpfc_sli_issue_iocb_s3; in lpfc_sli_api_table_setup()
10234 phba->__lpfc_sli_release_iocbq = __lpfc_sli_release_iocbq_s3; in lpfc_sli_api_table_setup()
10237 phba->__lpfc_sli_issue_iocb = __lpfc_sli_issue_iocb_s4; in lpfc_sli_api_table_setup()
10238 phba->__lpfc_sli_release_iocbq = __lpfc_sli_release_iocbq_s4; in lpfc_sli_api_table_setup()
10241 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_api_table_setup()
10247 phba->lpfc_get_iocb_from_iocbq = lpfc_get_iocb_from_iocbq; in lpfc_sli_api_table_setup()
10262 lpfc_sli4_calc_ring(struct lpfc_hba *phba, struct lpfc_iocbq *piocb) in lpfc_sli4_calc_ring() argument
10267 if (unlikely(!phba->sli4_hba.hdwq)) in lpfc_sli4_calc_ring()
10277 return phba->sli4_hba.hdwq[piocb->hba_wqidx].io_wq->pring; in lpfc_sli4_calc_ring()
10279 if (unlikely(!phba->sli4_hba.els_wq)) in lpfc_sli4_calc_ring()
10282 return phba->sli4_hba.els_wq->pring; in lpfc_sli4_calc_ring()
10300 lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number, in lpfc_sli_issue_iocb() argument
10308 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_issue_iocb()
10309 eq = phba->sli4_hba.hdwq[piocb->hba_wqidx].hba_eq; in lpfc_sli_issue_iocb()
10311 pring = lpfc_sli4_calc_ring(phba, piocb); in lpfc_sli_issue_iocb()
10316 rc = __lpfc_sli_issue_iocb(phba, ring_number, piocb, flag); in lpfc_sli_issue_iocb()
10322 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_issue_iocb()
10323 rc = __lpfc_sli_issue_iocb(phba, ring_number, piocb, flag); in lpfc_sli_issue_iocb()
10324 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_issue_iocb()
10341 lpfc_extra_ring_setup( struct lpfc_hba *phba) in lpfc_extra_ring_setup() argument
10346 psli = &phba->sli; in lpfc_extra_ring_setup()
10369 pring->prt[0].rctl = phba->cfg_multi_ring_rctl; in lpfc_extra_ring_setup()
10370 pring->prt[0].type = phba->cfg_multi_ring_type; in lpfc_extra_ring_setup()
10376 lpfc_sli_post_recovery_event(struct lpfc_hba *phba, in lpfc_sli_post_recovery_event() argument
10382 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_post_recovery_event()
10384 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_post_recovery_event()
10391 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_post_recovery_event()
10395 list_add_tail(&evtp->evt_listp, &phba->work_list); in lpfc_sli_post_recovery_event()
10396 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_post_recovery_event()
10398 lpfc_worker_wake_up(phba); in lpfc_sli_post_recovery_event()
10414 lpfc_sli_abts_err_handler(struct lpfc_hba *phba, in lpfc_sli_abts_err_handler() argument
10425 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_abts_err_handler()
10430 vport = lpfc_find_vport_by_vpid(phba, vpi); in lpfc_sli_abts_err_handler()
10442 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_abts_err_handler()
10460 lpfc_sli4_abts_err_handler(struct lpfc_hba *phba, in lpfc_sli4_abts_err_handler() argument
10467 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_abts_err_handler()
10473 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_abts_err_handler()
10476 ndlp->vport->vpi, phba->sli4_hba.rpi_ids[ndlp->nlp_rpi], in lpfc_sli4_abts_err_handler()
10489 lpfc_sli_post_recovery_event(phba, ndlp); in lpfc_sli4_abts_err_handler()
10506 lpfc_sli_async_event_handler(struct lpfc_hba * phba, in lpfc_sli_async_event_handler() argument
10525 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_async_event_handler()
10531 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_async_event_handler()
10538 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli_async_event_handler()
10544 lpfc_sli_abts_err_handler(phba, iocbq); in lpfc_sli_async_event_handler()
10548 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_async_event_handler()
10578 lpfc_sli4_setup(struct lpfc_hba *phba) in lpfc_sli4_setup() argument
10582 pring = phba->sli4_hba.els_wq->pring; in lpfc_sli4_setup()
10623 lpfc_sli_setup(struct lpfc_hba *phba) in lpfc_sli_setup() argument
10626 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_setup()
10651 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
10654 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
10659 (phba->cfg_hba_queue_depth * 2); in lpfc_sli_setup()
10667 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
10670 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
10673 pring->iotag_max = phba->cfg_hba_queue_depth; in lpfc_sli_setup()
10680 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
10683 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
10726 phba->brd_no, totiocbsize, in lpfc_sli_setup()
10729 if (phba->cfg_multi_ring_support == 2) in lpfc_sli_setup()
10730 lpfc_extra_ring_setup(phba); in lpfc_sli_setup()
10747 lpfc_sli4_queue_init(struct lpfc_hba *phba) in lpfc_sli4_queue_init() argument
10753 psli = &phba->sli; in lpfc_sli4_queue_init()
10754 spin_lock_irq(&phba->hbalock); in lpfc_sli4_queue_init()
10758 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_sli4_queue_init()
10759 pring = phba->sli4_hba.hdwq[i].io_wq->pring; in lpfc_sli4_queue_init()
10768 pring = phba->sli4_hba.els_wq->pring; in lpfc_sli4_queue_init()
10777 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_queue_init()
10778 pring = phba->sli4_hba.nvmels_wq->pring; in lpfc_sli4_queue_init()
10788 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_queue_init()
10803 lpfc_sli_queue_init(struct lpfc_hba *phba) in lpfc_sli_queue_init() argument
10809 psli = &phba->sli; in lpfc_sli_queue_init()
10810 spin_lock_irq(&phba->hbalock); in lpfc_sli_queue_init()
10828 spin_unlock_irq(&phba->hbalock); in lpfc_sli_queue_init()
10847 lpfc_sli_mbox_sys_flush(struct lpfc_hba *phba) in lpfc_sli_mbox_sys_flush() argument
10850 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_mbox_sys_flush()
10858 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_mbox_sys_flush()
10861 list_splice_init(&phba->sli.mboxq, &completions); in lpfc_sli_mbox_sys_flush()
10869 list_splice_init(&phba->sli.mboxq_cmpl, &completions); in lpfc_sli_mbox_sys_flush()
10870 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_mbox_sys_flush()
10880 pmb->mbox_cmpl(phba, pmb); in lpfc_sli_mbox_sys_flush()
10905 struct lpfc_hba *phba = vport->phba; in lpfc_sli_host_down() local
10906 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_host_down()
10916 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_host_down()
10923 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_sli_host_down()
10931 set_bit(LPFC_DATA_READY, &phba->data_flags); in lpfc_sli_host_down()
10943 lpfc_sli_issue_abort_iotag(phba, pring, iocb); in lpfc_sli_host_down()
10948 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_sli_host_down()
10952 if (pring == phba->sli4_hba.els_wq->pring) { in lpfc_sli_host_down()
10955 set_bit(LPFC_DATA_READY, &phba->data_flags); in lpfc_sli_host_down()
10970 lpfc_sli_issue_abort_iotag(phba, pring, iocb); in lpfc_sli_host_down()
10975 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_host_down()
10978 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_sli_host_down()
10999 lpfc_sli_hba_down(struct lpfc_hba *phba) in lpfc_sli_hba_down() argument
11002 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_hba_down()
11010 lpfc_sli_mbox_sys_shutdown(phba, LPFC_MBX_WAIT); in lpfc_sli_hba_down()
11012 lpfc_hba_down_prep(phba); in lpfc_sli_hba_down()
11017 lpfc_fabric_abort_hba(phba); in lpfc_sli_hba_down()
11019 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_hba_down()
11025 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_sli_hba_down()
11032 set_bit(LPFC_DATA_READY, &phba->data_flags); in lpfc_sli_hba_down()
11037 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_sli_hba_down()
11044 if (pring == phba->sli4_hba.els_wq->pring) { in lpfc_sli_hba_down()
11047 set_bit(LPFC_DATA_READY, &phba->data_flags); in lpfc_sli_hba_down()
11051 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hba_down()
11054 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_sli_hba_down()
11057 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_hba_down()
11058 list_splice_init(&phba->elsbuf, &completions); in lpfc_sli_hba_down()
11059 phba->elsbuf_cnt = 0; in lpfc_sli_hba_down()
11060 phba->elsbuf_prev_cnt = 0; in lpfc_sli_hba_down()
11061 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hba_down()
11066 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_sli_hba_down()
11076 spin_lock_irqsave(&phba->pport->work_port_lock, flags); in lpfc_sli_hba_down()
11077 phba->pport->work_port_events &= ~WORKER_MBOX_TMO; in lpfc_sli_hba_down()
11078 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); in lpfc_sli_hba_down()
11151 lpfc_sli_ringpostbuf_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_ringpostbuf_put() argument
11156 spin_lock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_put()
11159 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_put()
11175 lpfc_sli_get_buffer_tag(struct lpfc_hba *phba) in lpfc_sli_get_buffer_tag() argument
11177 spin_lock_irq(&phba->hbalock); in lpfc_sli_get_buffer_tag()
11178 phba->buffer_tag_count++; in lpfc_sli_get_buffer_tag()
11183 phba->buffer_tag_count |= QUE_BUFTAG_BIT; in lpfc_sli_get_buffer_tag()
11184 spin_unlock_irq(&phba->hbalock); in lpfc_sli_get_buffer_tag()
11185 return phba->buffer_tag_count; in lpfc_sli_get_buffer_tag()
11204 lpfc_sli_ring_taggedbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_ring_taggedbuf_get() argument
11211 spin_lock_irq(&phba->hbalock); in lpfc_sli_ring_taggedbuf_get()
11216 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ring_taggedbuf_get()
11221 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ring_taggedbuf_get()
11222 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_ring_taggedbuf_get()
11248 lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_ringpostbuf_get() argument
11255 spin_lock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_get()
11260 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_get()
11265 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_get()
11266 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_ringpostbuf_get()
11286 lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, in lpfc_sli_abort_els_cmpl() argument
11302 spin_lock_irq(&phba->hbalock); in lpfc_sli_abort_els_cmpl()
11303 if (phba->sli_rev < LPFC_SLI_REV4) { in lpfc_sli_abort_els_cmpl()
11307 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_els_cmpl()
11311 abort_iotag <= phba->sli.last_iotag) in lpfc_sli_abort_els_cmpl()
11313 phba->sli.iocbq_lookup[abort_iotag]; in lpfc_sli_abort_els_cmpl()
11320 abort_iocb = phba->sli.iocbq_lookup[abort_context]; in lpfc_sli_abort_els_cmpl()
11322 lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_SLI, in lpfc_sli_abort_els_cmpl()
11329 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_els_cmpl()
11332 lpfc_sli_release_iocbq(phba, cmdiocb); in lpfc_sli_abort_els_cmpl()
11348 lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, in lpfc_ignore_els_cmpl() argument
11354 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, in lpfc_ignore_els_cmpl()
11360 lpfc_ct_free_iocb(phba, cmdiocb); in lpfc_ignore_els_cmpl()
11362 lpfc_els_free_iocb(phba, cmdiocb); in lpfc_ignore_els_cmpl()
11380 lpfc_sli_abort_iotag_issue(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_abort_iotag_issue() argument
11403 abtsiocbp = __lpfc_sli_get_iocbq(phba); in lpfc_sli_abort_iotag_issue()
11415 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_abort_iotag_issue()
11435 if (phba->link_state >= LPFC_LINK_UP) in lpfc_sli_abort_iotag_issue()
11450 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_abort_iotag_issue()
11451 pring = lpfc_sli4_calc_ring(phba, abtsiocbp); in lpfc_sli_abort_iotag_issue()
11456 retval = __lpfc_sli_issue_iocb(phba, pring->ringno, in lpfc_sli_abort_iotag_issue()
11460 retval = __lpfc_sli_issue_iocb(phba, pring->ringno, in lpfc_sli_abort_iotag_issue()
11465 __lpfc_sli_release_iocbq(phba, abtsiocbp); in lpfc_sli_abort_iotag_issue()
11489 lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_issue_abort_iotag() argument
11496 lockdep_assert_held(&phba->hbalock); in lpfc_sli_issue_abort_iotag()
11531 retval = lpfc_sli_abort_iotag_issue(phba, pring, cmdiocb); in lpfc_sli_issue_abort_iotag()
11549 lpfc_sli_hba_iocb_abort(struct lpfc_hba *phba) in lpfc_sli_hba_iocb_abort() argument
11551 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_hba_iocb_abort()
11556 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_sli_hba_iocb_abort()
11559 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_sli_hba_iocb_abort()
11563 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_sli_hba_iocb_abort()
11567 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_sli_hba_iocb_abort()
11667 struct lpfc_hba *phba = vport->phba; in lpfc_sli_sum_iocb() local
11671 spin_lock_irq(&phba->hbalock); in lpfc_sli_sum_iocb()
11672 for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) { in lpfc_sli_sum_iocb()
11673 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli_sum_iocb()
11679 spin_unlock_irq(&phba->hbalock); in lpfc_sli_sum_iocb()
11695 lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, in lpfc_sli_abort_fcp_cmpl() argument
11698 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_abort_fcp_cmpl()
11706 lpfc_sli_release_iocbq(phba, cmdiocb); in lpfc_sli_abort_fcp_cmpl()
11735 struct lpfc_hba *phba = vport->phba; in lpfc_sli_abort_iocb() local
11744 if (phba->hba_flag & HBA_IOQ_FLUSH) in lpfc_sli_abort_iocb()
11747 for (i = 1; i <= phba->sli.last_iotag; i++) { in lpfc_sli_abort_iocb()
11748 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli_abort_iocb()
11762 abtsiocb = lpfc_sli_get_iocbq(phba); in lpfc_sli_abort_iocb()
11774 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_abort_iocb()
11789 if (lpfc_is_link_up(phba)) in lpfc_sli_abort_iocb()
11796 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_abort_iocb()
11797 pring_s4 = lpfc_sli4_calc_ring(phba, iocbq); in lpfc_sli_abort_iocb()
11800 ret_val = lpfc_sli_issue_iocb(phba, pring_s4->ringno, in lpfc_sli_abort_iocb()
11803 ret_val = lpfc_sli_issue_iocb(phba, pring->ringno, in lpfc_sli_abort_iocb()
11806 lpfc_sli_release_iocbq(phba, abtsiocb); in lpfc_sli_abort_iocb()
11841 struct lpfc_hba *phba = vport->phba; in lpfc_sli_abort_taskmgmt() local
11851 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_abort_taskmgmt()
11854 if (phba->hba_flag & HBA_IOQ_FLUSH) { in lpfc_sli_abort_taskmgmt()
11855 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_abort_taskmgmt()
11860 for (i = 1; i <= phba->sli.last_iotag; i++) { in lpfc_sli_abort_taskmgmt()
11861 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli_abort_taskmgmt()
11876 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_abort_taskmgmt()
11878 phba->sli4_hba.hdwq[iocbq->hba_wqidx].io_wq->pring; in lpfc_sli_abort_taskmgmt()
11893 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_abort_taskmgmt()
11900 abtsiocbq = __lpfc_sli_get_iocbq(phba); in lpfc_sli_abort_taskmgmt()
11902 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_abort_taskmgmt()
11911 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_abort_taskmgmt()
11929 if (lpfc_is_link_up(phba) && in lpfc_sli_abort_taskmgmt()
11944 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_abort_taskmgmt()
11945 ret_val = __lpfc_sli_issue_iocb(phba, pring_s4->ringno, in lpfc_sli_abort_taskmgmt()
11949 ret_val = __lpfc_sli_issue_iocb(phba, pring->ringno, in lpfc_sli_abort_taskmgmt()
11956 __lpfc_sli_release_iocbq(phba, abtsiocbq); in lpfc_sli_abort_taskmgmt()
11960 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_abort_taskmgmt()
11982 lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba, in lpfc_sli_wake_iocb_wait() argument
11990 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_wake_iocb_wait()
11999 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_wake_iocb_wait()
12003 (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, NULL); in lpfc_sli_wake_iocb_wait()
12005 lpfc_sli_release_iocbq(phba, cmdiocbq); in lpfc_sli_wake_iocb_wait()
12028 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_wake_iocb_wait()
12045 lpfc_chk_iocb_flg(struct lpfc_hba *phba, in lpfc_chk_iocb_flg() argument
12051 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_chk_iocb_flg()
12053 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_chk_iocb_flg()
12095 lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, in lpfc_sli_issue_iocb_wait() argument
12112 if (phba->sli_rev >= LPFC_SLI_REV4) in lpfc_sli_issue_iocb_wait()
12113 pring = lpfc_sli4_calc_ring(phba, piocb); in lpfc_sli_issue_iocb_wait()
12115 pring = &phba->sli.sli3_ring[ring_number]; in lpfc_sli_issue_iocb_wait()
12131 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_sli_issue_iocb_wait()
12132 if (lpfc_readl(phba->HCregaddr, &creg_val)) in lpfc_sli_issue_iocb_wait()
12135 writel(creg_val, phba->HCregaddr); in lpfc_sli_issue_iocb_wait()
12136 readl(phba->HCregaddr); /* flush */ in lpfc_sli_issue_iocb_wait()
12139 retval = lpfc_sli_issue_iocb(phba, ring_number, piocb, in lpfc_sli_issue_iocb_wait()
12144 lpfc_chk_iocb_flg(phba, piocb, LPFC_IO_WAKE), in lpfc_sli_issue_iocb_wait()
12146 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_issue_iocb_wait()
12157 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_issue_iocb_wait()
12159 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_issue_iocb_wait()
12167 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_iocb_wait()
12172 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_issue_iocb_wait()
12179 if (phba->cfg_log_verbose & LOG_SLI) { in lpfc_sli_issue_iocb_wait()
12186 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_issue_iocb_wait()
12188 phba->iocb_cnt, txq_cnt, txcmplq_cnt); in lpfc_sli_issue_iocb_wait()
12192 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_issue_iocb_wait()
12198 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_sli_issue_iocb_wait()
12199 if (lpfc_readl(phba->HCregaddr, &creg_val)) in lpfc_sli_issue_iocb_wait()
12202 writel(creg_val, phba->HCregaddr); in lpfc_sli_issue_iocb_wait()
12203 readl(phba->HCregaddr); /* flush */ in lpfc_sli_issue_iocb_wait()
12241 lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, in lpfc_sli_issue_mbox_wait() argument
12256 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); in lpfc_sli_issue_mbox_wait()
12261 spin_lock_irqsave(&phba->hbalock, flag); in lpfc_sli_issue_mbox_wait()
12273 spin_unlock_irqrestore(&phba->hbalock, flag); in lpfc_sli_issue_mbox_wait()
12295 lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) in lpfc_sli_mbox_sys_shutdown() argument
12297 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_mbox_sys_shutdown()
12303 lpfc_sli_mbox_sys_flush(phba); in lpfc_sli_mbox_sys_shutdown()
12311 spin_lock_irq(&phba->hbalock); in lpfc_sli_mbox_sys_shutdown()
12318 if (phba->sli.mbox_active) in lpfc_sli_mbox_sys_shutdown()
12319 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_sli_mbox_sys_shutdown()
12320 phba->sli.mbox_active) * in lpfc_sli_mbox_sys_shutdown()
12322 spin_unlock_irq(&phba->hbalock); in lpfc_sli_mbox_sys_shutdown()
12327 while (phba->sli.mbox_active) { in lpfc_sli_mbox_sys_shutdown()
12337 spin_unlock_irq(&phba->hbalock); in lpfc_sli_mbox_sys_shutdown()
12343 lpfc_sli_mbox_sys_flush(phba); in lpfc_sli_mbox_sys_shutdown()
12358 lpfc_sli_eratt_read(struct lpfc_hba *phba) in lpfc_sli_eratt_read() argument
12363 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_eratt_read()
12368 if (lpfc_sli_read_hs(phba)) in lpfc_sli_eratt_read()
12372 if ((HS_FFER1 & phba->work_hs) && in lpfc_sli_eratt_read()
12374 HS_FFER6 | HS_FFER7 | HS_FFER8) & phba->work_hs)) { in lpfc_sli_eratt_read()
12375 phba->hba_flag |= DEFER_ERATT; in lpfc_sli_eratt_read()
12377 writel(0, phba->HCregaddr); in lpfc_sli_eratt_read()
12378 readl(phba->HCregaddr); in lpfc_sli_eratt_read()
12382 phba->work_ha |= HA_ERATT; in lpfc_sli_eratt_read()
12384 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli_eratt_read()
12391 phba->work_hs |= UNPLUG_ERR; in lpfc_sli_eratt_read()
12393 phba->work_ha |= HA_ERATT; in lpfc_sli_eratt_read()
12395 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli_eratt_read()
12411 lpfc_sli4_eratt_read(struct lpfc_hba *phba) in lpfc_sli4_eratt_read() argument
12422 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_eratt_read()
12425 if (lpfc_readl(phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_sli4_eratt_read()
12427 lpfc_readl(phba->sli4_hba.u.if_type0.UERRHIregaddr, in lpfc_sli4_eratt_read()
12429 phba->work_hs |= UNPLUG_ERR; in lpfc_sli4_eratt_read()
12430 phba->work_ha |= HA_ERATT; in lpfc_sli4_eratt_read()
12431 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli4_eratt_read()
12434 if ((~phba->sli4_hba.ue_mask_lo & uerr_sta_lo) || in lpfc_sli4_eratt_read()
12435 (~phba->sli4_hba.ue_mask_hi & uerr_sta_hi)) { in lpfc_sli4_eratt_read()
12436 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_eratt_read()
12442 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_eratt_read()
12443 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_eratt_read()
12444 phba->work_status[0] = uerr_sta_lo; in lpfc_sli4_eratt_read()
12445 phba->work_status[1] = uerr_sta_hi; in lpfc_sli4_eratt_read()
12446 phba->work_ha |= HA_ERATT; in lpfc_sli4_eratt_read()
12447 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli4_eratt_read()
12453 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_eratt_read()
12455 lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_eratt_read()
12457 phba->work_hs |= UNPLUG_ERR; in lpfc_sli4_eratt_read()
12458 phba->work_ha |= HA_ERATT; in lpfc_sli4_eratt_read()
12459 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli4_eratt_read()
12463 phba->work_status[0] = in lpfc_sli4_eratt_read()
12464 readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_sli4_eratt_read()
12465 phba->work_status[1] = in lpfc_sli4_eratt_read()
12466 readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_sli4_eratt_read()
12468 if (phba->work_status[0] == in lpfc_sli4_eratt_read()
12470 phba->work_status[1] == SLIPORT_ERR2_REG_FW_RESTART) in lpfc_sli4_eratt_read()
12472 lpfc_printf_log(phba, KERN_ERR, logmask, in lpfc_sli4_eratt_read()
12479 phba->work_status[0], in lpfc_sli4_eratt_read()
12480 phba->work_status[1]); in lpfc_sli4_eratt_read()
12481 phba->work_ha |= HA_ERATT; in lpfc_sli4_eratt_read()
12482 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli4_eratt_read()
12488 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_eratt_read()
12508 lpfc_sli_check_eratt(struct lpfc_hba *phba) in lpfc_sli_check_eratt() argument
12515 if (phba->link_flag & LS_IGNORE_ERATT) in lpfc_sli_check_eratt()
12519 spin_lock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
12520 if (phba->hba_flag & HBA_ERATT_HANDLED) { in lpfc_sli_check_eratt()
12522 spin_unlock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
12530 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_check_eratt()
12531 spin_unlock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
12536 if (unlikely(pci_channel_offline(phba->pcidev))) { in lpfc_sli_check_eratt()
12537 spin_unlock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
12541 switch (phba->sli_rev) { in lpfc_sli_check_eratt()
12545 ha_copy = lpfc_sli_eratt_read(phba); in lpfc_sli_check_eratt()
12549 ha_copy = lpfc_sli4_eratt_read(phba); in lpfc_sli_check_eratt()
12552 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_check_eratt()
12554 phba->sli_rev); in lpfc_sli_check_eratt()
12558 spin_unlock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
12574 lpfc_intr_state_check(struct lpfc_hba *phba) in lpfc_intr_state_check() argument
12577 if (unlikely(pci_channel_offline(phba->pcidev))) in lpfc_intr_state_check()
12581 phba->sli.slistat.sli_intr++; in lpfc_intr_state_check()
12584 if (unlikely(phba->link_state < LPFC_LINK_DOWN)) in lpfc_intr_state_check()
12614 struct lpfc_hba *phba; in lpfc_sli_sp_intr_handler() local
12632 phba = (struct lpfc_hba *)dev_id; in lpfc_sli_sp_intr_handler()
12634 if (unlikely(!phba)) in lpfc_sli_sp_intr_handler()
12641 if (phba->intr_type == MSIX) { in lpfc_sli_sp_intr_handler()
12643 if (lpfc_intr_state_check(phba)) in lpfc_sli_sp_intr_handler()
12646 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12647 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_sp_intr_handler()
12652 if (phba->link_flag & LS_IGNORE_ERATT) in lpfc_sli_sp_intr_handler()
12656 if (phba->hba_flag & HBA_ERATT_HANDLED) in lpfc_sli_sp_intr_handler()
12661 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli_sp_intr_handler()
12668 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_sp_intr_handler()
12669 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12674 if (lpfc_readl(phba->HCregaddr, &hc_copy)) in lpfc_sli_sp_intr_handler()
12679 phba->HCregaddr); in lpfc_sli_sp_intr_handler()
12681 phba->HAregaddr); in lpfc_sli_sp_intr_handler()
12682 writel(hc_copy, phba->HCregaddr); in lpfc_sli_sp_intr_handler()
12683 readl(phba->HAregaddr); /* flush */ in lpfc_sli_sp_intr_handler()
12684 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12686 ha_copy = phba->ha_copy; in lpfc_sli_sp_intr_handler()
12688 work_ha_copy = ha_copy & phba->work_ha_mask; in lpfc_sli_sp_intr_handler()
12692 if (phba->sli.sli_flag & LPFC_PROCESS_LA) { in lpfc_sli_sp_intr_handler()
12697 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12698 phba->sli.sli_flag &= ~LPFC_PROCESS_LA; in lpfc_sli_sp_intr_handler()
12699 if (lpfc_readl(phba->HCregaddr, &control)) in lpfc_sli_sp_intr_handler()
12702 writel(control, phba->HCregaddr); in lpfc_sli_sp_intr_handler()
12703 readl(phba->HCregaddr); /* flush */ in lpfc_sli_sp_intr_handler()
12704 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12719 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12720 if (lpfc_readl(phba->HCregaddr, &control)) in lpfc_sli_sp_intr_handler()
12723 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_sp_intr_handler()
12726 (uint32_t)phba->sli.slistat.sli_intr); in lpfc_sli_sp_intr_handler()
12729 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_sp_intr_handler()
12732 phba->work_ha, work_ha_copy, in lpfc_sli_sp_intr_handler()
12734 &phba->work_waitq)); in lpfc_sli_sp_intr_handler()
12738 writel(control, phba->HCregaddr); in lpfc_sli_sp_intr_handler()
12739 readl(phba->HCregaddr); /* flush */ in lpfc_sli_sp_intr_handler()
12742 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_sp_intr_handler()
12745 phba->work_ha, work_ha_copy, in lpfc_sli_sp_intr_handler()
12747 &phba->work_waitq)); in lpfc_sli_sp_intr_handler()
12749 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12752 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12754 if (lpfc_sli_read_hs(phba)) in lpfc_sli_sp_intr_handler()
12760 if ((HS_FFER1 & phba->work_hs) && in lpfc_sli_sp_intr_handler()
12763 phba->work_hs)) { in lpfc_sli_sp_intr_handler()
12764 phba->hba_flag |= DEFER_ERATT; in lpfc_sli_sp_intr_handler()
12766 writel(0, phba->HCregaddr); in lpfc_sli_sp_intr_handler()
12767 readl(phba->HCregaddr); in lpfc_sli_sp_intr_handler()
12771 if ((work_ha_copy & HA_MBATT) && (phba->sli.mbox_active)) { in lpfc_sli_sp_intr_handler()
12772 pmb = phba->sli.mbox_active; in lpfc_sli_sp_intr_handler()
12774 mbox = phba->mbox; in lpfc_sli_sp_intr_handler()
12780 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12785 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_sp_intr_handler()
12795 phba->sli.mbox_active = NULL; in lpfc_sli_sp_intr_handler()
12796 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12797 phba->last_completion_time = jiffies; in lpfc_sli_sp_intr_handler()
12798 del_timer(&phba->sli.mbox_tmo); in lpfc_sli_sp_intr_handler()
12805 phba->mbox_ext, in lpfc_sli_sp_intr_handler()
12830 lpfc_unreg_login(phba, in lpfc_sli_sp_intr_handler()
12839 rc = lpfc_sli_issue_mbox(phba, in lpfc_sli_sp_intr_handler()
12843 lpfc_printf_log(phba, in lpfc_sli_sp_intr_handler()
12853 &phba->pport->work_port_lock, in lpfc_sli_sp_intr_handler()
12855 phba->pport->work_port_events &= in lpfc_sli_sp_intr_handler()
12858 &phba->pport->work_port_lock, in lpfc_sli_sp_intr_handler()
12860 lpfc_mbox_cmpl_put(phba, pmb); in lpfc_sli_sp_intr_handler()
12863 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12866 (phba->sli.mbox_active == NULL)) { in lpfc_sli_sp_intr_handler()
12870 rc = lpfc_sli_issue_mbox(phba, NULL, in lpfc_sli_sp_intr_handler()
12874 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli_sp_intr_handler()
12880 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12881 phba->work_ha |= work_ha_copy; in lpfc_sli_sp_intr_handler()
12882 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12883 lpfc_worker_wake_up(phba); in lpfc_sli_sp_intr_handler()
12887 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
12914 struct lpfc_hba *phba; in lpfc_sli_fp_intr_handler() local
12923 phba = (struct lpfc_hba *) dev_id; in lpfc_sli_fp_intr_handler()
12925 if (unlikely(!phba)) in lpfc_sli_fp_intr_handler()
12932 if (phba->intr_type == MSIX) { in lpfc_sli_fp_intr_handler()
12934 if (lpfc_intr_state_check(phba)) in lpfc_sli_fp_intr_handler()
12937 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_fp_intr_handler()
12940 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_fp_intr_handler()
12945 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_fp_intr_handler()
12946 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_fp_intr_handler()
12950 phba->HAregaddr); in lpfc_sli_fp_intr_handler()
12951 readl(phba->HAregaddr); /* flush */ in lpfc_sli_fp_intr_handler()
12952 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_fp_intr_handler()
12954 ha_copy = phba->ha_copy; in lpfc_sli_fp_intr_handler()
12959 ha_copy &= ~(phba->work_ha_mask); in lpfc_sli_fp_intr_handler()
12963 pring = &phba->sli.sli3_ring[LPFC_FCP_RING]; in lpfc_sli_fp_intr_handler()
12965 lpfc_sli_handle_fast_ring_event(phba, pring, status); in lpfc_sli_fp_intr_handler()
12967 if (phba->cfg_multi_ring_support == 2) { in lpfc_sli_fp_intr_handler()
12975 lpfc_sli_handle_fast_ring_event(phba, in lpfc_sli_fp_intr_handler()
12976 &phba->sli.sli3_ring[LPFC_EXTRA_RING], in lpfc_sli_fp_intr_handler()
13003 struct lpfc_hba *phba; in lpfc_sli_intr_handler() local
13012 phba = (struct lpfc_hba *) dev_id; in lpfc_sli_intr_handler()
13014 if (unlikely(!phba)) in lpfc_sli_intr_handler()
13018 if (lpfc_intr_state_check(phba)) in lpfc_sli_intr_handler()
13021 spin_lock(&phba->hbalock); in lpfc_sli_intr_handler()
13022 if (lpfc_readl(phba->HAregaddr, &phba->ha_copy)) { in lpfc_sli_intr_handler()
13023 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
13027 if (unlikely(!phba->ha_copy)) { in lpfc_sli_intr_handler()
13028 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
13030 } else if (phba->ha_copy & HA_ERATT) { in lpfc_sli_intr_handler()
13031 if (phba->hba_flag & HBA_ERATT_HANDLED) in lpfc_sli_intr_handler()
13033 phba->ha_copy &= ~HA_ERATT; in lpfc_sli_intr_handler()
13036 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli_intr_handler()
13042 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_intr_handler()
13043 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
13048 if (lpfc_readl(phba->HCregaddr, &hc_copy)) { in lpfc_sli_intr_handler()
13049 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
13054 phba->HCregaddr); in lpfc_sli_intr_handler()
13055 writel((phba->ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); in lpfc_sli_intr_handler()
13056 writel(hc_copy, phba->HCregaddr); in lpfc_sli_intr_handler()
13057 readl(phba->HAregaddr); /* flush */ in lpfc_sli_intr_handler()
13058 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
13065 status1 = phba->ha_copy & (HA_MBATT | HA_LATT | HA_ERATT); in lpfc_sli_intr_handler()
13068 status2 = (phba->ha_copy & (HA_RXMASK << (4*LPFC_ELS_RING))); in lpfc_sli_intr_handler()
13081 status1 = (phba->ha_copy & (HA_RXMASK << (4*LPFC_FCP_RING))); in lpfc_sli_intr_handler()
13085 if (phba->cfg_multi_ring_support == 2) { in lpfc_sli_intr_handler()
13086 status2 = (phba->ha_copy & (HA_RXMASK << (4*LPFC_EXTRA_RING))); in lpfc_sli_intr_handler()
13107 void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba) in lpfc_sli4_els_xri_abort_event_proc() argument
13113 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_els_xri_abort_event_proc()
13114 phba->hba_flag &= ~ELS_XRI_ABORT_EVENT; in lpfc_sli4_els_xri_abort_event_proc()
13115 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_els_xri_abort_event_proc()
13118 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_els_xri_abort_event_proc()
13119 while (!list_empty(&phba->sli4_hba.sp_els_xri_aborted_work_queue)) { in lpfc_sli4_els_xri_abort_event_proc()
13121 list_remove_head(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_els_xri_abort_event_proc()
13123 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, in lpfc_sli4_els_xri_abort_event_proc()
13126 lpfc_sli4_els_xri_aborted(phba, &cq_event->cqe.wcqe_axri); in lpfc_sli4_els_xri_abort_event_proc()
13129 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_els_xri_abort_event_proc()
13130 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, in lpfc_sli4_els_xri_abort_event_proc()
13133 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); in lpfc_sli4_els_xri_abort_event_proc()
13148 lpfc_sli4_iocb_param_transfer(struct lpfc_hba *phba, in lpfc_sli4_iocb_param_transfer() argument
13246 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_iocb_param_transfer()
13248 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_iocb_param_transfer()
13264 lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba, in lpfc_sli4_els_wcqe_to_rspiocbq() argument
13272 pring = lpfc_phba_elsring(phba); in lpfc_sli4_els_wcqe_to_rspiocbq()
13279 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, in lpfc_sli4_els_wcqe_to_rspiocbq()
13282 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_els_wcqe_to_rspiocbq()
13287 lpfc_sli_release_iocbq(phba, irspiocbq); in lpfc_sli4_els_wcqe_to_rspiocbq()
13293 lpfc_sli_ringtxcmpl_put(phba, pring, cmdiocbq); in lpfc_sli4_els_wcqe_to_rspiocbq()
13297 lpfc_sli4_iocb_param_transfer(phba, irspiocbq, cmdiocbq, wcqe); in lpfc_sli4_els_wcqe_to_rspiocbq()
13303 lpfc_cq_event_setup(struct lpfc_hba *phba, void *entry, int size) in lpfc_cq_event_setup() argument
13308 cq_event = lpfc_sli4_cq_event_alloc(phba); in lpfc_cq_event_setup()
13310 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_cq_event_setup()
13331 lpfc_sli4_sp_handle_async_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe) in lpfc_sli4_sp_handle_async_event() argument
13336 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_sp_handle_async_event()
13341 cq_event = lpfc_cq_event_setup(phba, mcqe, sizeof(struct lpfc_mcqe)); in lpfc_sli4_sp_handle_async_event()
13345 spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_sp_handle_async_event()
13346 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_sp_handle_async_event()
13347 spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); in lpfc_sli4_sp_handle_async_event()
13350 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_async_event()
13351 phba->hba_flag |= ASYNC_EVENT; in lpfc_sli4_sp_handle_async_event()
13352 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_async_event()
13368 lpfc_sli4_sp_handle_mbox_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe) in lpfc_sli4_sp_handle_mbox_event() argument
13386 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13387 pmb = phba->sli.mbox_active; in lpfc_sli4_sp_handle_mbox_event()
13389 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sp_handle_mbox_event()
13391 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13394 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13397 mbox = phba->mbox; in lpfc_sli4_sp_handle_mbox_event()
13401 phba->last_completion_time = jiffies; in lpfc_sli4_sp_handle_mbox_event()
13402 del_timer(&phba->sli.mbox_tmo); in lpfc_sli4_sp_handle_mbox_event()
13430 lpfc_unreg_login(phba, vport->vpi, in lpfc_sli4_sp_handle_mbox_event()
13436 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_sp_handle_mbox_event()
13438 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli4_sp_handle_mbox_event()
13446 spin_lock_irqsave(&phba->pport->work_port_lock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13447 phba->pport->work_port_events &= ~WORKER_MBOX_TMO; in lpfc_sli4_sp_handle_mbox_event()
13448 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13451 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13452 __lpfc_mbox_cmpl_put(phba, pmb); in lpfc_sli4_sp_handle_mbox_event()
13453 phba->work_ha |= HA_MBATT; in lpfc_sli4_sp_handle_mbox_event()
13454 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13458 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13460 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_sp_handle_mbox_event()
13462 phba->sli.mbox_active = NULL; in lpfc_sli4_sp_handle_mbox_event()
13464 lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); in lpfc_sli4_sp_handle_mbox_event()
13465 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13467 lpfc_worker_wake_up(phba); in lpfc_sli4_sp_handle_mbox_event()
13471 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13473 lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); in lpfc_sli4_sp_handle_mbox_event()
13474 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
13491 lpfc_sli4_sp_handle_mcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_sp_handle_mcqe() argument
13504 workposted = lpfc_sli4_sp_handle_mbox_event(phba, &mcqe); in lpfc_sli4_sp_handle_mcqe()
13506 workposted = lpfc_sli4_sp_handle_async_event(phba, &mcqe); in lpfc_sli4_sp_handle_mcqe()
13521 lpfc_sli4_sp_handle_els_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_sp_handle_els_wcqe() argument
13533 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_sp_handle_els_wcqe()
13542 irspiocbq = lpfc_sli_get_iocbq(phba); in lpfc_sli4_sp_handle_els_wcqe()
13548 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sp_handle_els_wcqe()
13551 txq_cnt, phba->iocb_cnt, in lpfc_sli4_sp_handle_els_wcqe()
13558 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_els_wcqe()
13560 &phba->sli4_hba.sp_queue_event); in lpfc_sli4_sp_handle_els_wcqe()
13561 phba->hba_flag |= HBA_SP_QUEUE_EVT; in lpfc_sli4_sp_handle_els_wcqe()
13562 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_els_wcqe()
13576 lpfc_sli4_sp_handle_rel_wcqe(struct lpfc_hba *phba, in lpfc_sli4_sp_handle_rel_wcqe() argument
13580 if (unlikely(!phba->sli4_hba.els_wq)) in lpfc_sli4_sp_handle_rel_wcqe()
13583 if (bf_get(lpfc_wcqe_r_wq_id, wcqe) == phba->sli4_hba.els_wq->queue_id) in lpfc_sli4_sp_handle_rel_wcqe()
13584 lpfc_sli4_wq_release(phba->sli4_hba.els_wq, in lpfc_sli4_sp_handle_rel_wcqe()
13587 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_sp_handle_rel_wcqe()
13591 phba->sli4_hba.els_wq->queue_id); in lpfc_sli4_sp_handle_rel_wcqe()
13605 lpfc_sli4_sp_handle_abort_xri_wcqe(struct lpfc_hba *phba, in lpfc_sli4_sp_handle_abort_xri_wcqe() argument
13615 lpfc_sli4_io_xri_aborted(phba, wcqe, cq->hdwq); in lpfc_sli4_sp_handle_abort_xri_wcqe()
13616 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { in lpfc_sli4_sp_handle_abort_xri_wcqe()
13618 if (phba->nvmet_support) in lpfc_sli4_sp_handle_abort_xri_wcqe()
13619 lpfc_sli4_nvmet_xri_aborted(phba, wcqe); in lpfc_sli4_sp_handle_abort_xri_wcqe()
13625 cq_event = lpfc_cq_event_setup(phba, wcqe, sizeof(*wcqe)); in lpfc_sli4_sp_handle_abort_xri_wcqe()
13631 spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, in lpfc_sli4_sp_handle_abort_xri_wcqe()
13634 &phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_sp_handle_abort_xri_wcqe()
13636 phba->hba_flag |= ELS_XRI_ABORT_EVENT; in lpfc_sli4_sp_handle_abort_xri_wcqe()
13637 spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, in lpfc_sli4_sp_handle_abort_xri_wcqe()
13642 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sp_handle_abort_xri_wcqe()
13665 lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe) in lpfc_sli4_sp_handle_rcqe() argument
13669 struct lpfc_queue *hrq = phba->sli4_hba.hdr_rq; in lpfc_sli4_sp_handle_rcqe()
13670 struct lpfc_queue *drq = phba->sli4_hba.dat_rq; in lpfc_sli4_sp_handle_rcqe()
13690 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sp_handle_rcqe()
13694 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
13696 dma_buf = lpfc_sli_hbqbuf_get(&phba->hbqs[0].hbq_buffer_list); in lpfc_sli4_sp_handle_rcqe()
13699 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
13710 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
13712 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_sli4_sp_handle_rcqe()
13713 lpfc_sli4_handle_mds_loopback(phba->pport, in lpfc_sli4_sp_handle_rcqe()
13716 lpfc_in_buf_free(phba, &dma_buf->dbuf); in lpfc_sli4_sp_handle_rcqe()
13722 &phba->sli4_hba.sp_queue_event); in lpfc_sli4_sp_handle_rcqe()
13724 phba->hba_flag |= HBA_SP_QUEUE_EVT; in lpfc_sli4_sp_handle_rcqe()
13725 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
13729 if (phba->nvmet_support) { in lpfc_sli4_sp_handle_rcqe()
13730 tgtp = phba->targetport->private; in lpfc_sli4_sp_handle_rcqe()
13731 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sp_handle_rcqe()
13745 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
13746 phba->hba_flag |= HBA_POST_RECEIVE_BUFFER; in lpfc_sli4_sp_handle_rcqe()
13747 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
13767 lpfc_sli4_sp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_sp_handle_cqe() argument
13780 phba->last_completion_time = jiffies; in lpfc_sli4_sp_handle_cqe()
13781 workposted = lpfc_sli4_sp_handle_els_wcqe(phba, cq, in lpfc_sli4_sp_handle_cqe()
13786 lpfc_sli4_sp_handle_rel_wcqe(phba, in lpfc_sli4_sp_handle_cqe()
13791 phba->last_completion_time = jiffies; in lpfc_sli4_sp_handle_cqe()
13792 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq, in lpfc_sli4_sp_handle_cqe()
13798 phba->last_completion_time = jiffies; in lpfc_sli4_sp_handle_cqe()
13799 workposted = lpfc_sli4_sp_handle_rcqe(phba, in lpfc_sli4_sp_handle_cqe()
13803 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sp_handle_cqe()
13826 lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, in lpfc_sli4_sp_handle_eqe() argument
13843 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_sli4_sp_handle_eqe()
13844 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sp_handle_eqe()
13854 ret = queue_work(phba->wq, &cq->spwork); in lpfc_sli4_sp_handle_eqe()
13856 ret = queue_work_on(cq->chann, phba->wq, &cq->spwork); in lpfc_sli4_sp_handle_eqe()
13859 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sp_handle_eqe()
13887 __lpfc_sli4_process_cq(struct lpfc_hba *phba, struct lpfc_queue *cq, in __lpfc_sli4_process_cq() argument
13907 workposted |= handler(phba, cq, cqe); in __lpfc_sli4_process_cq()
13908 __lpfc_sli4_consume_cqe(phba, cq, cqe); in __lpfc_sli4_process_cq()
13915 phba->sli4_hba.sli4_write_cq_db(phba, cq, consumed, in __lpfc_sli4_process_cq()
13926 if (count >= phba->cfg_cq_poll_threshold) { in __lpfc_sli4_process_cq()
13943 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in __lpfc_sli4_process_cq()
13950 phba->sli4_hba.sli4_write_cq_db(phba, cq, consumed, in __lpfc_sli4_process_cq()
13974 struct lpfc_hba *phba = cq->phba; in __lpfc_sli4_sp_process_cq() local
13982 workposted |= __lpfc_sli4_process_cq(phba, cq, in __lpfc_sli4_sp_process_cq()
13988 workposted |= __lpfc_sli4_process_cq(phba, cq, in __lpfc_sli4_sp_process_cq()
13992 workposted |= __lpfc_sli4_process_cq(phba, cq, in __lpfc_sli4_sp_process_cq()
13997 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in __lpfc_sli4_sp_process_cq()
14005 ret = queue_delayed_work(phba->wq, &cq->sched_spwork, in __lpfc_sli4_sp_process_cq()
14008 ret = queue_delayed_work_on(cq->chann, phba->wq, in __lpfc_sli4_sp_process_cq()
14011 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in __lpfc_sli4_sp_process_cq()
14019 lpfc_worker_wake_up(phba); in __lpfc_sli4_sp_process_cq()
14062 lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_fp_handle_fcp_wcqe() argument
14079 phba->lpfc_rampdown_queue_depth(phba); in lpfc_sli4_fp_handle_fcp_wcqe()
14082 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_fp_handle_fcp_wcqe()
14094 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, in lpfc_sli4_fp_handle_fcp_wcqe()
14097 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_fp_handle_fcp_wcqe()
14109 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_fp_handle_fcp_wcqe()
14111 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_fp_handle_fcp_wcqe()
14115 (cmdiocbq->wqe_cmpl)(phba, cmdiocbq, wcqe); in lpfc_sli4_fp_handle_fcp_wcqe()
14118 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_fp_handle_fcp_wcqe()
14126 lpfc_sli4_iocb_param_transfer(phba, &irspiocbq, cmdiocbq, wcqe); in lpfc_sli4_fp_handle_fcp_wcqe()
14129 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_fp_handle_fcp_wcqe()
14131 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_fp_handle_fcp_wcqe()
14135 (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, &irspiocbq); in lpfc_sli4_fp_handle_fcp_wcqe()
14148 lpfc_sli4_fp_handle_rel_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_fp_handle_rel_wcqe() argument
14162 lpfc_nvmet_wqfull_process(phba, childwq); in lpfc_sli4_fp_handle_rel_wcqe()
14169 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_fp_handle_rel_wcqe()
14185 lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_nvmet_handle_rcqe() argument
14198 if ((phba->nvmet_support == 0) || in lpfc_sli4_nvmet_handle_rcqe()
14199 (phba->sli4_hba.nvmet_cqset == NULL)) in lpfc_sli4_nvmet_handle_rcqe()
14202 idx = cq->queue_id - phba->sli4_hba.nvmet_cqset[0]->queue_id; in lpfc_sli4_nvmet_handle_rcqe()
14203 hrq = phba->sli4_hba.nvmet_mrq_hdr[idx]; in lpfc_sli4_nvmet_handle_rcqe()
14204 drq = phba->sli4_hba.nvmet_mrq_data[idx]; in lpfc_sli4_nvmet_handle_rcqe()
14215 if ((phba->nvmet_support == 0) || in lpfc_sli4_nvmet_handle_rcqe()
14222 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_nvmet_handle_rcqe()
14226 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_nvmet_handle_rcqe()
14228 dma_buf = lpfc_sli_rqbuf_get(phba, hrq); in lpfc_sli4_nvmet_handle_rcqe()
14231 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_nvmet_handle_rcqe()
14234 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_nvmet_handle_rcqe()
14252 phba, idx, dma_buf, cq->isr_timestamp, in lpfc_sli4_nvmet_handle_rcqe()
14257 lpfc_rq_buf_free(phba, &dma_buf->hbuf); in lpfc_sli4_nvmet_handle_rcqe()
14260 if (phba->nvmet_support) { in lpfc_sli4_nvmet_handle_rcqe()
14261 tgtp = phba->targetport->private; in lpfc_sli4_nvmet_handle_rcqe()
14262 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_nvmet_handle_rcqe()
14294 lpfc_sli4_fp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_fp_handle_cqe() argument
14309 phba->last_completion_time = jiffies; in lpfc_sli4_fp_handle_cqe()
14311 lpfc_sli4_fp_handle_fcp_wcqe(phba, cq, in lpfc_sli4_fp_handle_cqe()
14317 lpfc_sli4_fp_handle_rel_wcqe(phba, cq, in lpfc_sli4_fp_handle_cqe()
14323 phba->last_completion_time = jiffies; in lpfc_sli4_fp_handle_cqe()
14324 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq, in lpfc_sli4_fp_handle_cqe()
14329 phba->last_completion_time = jiffies; in lpfc_sli4_fp_handle_cqe()
14332 phba, cq, (struct lpfc_rcqe *)&wcqe); in lpfc_sli4_fp_handle_cqe()
14336 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fp_handle_cqe()
14358 static void lpfc_sli4_sched_cq_work(struct lpfc_hba *phba, in lpfc_sli4_sched_cq_work() argument
14370 ret = queue_work(phba->wq, &cq->irqwork); in lpfc_sli4_sched_cq_work()
14372 ret = queue_work_on(cq->chann, phba->wq, &cq->irqwork); in lpfc_sli4_sched_cq_work()
14374 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_sched_cq_work()
14396 lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_queue *eq, in lpfc_sli4_hba_handle_eqe() argument
14404 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_handle_eqe()
14416 if (cqid <= phba->sli4_hba.cq_max) { in lpfc_sli4_hba_handle_eqe()
14417 cq = phba->sli4_hba.cq_lookup[cqid]; in lpfc_sli4_hba_handle_eqe()
14423 if (phba->cfg_nvmet_mrq && phba->sli4_hba.nvmet_cqset) { in lpfc_sli4_hba_handle_eqe()
14424 id = phba->sli4_hba.nvmet_cqset[0]->queue_id; in lpfc_sli4_hba_handle_eqe()
14425 if ((cqid >= id) && (cqid < (id + phba->cfg_nvmet_mrq))) { in lpfc_sli4_hba_handle_eqe()
14427 cq = phba->sli4_hba.nvmet_cqset[cqid - id]; in lpfc_sli4_hba_handle_eqe()
14432 if (phba->sli4_hba.nvmels_cq && in lpfc_sli4_hba_handle_eqe()
14433 (cqid == phba->sli4_hba.nvmels_cq->queue_id)) { in lpfc_sli4_hba_handle_eqe()
14435 cq = phba->sli4_hba.nvmels_cq; in lpfc_sli4_hba_handle_eqe()
14440 lpfc_sli4_sp_handle_eqe(phba, eqe, in lpfc_sli4_hba_handle_eqe()
14441 phba->sli4_hba.hdwq[qidx].hba_eq); in lpfc_sli4_hba_handle_eqe()
14447 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_hba_handle_eqe()
14456 if (phba->ktime_on) in lpfc_sli4_hba_handle_eqe()
14461 lpfc_sli4_sched_cq_work(phba, cq, cqid); in lpfc_sli4_hba_handle_eqe()
14484 struct lpfc_hba *phba = cq->phba; in __lpfc_sli4_hba_process_cq() local
14490 workposted |= __lpfc_sli4_process_cq(phba, cq, lpfc_sli4_fp_handle_cqe, in __lpfc_sli4_hba_process_cq()
14495 ret = queue_delayed_work(phba->wq, &cq->sched_irqwork, in __lpfc_sli4_hba_process_cq()
14498 ret = queue_delayed_work_on(cq->chann, phba->wq, in __lpfc_sli4_hba_process_cq()
14501 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in __lpfc_sli4_hba_process_cq()
14509 lpfc_worker_wake_up(phba); in __lpfc_sli4_hba_process_cq()
14571 struct lpfc_hba *phba; in lpfc_sli4_hba_intr_handler() local
14581 phba = hba_eq_hdl->phba; in lpfc_sli4_hba_intr_handler()
14584 if (unlikely(!phba)) in lpfc_sli4_hba_intr_handler()
14586 if (unlikely(!phba->sli4_hba.hdwq)) in lpfc_sli4_hba_intr_handler()
14590 fpeq = phba->sli4_hba.hba_eq_hdl[hba_eqidx].eq; in lpfc_sli4_hba_intr_handler()
14595 if (unlikely(lpfc_intr_state_check(phba))) { in lpfc_sli4_hba_intr_handler()
14597 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_hba_intr_handler()
14598 if (phba->link_state < LPFC_LINK_DOWN) in lpfc_sli4_hba_intr_handler()
14600 lpfc_sli4_eqcq_flush(phba, fpeq); in lpfc_sli4_hba_intr_handler()
14601 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_hba_intr_handler()
14605 eqi = this_cpu_ptr(phba->sli4_hba.eq_info); in lpfc_sli4_hba_intr_handler()
14612 phba->cfg_auto_imax && in lpfc_sli4_hba_intr_handler()
14614 phba->sli.sli_flag & LPFC_SLI_USE_EQDR) in lpfc_sli4_hba_intr_handler()
14615 lpfc_sli4_mod_hba_eq_delay(phba, fpeq, LPFC_MAX_AUTO_EQ_DELAY); in lpfc_sli4_hba_intr_handler()
14618 ecount = lpfc_sli4_process_eq(phba, fpeq, LPFC_QUEUE_REARM); in lpfc_sli4_hba_intr_handler()
14622 if (phba->intr_type == MSIX) in lpfc_sli4_hba_intr_handler()
14624 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_hba_intr_handler()
14654 struct lpfc_hba *phba; in lpfc_sli4_intr_handler() local
14660 phba = (struct lpfc_hba *)dev_id; in lpfc_sli4_intr_handler()
14662 if (unlikely(!phba)) in lpfc_sli4_intr_handler()
14668 for (qidx = 0; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_sli4_intr_handler()
14670 &phba->sli4_hba.hba_eq_hdl[qidx]); in lpfc_sli4_intr_handler()
14680 struct lpfc_hba *phba = from_timer(phba, t, cpuhp_poll_timer); in lpfc_sli4_poll_hbtimer() local
14686 list_for_each_entry_rcu(eq, &phba->poll_list, _poll_list) in lpfc_sli4_poll_hbtimer()
14688 if (!list_empty(&phba->poll_list)) in lpfc_sli4_poll_hbtimer()
14689 mod_timer(&phba->cpuhp_poll_timer, in lpfc_sli4_poll_hbtimer()
14697 struct lpfc_hba *phba = eq->phba; in lpfc_sli4_poll_eq() local
14717 i = lpfc_sli4_process_eq(phba, eq, LPFC_QUEUE_NOARM); in lpfc_sli4_poll_eq()
14724 struct lpfc_hba *phba = eq->phba; in lpfc_sli4_add_to_poll_list() local
14727 if (list_empty(&phba->poll_list)) in lpfc_sli4_add_to_poll_list()
14728 mod_timer(&phba->cpuhp_poll_timer, in lpfc_sli4_add_to_poll_list()
14731 list_add_rcu(&eq->_poll_list, &phba->poll_list); in lpfc_sli4_add_to_poll_list()
14737 struct lpfc_hba *phba = eq->phba; in lpfc_sli4_remove_from_poll_list() local
14745 if (list_empty(&phba->poll_list)) in lpfc_sli4_remove_from_poll_list()
14746 del_timer_sync(&phba->cpuhp_poll_timer); in lpfc_sli4_remove_from_poll_list()
14749 void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba) in lpfc_sli4_cleanup_poll_list() argument
14753 list_for_each_entry_safe(eq, next, &phba->poll_list, _poll_list) in lpfc_sli4_cleanup_poll_list()
14756 INIT_LIST_HEAD(&phba->poll_list); in lpfc_sli4_cleanup_poll_list()
14803 struct lpfc_hba *phba = eq->phba; in lpfc_sli4_stop_polling() local
14814 phba->sli4_hba.sli4_write_eq_db(phba, eq, 0, LPFC_QUEUE_REARM); in lpfc_sli4_stop_polling()
14839 dma_free_coherent(&queue->phba->pcidev->dev, queue->page_size, in lpfc_sli4_queue_free()
14844 lpfc_free_rq_buffer(queue->phba, queue); in lpfc_sli4_queue_free()
14868 lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t page_size, in lpfc_sli4_queue_alloc() argument
14873 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_sli4_queue_alloc()
14876 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_sli4_queue_alloc()
14882 if (pgcnt > phba->sli4_hba.pc_sli4_params.wqpcnt) in lpfc_sli4_queue_alloc()
14883 pgcnt = phba->sli4_hba.pc_sli4_params.wqpcnt; in lpfc_sli4_queue_alloc()
14907 queue->phba = phba; in lpfc_sli4_queue_alloc()
14911 dev_to_node(&phba->pcidev->dev)); in lpfc_sli4_queue_alloc()
14914 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_queue_alloc()
14949 lpfc_dual_chute_pci_bar_map(struct lpfc_hba *phba, uint16_t pci_barset) in lpfc_dual_chute_pci_bar_map() argument
14951 if (!phba->pcidev) in lpfc_dual_chute_pci_bar_map()
14956 return phba->pci_bar0_memmap_p; in lpfc_dual_chute_pci_bar_map()
14958 return phba->pci_bar2_memmap_p; in lpfc_dual_chute_pci_bar_map()
14960 return phba->pci_bar4_memmap_p; in lpfc_dual_chute_pci_bar_map()
14991 lpfc_modify_hba_eq_delay(struct lpfc_hba *phba, uint32_t startq, in lpfc_modify_hba_eq_delay() argument
15003 if (startq >= phba->cfg_irq_chann) in lpfc_modify_hba_eq_delay()
15007 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP | LOG_NVME, in lpfc_modify_hba_eq_delay()
15014 if (phba->sli.sli_flag & LPFC_SLI_USE_EQDR) { in lpfc_modify_hba_eq_delay()
15015 for (qidx = startq; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_modify_hba_eq_delay()
15016 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_modify_hba_eq_delay()
15020 lpfc_sli4_mod_hba_eq_delay(phba, eq, usdelay); in lpfc_modify_hba_eq_delay()
15030 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_modify_hba_eq_delay()
15032 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_modify_hba_eq_delay()
15039 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_modify_hba_eq_delay()
15051 for (qidx = startq; qidx < phba->cfg_irq_chann; qidx++) { in lpfc_modify_hba_eq_delay()
15052 eq = phba->sli4_hba.hba_eq_hdl[qidx].eq; in lpfc_modify_hba_eq_delay()
15065 mbox->vport = phba->pport; in lpfc_modify_hba_eq_delay()
15069 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_modify_hba_eq_delay()
15074 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_modify_hba_eq_delay()
15079 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_modify_hba_eq_delay()
15104 lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax) in lpfc_eq_create() argument
15113 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_eq_create()
15118 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_eq_create()
15121 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_eq_create()
15126 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_eq_create()
15138 if (phba->sli4_hba.pc_sli4_params.eqav) { in lpfc_eq_create()
15142 phba->sli4_hba.pc_sli4_params.eqav); in lpfc_eq_create()
15151 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_eq_create()
15187 mbox->vport = phba->pport; in lpfc_eq_create()
15191 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_eq_create()
15195 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_eq_create()
15210 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_eq_create()
15247 lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_cq_create() argument
15261 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_cq_create()
15266 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_cq_create()
15276 phba->sli4_hba.pc_sli4_params.cqv); in lpfc_cq_create()
15277 if (phba->sli4_hba.pc_sli4_params.cqv == LPFC_Q_CREATE_VERSION_2) { in lpfc_cq_create()
15283 phba->sli4_hba.pc_sli4_params.cqav); in lpfc_cq_create()
15291 if (phba->sli4_hba.pc_sli4_params.cqv == in lpfc_cq_create()
15302 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_cq_create()
15332 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_cq_create()
15338 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_cq_create()
15360 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, cq->entry_count); in lpfc_cq_create()
15362 if (cq->queue_id > phba->sli4_hba.cq_max) in lpfc_cq_create()
15363 phba->sli4_hba.cq_max = cq->queue_id; in lpfc_cq_create()
15367 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_cq_create()
15396 lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp, in lpfc_cq_create_set() argument
15409 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_cq_create_set()
15412 numcq = phba->cfg_nvmet_mrq; in lpfc_cq_create_set()
15416 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_cq_create_set()
15423 alloclen = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_cq_create_set()
15427 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_cq_create_set()
15445 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_cq_create_set()
15465 phba->sli4_hba.pc_sli4_params.cqav); in lpfc_cq_create_set()
15469 if (phba->sli4_hba.pc_sli4_params.cqv == in lpfc_cq_create_set()
15481 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_cq_create_set()
15576 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, in lpfc_cq_create_set()
15593 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_cq_create_set()
15599 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_cq_create_set()
15615 if (cq->queue_id > phba->sli4_hba.cq_max) in lpfc_cq_create_set()
15616 phba->sli4_hba.cq_max = cq->queue_id; in lpfc_cq_create_set()
15620 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_cq_create_set()
15639 lpfc_mq_create_fb_init(struct lpfc_hba *phba, struct lpfc_queue *mq, in lpfc_mq_create_fb_init() argument
15648 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_mq_create_fb_init()
15705 lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq, in lpfc_mq_create() argument
15715 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_mq_create()
15720 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_mq_create()
15723 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_mq_create()
15728 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_mq_create()
15748 phba->sli4_hba.pc_sli4_params.mqv); in lpfc_mq_create()
15749 if (phba->sli4_hba.pc_sli4_params.mqv == LPFC_Q_CREATE_VERSION_1) in lpfc_mq_create()
15757 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mq_create()
15793 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_mq_create()
15797 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_mq_create()
15801 lpfc_mq_create_fb_init(phba, mq, mbox, cq); in lpfc_mq_create()
15803 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_mq_create()
15813 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mq_create()
15833 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mq_create()
15860 lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq, in lpfc_wq_create() argument
15869 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_wq_create()
15884 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_wq_create()
15887 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_wq_create()
15892 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_wq_create()
15904 phba->sli4_hba.pc_sli4_params.wqv); in lpfc_wq_create()
15906 if ((phba->sli4_hba.pc_sli4_params.wqsize & LPFC_WQ_SZ128_SUPPORT) || in lpfc_wq_create()
15913 if (phba->sli4_hba.pc_sli4_params.wqsize & LPFC_WQ_SZ128_SUPPORT) in lpfc_wq_create()
15956 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) in lpfc_wq_create()
15959 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_wq_create()
15964 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_wq_create()
15986 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) { in lpfc_wq_create()
15991 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_wq_create()
16000 bar_memmap_p = lpfc_dual_chute_pci_bar_map(phba, in lpfc_wq_create()
16003 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_wq_create()
16013 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_wq_create()
16021 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_wq_create()
16026 wq->db_regaddr = phba->sli4_hba.WQDBregaddr; in lpfc_wq_create()
16034 bar_memmap_p = lpfc_dual_chute_pci_bar_map(phba, in lpfc_wq_create()
16037 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_wq_create()
16050 bar_memmap_p = lpfc_dual_chute_pci_bar_map(phba, in lpfc_wq_create()
16053 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_wq_create()
16062 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_wq_create()
16074 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_wq_create()
16078 phba->cfg_enable_dpp = 0; in lpfc_wq_create()
16081 phba->cfg_enable_dpp = 0; in lpfc_wq_create()
16084 wq->db_regaddr = phba->sli4_hba.WQDBregaddr; in lpfc_wq_create()
16101 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_wq_create()
16130 lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq, in lpfc_rq_create() argument
16139 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_rq_create()
16147 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_rq_create()
16152 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_rq_create()
16157 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_rq_create()
16163 phba->sli4_hba.pc_sli4_params.rqv); in lpfc_rq_create()
16164 if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) { in lpfc_rq_create()
16178 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_rq_create()
16221 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) in lpfc_rq_create()
16224 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_rq_create()
16229 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_rq_create()
16242 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) { in lpfc_rq_create()
16247 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_rq_create()
16257 bar_memmap_p = lpfc_dual_chute_pci_bar_map(phba, pci_barset); in lpfc_rq_create()
16259 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_rq_create()
16270 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_rq_create()
16278 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_rq_create()
16284 hrq->db_regaddr = phba->sli4_hba.RQDBregaddr; in lpfc_rq_create()
16294 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_rq_create()
16298 phba->sli4_hba.pc_sli4_params.rqv); in lpfc_rq_create()
16299 if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) { in lpfc_rq_create()
16315 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_rq_create()
16363 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) in lpfc_rq_create()
16365 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_rq_create()
16391 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_rq_create()
16420 lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp, in lpfc_mrq_create() argument
16432 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_mrq_create()
16434 numrq = phba->cfg_nvmet_mrq; in lpfc_mrq_create()
16438 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_mrq_create()
16441 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_mrq_create()
16449 alloclen = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_mrq_create()
16453 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mrq_create()
16537 hrq->db_regaddr = phba->sli4_hba.RQDBregaddr; in lpfc_mrq_create()
16546 drq->db_regaddr = phba->sli4_hba.RQDBregaddr; in lpfc_mrq_create()
16558 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_mrq_create()
16563 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mrq_create()
16585 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_mrq_create()
16603 lpfc_eq_destroy(struct lpfc_hba *phba, struct lpfc_queue *eq) in lpfc_eq_destroy() argument
16614 mbox = mempool_alloc(eq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_eq_destroy()
16619 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_eq_destroy()
16624 mbox->vport = eq->phba->pport; in lpfc_eq_destroy()
16627 rc = lpfc_sli_issue_mbox(eq->phba, mbox, MBX_POLL); in lpfc_eq_destroy()
16634 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_eq_destroy()
16643 mempool_free(mbox, eq->phba->mbox_mem_pool); in lpfc_eq_destroy()
16661 lpfc_cq_destroy(struct lpfc_hba *phba, struct lpfc_queue *cq) in lpfc_cq_destroy() argument
16671 mbox = mempool_alloc(cq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_cq_destroy()
16676 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_cq_destroy()
16681 mbox->vport = cq->phba->pport; in lpfc_cq_destroy()
16683 rc = lpfc_sli_issue_mbox(cq->phba, mbox, MBX_POLL); in lpfc_cq_destroy()
16690 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_cq_destroy()
16698 mempool_free(mbox, cq->phba->mbox_mem_pool); in lpfc_cq_destroy()
16716 lpfc_mq_destroy(struct lpfc_hba *phba, struct lpfc_queue *mq) in lpfc_mq_destroy() argument
16726 mbox = mempool_alloc(mq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_mq_destroy()
16731 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_mq_destroy()
16736 mbox->vport = mq->phba->pport; in lpfc_mq_destroy()
16738 rc = lpfc_sli_issue_mbox(mq->phba, mbox, MBX_POLL); in lpfc_mq_destroy()
16745 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mq_destroy()
16753 mempool_free(mbox, mq->phba->mbox_mem_pool); in lpfc_mq_destroy()
16771 lpfc_wq_destroy(struct lpfc_hba *phba, struct lpfc_queue *wq) in lpfc_wq_destroy() argument
16781 mbox = mempool_alloc(wq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_wq_destroy()
16786 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_wq_destroy()
16791 mbox->vport = wq->phba->pport; in lpfc_wq_destroy()
16793 rc = lpfc_sli_issue_mbox(wq->phba, mbox, MBX_POLL); in lpfc_wq_destroy()
16799 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_wq_destroy()
16809 mempool_free(mbox, wq->phba->mbox_mem_pool); in lpfc_wq_destroy()
16828 lpfc_rq_destroy(struct lpfc_hba *phba, struct lpfc_queue *hrq, in lpfc_rq_destroy() argument
16839 mbox = mempool_alloc(hrq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_rq_destroy()
16844 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_rq_destroy()
16849 mbox->vport = hrq->phba->pport; in lpfc_rq_destroy()
16851 rc = lpfc_sli_issue_mbox(hrq->phba, mbox, MBX_POLL); in lpfc_rq_destroy()
16858 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_rq_destroy()
16862 mempool_free(mbox, hrq->phba->mbox_mem_pool); in lpfc_rq_destroy()
16867 rc = lpfc_sli_issue_mbox(drq->phba, mbox, MBX_POLL); in lpfc_rq_destroy()
16873 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_rq_destroy()
16881 mempool_free(mbox, hrq->phba->mbox_mem_pool); in lpfc_rq_destroy()
16908 lpfc_sli4_post_sgl(struct lpfc_hba *phba, in lpfc_sli4_post_sgl() argument
16921 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_sgl()
16926 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_post_sgl()
16930 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_post_sgl()
16949 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_post_sgl()
16950 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_post_sgl()
16952 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_post_sgl()
16953 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_post_sgl()
16959 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_post_sgl()
16960 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_post_sgl()
16962 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_post_sgl()
16964 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_sgl()
16986 lpfc_sli4_alloc_xri(struct lpfc_hba *phba) in lpfc_sli4_alloc_xri() argument
16994 spin_lock_irq(&phba->hbalock); in lpfc_sli4_alloc_xri()
16995 xri = find_next_zero_bit(phba->sli4_hba.xri_bmask, in lpfc_sli4_alloc_xri()
16996 phba->sli4_hba.max_cfg_param.max_xri, 0); in lpfc_sli4_alloc_xri()
16997 if (xri >= phba->sli4_hba.max_cfg_param.max_xri) { in lpfc_sli4_alloc_xri()
16998 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_alloc_xri()
17001 set_bit(xri, phba->sli4_hba.xri_bmask); in lpfc_sli4_alloc_xri()
17002 phba->sli4_hba.max_cfg_param.xri_used++; in lpfc_sli4_alloc_xri()
17004 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_alloc_xri()
17017 __lpfc_sli4_free_xri(struct lpfc_hba *phba, int xri) in __lpfc_sli4_free_xri() argument
17019 if (test_and_clear_bit(xri, phba->sli4_hba.xri_bmask)) { in __lpfc_sli4_free_xri()
17020 phba->sli4_hba.max_cfg_param.xri_used--; in __lpfc_sli4_free_xri()
17033 lpfc_sli4_free_xri(struct lpfc_hba *phba, int xri) in lpfc_sli4_free_xri() argument
17035 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_xri()
17036 __lpfc_sli4_free_xri(phba, xri); in lpfc_sli4_free_xri()
17037 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_xri()
17051 lpfc_sli4_next_xritag(struct lpfc_hba *phba) in lpfc_sli4_next_xritag() argument
17055 xri_index = lpfc_sli4_alloc_xri(phba); in lpfc_sli4_next_xritag()
17057 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_next_xritag()
17061 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_next_xritag()
17062 phba->sli4_hba.max_cfg_param.xri_used); in lpfc_sli4_next_xritag()
17078 lpfc_sli4_post_sgl_list(struct lpfc_hba *phba, in lpfc_sli4_post_sgl_list() argument
17097 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_sgl_list()
17103 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_post_sgl_list()
17108 alloclen = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_post_sgl_list()
17113 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_sgl_list()
17117 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_sgl_list()
17149 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_post_sgl_list()
17150 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_post_sgl_list()
17152 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_post_sgl_list()
17153 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_post_sgl_list()
17158 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_post_sgl_list()
17159 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_sgl_list()
17161 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_sgl_list()
17163 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_sgl_list()
17184 lpfc_sli4_post_io_sgl_block(struct lpfc_hba *phba, struct list_head *nblist, in lpfc_sli4_post_io_sgl_block() argument
17204 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_post_io_sgl_block()
17209 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_post_io_sgl_block()
17211 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_io_sgl_block()
17217 alloclen = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_post_io_sgl_block()
17222 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_io_sgl_block()
17226 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_io_sgl_block()
17244 if (phba->cfg_sg_dma_buf_size > SGL_PAGE_SIZE) in lpfc_sli4_post_io_sgl_block()
17264 if (!phba->sli4_hba.intr_enable) { in lpfc_sli4_post_io_sgl_block()
17265 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_post_io_sgl_block()
17267 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_post_io_sgl_block()
17268 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_post_io_sgl_block()
17273 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_post_io_sgl_block()
17274 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_io_sgl_block()
17276 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_io_sgl_block()
17278 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_io_sgl_block()
17303 lpfc_sli4_post_io_sgl_list(struct lpfc_hba *phba, in lpfc_sli4_post_io_sgl_list() argument
17320 sgl_size = phba->cfg_sg_dma_buf_size; in lpfc_sli4_post_io_sgl_list()
17361 phba, lpfc_ncmd->dma_phys_sgl, in lpfc_sli4_post_io_sgl_list()
17384 status = lpfc_sli4_post_io_sgl_block(phba, &blck_nblist, in lpfc_sli4_post_io_sgl_list()
17411 lpfc_io_buf_replenish(phba, &nvme_nblist); in lpfc_sli4_post_io_sgl_list()
17427 lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr) in lpfc_fc_frame_check() argument
17467 return lpfc_fc_frame_check(phba, fc_hdr); in lpfc_fc_frame_check()
17486 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, in lpfc_fc_frame_check()
17496 lpfc_printf_log(phba, KERN_WARNING, LOG_ELS, in lpfc_fc_frame_check()
17534 lpfc_fc_frame_to_vport(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr, in lpfc_fc_frame_to_vport() argument
17542 return phba->pport; in lpfc_fc_frame_to_vport()
17543 if ((phba->pport->fc_flag & FC_PT2PT) && in lpfc_fc_frame_to_vport()
17544 !(phba->link_state == LPFC_HBA_READY)) in lpfc_fc_frame_to_vport()
17545 return phba->pport; in lpfc_fc_frame_to_vport()
17547 vports = lpfc_create_vport_work_array(phba); in lpfc_fc_frame_to_vport()
17549 for (i = 0; i <= phba->max_vpi && vports[i] != NULL; i++) { in lpfc_fc_frame_to_vport()
17550 if (phba->fcf.fcfi == fcfi && in lpfc_fc_frame_to_vport()
17558 lpfc_destroy_vport_work_array(phba, vports); in lpfc_fc_frame_to_vport()
17609 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_cleanup_rcv_buffers()
17611 lpfc_in_buf_free(vport->phba, &dmabuf->dbuf); in lpfc_cleanup_rcv_buffers()
17636 timeout = (msecs_to_jiffies(vport->phba->fc_edtov) + in lpfc_rcv_seq_check_edtov()
17644 timeout = (msecs_to_jiffies(vport->phba->fc_edtov) + in lpfc_rcv_seq_check_edtov()
17653 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_rcv_seq_check_edtov()
17655 lpfc_in_buf_free(vport->phba, &dmabuf->dbuf); in lpfc_rcv_seq_check_edtov()
17798 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_sli4_abort_partial_seq()
17824 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_abort_ulp_seq() local
17828 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli4_abort_ulp_seq()
17832 handled = lpfc_ct_handle_unsol_abort(phba, dmabuf); in lpfc_sli4_abort_ulp_seq()
17850 lpfc_sli4_seq_abort_rsp_cmpl(struct lpfc_hba *phba, in lpfc_sli4_seq_abort_rsp_cmpl() argument
17859 lpfc_sli_release_iocbq(phba, cmd_iocbq); in lpfc_sli4_seq_abort_rsp_cmpl()
17864 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_seq_abort_rsp_cmpl()
17879 lpfc_sli4_xri_inrange(struct lpfc_hba *phba, in lpfc_sli4_xri_inrange() argument
17884 for (i = 0; i < phba->sli4_hba.max_cfg_param.max_xri; i++) { in lpfc_sli4_xri_inrange()
17885 if (xri == phba->sli4_hba.xri_ids[i]) in lpfc_sli4_xri_inrange()
17904 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_seq_abort_rsp() local
17912 if (!lpfc_is_link_up(phba)) in lpfc_sli4_seq_abort_rsp()
17942 ctiocb = lpfc_sli_get_iocbq(phba); in lpfc_sli4_seq_abort_rsp()
17961 icmd->ulpContext = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; in lpfc_sli4_seq_abort_rsp()
17964 ctiocb->vport = phba->pport; in lpfc_sli4_seq_abort_rsp()
17976 lxri = lpfc_sli4_xri_inrange(phba, xri); in lpfc_sli4_seq_abort_rsp()
17978 lpfc_set_rrq_active(phba, ndlp, lxri, in lpfc_sli4_seq_abort_rsp()
17986 (lxri > lpfc_sli4_get_iocb_cnt(phba))) { in lpfc_sli4_seq_abort_rsp()
18023 icmd->un.xseq64.w5.hcsw.Rctl, oxid, phba->link_state); in lpfc_sli4_seq_abort_rsp()
18025 rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, ctiocb, 0); in lpfc_sli4_seq_abort_rsp()
18031 phba->link_state); in lpfc_sli4_seq_abort_rsp()
18034 lpfc_sli_release_iocbq(phba, ctiocb); in lpfc_sli4_seq_abort_rsp()
18055 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_handle_unsol_abort() local
18073 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_unsol_abort()
18075 if (phba->nvmet_support) { in lpfc_sli4_handle_unsol_abort()
18163 first_iocbq = lpfc_sli_get_iocbq(vport->phba); in lpfc_prep_seq()
18183 vport->phba->vpi_ids[vport->vpi]; in lpfc_prep_seq()
18208 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_prep_seq()
18228 iocbq = lpfc_sli_get_iocbq(vport->phba); in lpfc_prep_seq()
18236 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_prep_seq()
18261 lpfc_in_buf_free(vport->phba, &seq_dmabuf->dbuf); in lpfc_prep_seq()
18272 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_send_seq_to_ulp() local
18277 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_send_seq_to_ulp()
18284 if (!lpfc_complete_unsol_iocb(phba, in lpfc_sli4_send_seq_to_ulp()
18285 phba->sli4_hba.els_wq->pring, in lpfc_sli4_send_seq_to_ulp()
18288 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_send_seq_to_ulp()
18293 lpfc_in_buf_free(phba, &seq_dmabuf->dbuf); in lpfc_sli4_send_seq_to_ulp()
18300 lpfc_sli_release_iocbq(phba, curr_iocb); in lpfc_sli4_send_seq_to_ulp()
18302 lpfc_sli_release_iocbq(phba, iocbq); in lpfc_sli4_send_seq_to_ulp()
18306 lpfc_sli4_mds_loopback_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, in lpfc_sli4_mds_loopback_cmpl() argument
18312 dma_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys); in lpfc_sli4_mds_loopback_cmpl()
18314 lpfc_sli_release_iocbq(phba, cmdiocb); in lpfc_sli4_mds_loopback_cmpl()
18315 lpfc_drain_txq(phba); in lpfc_sli4_mds_loopback_cmpl()
18323 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_handle_mds_loopback() local
18335 iocbq = lpfc_sli_get_iocbq(phba); in lpfc_sli4_handle_mds_loopback()
18338 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_handle_mds_loopback()
18340 &phba->sli4_hba.sp_queue_event); in lpfc_sli4_handle_mds_loopback()
18341 phba->hba_flag |= HBA_SP_QUEUE_EVT; in lpfc_sli4_handle_mds_loopback()
18342 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_handle_mds_loopback()
18343 lpfc_worker_wake_up(phba); in lpfc_sli4_handle_mds_loopback()
18350 pcmd->virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL, in lpfc_sli4_handle_mds_loopback()
18388 rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, iocbq, 0); in lpfc_sli4_handle_mds_loopback()
18392 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_mds_loopback()
18396 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_handle_mds_loopback()
18399 dma_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys); in lpfc_sli4_handle_mds_loopback()
18402 lpfc_sli_release_iocbq(phba, iocbq); in lpfc_sli4_handle_mds_loopback()
18403 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_mds_loopback()
18419 lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba, in lpfc_sli4_handle_received_buffer() argument
18433 vport = phba->pport; in lpfc_sli4_handle_received_buffer()
18435 if (!(phba->pport->load_flag & FC_UNLOADING)) in lpfc_sli4_handle_received_buffer()
18438 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
18443 if (lpfc_fc_frame_check(phba, fc_hdr)) { in lpfc_sli4_handle_received_buffer()
18444 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
18457 vport = phba->pport; in lpfc_sli4_handle_received_buffer()
18458 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_handle_received_buffer()
18470 vport = lpfc_fc_frame_to_vport(phba, fc_hdr, fcfi, did); in lpfc_sli4_handle_received_buffer()
18473 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
18486 (phba->link_state == LPFC_HBA_READY)) { in lpfc_sli4_handle_received_buffer()
18487 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
18502 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
18535 lpfc_sli4_post_all_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_post_all_rpi_hdrs() argument
18542 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_post_all_rpi_hdrs()
18544 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_post_all_rpi_hdrs()
18547 list_for_each_entry(rpi_page, &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_post_all_rpi_hdrs()
18553 if (bf_get(lpfc_rpi_rsrc_rdy, &phba->sli4_hba.sli4_flags) != in lpfc_sli4_post_all_rpi_hdrs()
18555 rpi_page->start_rpi = phba->sli4_hba.rpi_ids[lrpi]; in lpfc_sli4_post_all_rpi_hdrs()
18557 rc = lpfc_sli4_post_rpi_hdr(phba, rpi_page); in lpfc_sli4_post_all_rpi_hdrs()
18559 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_all_rpi_hdrs()
18568 bf_set(lpfc_rpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, in lpfc_sli4_post_all_rpi_hdrs()
18588 lpfc_sli4_post_rpi_hdr(struct lpfc_hba *phba, struct lpfc_rpi_hdr *rpi_page) in lpfc_sli4_post_rpi_hdr() argument
18597 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_post_rpi_hdr()
18599 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_post_rpi_hdr()
18603 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_post_rpi_hdr()
18605 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_rpi_hdr()
18613 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_post_rpi_hdr()
18628 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_post_rpi_hdr()
18632 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_post_rpi_hdr()
18634 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_post_rpi_hdr()
18644 spin_lock_irq(&phba->hbalock); in lpfc_sli4_post_rpi_hdr()
18645 phba->sli4_hba.next_rpi = rpi_page->next_rpi; in lpfc_sli4_post_rpi_hdr()
18646 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_post_rpi_hdr()
18665 lpfc_sli4_alloc_rpi(struct lpfc_hba *phba) in lpfc_sli4_alloc_rpi() argument
18677 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_alloc_rpi()
18678 max_rpi = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_alloc_rpi()
18679 rpi_limit = phba->sli4_hba.next_rpi; in lpfc_sli4_alloc_rpi()
18681 rpi = find_next_zero_bit(phba->sli4_hba.rpi_bmask, rpi_limit, 0); in lpfc_sli4_alloc_rpi()
18685 set_bit(rpi, phba->sli4_hba.rpi_bmask); in lpfc_sli4_alloc_rpi()
18686 phba->sli4_hba.max_cfg_param.rpi_used++; in lpfc_sli4_alloc_rpi()
18687 phba->sli4_hba.rpi_count++; in lpfc_sli4_alloc_rpi()
18689 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_alloc_rpi()
18699 (phba->sli4_hba.rpi_count >= max_rpi)) { in lpfc_sli4_alloc_rpi()
18700 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_alloc_rpi()
18708 if (!phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_alloc_rpi()
18709 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_alloc_rpi()
18719 rpi_remaining = phba->sli4_hba.next_rpi - phba->sli4_hba.rpi_count; in lpfc_sli4_alloc_rpi()
18720 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_alloc_rpi()
18722 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_alloc_rpi()
18724 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_alloc_rpi()
18729 rpi_hdr->start_rpi = phba->sli4_hba.rpi_ids[lrpi]; in lpfc_sli4_alloc_rpi()
18730 lpfc_sli4_post_rpi_hdr(phba, rpi_hdr); in lpfc_sli4_alloc_rpi()
18746 __lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) in __lpfc_sli4_free_rpi() argument
18755 if (test_and_clear_bit(rpi, phba->sli4_hba.rpi_bmask)) { in __lpfc_sli4_free_rpi()
18756 phba->sli4_hba.rpi_count--; in __lpfc_sli4_free_rpi()
18757 phba->sli4_hba.max_cfg_param.rpi_used--; in __lpfc_sli4_free_rpi()
18759 lpfc_printf_log(phba, KERN_INFO, in __lpfc_sli4_free_rpi()
18775 lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) in lpfc_sli4_free_rpi() argument
18777 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_rpi()
18778 __lpfc_sli4_free_rpi(phba, rpi); in lpfc_sli4_free_rpi()
18779 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_rpi()
18790 lpfc_sli4_remove_rpis(struct lpfc_hba *phba) in lpfc_sli4_remove_rpis() argument
18792 kfree(phba->sli4_hba.rpi_bmask); in lpfc_sli4_remove_rpis()
18793 kfree(phba->sli4_hba.rpi_ids); in lpfc_sli4_remove_rpis()
18794 bf_set(lpfc_rpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_remove_rpis()
18811 struct lpfc_hba *phba = ndlp->phba; in lpfc_sli4_resume_rpi() local
18815 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_resume_rpi()
18828 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_resume_rpi()
18830 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_resume_rpi()
18834 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_resume_rpi()
18857 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_init_vpi() local
18858 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_init_vpi()
18861 lpfc_init_vpi(phba, mboxq, vport->vpi); in lpfc_sli4_init_vpi()
18862 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_sli4_init_vpi()
18863 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_sli4_init_vpi()
18872 mempool_free(mboxq, vport->phba->mbox_mem_pool); in lpfc_sli4_init_vpi()
18887 lpfc_mbx_cmpl_add_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_mbx_cmpl_add_fcf_record() argument
18901 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_mbx_cmpl_add_fcf_record()
18906 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_mbx_cmpl_add_fcf_record()
18919 lpfc_sli4_add_fcf_record(struct lpfc_hba *phba, struct fcf_record *fcf_record) in lpfc_sli4_add_fcf_record() argument
18929 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_add_fcf_record()
18931 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_add_fcf_record()
18940 alloc_len = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_add_fcf_record()
18944 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_add_fcf_record()
18948 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_add_fcf_record()
18973 mboxq->vport = phba->pport; in lpfc_sli4_add_fcf_record()
18975 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_add_fcf_record()
18977 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_add_fcf_record()
18980 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_add_fcf_record()
18999 lpfc_sli4_build_dflt_fcf_record(struct lpfc_hba *phba, in lpfc_sli4_build_dflt_fcf_record() argument
19007 bf_set(lpfc_fcf_record_mac_0, fcf_record, phba->fc_map[0]); in lpfc_sli4_build_dflt_fcf_record()
19008 bf_set(lpfc_fcf_record_mac_1, fcf_record, phba->fc_map[1]); in lpfc_sli4_build_dflt_fcf_record()
19009 bf_set(lpfc_fcf_record_mac_2, fcf_record, phba->fc_map[2]); in lpfc_sli4_build_dflt_fcf_record()
19013 bf_set(lpfc_fcf_record_fc_map_0, fcf_record, phba->fc_map[0]); in lpfc_sli4_build_dflt_fcf_record()
19014 bf_set(lpfc_fcf_record_fc_map_1, fcf_record, phba->fc_map[1]); in lpfc_sli4_build_dflt_fcf_record()
19015 bf_set(lpfc_fcf_record_fc_map_2, fcf_record, phba->fc_map[2]); in lpfc_sli4_build_dflt_fcf_record()
19022 if (phba->valid_vlan) { in lpfc_sli4_build_dflt_fcf_record()
19023 fcf_record->vlan_bitmap[phba->vlan_id / 8] in lpfc_sli4_build_dflt_fcf_record()
19024 = 1 << (phba->vlan_id % 8); in lpfc_sli4_build_dflt_fcf_record()
19041 lpfc_sli4_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_fcf_scan_read_fcf_rec() argument
19046 phba->fcoe_eventtag_at_fcf_scan = phba->fcoe_eventtag; in lpfc_sli4_fcf_scan_read_fcf_rec()
19047 phba->fcoe_cvl_eventtag_attn = phba->fcoe_cvl_eventtag; in lpfc_sli4_fcf_scan_read_fcf_rec()
19048 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_fcf_scan_read_fcf_rec()
19050 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_fcf_scan_read_fcf_rec()
19057 rc = lpfc_sli4_mbx_read_fcf_rec(phba, mboxq, fcf_index); in lpfc_sli4_fcf_scan_read_fcf_rec()
19063 mboxq->vport = phba->pport; in lpfc_sli4_fcf_scan_read_fcf_rec()
19066 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_scan_read_fcf_rec()
19067 phba->hba_flag |= FCF_TS_INPROG; in lpfc_sli4_fcf_scan_read_fcf_rec()
19068 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_scan_read_fcf_rec()
19070 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_fcf_scan_read_fcf_rec()
19076 phba->fcf.eligible_fcf_cnt = 0; in lpfc_sli4_fcf_scan_read_fcf_rec()
19082 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_fcf_scan_read_fcf_rec()
19084 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_scan_read_fcf_rec()
19085 phba->hba_flag &= ~FCF_TS_INPROG; in lpfc_sli4_fcf_scan_read_fcf_rec()
19086 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_scan_read_fcf_rec()
19103 lpfc_sli4_fcf_rr_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_fcf_rr_read_fcf_rec() argument
19108 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_fcf_rr_read_fcf_rec()
19110 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_INIT, in lpfc_sli4_fcf_rr_read_fcf_rec()
19117 rc = lpfc_sli4_mbx_read_fcf_rec(phba, mboxq, fcf_index); in lpfc_sli4_fcf_rr_read_fcf_rec()
19123 mboxq->vport = phba->pport; in lpfc_sli4_fcf_rr_read_fcf_rec()
19125 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_fcf_rr_read_fcf_rec()
19133 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_fcf_rr_read_fcf_rec()
19149 lpfc_sli4_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_read_fcf_rec() argument
19154 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_fcf_rec()
19156 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_INIT, in lpfc_sli4_read_fcf_rec()
19163 rc = lpfc_sli4_mbx_read_fcf_rec(phba, mboxq, fcf_index); in lpfc_sli4_read_fcf_rec()
19169 mboxq->vport = phba->pport; in lpfc_sli4_read_fcf_rec()
19171 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_read_fcf_rec()
19179 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_read_fcf_rec()
19197 lpfc_check_next_fcf_pri_level(struct lpfc_hba *phba) in lpfc_check_next_fcf_pri_level() argument
19205 last_index = find_first_bit(phba->fcf.fcf_rr_bmask, in lpfc_check_next_fcf_pri_level()
19207 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_check_next_fcf_pri_level()
19211 spin_lock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19212 if (list_empty(&phba->fcf.fcf_pri_list) || in lpfc_check_next_fcf_pri_level()
19213 list_is_singular(&phba->fcf.fcf_pri_list)) { in lpfc_check_next_fcf_pri_level()
19214 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19215 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, in lpfc_check_next_fcf_pri_level()
19219 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19226 memset(phba->fcf.fcf_rr_bmask, 0, in lpfc_check_next_fcf_pri_level()
19227 sizeof(*phba->fcf.fcf_rr_bmask)); in lpfc_check_next_fcf_pri_level()
19228 spin_lock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19229 list_for_each_entry(fcf_pri, &phba->fcf.fcf_pri_list, list) { in lpfc_check_next_fcf_pri_level()
19238 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19240 rc = lpfc_sli4_fcf_rr_index_set(phba, in lpfc_check_next_fcf_pri_level()
19245 spin_lock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19252 if (!next_fcf_pri && !list_empty(&phba->fcf.fcf_pri_list)) { in lpfc_check_next_fcf_pri_level()
19253 list_for_each_entry(fcf_pri, &phba->fcf.fcf_pri_list, list) { in lpfc_check_next_fcf_pri_level()
19261 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19263 rc = lpfc_sli4_fcf_rr_index_set(phba, in lpfc_check_next_fcf_pri_level()
19268 spin_lock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19272 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
19287 lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba) in lpfc_sli4_fcf_rr_next_index_get() argument
19293 next_fcf_index = phba->fcf.current_rec.fcf_indx; in lpfc_sli4_fcf_rr_next_index_get()
19298 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask, in lpfc_sli4_fcf_rr_next_index_get()
19309 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask, in lpfc_sli4_fcf_rr_next_index_get()
19316 next_fcf_index == phba->fcf.current_rec.fcf_indx) { in lpfc_sli4_fcf_rr_next_index_get()
19323 if (lpfc_check_next_fcf_pri_level(phba)) in lpfc_sli4_fcf_rr_next_index_get()
19325 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP, in lpfc_sli4_fcf_rr_next_index_get()
19332 phba->fcf.fcf_pri[next_fcf_index].fcf_rec.flag & in lpfc_sli4_fcf_rr_next_index_get()
19334 if (list_is_singular(&phba->fcf.fcf_pri_list)) in lpfc_sli4_fcf_rr_next_index_get()
19340 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_rr_next_index_get()
19361 lpfc_sli4_fcf_rr_index_set(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_fcf_rr_index_set() argument
19364 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, in lpfc_sli4_fcf_rr_index_set()
19371 set_bit(fcf_index, phba->fcf.fcf_rr_bmask); in lpfc_sli4_fcf_rr_index_set()
19373 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_rr_index_set()
19391 lpfc_sli4_fcf_rr_index_clear(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_fcf_rr_index_clear() argument
19395 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, in lpfc_sli4_fcf_rr_index_clear()
19402 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_rr_index_clear()
19403 list_for_each_entry_safe(fcf_pri, fcf_pri_next, &phba->fcf.fcf_pri_list, in lpfc_sli4_fcf_rr_index_clear()
19410 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_rr_index_clear()
19411 clear_bit(fcf_index, phba->fcf.fcf_rr_bmask); in lpfc_sli4_fcf_rr_index_clear()
19413 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_rr_index_clear()
19428 lpfc_mbx_cmpl_redisc_fcf_table(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) in lpfc_mbx_cmpl_redisc_fcf_table() argument
19440 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, in lpfc_mbx_cmpl_redisc_fcf_table()
19444 if (phba->fcf.fcf_flag & FCF_ACVL_DISC) { in lpfc_mbx_cmpl_redisc_fcf_table()
19445 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_redisc_fcf_table()
19446 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_mbx_cmpl_redisc_fcf_table()
19447 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_redisc_fcf_table()
19452 lpfc_retry_pport_discovery(phba); in lpfc_mbx_cmpl_redisc_fcf_table()
19454 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_redisc_fcf_table()
19455 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_mbx_cmpl_redisc_fcf_table()
19456 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_redisc_fcf_table()
19462 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_mbx_cmpl_redisc_fcf_table()
19465 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_mbx_cmpl_redisc_fcf_table()
19471 lpfc_fcf_redisc_wait_start_timer(phba); in lpfc_mbx_cmpl_redisc_fcf_table()
19474 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mbx_cmpl_redisc_fcf_table()
19485 lpfc_sli4_redisc_fcf_table(struct lpfc_hba *phba) in lpfc_sli4_redisc_fcf_table() argument
19492 lpfc_cancel_all_vport_retry_delay_timer(phba); in lpfc_sli4_redisc_fcf_table()
19494 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_redisc_fcf_table()
19496 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_redisc_fcf_table()
19504 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_redisc_fcf_table()
19513 mbox->vport = phba->pport; in lpfc_sli4_redisc_fcf_table()
19515 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); in lpfc_sli4_redisc_fcf_table()
19518 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_redisc_fcf_table()
19532 lpfc_sli4_fcf_dead_failthrough(struct lpfc_hba *phba) in lpfc_sli4_fcf_dead_failthrough() argument
19541 link_state = phba->link_state; in lpfc_sli4_fcf_dead_failthrough()
19542 lpfc_linkdown(phba); in lpfc_sli4_fcf_dead_failthrough()
19543 phba->link_state = link_state; in lpfc_sli4_fcf_dead_failthrough()
19546 lpfc_unregister_unused_fcf(phba); in lpfc_sli4_fcf_dead_failthrough()
19559 lpfc_sli_get_config_region23(struct lpfc_hba *phba, char *rgn23_data) in lpfc_sli_get_config_region23() argument
19569 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_get_config_region23()
19571 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_get_config_region23()
19578 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_23); in lpfc_sli_get_config_region23()
19579 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_get_config_region23()
19582 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_get_config_region23()
19603 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_get_config_region23()
19617 lpfc_sli4_get_config_region23(struct lpfc_hba *phba, char *rgn23_data) in lpfc_sli4_get_config_region23() argument
19628 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_get_config_region23()
19630 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli4_get_config_region23()
19635 if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) in lpfc_sli4_get_config_region23()
19639 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_get_config_region23()
19651 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_get_config_region23()
19653 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_get_config_region23()
19668 lpfc_sli_read_link_ste(struct lpfc_hba *phba) in lpfc_sli_read_link_ste() argument
19679 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli_read_link_ste()
19680 data_size = lpfc_sli_get_config_region23(phba, rgn23_data); in lpfc_sli_read_link_ste()
19683 &phba->sli4_hba.sli_intf); in lpfc_sli_read_link_ste()
19686 data_size = lpfc_sli4_get_config_region23(phba, rgn23_data); in lpfc_sli_read_link_ste()
19694 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_read_link_ste()
19702 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sli_read_link_ste()
19746 phba->hba_flag |= LINK_DISABLED; in lpfc_sli_read_link_ste()
19777 lpfc_wr_object(struct lpfc_hba *phba, struct list_head *dmabuf_list, in lpfc_wr_object() argument
19789 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_wr_object()
19793 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_wr_object()
19826 if (!phba->sli4_hba.intr_enable) in lpfc_wr_object()
19827 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_wr_object()
19829 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_wr_object()
19830 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_wr_object()
19852 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_wr_object()
19857 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_wr_object()
19862 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_wr_object()
19868 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_wr_object()
19876 if (!phba->sli4_hba.intr_enable) in lpfc_wr_object()
19877 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_wr_object()
19879 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_wr_object()
19881 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_wr_object()
19904 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup_pending_mbox() local
19914 spin_lock_irq(&phba->hbalock); in lpfc_cleanup_pending_mbox()
19915 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { in lpfc_cleanup_pending_mbox()
19927 mb = phba->sli.mbox_active; in lpfc_cleanup_pending_mbox()
19943 list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) { in lpfc_cleanup_pending_mbox()
19962 spin_unlock_irq(&phba->hbalock); in lpfc_cleanup_pending_mbox()
19966 spin_lock_irq(&phba->hbalock); in lpfc_cleanup_pending_mbox()
19972 spin_unlock_irq(&phba->hbalock); in lpfc_cleanup_pending_mbox()
19980 __lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_cleanup_pending_mbox()
19993 mempool_free(mb, phba->mbox_mem_pool); in lpfc_cleanup_pending_mbox()
20017 lpfc_drain_txq(struct lpfc_hba *phba) in lpfc_drain_txq() argument
20029 if (phba->link_flag & LS_MDS_LOOPBACK) { in lpfc_drain_txq()
20031 wq = phba->sli4_hba.hdwq[0].io_wq; in lpfc_drain_txq()
20036 wq = phba->sli4_hba.els_wq; in lpfc_drain_txq()
20039 pring = lpfc_phba_elsring(phba); in lpfc_drain_txq()
20058 piocbq = lpfc_sli_ringtx_get(phba, pring); in lpfc_drain_txq()
20061 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_drain_txq()
20066 sglq = __lpfc_sli_get_els_sglq(phba, piocbq); in lpfc_drain_txq()
20068 __lpfc_sli_ringtx_put(phba, pring, piocbq); in lpfc_drain_txq()
20079 if (NO_XRI == lpfc_sli4_bpl2sgl(phba, piocbq, sglq)) in lpfc_drain_txq()
20081 else if (lpfc_sli4_iocb2wqe(phba, piocbq, &wqe)) in lpfc_drain_txq()
20086 lpfc_sli_ringtxcmpl_put(phba, pring, piocbq); in lpfc_drain_txq()
20090 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_drain_txq()
20102 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_drain_txq()
20126 lpfc_wqe_bpl2sgl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeq, in lpfc_wqe_bpl2sgl() argument
20240 lpfc_sli4_issue_wqe(struct lpfc_hba *phba, struct lpfc_sli4_hdw_queue *qp, in lpfc_sli4_issue_wqe() argument
20253 pring = phba->sli4_hba.nvmels_wq->pring; in lpfc_sli4_issue_wqe()
20256 sglq = __lpfc_sli_get_els_sglq(phba, pwqe); in lpfc_sli4_issue_wqe()
20263 if (lpfc_wqe_bpl2sgl(phba, pwqe, sglq) == NO_XRI) { in lpfc_sli4_issue_wqe()
20269 ret = lpfc_sli4_wq_put(phba->sli4_hba.nvmels_wq, wqe); in lpfc_sli4_issue_wqe()
20275 lpfc_sli_ringtxcmpl_put(phba, pring, pwqe); in lpfc_sli4_issue_wqe()
20297 lpfc_sli_ringtxcmpl_put(phba, pring, pwqe); in lpfc_sli4_issue_wqe()
20327 lpfc_sli_ringtxcmpl_put(phba, pring, pwqe); in lpfc_sli4_issue_wqe()
20351 void lpfc_snapshot_mxp(struct lpfc_hba *phba, u32 hwqid) in lpfc_snapshot_mxp() argument
20359 qp = &phba->sli4_hba.hdwq[hwqid]; in lpfc_snapshot_mxp()
20386 void lpfc_adjust_pvt_pool_count(struct lpfc_hba *phba, u32 hwqid) in lpfc_adjust_pvt_pool_count() argument
20392 multixri_pool = phba->sli4_hba.hdwq[hwqid].p_multixri_pool; in lpfc_adjust_pvt_pool_count()
20405 lpfc_move_xri_pvt_to_pbl(phba, hwqid); in lpfc_adjust_pvt_pool_count()
20417 void lpfc_adjust_high_watermark(struct lpfc_hba *phba, u32 hwqid) in lpfc_adjust_high_watermark() argument
20428 qp = &phba->sli4_hba.hdwq[hwqid]; in lpfc_adjust_high_watermark()
20462 void lpfc_move_xri_pvt_to_pbl(struct lpfc_hba *phba, u32 hwqid) in lpfc_move_xri_pvt_to_pbl() argument
20473 qp = &phba->sli4_hba.hdwq[hwqid]; in lpfc_move_xri_pvt_to_pbl()
20533 _lpfc_move_xri_pbl_to_pvt(struct lpfc_hba *phba, struct lpfc_sli4_hdw_queue *qp, in _lpfc_move_xri_pbl_to_pvt() argument
20582 void lpfc_move_xri_pbl_to_pvt(struct lpfc_hba *phba, u32 hwqid, u32 count) in lpfc_move_xri_pbl_to_pvt() argument
20593 qp = &phba->sli4_hba.hdwq[hwqid]; in lpfc_move_xri_pbl_to_pvt()
20599 ret = _lpfc_move_xri_pbl_to_pvt(phba, qp, pbl_pool, pvt_pool, count); in lpfc_move_xri_pbl_to_pvt()
20607 hwq_count = phba->cfg_hdw_queue; in lpfc_move_xri_pbl_to_pvt()
20617 phba->sli4_hba.hdwq[next_hwqid].p_multixri_pool; in lpfc_move_xri_pbl_to_pvt()
20622 phba, qp, pbl_pool, pvt_pool, count); in lpfc_move_xri_pbl_to_pvt()
20653 void lpfc_keep_pvt_pool_above_lowwm(struct lpfc_hba *phba, u32 hwqid) in lpfc_keep_pvt_pool_above_lowwm() argument
20658 multixri_pool = phba->sli4_hba.hdwq[hwqid].p_multixri_pool; in lpfc_keep_pvt_pool_above_lowwm()
20662 lpfc_move_xri_pbl_to_pvt(phba, hwqid, XRI_BATCH); in lpfc_keep_pvt_pool_above_lowwm()
20677 void lpfc_release_io_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_ncmd, in lpfc_release_io_buf() argument
20694 if (phba->cfg_xpsgl && !phba->nvmet_support && in lpfc_release_io_buf()
20696 lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); in lpfc_release_io_buf()
20699 lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); in lpfc_release_io_buf()
20701 if (phba->cfg_xri_rebalancing) { in lpfc_release_io_buf()
20704 epd_pool = &phba->epd_pool; in lpfc_release_io_buf()
20781 lpfc_get_io_buf_from_private_pool(struct lpfc_hba *phba, in lpfc_get_io_buf_from_private_pool() argument
20794 phba, ndlp, lpfc_ncmd->cur_iocbq.sli4_lxritag)) in lpfc_get_io_buf_from_private_pool()
20817 lpfc_get_io_buf_from_expedite_pool(struct lpfc_hba *phba) in lpfc_get_io_buf_from_expedite_pool() argument
20824 epd_pool = &phba->epd_pool; in lpfc_get_io_buf_from_expedite_pool()
20865 lpfc_get_io_buf_from_multixri_pools(struct lpfc_hba *phba, in lpfc_get_io_buf_from_multixri_pools() argument
20874 qp = &phba->sli4_hba.hdwq[hwqid]; in lpfc_get_io_buf_from_multixri_pools()
20882 lpfc_move_xri_pbl_to_pvt(phba, hwqid, XRI_BATCH); in lpfc_get_io_buf_from_multixri_pools()
20885 lpfc_ncmd = lpfc_get_io_buf_from_private_pool(phba, qp, pvt_pool, ndlp); in lpfc_get_io_buf_from_multixri_pools()
20894 lpfc_ncmd = lpfc_get_io_buf_from_expedite_pool(phba); in lpfc_get_io_buf_from_multixri_pools()
20901 lpfc_io_buf(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, int idx) in lpfc_io_buf() argument
20906 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_io_buf()
20909 if (lpfc_test_rrq_active(phba, ndlp, in lpfc_io_buf()
20943 struct lpfc_io_buf *lpfc_get_io_buf(struct lpfc_hba *phba, in lpfc_get_io_buf() argument
20951 qp = &phba->sli4_hba.hdwq[hwqid]; in lpfc_get_io_buf()
20954 if (phba->cfg_xri_rebalancing) in lpfc_get_io_buf()
20956 phba, ndlp, hwqid, expedite); in lpfc_get_io_buf()
20961 lpfc_cmd = lpfc_io_buf(phba, ndlp, hwqid); in lpfc_get_io_buf()
20973 lpfc_cmd = lpfc_io_buf(phba, ndlp, hwqid); in lpfc_get_io_buf()
20994 lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf) in lpfc_get_sgl_per_hdwq() argument
21019 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_get_sgl_per_hdwq()
21026 tmp->dma_sgl = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool, in lpfc_get_sgl_per_hdwq()
21029 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_get_sgl_per_hdwq()
21062 lpfc_put_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf) in lpfc_put_sgl_per_hdwq() argument
21099 lpfc_free_sgl_per_hdwq(struct lpfc_hba *phba, in lpfc_free_sgl_per_hdwq() argument
21112 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_free_sgl_per_hdwq()
21135 lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, in lpfc_get_cmd_rsp_buf_per_hdwq() argument
21162 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_get_cmd_rsp_buf_per_hdwq()
21169 tmp->fcp_cmnd = dma_pool_alloc(phba->lpfc_cmd_rsp_buf_pool, in lpfc_get_cmd_rsp_buf_per_hdwq()
21174 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_get_cmd_rsp_buf_per_hdwq()
21210 lpfc_put_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, in lpfc_put_cmd_rsp_buf_per_hdwq() argument
21248 lpfc_free_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, in lpfc_free_cmd_rsp_buf_per_hdwq() argument
21262 dma_pool_free(phba->lpfc_cmd_rsp_buf_pool, in lpfc_free_cmd_rsp_buf_per_hdwq()