Lines Matching refs:phba

74 static bool lpfc_sli4_mbox_completions_pending(struct lpfc_hba *phba);
75 static bool lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba);
118 if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED) in lpfc_sli4_wq_put()
201 q->phba->mbox = (MAILBOX_t *)temp_mqe; in lpfc_sli4_mq_put()
210 writel(doorbell.word0, q->phba->sli4_hba.MQDBregaddr); in lpfc_sli4_mq_put()
232 q->phba->mbox = NULL; in lpfc_sli4_mq_release()
295 writel(doorbell.word0, q->phba->sli4_hba.EQCQDBregaddr); in lpfc_sli4_eq_clr_intr()
345 writel(doorbell.word0, q->phba->sli4_hba.EQCQDBregaddr); in lpfc_sli4_eq_release()
347 if ((q->phba->intr_type == INTx) && (arm == LPFC_QUEUE_REARM)) in lpfc_sli4_eq_release()
348 readl(q->phba->sli4_hba.EQCQDBregaddr); in lpfc_sli4_eq_release()
439 writel(doorbell.word0, q->phba->sli4_hba.EQCQDBregaddr); in lpfc_sli4_cq_release()
541 lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_cmd_iocb() argument
544 pring->sli.sli3.cmdidx * phba->iocb_cmd_size); in lpfc_cmd_iocb()
558 lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_resp_iocb() argument
561 pring->sli.sli3.rspidx * phba->iocb_rsp_size); in lpfc_resp_iocb()
574 __lpfc_sli_get_iocbq(struct lpfc_hba *phba) in __lpfc_sli_get_iocbq() argument
576 struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list; in __lpfc_sli_get_iocbq()
581 phba->iocb_cnt++; in __lpfc_sli_get_iocbq()
582 if (phba->iocb_cnt > phba->iocb_max) in __lpfc_sli_get_iocbq()
583 phba->iocb_max = phba->iocb_cnt; in __lpfc_sli_get_iocbq()
600 __lpfc_clear_active_sglq(struct lpfc_hba *phba, uint16_t xritag) in __lpfc_clear_active_sglq() argument
604 sglq = phba->sli4_hba.lpfc_sglq_active_list[xritag]; in __lpfc_clear_active_sglq()
605 phba->sli4_hba.lpfc_sglq_active_list[xritag] = NULL; in __lpfc_clear_active_sglq()
622 __lpfc_get_active_sglq(struct lpfc_hba *phba, uint16_t xritag) in __lpfc_get_active_sglq() argument
626 sglq = phba->sli4_hba.lpfc_sglq_active_list[xritag]; in __lpfc_get_active_sglq()
638 lpfc_clr_rrq_active(struct lpfc_hba *phba, in lpfc_clr_rrq_active() argument
663 mempool_free(rrq, phba->rrq_pool); in lpfc_clr_rrq_active()
681 lpfc_handle_rrq_active(struct lpfc_hba *phba) in lpfc_handle_rrq_active() argument
689 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_handle_rrq_active()
690 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_handle_rrq_active()
691 next_time = jiffies + msecs_to_jiffies(1000 * (phba->fc_ratov + 1)); in lpfc_handle_rrq_active()
693 &phba->active_rrq_list, list) { in lpfc_handle_rrq_active()
699 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_handle_rrq_active()
700 if ((!list_empty(&phba->active_rrq_list)) && in lpfc_handle_rrq_active()
701 (!(phba->pport->load_flag & FC_UNLOADING))) in lpfc_handle_rrq_active()
702 mod_timer(&phba->rrq_tmr, next_time); in lpfc_handle_rrq_active()
707 lpfc_clr_rrq_active(phba, rrq->xritag, rrq); in lpfc_handle_rrq_active()
708 else if (lpfc_send_rrq(phba, rrq)) { in lpfc_handle_rrq_active()
712 lpfc_clr_rrq_active(phba, rrq->xritag, in lpfc_handle_rrq_active()
730 struct lpfc_hba *phba = vport->phba; in lpfc_get_active_rrq() local
735 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_active_rrq()
737 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_get_active_rrq()
738 list_for_each_entry_safe(rrq, nextrrq, &phba->active_rrq_list, list) { in lpfc_get_active_rrq()
742 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_get_active_rrq()
746 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_get_active_rrq()
762 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup_vports_rrqs() local
768 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cleanup_vports_rrqs()
774 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_cleanup_vports_rrqs()
775 list_for_each_entry_safe(rrq, nextrrq, &phba->active_rrq_list, list) in lpfc_cleanup_vports_rrqs()
778 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_cleanup_vports_rrqs()
782 lpfc_clr_rrq_active(phba, rrq->xritag, rrq); in lpfc_cleanup_vports_rrqs()
797 lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_test_rrq_active() argument
826 lpfc_set_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_set_rrq_active() argument
836 if (!phba->cfg_enable_rrq) in lpfc_set_rrq_active()
839 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_set_rrq_active()
840 if (phba->pport->load_flag & FC_UNLOADING) { in lpfc_set_rrq_active()
841 phba->hba_flag &= ~HBA_RRQ_ACTIVE; in lpfc_set_rrq_active()
860 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_set_rrq_active()
861 rrq = mempool_alloc(phba->rrq_pool, GFP_KERNEL); in lpfc_set_rrq_active()
863 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_set_rrq_active()
869 if (phba->cfg_enable_rrq == 1) in lpfc_set_rrq_active()
875 msecs_to_jiffies(1000 * (phba->fc_ratov + 1)); in lpfc_set_rrq_active()
880 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_set_rrq_active()
881 empty = list_empty(&phba->active_rrq_list); in lpfc_set_rrq_active()
882 list_add_tail(&rrq->list, &phba->active_rrq_list); in lpfc_set_rrq_active()
883 phba->hba_flag |= HBA_RRQ_ACTIVE; in lpfc_set_rrq_active()
885 lpfc_worker_wake_up(phba); in lpfc_set_rrq_active()
886 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_set_rrq_active()
889 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_set_rrq_active()
890 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_set_rrq_active()
908 __lpfc_sli_get_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq) in __lpfc_sli_get_sglq() argument
910 struct list_head *lpfc_sgl_list = &phba->sli4_hba.lpfc_sgl_list; in __lpfc_sli_get_sglq()
937 if (lpfc_test_rrq_active(phba, ndlp, sglq->sli4_lxritag)) { in __lpfc_sli_get_sglq()
953 phba->sli4_hba.lpfc_sglq_active_list[sglq->sli4_lxritag] = sglq; in __lpfc_sli_get_sglq()
969 lpfc_sli_get_iocbq(struct lpfc_hba *phba) in lpfc_sli_get_iocbq() argument
974 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_get_iocbq()
975 iocbq = __lpfc_sli_get_iocbq(phba); in lpfc_sli_get_iocbq()
976 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_get_iocbq()
999 __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in __lpfc_sli_release_iocbq_s4() argument
1004 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in __lpfc_sli_release_iocbq_s4()
1009 sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_lxritag); in __lpfc_sli_release_iocbq_s4()
1015 spin_lock_irqsave(&phba->sli4_hba.abts_sgl_list_lock, in __lpfc_sli_release_iocbq_s4()
1018 &phba->sli4_hba.lpfc_abts_els_sgl_list); in __lpfc_sli_release_iocbq_s4()
1020 &phba->sli4_hba.abts_sgl_list_lock, iflag); in __lpfc_sli_release_iocbq_s4()
1026 &phba->sli4_hba.lpfc_sgl_list); in __lpfc_sli_release_iocbq_s4()
1031 lpfc_worker_wake_up(phba); in __lpfc_sli_release_iocbq_s4()
1042 list_add_tail(&iocbq->list, &phba->lpfc_iocb_list); in __lpfc_sli_release_iocbq_s4()
1057 __lpfc_sli_release_iocbq_s3(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in __lpfc_sli_release_iocbq_s3() argument
1067 list_add_tail(&iocbq->list, &phba->lpfc_iocb_list); in __lpfc_sli_release_iocbq_s3()
1081 __lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in __lpfc_sli_release_iocbq() argument
1083 phba->__lpfc_sli_release_iocbq(phba, iocbq); in __lpfc_sli_release_iocbq()
1084 phba->iocb_cnt--; in __lpfc_sli_release_iocbq()
1096 lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in lpfc_sli_release_iocbq() argument
1103 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_release_iocbq()
1104 __lpfc_sli_release_iocbq(phba, iocbq); in lpfc_sli_release_iocbq()
1105 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_release_iocbq()
1121 lpfc_sli_cancel_iocbs(struct lpfc_hba *phba, struct list_head *iocblist, in lpfc_sli_cancel_iocbs() argument
1129 lpfc_sli_release_iocbq(phba, piocb); in lpfc_sli_cancel_iocbs()
1133 (piocb->iocb_cmpl) (phba, piocb, piocb); in lpfc_sli_cancel_iocbs()
1266 lpfc_sli_ring_map(struct lpfc_hba *phba) in lpfc_sli_ring_map() argument
1268 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_ring_map()
1273 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_ring_map()
1277 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_sli_ring_map()
1279 lpfc_config_ring(phba, i, pmb); in lpfc_sli_ring_map()
1280 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_ring_map()
1282 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_ring_map()
1288 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_ring_map()
1293 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_ring_map()
1310 lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_ringtxcmpl_put() argument
1325 msecs_to_jiffies(1000 * (phba->fc_ratov << 1))); in lpfc_sli_ringtxcmpl_put()
1343 lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_ringtx_get() argument
1366 lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_next_iocb_slot() argument
1368 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; in lpfc_sli_next_iocb_slot()
1380 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_next_iocb_slot()
1387 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_next_iocb_slot()
1392 phba->work_ha |= HA_ERATT; in lpfc_sli_next_iocb_slot()
1393 phba->work_hs = HS_FFER3; in lpfc_sli_next_iocb_slot()
1395 lpfc_worker_wake_up(phba); in lpfc_sli_next_iocb_slot()
1404 return lpfc_cmd_iocb(phba, pring); in lpfc_sli_next_iocb_slot()
1420 lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) in lpfc_sli_next_iotag() argument
1425 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_next_iotag()
1428 spin_lock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1433 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1439 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1443 spin_lock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1452 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1456 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1467 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1473 spin_unlock_irq(&phba->hbalock); in lpfc_sli_next_iotag()
1475 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_next_iotag()
1497 lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_submit_iocb() argument
1507 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_submit_iocb()
1517 lpfc_sli_pcimem_bcopy(&nextiocb->iocb, iocb, phba->iocb_cmd_size); in lpfc_sli_submit_iocb()
1527 lpfc_sli_ringtxcmpl_put(phba, pring, nextiocb); in lpfc_sli_submit_iocb()
1529 __lpfc_sli_release_iocbq(phba, nextiocb); in lpfc_sli_submit_iocb()
1536 writel(pring->sli.sli3.cmdidx, &phba->host_gp[pring->ringno].cmdPutInx); in lpfc_sli_submit_iocb()
1552 lpfc_sli_update_full_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_update_full_ring() argument
1564 writel((CA_R0ATT|CA_R0CE_REQ) << (ringno*4), phba->CAregaddr); in lpfc_sli_update_full_ring()
1565 readl(phba->CAregaddr); /* flush */ in lpfc_sli_update_full_ring()
1580 lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_update_ring() argument
1587 if (!(phba->sli3_options & LPFC_SLI3_CRP_ENABLED)) { in lpfc_sli_update_ring()
1589 writel(CA_R0ATT << (ringno * 4), phba->CAregaddr); in lpfc_sli_update_ring()
1590 readl(phba->CAregaddr); /* flush */ in lpfc_sli_update_ring()
1604 lpfc_sli_resume_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_resume_iocb() argument
1617 if (lpfc_is_link_up(phba) && in lpfc_sli_resume_iocb()
1619 (pring->ringno != phba->sli.fcp_ring || in lpfc_sli_resume_iocb()
1620 phba->sli.sli_flag & LPFC_PROCESS_LA)) { in lpfc_sli_resume_iocb()
1622 while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) && in lpfc_sli_resume_iocb()
1623 (nextiocb = lpfc_sli_ringtx_get(phba, pring))) in lpfc_sli_resume_iocb()
1624 lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb); in lpfc_sli_resume_iocb()
1627 lpfc_sli_update_ring(phba, pring); in lpfc_sli_resume_iocb()
1629 lpfc_sli_update_full_ring(phba, pring); in lpfc_sli_resume_iocb()
1646 lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) in lpfc_sli_next_hbq_slot() argument
1648 struct hbq_s *hbqp = &phba->hbqs[hbqno]; in lpfc_sli_next_hbq_slot()
1655 uint32_t raw_index = phba->hbq_get[hbqno]; in lpfc_sli_next_hbq_slot()
1661 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli_next_hbq_slot()
1668 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_next_hbq_slot()
1676 return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt + in lpfc_sli_next_hbq_slot()
1690 lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba) in lpfc_sli_hbqbuf_free_all() argument
1700 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_hbqbuf_free_all()
1703 &phba->hbqs[i].hbq_buffer_list, list) { in lpfc_sli_hbqbuf_free_all()
1706 (phba->hbqs[i].hbq_free_buffer)(phba, hbq_buf); in lpfc_sli_hbqbuf_free_all()
1708 phba->hbqs[i].buffer_count = 0; in lpfc_sli_hbqbuf_free_all()
1711 list_for_each_entry_safe(dmabuf, next_dmabuf, &phba->rb_pend_list, in lpfc_sli_hbqbuf_free_all()
1716 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer) in lpfc_sli_hbqbuf_free_all()
1717 (phba, hbq_buf); in lpfc_sli_hbqbuf_free_all()
1721 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer) in lpfc_sli_hbqbuf_free_all()
1722 (phba, hbq_buf); in lpfc_sli_hbqbuf_free_all()
1724 (phba->hbqs[hbqno].hbq_free_buffer)(phba, in lpfc_sli_hbqbuf_free_all()
1730 phba->hbq_in_use = 0; in lpfc_sli_hbqbuf_free_all()
1731 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hbqbuf_free_all()
1747 lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, in lpfc_sli_hbq_to_firmware() argument
1750 return phba->lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buf); in lpfc_sli_hbq_to_firmware()
1765 lpfc_sli_hbq_to_firmware_s3(struct lpfc_hba *phba, uint32_t hbqno, in lpfc_sli_hbq_to_firmware_s3() argument
1772 hbqe = lpfc_sli_next_hbq_slot(phba, hbqno); in lpfc_sli_hbq_to_firmware_s3()
1774 struct hbq_s *hbqp = &phba->hbqs[hbqno]; in lpfc_sli_hbq_to_firmware_s3()
1784 writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); in lpfc_sli_hbq_to_firmware_s3()
1786 readl(phba->hbq_put + hbqno); in lpfc_sli_hbq_to_firmware_s3()
1804 lpfc_sli_hbq_to_firmware_s4(struct lpfc_hba *phba, uint32_t hbqno, in lpfc_sli_hbq_to_firmware_s4() argument
1815 rc = lpfc_sli4_rq_put(phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq, in lpfc_sli_hbq_to_firmware_s4()
1820 list_add_tail(&hbq_buf->dbuf.list, &phba->hbqs[hbqno].hbq_buffer_list); in lpfc_sli_hbq_to_firmware_s4()
1865 lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) in lpfc_sli_hbqbuf_fill_hbqs() argument
1871 if (!phba->hbqs[hbqno].hbq_alloc_buffer) in lpfc_sli_hbqbuf_fill_hbqs()
1874 if ((phba->hbqs[hbqno].buffer_count + count) > in lpfc_sli_hbqbuf_fill_hbqs()
1877 phba->hbqs[hbqno].buffer_count; in lpfc_sli_hbqbuf_fill_hbqs()
1882 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); in lpfc_sli_hbqbuf_fill_hbqs()
1888 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_hbqbuf_fill_hbqs()
1889 if (!phba->hbq_in_use) in lpfc_sli_hbqbuf_fill_hbqs()
1894 hbq_buffer->tag = (phba->hbqs[hbqno].buffer_count | in lpfc_sli_hbqbuf_fill_hbqs()
1896 if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) { in lpfc_sli_hbqbuf_fill_hbqs()
1897 phba->hbqs[hbqno].buffer_count++; in lpfc_sli_hbqbuf_fill_hbqs()
1900 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); in lpfc_sli_hbqbuf_fill_hbqs()
1902 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hbqbuf_fill_hbqs()
1905 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hbqbuf_fill_hbqs()
1909 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); in lpfc_sli_hbqbuf_fill_hbqs()
1924 lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno) in lpfc_sli_hbqbuf_add_hbqs() argument
1926 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_hbqbuf_add_hbqs()
1929 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, in lpfc_sli_hbqbuf_add_hbqs()
1943 lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno) in lpfc_sli_hbqbuf_init_hbqs() argument
1945 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_hbqbuf_init_hbqs()
1946 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, in lpfc_sli_hbqbuf_init_hbqs()
1949 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, in lpfc_sli_hbqbuf_init_hbqs()
1983 lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) in lpfc_sli_hbqbuf_find() argument
1993 spin_lock_irq(&phba->hbalock); in lpfc_sli_hbqbuf_find()
1994 list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) { in lpfc_sli_hbqbuf_find()
1997 spin_unlock_irq(&phba->hbalock); in lpfc_sli_hbqbuf_find()
2001 spin_unlock_irq(&phba->hbalock); in lpfc_sli_hbqbuf_find()
2002 lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, in lpfc_sli_hbqbuf_find()
2004 tag, phba->hbqs[tag >> 16].buffer_count); in lpfc_sli_hbqbuf_find()
2018 lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer) in lpfc_sli_free_hbq() argument
2024 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) in lpfc_sli_free_hbq()
2025 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); in lpfc_sli_free_hbq()
2130 lpfc_sli_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) in lpfc_sli_wake_mbox_wait() argument
2140 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_sli_wake_mbox_wait()
2144 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_wake_mbox_wait()
2160 lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) in lpfc_sli_def_mbox_cmpl() argument
2172 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli_def_mbox_cmpl()
2180 if (!(phba->pport->load_flag & FC_UNLOADING) && in lpfc_sli_def_mbox_cmpl()
2185 lpfc_unreg_login(phba, vpi, rpi, pmb); in lpfc_sli_def_mbox_cmpl()
2187 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli_def_mbox_cmpl()
2193 !(phba->pport->load_flag & FC_UNLOADING) && in lpfc_sli_def_mbox_cmpl()
2211 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_def_mbox_cmpl()
2216 lpfc_sli4_mbox_cmd_free(phba, pmb); in lpfc_sli_def_mbox_cmpl()
2218 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_def_mbox_cmpl()
2234 lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) in lpfc_sli4_unreg_rpi_cmpl_clr() argument
2241 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_sli4_unreg_rpi_cmpl_clr()
2243 &phba->sli4_hba.sli_intf) == in lpfc_sli4_unreg_rpi_cmpl_clr()
2258 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli4_unreg_rpi_cmpl_clr()
2275 lpfc_sli_handle_mb_event(struct lpfc_hba *phba) in lpfc_sli_handle_mb_event() argument
2282 phba->sli.slistat.mbox_event++; in lpfc_sli_handle_mb_event()
2285 spin_lock_irq(&phba->hbalock); in lpfc_sli_handle_mb_event()
2286 list_splice_init(&phba->sli.mboxq_cmpl, &cmplq); in lpfc_sli_handle_mb_event()
2287 spin_unlock_irq(&phba->hbalock); in lpfc_sli_handle_mb_event()
2307 lpfc_debugfs_disc_trc(phba->pport, in lpfc_sli_handle_mb_event()
2322 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_handle_mb_event()
2327 lpfc_sli_config_mbox_subsys_get(phba, in lpfc_sli_handle_mb_event()
2329 lpfc_sli_config_mbox_opcode_get(phba, in lpfc_sli_handle_mb_event()
2331 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_handle_mb_event()
2332 phba->work_hs = HS_FFER3; in lpfc_sli_handle_mb_event()
2333 lpfc_handle_eratt(phba); in lpfc_sli_handle_mb_event()
2338 phba->sli.slistat.mbox_stat_err++; in lpfc_sli_handle_mb_event()
2341 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli_handle_mb_event()
2348 lpfc_sli_config_mbox_subsys_get(phba, in lpfc_sli_handle_mb_event()
2350 lpfc_sli_config_mbox_opcode_get(phba, in lpfc_sli_handle_mb_event()
2357 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli_handle_mb_event()
2364 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli_handle_mb_event()
2370 lpfc_sli_config_mbox_subsys_get(phba, pmb), in lpfc_sli_handle_mb_event()
2371 lpfc_sli_config_mbox_opcode_get(phba, pmb), in lpfc_sli_handle_mb_event()
2387 pmb->mbox_cmpl(phba,pmb); in lpfc_sli_handle_mb_event()
2405 lpfc_sli_get_buff(struct lpfc_hba *phba, in lpfc_sli_get_buff() argument
2412 return lpfc_sli_ring_taggedbuf_get(phba, pring, tag); in lpfc_sli_get_buff()
2413 hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); in lpfc_sli_get_buff()
2432 lpfc_complete_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_complete_unsol_iocb() argument
2441 (pring->prt[0].lpfc_sli_rcv_unsol_event) (phba, pring, in lpfc_complete_unsol_iocb()
2452 (phba, pring, saveq); in lpfc_complete_unsol_iocb()
2474 lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_process_unsol_iocb() argument
2487 pring->lpfc_sli_rcv_async_status(phba, pring, saveq); in lpfc_sli_process_unsol_iocb()
2489 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
2501 (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)) { in lpfc_sli_process_unsol_iocb()
2503 dmzbuf = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
2505 lpfc_in_buf_free(phba, dmzbuf); in lpfc_sli_process_unsol_iocb()
2509 dmzbuf = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
2511 lpfc_in_buf_free(phba, dmzbuf); in lpfc_sli_process_unsol_iocb()
2515 dmzbuf = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
2517 lpfc_in_buf_free(phba, dmzbuf); in lpfc_sli_process_unsol_iocb()
2523 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { in lpfc_sli_process_unsol_iocb()
2525 saveq->context2 = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
2528 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
2537 saveq->context3 = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
2540 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
2551 iocbq->context2 = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
2554 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
2563 iocbq->context3 = lpfc_sli_get_buff(phba, pring, in lpfc_sli_process_unsol_iocb()
2566 lpfc_printf_log(phba, in lpfc_sli_process_unsol_iocb()
2622 if (!lpfc_complete_unsol_iocb(phba, pring, saveq, Rctl, Type)) in lpfc_sli_process_unsol_iocb()
2623 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_process_unsol_iocb()
2644 lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, in lpfc_sli_iocbq_lookup() argument
2653 if (iotag != 0 && iotag <= phba->sli.last_iotag) { in lpfc_sli_iocbq_lookup()
2654 cmd_iocb = phba->sli.iocbq_lookup[iotag]; in lpfc_sli_iocbq_lookup()
2662 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_iocbq_lookup()
2665 iotag, phba->sli.last_iotag, in lpfc_sli_iocbq_lookup()
2683 lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, in lpfc_sli_iocbq_lookup_by_tag() argument
2688 if (iotag != 0 && iotag <= phba->sli.last_iotag) { in lpfc_sli_iocbq_lookup_by_tag()
2689 cmd_iocb = phba->sli.iocbq_lookup[iotag]; in lpfc_sli_iocbq_lookup_by_tag()
2697 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_iocbq_lookup_by_tag()
2699 iotag, phba->sli.last_iotag); in lpfc_sli_iocbq_lookup_by_tag()
2721 lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_process_sol_iocb() argument
2729 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
2730 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); in lpfc_sli_process_sol_iocb()
2731 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
2743 lpfc_send_els_failure_event(phba, in lpfc_sli_process_sol_iocb()
2751 if ((phba->sli_rev < LPFC_SLI_REV4) && in lpfc_sli_process_sol_iocb()
2754 spin_lock_irqsave(&phba->hbalock, in lpfc_sli_process_sol_iocb()
2758 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_process_sol_iocb()
2769 spin_lock_irqsave(&phba->hbalock, in lpfc_sli_process_sol_iocb()
2772 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_process_sol_iocb()
2775 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_process_sol_iocb()
2785 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
2789 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
2799 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
2803 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
2819 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
2823 &phba->hbalock, iflag); in lpfc_sli_process_sol_iocb()
2827 (cmdiocbp->iocb_cmpl) (phba, cmdiocbp, saveq); in lpfc_sli_process_sol_iocb()
2829 lpfc_sli_release_iocbq(phba, cmdiocbp); in lpfc_sli_process_sol_iocb()
2841 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_process_sol_iocb()
2868 lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_rsp_pointers_error() argument
2870 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; in lpfc_sli_rsp_pointers_error()
2875 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_rsp_pointers_error()
2881 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_rsp_pointers_error()
2887 phba->work_ha |= HA_ERATT; in lpfc_sli_rsp_pointers_error()
2888 phba->work_hs = HS_FFER3; in lpfc_sli_rsp_pointers_error()
2890 lpfc_worker_wake_up(phba); in lpfc_sli_rsp_pointers_error()
2907 struct lpfc_hba *phba; in lpfc_poll_eratt() local
2911 phba = (struct lpfc_hba *)ptr; in lpfc_poll_eratt()
2914 sli_intr = phba->sli.slistat.sli_intr; in lpfc_poll_eratt()
2916 if (phba->sli.slistat.sli_prev_intr > sli_intr) in lpfc_poll_eratt()
2917 cnt = (((uint64_t)(-1) - phba->sli.slistat.sli_prev_intr) + in lpfc_poll_eratt()
2920 cnt = (sli_intr - phba->sli.slistat.sli_prev_intr); in lpfc_poll_eratt()
2924 phba->sli.slistat.sli_ips = cnt; in lpfc_poll_eratt()
2926 phba->sli.slistat.sli_prev_intr = sli_intr; in lpfc_poll_eratt()
2929 eratt = lpfc_sli_check_eratt(phba); in lpfc_poll_eratt()
2933 lpfc_worker_wake_up(phba); in lpfc_poll_eratt()
2936 mod_timer(&phba->eratt_poll, in lpfc_poll_eratt()
2961 lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, in lpfc_sli_handle_fast_ring_event() argument
2964 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; in lpfc_sli_handle_fast_ring_event()
2976 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
2986 lpfc_sli_rsp_pointers_error(phba, pring); in lpfc_sli_handle_fast_ring_event()
2987 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
2990 if (phba->fcp_ring_in_use) { in lpfc_sli_handle_fast_ring_event()
2991 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
2994 phba->fcp_ring_in_use = 1; in lpfc_sli_handle_fast_ring_event()
3003 entry = lpfc_resp_iocb(phba, pring); in lpfc_sli_handle_fast_ring_event()
3004 phba->last_completion_time = jiffies; in lpfc_sli_handle_fast_ring_event()
3011 phba->iocb_rsp_size); in lpfc_sli_handle_fast_ring_event()
3027 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3028 phba->lpfc_rampdown_queue_depth(phba); in lpfc_sli_handle_fast_ring_event()
3029 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3033 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_handle_fast_ring_event()
3055 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_handle_fast_ring_event()
3063 cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, in lpfc_sli_handle_fast_ring_event()
3070 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3071 (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, in lpfc_sli_handle_fast_ring_event()
3073 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3077 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3078 lpfc_sli_process_unsol_iocb(phba, pring, &rspiocbq); in lpfc_sli_handle_fast_ring_event()
3079 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3087 dev_warn(&((phba->pcidev)->dev), in lpfc_sli_handle_fast_ring_event()
3089 phba->brd_no, adaptermsg); in lpfc_sli_handle_fast_ring_event()
3092 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_handle_fast_ring_event()
3110 &phba->host_gp[pring->ringno].rspGetInx); in lpfc_sli_handle_fast_ring_event()
3119 writel(status, phba->CAregaddr); in lpfc_sli_handle_fast_ring_event()
3120 readl(phba->CAregaddr); in lpfc_sli_handle_fast_ring_event()
3128 lpfc_sli_resume_iocb(phba, pring); in lpfc_sli_handle_fast_ring_event()
3131 (pring->lpfc_sli_cmd_available) (phba, pring); in lpfc_sli_handle_fast_ring_event()
3135 phba->fcp_ring_in_use = 0; in lpfc_sli_handle_fast_ring_event()
3136 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_fast_ring_event()
3159 lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_sp_handle_rspiocb() argument
3172 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3200 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3201 phba->lpfc_rampdown_queue_depth(phba); in lpfc_sli_sp_handle_rspiocb()
3202 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3207 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_sp_handle_rspiocb()
3243 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3244 rc = lpfc_sli_process_sol_iocb(phba, pring, saveq); in lpfc_sli_sp_handle_rspiocb()
3245 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3249 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3250 rc = lpfc_sli_process_unsol_iocb(phba, pring, saveq); in lpfc_sli_sp_handle_rspiocb()
3251 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3259 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, in lpfc_sli_sp_handle_rspiocb()
3264 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_sp_handle_rspiocb()
3266 (cmdiocbp->iocb_cmpl)(phba, cmdiocbp, in lpfc_sli_sp_handle_rspiocb()
3268 spin_lock_irqsave(&phba->hbalock, in lpfc_sli_sp_handle_rspiocb()
3271 __lpfc_sli_release_iocbq(phba, in lpfc_sli_sp_handle_rspiocb()
3282 dev_warn(&((phba->pcidev)->dev), in lpfc_sli_sp_handle_rspiocb()
3284 phba->brd_no, adaptermsg); in lpfc_sli_sp_handle_rspiocb()
3287 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_sp_handle_rspiocb()
3303 __lpfc_sli_release_iocbq(phba, rspiocbp); in lpfc_sli_sp_handle_rspiocb()
3305 __lpfc_sli_release_iocbq(phba, saveq); in lpfc_sli_sp_handle_rspiocb()
3309 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_handle_rspiocb()
3323 lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, in lpfc_sli_handle_slow_ring_event() argument
3326 phba->lpfc_sli_handle_slow_ring_event(phba, pring, mask); in lpfc_sli_handle_slow_ring_event()
3341 lpfc_sli_handle_slow_ring_event_s3(struct lpfc_hba *phba, in lpfc_sli_handle_slow_ring_event_s3() argument
3352 pgp = &phba->port_gp[pring->ringno]; in lpfc_sli_handle_slow_ring_event_s3()
3353 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3367 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_handle_slow_ring_event_s3()
3372 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_handle_slow_ring_event_s3()
3373 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3375 phba->work_hs = HS_FFER3; in lpfc_sli_handle_slow_ring_event_s3()
3376 lpfc_handle_eratt(phba); in lpfc_sli_handle_slow_ring_event_s3()
3396 entry = lpfc_resp_iocb(phba, pring); in lpfc_sli_handle_slow_ring_event_s3()
3398 phba->last_completion_time = jiffies; in lpfc_sli_handle_slow_ring_event_s3()
3399 rspiocbp = __lpfc_sli_get_iocbq(phba); in lpfc_sli_handle_slow_ring_event_s3()
3407 phba->iocb_rsp_size); in lpfc_sli_handle_slow_ring_event_s3()
3414 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_handle_slow_ring_event_s3()
3422 &phba->host_gp[pring->ringno].rspGetInx); in lpfc_sli_handle_slow_ring_event_s3()
3424 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3426 rspiocbp = lpfc_sli_sp_handle_rspiocb(phba, pring, rspiocbp); in lpfc_sli_handle_slow_ring_event_s3()
3427 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3444 writel(status, phba->CAregaddr); in lpfc_sli_handle_slow_ring_event_s3()
3445 readl(phba->CAregaddr); /* flush */ in lpfc_sli_handle_slow_ring_event_s3()
3453 lpfc_sli_resume_iocb(phba, pring); in lpfc_sli_handle_slow_ring_event_s3()
3456 (pring->lpfc_sli_cmd_available) (phba, pring); in lpfc_sli_handle_slow_ring_event_s3()
3460 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s3()
3477 lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, in lpfc_sli_handle_slow_ring_event_s4() argument
3485 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s4()
3486 phba->hba_flag &= ~HBA_SP_QUEUE_EVT; in lpfc_sli_handle_slow_ring_event_s4()
3487 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s4()
3488 while (!list_empty(&phba->sli4_hba.sp_queue_event)) { in lpfc_sli_handle_slow_ring_event_s4()
3490 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s4()
3491 list_remove_head(&phba->sli4_hba.sp_queue_event, in lpfc_sli_handle_slow_ring_event_s4()
3493 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_handle_slow_ring_event_s4()
3500 irspiocbq = lpfc_sli4_els_wcqe_to_rspiocbq(phba, in lpfc_sli_handle_slow_ring_event_s4()
3503 lpfc_sli_sp_handle_rspiocb(phba, pring, in lpfc_sli_handle_slow_ring_event_s4()
3510 lpfc_sli4_handle_received_buffer(phba, dmabuf); in lpfc_sli_handle_slow_ring_event_s4()
3529 lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) in lpfc_sli_abort_iocb_ring() argument
3535 lpfc_fabric_abort_hba(phba); in lpfc_sli_abort_iocb_ring()
3541 if (phba->sli_rev >= LPFC_SLI_REV4) { in lpfc_sli_abort_iocb_ring()
3547 spin_lock_irq(&phba->hbalock); in lpfc_sli_abort_iocb_ring()
3550 lpfc_sli_issue_abort_iotag(phba, pring, iocb); in lpfc_sli_abort_iocb_ring()
3551 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_iocb_ring()
3553 spin_lock_irq(&phba->hbalock); in lpfc_sli_abort_iocb_ring()
3559 lpfc_sli_issue_abort_iotag(phba, pring, iocb); in lpfc_sli_abort_iocb_ring()
3560 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_iocb_ring()
3564 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_sli_abort_iocb_ring()
3579 lpfc_sli_abort_fcp_rings(struct lpfc_hba *phba) in lpfc_sli_abort_fcp_rings() argument
3581 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_abort_fcp_rings()
3586 if (phba->sli_rev >= LPFC_SLI_REV4) { in lpfc_sli_abort_fcp_rings()
3587 for (i = 0; i < phba->cfg_fcp_io_channel; i++) { in lpfc_sli_abort_fcp_rings()
3589 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_sli_abort_fcp_rings()
3593 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_sli_abort_fcp_rings()
3609 lpfc_sli_flush_fcp_rings(struct lpfc_hba *phba) in lpfc_sli_flush_fcp_rings() argument
3613 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_flush_fcp_rings()
3617 spin_lock_irq(&phba->hbalock); in lpfc_sli_flush_fcp_rings()
3619 phba->hba_flag |= HBA_FCP_IOQ_FLUSH; in lpfc_sli_flush_fcp_rings()
3620 spin_unlock_irq(&phba->hbalock); in lpfc_sli_flush_fcp_rings()
3623 if (phba->sli_rev >= LPFC_SLI_REV4) { in lpfc_sli_flush_fcp_rings()
3624 for (i = 0; i < phba->cfg_fcp_io_channel; i++) { in lpfc_sli_flush_fcp_rings()
3637 lpfc_sli_cancel_iocbs(phba, &txq, in lpfc_sli_flush_fcp_rings()
3641 lpfc_sli_cancel_iocbs(phba, &txcmplq, in lpfc_sli_flush_fcp_rings()
3648 spin_lock_irq(&phba->hbalock); in lpfc_sli_flush_fcp_rings()
3655 spin_unlock_irq(&phba->hbalock); in lpfc_sli_flush_fcp_rings()
3658 lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT, in lpfc_sli_flush_fcp_rings()
3661 lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT, in lpfc_sli_flush_fcp_rings()
3680 lpfc_sli_brdready_s3(struct lpfc_hba *phba, uint32_t mask) in lpfc_sli_brdready_s3() argument
3687 if (lpfc_readl(phba->HSregaddr, &status)) in lpfc_sli_brdready_s3()
3709 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli_brdready_s3()
3710 lpfc_sli_brdrestart(phba); in lpfc_sli_brdready_s3()
3713 if (lpfc_readl(phba->HSregaddr, &status)) { in lpfc_sli_brdready_s3()
3721 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_brdready_s3()
3725 readl(phba->MBslimaddr + 0xa8), in lpfc_sli_brdready_s3()
3726 readl(phba->MBslimaddr + 0xac)); in lpfc_sli_brdready_s3()
3727 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_brdready_s3()
3746 lpfc_sli_brdready_s4(struct lpfc_hba *phba, uint32_t mask) in lpfc_sli_brdready_s4() argument
3752 status = lpfc_sli4_post_status_check(phba); in lpfc_sli_brdready_s4()
3755 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli_brdready_s4()
3756 lpfc_sli_brdrestart(phba); in lpfc_sli_brdready_s4()
3757 status = lpfc_sli4_post_status_check(phba); in lpfc_sli_brdready_s4()
3762 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_brdready_s4()
3765 phba->sli4_hba.intr_enable = 0; in lpfc_sli_brdready_s4()
3779 lpfc_sli_brdready(struct lpfc_hba *phba, uint32_t mask) in lpfc_sli_brdready() argument
3781 return phba->lpfc_sli_brdready(phba, mask); in lpfc_sli_brdready()
3793 void lpfc_reset_barrier(struct lpfc_hba *phba) in lpfc_reset_barrier() argument
3802 pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype); in lpfc_reset_barrier()
3804 (FC_JEDEC_ID(phba->vpd.rev.biuRev) != HELIOS_JEDEC_ID && in lpfc_reset_barrier()
3805 FC_JEDEC_ID(phba->vpd.rev.biuRev) != THOR_JEDEC_ID)) in lpfc_reset_barrier()
3812 resp_buf = phba->MBslimaddr; in lpfc_reset_barrier()
3815 if (lpfc_readl(phba->HCregaddr, &hc_copy)) in lpfc_reset_barrier()
3817 writel((hc_copy & ~HC_ERINT_ENA), phba->HCregaddr); in lpfc_reset_barrier()
3818 readl(phba->HCregaddr); /* flush */ in lpfc_reset_barrier()
3819 phba->link_flag |= LS_IGNORE_ERATT; in lpfc_reset_barrier()
3821 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_reset_barrier()
3825 writel(HA_ERATT, phba->HAregaddr); in lpfc_reset_barrier()
3826 phba->pport->stopped = 1; in lpfc_reset_barrier()
3834 mbox_buf = phba->MBslimaddr; in lpfc_reset_barrier()
3849 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE || in lpfc_reset_barrier()
3850 phba->pport->stopped) in lpfc_reset_barrier()
3870 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_reset_barrier()
3878 if (readl(phba->HAregaddr) & HA_ERATT) { in lpfc_reset_barrier()
3879 writel(HA_ERATT, phba->HAregaddr); in lpfc_reset_barrier()
3880 phba->pport->stopped = 1; in lpfc_reset_barrier()
3884 phba->link_flag &= ~LS_IGNORE_ERATT; in lpfc_reset_barrier()
3885 writel(hc_copy, phba->HCregaddr); in lpfc_reset_barrier()
3886 readl(phba->HCregaddr); /* flush */ in lpfc_reset_barrier()
3901 lpfc_sli_brdkill(struct lpfc_hba *phba) in lpfc_sli_brdkill() argument
3910 psli = &phba->sli; in lpfc_sli_brdkill()
3913 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_brdkill()
3915 phba->pport->port_state, psli->sli_flag); in lpfc_sli_brdkill()
3917 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_brdkill()
3922 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3923 if (lpfc_readl(phba->HCregaddr, &status)) { in lpfc_sli_brdkill()
3924 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3925 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_brdkill()
3929 writel(status, phba->HCregaddr); in lpfc_sli_brdkill()
3930 readl(phba->HCregaddr); /* flush */ in lpfc_sli_brdkill()
3931 phba->link_flag |= LS_IGNORE_ERATT; in lpfc_sli_brdkill()
3932 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3934 lpfc_kill_board(phba, pmb); in lpfc_sli_brdkill()
3936 retval = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli_brdkill()
3940 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_brdkill()
3941 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_brdkill()
3944 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3945 phba->link_flag &= ~LS_IGNORE_ERATT; in lpfc_sli_brdkill()
3946 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3950 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3952 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3954 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_brdkill()
3961 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_brdkill()
3965 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_brdkill()
3971 writel(HA_ERATT, phba->HAregaddr); in lpfc_sli_brdkill()
3972 phba->pport->stopped = 1; in lpfc_sli_brdkill()
3974 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3977 phba->link_flag &= ~LS_IGNORE_ERATT; in lpfc_sli_brdkill()
3978 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdkill()
3980 lpfc_hba_down_post(phba); in lpfc_sli_brdkill()
3981 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_brdkill()
3998 lpfc_sli_brdreset(struct lpfc_hba *phba) in lpfc_sli_brdreset() argument
4005 psli = &phba->sli; in lpfc_sli_brdreset()
4008 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_brdreset()
4010 phba->pport->port_state, psli->sli_flag); in lpfc_sli_brdreset()
4013 phba->fc_eventTag = 0; in lpfc_sli_brdreset()
4014 phba->link_events = 0; in lpfc_sli_brdreset()
4015 phba->pport->fc_myDID = 0; in lpfc_sli_brdreset()
4016 phba->pport->fc_prevDID = 0; in lpfc_sli_brdreset()
4019 pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value); in lpfc_sli_brdreset()
4020 pci_write_config_word(phba->pcidev, PCI_COMMAND, in lpfc_sli_brdreset()
4027 writel(HC_INITFF, phba->HCregaddr); in lpfc_sli_brdreset()
4029 readl(phba->HCregaddr); /* flush */ in lpfc_sli_brdreset()
4030 writel(0, phba->HCregaddr); in lpfc_sli_brdreset()
4031 readl(phba->HCregaddr); /* flush */ in lpfc_sli_brdreset()
4034 pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value); in lpfc_sli_brdreset()
4047 phba->link_state = LPFC_WARM_START; in lpfc_sli_brdreset()
4062 lpfc_sli4_brdreset(struct lpfc_hba *phba) in lpfc_sli4_brdreset() argument
4064 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_brdreset()
4069 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_brdreset()
4071 phba->pport->port_state, psli->sli_flag, in lpfc_sli4_brdreset()
4072 phba->hba_flag); in lpfc_sli4_brdreset()
4075 phba->fc_eventTag = 0; in lpfc_sli4_brdreset()
4076 phba->link_events = 0; in lpfc_sli4_brdreset()
4077 phba->pport->fc_myDID = 0; in lpfc_sli4_brdreset()
4078 phba->pport->fc_prevDID = 0; in lpfc_sli4_brdreset()
4080 spin_lock_irq(&phba->hbalock); in lpfc_sli4_brdreset()
4082 phba->fcf.fcf_flag = 0; in lpfc_sli4_brdreset()
4083 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_brdreset()
4086 if (phba->hba_flag & HBA_FW_DUMP_OP) { in lpfc_sli4_brdreset()
4087 phba->hba_flag &= ~HBA_FW_DUMP_OP; in lpfc_sli4_brdreset()
4092 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_brdreset()
4096 pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value); in lpfc_sli4_brdreset()
4097 pci_write_config_word(phba->pcidev, PCI_COMMAND, (cfg_value & in lpfc_sli4_brdreset()
4101 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_brdreset()
4102 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_brdreset()
4105 pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value); in lpfc_sli4_brdreset()
4124 lpfc_sli_brdrestart_s3(struct lpfc_hba *phba) in lpfc_sli_brdrestart_s3() argument
4132 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdrestart_s3()
4135 hba_aer_enabled = phba->hba_flag & HBA_AER_ENABLED; in lpfc_sli_brdrestart_s3()
4137 psli = &phba->sli; in lpfc_sli_brdrestart_s3()
4140 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_brdrestart_s3()
4142 phba->pport->port_state, psli->sli_flag); in lpfc_sli_brdrestart_s3()
4149 lpfc_reset_barrier(phba); in lpfc_sli_brdrestart_s3()
4151 to_slim = phba->MBslimaddr; in lpfc_sli_brdrestart_s3()
4156 if (phba->pport->port_state) in lpfc_sli_brdrestart_s3()
4160 to_slim = phba->MBslimaddr + sizeof (uint32_t); in lpfc_sli_brdrestart_s3()
4164 lpfc_sli_brdreset(phba); in lpfc_sli_brdrestart_s3()
4165 phba->pport->stopped = 0; in lpfc_sli_brdrestart_s3()
4166 phba->link_state = LPFC_INIT_START; in lpfc_sli_brdrestart_s3()
4167 phba->hba_flag = 0; in lpfc_sli_brdrestart_s3()
4168 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdrestart_s3()
4178 pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_sli_brdrestart_s3()
4180 lpfc_hba_down_post(phba); in lpfc_sli_brdrestart_s3()
4195 lpfc_sli_brdrestart_s4(struct lpfc_hba *phba) in lpfc_sli_brdrestart_s4() argument
4197 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_brdrestart_s4()
4202 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_brdrestart_s4()
4204 phba->pport->port_state, psli->sli_flag); in lpfc_sli_brdrestart_s4()
4207 hba_aer_enabled = phba->hba_flag & HBA_AER_ENABLED; in lpfc_sli_brdrestart_s4()
4209 rc = lpfc_sli4_brdreset(phba); in lpfc_sli_brdrestart_s4()
4211 spin_lock_irq(&phba->hbalock); in lpfc_sli_brdrestart_s4()
4212 phba->pport->stopped = 0; in lpfc_sli_brdrestart_s4()
4213 phba->link_state = LPFC_INIT_START; in lpfc_sli_brdrestart_s4()
4214 phba->hba_flag = 0; in lpfc_sli_brdrestart_s4()
4215 spin_unlock_irq(&phba->hbalock); in lpfc_sli_brdrestart_s4()
4222 pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_sli_brdrestart_s4()
4224 lpfc_hba_down_post(phba); in lpfc_sli_brdrestart_s4()
4237 lpfc_sli_brdrestart(struct lpfc_hba *phba) in lpfc_sli_brdrestart() argument
4239 return phba->lpfc_sli_brdrestart(phba); in lpfc_sli_brdrestart()
4253 lpfc_sli_chipset_init(struct lpfc_hba *phba) in lpfc_sli_chipset_init() argument
4258 if (lpfc_readl(phba->HSregaddr, &status)) in lpfc_sli_chipset_init()
4276 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_chipset_init()
4280 readl(phba->MBslimaddr + 0xa8), in lpfc_sli_chipset_init()
4281 readl(phba->MBslimaddr + 0xac)); in lpfc_sli_chipset_init()
4282 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_chipset_init()
4291 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_chipset_init()
4295 readl(phba->MBslimaddr + 0xa8), in lpfc_sli_chipset_init()
4296 readl(phba->MBslimaddr + 0xac)); in lpfc_sli_chipset_init()
4297 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_chipset_init()
4310 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli_chipset_init()
4311 lpfc_sli_brdrestart(phba); in lpfc_sli_chipset_init()
4314 if (lpfc_readl(phba->HSregaddr, &status)) in lpfc_sli_chipset_init()
4322 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_chipset_init()
4326 readl(phba->MBslimaddr + 0xa8), in lpfc_sli_chipset_init()
4327 readl(phba->MBslimaddr + 0xac)); in lpfc_sli_chipset_init()
4328 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_chipset_init()
4333 writel(0, phba->HCregaddr); in lpfc_sli_chipset_init()
4334 readl(phba->HCregaddr); /* flush */ in lpfc_sli_chipset_init()
4337 writel(0xffffffff, phba->HAregaddr); in lpfc_sli_chipset_init()
4338 readl(phba->HAregaddr); /* flush */ in lpfc_sli_chipset_init()
4395 lpfc_sli_hbq_setup(struct lpfc_hba *phba) in lpfc_sli_hbq_setup() argument
4406 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_hbq_setup()
4414 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_sli_hbq_setup()
4415 phba->hbq_in_use = 1; in lpfc_sli_hbq_setup()
4419 phba->hbqs[hbqno].next_hbqPutIdx = 0; in lpfc_sli_hbq_setup()
4420 phba->hbqs[hbqno].hbqPutIdx = 0; in lpfc_sli_hbq_setup()
4421 phba->hbqs[hbqno].local_hbqGetIdx = 0; in lpfc_sli_hbq_setup()
4422 phba->hbqs[hbqno].entry_count = in lpfc_sli_hbq_setup()
4424 lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno], in lpfc_sli_hbq_setup()
4426 hbq_entry_index += phba->hbqs[hbqno].entry_count; in lpfc_sli_hbq_setup()
4428 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { in lpfc_sli_hbq_setup()
4432 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli_hbq_setup()
4439 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_hbq_setup()
4440 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_hbq_setup()
4444 phba->hbq_count = hbq_count; in lpfc_sli_hbq_setup()
4446 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_hbq_setup()
4450 lpfc_sli_hbqbuf_init_hbqs(phba, hbqno); in lpfc_sli_hbq_setup()
4464 lpfc_sli4_rb_setup(struct lpfc_hba *phba) in lpfc_sli4_rb_setup() argument
4466 phba->hbq_in_use = 1; in lpfc_sli4_rb_setup()
4467 phba->hbqs[0].entry_count = lpfc_hbq_defs[0]->entry_count; in lpfc_sli4_rb_setup()
4468 phba->hbq_count = 1; in lpfc_sli4_rb_setup()
4470 lpfc_sli_hbqbuf_init_hbqs(phba, 0); in lpfc_sli4_rb_setup()
4488 lpfc_sli_config_port(struct lpfc_hba *phba, int sli_mode) in lpfc_sli_config_port() argument
4493 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_config_port()
4495 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_config_port()
4499 phba->sli_rev = sli_mode; in lpfc_sli_config_port()
4501 spin_lock_irq(&phba->hbalock); in lpfc_sli_config_port()
4502 phba->sli.sli_flag |= LPFC_SLI_MBOX_ACTIVE; in lpfc_sli_config_port()
4503 spin_unlock_irq(&phba->hbalock); in lpfc_sli_config_port()
4504 phba->pport->port_state = LPFC_VPORT_UNKNOWN; in lpfc_sli_config_port()
4505 lpfc_sli_brdrestart(phba); in lpfc_sli_config_port()
4506 rc = lpfc_sli_chipset_init(phba); in lpfc_sli_config_port()
4510 spin_lock_irq(&phba->hbalock); in lpfc_sli_config_port()
4511 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli_config_port()
4512 spin_unlock_irq(&phba->hbalock); in lpfc_sli_config_port()
4520 rc = lpfc_config_port_prep(phba); in lpfc_sli_config_port()
4522 phba->link_state = LPFC_LINK_UNKNOWN; in lpfc_sli_config_port()
4527 phba->link_state = LPFC_INIT_MBX_CMDS; in lpfc_sli_config_port()
4528 lpfc_config_port(phba, pmb); in lpfc_sli_config_port()
4529 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_config_port()
4530 phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED | in lpfc_sli_config_port()
4536 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_config_port()
4540 spin_lock_irq(&phba->hbalock); in lpfc_sli_config_port()
4541 phba->sli.sli_flag &= ~LPFC_SLI_ACTIVE; in lpfc_sli_config_port()
4542 spin_unlock_irq(&phba->hbalock); in lpfc_sli_config_port()
4546 spin_lock_irq(&phba->hbalock); in lpfc_sli_config_port()
4547 phba->sli.sli_flag &= ~LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli_config_port()
4548 spin_unlock_irq(&phba->hbalock); in lpfc_sli_config_port()
4553 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli_config_port()
4566 if (phba->max_vpi && pmb->u.mb.un.varCfgPort.gmv) { in lpfc_sli_config_port()
4567 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; in lpfc_sli_config_port()
4568 phba->max_vpi = pmb->u.mb.un.varCfgPort.max_vpi; in lpfc_sli_config_port()
4569 phba->max_vports = (phba->max_vpi > phba->max_vports) ? in lpfc_sli_config_port()
4570 phba->max_vpi : phba->max_vports; in lpfc_sli_config_port()
4573 phba->max_vpi = 0; in lpfc_sli_config_port()
4574 phba->fips_level = 0; in lpfc_sli_config_port()
4575 phba->fips_spec_rev = 0; in lpfc_sli_config_port()
4577 phba->sli3_options |= LPFC_SLI3_DSS_ENABLED; in lpfc_sli_config_port()
4578 phba->fips_level = pmb->u.mb.un.varCfgPort.fips_level; in lpfc_sli_config_port()
4579 phba->fips_spec_rev = pmb->u.mb.un.varCfgPort.fips_rev; in lpfc_sli_config_port()
4580 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_config_port()
4583 phba->fips_level, phba->fips_spec_rev); in lpfc_sli_config_port()
4586 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_config_port()
4592 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED; in lpfc_sli_config_port()
4594 phba->sli3_options |= LPFC_SLI3_CRP_ENABLED; in lpfc_sli_config_port()
4596 phba->hbq_get = phba->mbox->us.s3_pgp.hbq_get; in lpfc_sli_config_port()
4597 phba->port_gp = phba->mbox->us.s3_pgp.port; in lpfc_sli_config_port()
4599 if (phba->cfg_enable_bg) { in lpfc_sli_config_port()
4601 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_sli_config_port()
4603 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_config_port()
4608 phba->hbq_get = NULL; in lpfc_sli_config_port()
4609 phba->port_gp = phba->mbox->us.s2.port; in lpfc_sli_config_port()
4610 phba->max_vpi = 0; in lpfc_sli_config_port()
4613 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_config_port()
4632 lpfc_sli_hba_setup(struct lpfc_hba *phba) in lpfc_sli_hba_setup() argument
4640 if (phba->cfg_enable_npiv) { in lpfc_sli_hba_setup()
4641 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, in lpfc_sli_hba_setup()
4653 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, in lpfc_sli_hba_setup()
4660 rc = lpfc_sli_config_port(phba, mode); in lpfc_sli_hba_setup()
4663 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, in lpfc_sli_hba_setup()
4667 rc = lpfc_sli_config_port(phba, 2); in lpfc_sli_hba_setup()
4672 if (phba->cfg_aer_support == 1 && !(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_sli_hba_setup()
4673 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_sli_hba_setup()
4675 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_hba_setup()
4678 spin_lock_irq(&phba->hbalock); in lpfc_sli_hba_setup()
4679 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_sli_hba_setup()
4680 spin_unlock_irq(&phba->hbalock); in lpfc_sli_hba_setup()
4682 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_hba_setup()
4686 phba->cfg_aer_support = 0; in lpfc_sli_hba_setup()
4690 if (phba->sli_rev == 3) { in lpfc_sli_hba_setup()
4691 phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE; in lpfc_sli_hba_setup()
4692 phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE; in lpfc_sli_hba_setup()
4694 phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE; in lpfc_sli_hba_setup()
4695 phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE; in lpfc_sli_hba_setup()
4696 phba->sli3_options = 0; in lpfc_sli_hba_setup()
4699 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_hba_setup()
4701 phba->sli_rev, phba->max_vpi); in lpfc_sli_hba_setup()
4702 rc = lpfc_sli_ring_map(phba); in lpfc_sli_hba_setup()
4708 if (phba->sli_rev == LPFC_SLI_REV3) { in lpfc_sli_hba_setup()
4714 if ((phba->vpi_bmask == NULL) && (phba->vpi_ids == NULL)) { in lpfc_sli_hba_setup()
4715 longs = (phba->max_vpi + BITS_PER_LONG) / BITS_PER_LONG; in lpfc_sli_hba_setup()
4716 phba->vpi_bmask = kzalloc(longs * sizeof(unsigned long), in lpfc_sli_hba_setup()
4718 if (!phba->vpi_bmask) { in lpfc_sli_hba_setup()
4723 phba->vpi_ids = kzalloc( in lpfc_sli_hba_setup()
4724 (phba->max_vpi+1) * sizeof(uint16_t), in lpfc_sli_hba_setup()
4726 if (!phba->vpi_ids) { in lpfc_sli_hba_setup()
4727 kfree(phba->vpi_bmask); in lpfc_sli_hba_setup()
4731 for (i = 0; i < phba->max_vpi; i++) in lpfc_sli_hba_setup()
4732 phba->vpi_ids[i] = i; in lpfc_sli_hba_setup()
4737 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { in lpfc_sli_hba_setup()
4738 rc = lpfc_sli_hbq_setup(phba); in lpfc_sli_hba_setup()
4742 spin_lock_irq(&phba->hbalock); in lpfc_sli_hba_setup()
4743 phba->sli.sli_flag |= LPFC_PROCESS_LA; in lpfc_sli_hba_setup()
4744 spin_unlock_irq(&phba->hbalock); in lpfc_sli_hba_setup()
4746 rc = lpfc_config_port_post(phba); in lpfc_sli_hba_setup()
4753 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli_hba_setup()
4754 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_hba_setup()
4768 lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba) in lpfc_sli4_read_fcoe_params() argument
4777 phba->valid_vlan = 0; in lpfc_sli4_read_fcoe_params()
4778 phba->fc_map[0] = LPFC_FCOE_FCF_MAP0; in lpfc_sli4_read_fcoe_params()
4779 phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; in lpfc_sli4_read_fcoe_params()
4780 phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; in lpfc_sli4_read_fcoe_params()
4782 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_fcoe_params()
4787 if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) { in lpfc_sli4_read_fcoe_params()
4793 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_read_fcoe_params()
4795 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_read_fcoe_params()
4817 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_read_fcoe_params()
4824 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_read_fcoe_params()
4830 lpfc_parse_fcoe_conf(phba, mp->virt, data_length); in lpfc_sli4_read_fcoe_params()
4831 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_read_fcoe_params()
4836 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_read_fcoe_params()
4856 lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, in lpfc_sli4_read_rev() argument
4873 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, dma_size, in lpfc_sli4_read_rev()
4885 lpfc_read_rev(phba, mboxq); in lpfc_sli4_read_rev()
4893 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_read_rev()
4895 dma_free_coherent(&phba->pcidev->dev, dma_size, in lpfc_sli4_read_rev()
4911 dma_free_coherent(&phba->pcidev->dev, dma_size, in lpfc_sli4_read_rev()
4929 lpfc_sli4_retrieve_pport_name(struct lpfc_hba *phba) in lpfc_sli4_retrieve_pport_name() argument
4943 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL; in lpfc_sli4_retrieve_pport_name()
4944 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_NON; in lpfc_sli4_retrieve_pport_name()
4946 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_retrieve_pport_name()
4950 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL; in lpfc_sli4_retrieve_pport_name()
4951 lpfc_sli4_read_config(phba); in lpfc_sli4_retrieve_pport_name()
4952 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) in lpfc_sli4_retrieve_pport_name()
4957 alloclen = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_retrieve_pport_name()
4961 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_retrieve_pport_name()
4968 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_retrieve_pport_name()
4975 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_retrieve_pport_name()
4979 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_retrieve_pport_name()
4980 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_retrieve_pport_name()
4986 phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; in lpfc_sli4_retrieve_pport_name()
4987 phba->sli4_hba.lnk_info.lnk_tp = in lpfc_sli4_retrieve_pport_name()
4989 phba->sli4_hba.lnk_info.lnk_no = in lpfc_sli4_retrieve_pport_name()
4991 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_retrieve_pport_name()
4993 phba->sli4_hba.lnk_info.lnk_tp, in lpfc_sli4_retrieve_pport_name()
4994 phba->sli4_hba.lnk_info.lnk_no); in lpfc_sli4_retrieve_pport_name()
4997 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_retrieve_pport_name()
5006 phba->sli4_hba.lnk_info.lnk_tp); in lpfc_sli4_retrieve_pport_name()
5007 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_retrieve_pport_name()
5011 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_retrieve_pport_name()
5015 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_retrieve_pport_name()
5016 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_retrieve_pport_name()
5021 switch (phba->sli4_hba.lnk_info.lnk_no) { in lpfc_sli4_retrieve_pport_name()
5025 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; in lpfc_sli4_retrieve_pport_name()
5030 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; in lpfc_sli4_retrieve_pport_name()
5035 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; in lpfc_sli4_retrieve_pport_name()
5040 phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; in lpfc_sli4_retrieve_pport_name()
5046 if (phba->sli4_hba.pport_name_sta == LPFC_SLI4_PPNAME_GET) { in lpfc_sli4_retrieve_pport_name()
5047 phba->Port[0] = cport_name; in lpfc_sli4_retrieve_pport_name()
5048 phba->Port[1] = '\0'; in lpfc_sli4_retrieve_pport_name()
5049 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_retrieve_pport_name()
5050 "3091 SLI get port name: %s\n", phba->Port); in lpfc_sli4_retrieve_pport_name()
5056 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_retrieve_pport_name()
5058 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_retrieve_pport_name()
5071 lpfc_sli4_arm_cqeq_intr(struct lpfc_hba *phba) in lpfc_sli4_arm_cqeq_intr() argument
5075 lpfc_sli4_cq_release(phba->sli4_hba.mbx_cq, LPFC_QUEUE_REARM); in lpfc_sli4_arm_cqeq_intr()
5076 lpfc_sli4_cq_release(phba->sli4_hba.els_cq, LPFC_QUEUE_REARM); in lpfc_sli4_arm_cqeq_intr()
5078 if (phba->sli4_hba.fcp_cq) { in lpfc_sli4_arm_cqeq_intr()
5080 lpfc_sli4_cq_release(phba->sli4_hba.fcp_cq[fcp_eqidx], in lpfc_sli4_arm_cqeq_intr()
5082 } while (++fcp_eqidx < phba->cfg_fcp_io_channel); in lpfc_sli4_arm_cqeq_intr()
5085 if (phba->cfg_fof) in lpfc_sli4_arm_cqeq_intr()
5086 lpfc_sli4_cq_release(phba->sli4_hba.oas_cq, LPFC_QUEUE_REARM); in lpfc_sli4_arm_cqeq_intr()
5088 if (phba->sli4_hba.hba_eq) { in lpfc_sli4_arm_cqeq_intr()
5089 for (fcp_eqidx = 0; fcp_eqidx < phba->cfg_fcp_io_channel; in lpfc_sli4_arm_cqeq_intr()
5091 lpfc_sli4_eq_release(phba->sli4_hba.hba_eq[fcp_eqidx], in lpfc_sli4_arm_cqeq_intr()
5095 if (phba->cfg_fof) in lpfc_sli4_arm_cqeq_intr()
5096 lpfc_sli4_eq_release(phba->sli4_hba.fof_eq, LPFC_QUEUE_REARM); in lpfc_sli4_arm_cqeq_intr()
5112 lpfc_sli4_get_avail_extnt_rsrc(struct lpfc_hba *phba, uint16_t type, in lpfc_sli4_get_avail_extnt_rsrc() argument
5121 mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_get_avail_extnt_rsrc()
5128 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_get_avail_extnt_rsrc()
5133 rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, 0, type, in lpfc_sli4_get_avail_extnt_rsrc()
5140 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_get_avail_extnt_rsrc()
5141 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_get_avail_extnt_rsrc()
5143 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_get_avail_extnt_rsrc()
5144 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_get_avail_extnt_rsrc()
5154 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_INIT, in lpfc_sli4_get_avail_extnt_rsrc()
5170 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_get_avail_extnt_rsrc()
5175 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_get_avail_extnt_rsrc()
5195 lpfc_sli4_chk_avail_extnt_rsrc(struct lpfc_hba *phba, uint16_t type) in lpfc_sli4_chk_avail_extnt_rsrc() argument
5205 rc = lpfc_sli4_get_avail_extnt_rsrc(phba, type, in lpfc_sli4_chk_avail_extnt_rsrc()
5213 rsrc_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list; in lpfc_sli4_chk_avail_extnt_rsrc()
5216 rsrc_blk_list = &phba->lpfc_vpi_blk_list; in lpfc_sli4_chk_avail_extnt_rsrc()
5219 rsrc_blk_list = &phba->sli4_hba.lpfc_xri_blk_list; in lpfc_sli4_chk_avail_extnt_rsrc()
5222 rsrc_blk_list = &phba->sli4_hba.lpfc_vfi_blk_list; in lpfc_sli4_chk_avail_extnt_rsrc()
5258 lpfc_sli4_cfg_post_extnts(struct lpfc_hba *phba, uint16_t extnt_cnt, in lpfc_sli4_cfg_post_extnts() argument
5288 alloc_len = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_cfg_post_extnts()
5292 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_cfg_post_extnts()
5298 rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, extnt_cnt, type, *emb); in lpfc_sli4_cfg_post_extnts()
5302 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_cfg_post_extnts()
5303 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_cfg_post_extnts()
5305 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_cfg_post_extnts()
5306 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_cfg_post_extnts()
5323 lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type) in lpfc_sli4_alloc_extent() argument
5341 rc = lpfc_sli4_get_avail_extnt_rsrc(phba, type, in lpfc_sli4_alloc_extent()
5348 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_INIT, in lpfc_sli4_alloc_extent()
5356 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_INIT | LOG_SLI, in lpfc_sli4_alloc_extent()
5360 mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_alloc_extent()
5364 rc = lpfc_sli4_cfg_post_extnts(phba, rsrc_cnt, type, &emb, mbox); in lpfc_sli4_alloc_extent()
5397 phba->sli4_hba.rpi_bmask = kzalloc(longs * in lpfc_sli4_alloc_extent()
5400 if (unlikely(!phba->sli4_hba.rpi_bmask)) { in lpfc_sli4_alloc_extent()
5404 phba->sli4_hba.rpi_ids = kzalloc(rsrc_id_cnt * in lpfc_sli4_alloc_extent()
5407 if (unlikely(!phba->sli4_hba.rpi_ids)) { in lpfc_sli4_alloc_extent()
5408 kfree(phba->sli4_hba.rpi_bmask); in lpfc_sli4_alloc_extent()
5418 phba->sli4_hba.next_rpi = rsrc_id_cnt; in lpfc_sli4_alloc_extent()
5421 bmask = phba->sli4_hba.rpi_bmask; in lpfc_sli4_alloc_extent()
5422 ids = phba->sli4_hba.rpi_ids; in lpfc_sli4_alloc_extent()
5423 ext_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list; in lpfc_sli4_alloc_extent()
5426 phba->vpi_bmask = kzalloc(longs * in lpfc_sli4_alloc_extent()
5429 if (unlikely(!phba->vpi_bmask)) { in lpfc_sli4_alloc_extent()
5433 phba->vpi_ids = kzalloc(rsrc_id_cnt * in lpfc_sli4_alloc_extent()
5436 if (unlikely(!phba->vpi_ids)) { in lpfc_sli4_alloc_extent()
5437 kfree(phba->vpi_bmask); in lpfc_sli4_alloc_extent()
5443 bmask = phba->vpi_bmask; in lpfc_sli4_alloc_extent()
5444 ids = phba->vpi_ids; in lpfc_sli4_alloc_extent()
5445 ext_blk_list = &phba->lpfc_vpi_blk_list; in lpfc_sli4_alloc_extent()
5448 phba->sli4_hba.xri_bmask = kzalloc(longs * in lpfc_sli4_alloc_extent()
5451 if (unlikely(!phba->sli4_hba.xri_bmask)) { in lpfc_sli4_alloc_extent()
5455 phba->sli4_hba.max_cfg_param.xri_used = 0; in lpfc_sli4_alloc_extent()
5456 phba->sli4_hba.xri_ids = kzalloc(rsrc_id_cnt * in lpfc_sli4_alloc_extent()
5459 if (unlikely(!phba->sli4_hba.xri_ids)) { in lpfc_sli4_alloc_extent()
5460 kfree(phba->sli4_hba.xri_bmask); in lpfc_sli4_alloc_extent()
5466 bmask = phba->sli4_hba.xri_bmask; in lpfc_sli4_alloc_extent()
5467 ids = phba->sli4_hba.xri_ids; in lpfc_sli4_alloc_extent()
5468 ext_blk_list = &phba->sli4_hba.lpfc_xri_blk_list; in lpfc_sli4_alloc_extent()
5471 phba->sli4_hba.vfi_bmask = kzalloc(longs * in lpfc_sli4_alloc_extent()
5474 if (unlikely(!phba->sli4_hba.vfi_bmask)) { in lpfc_sli4_alloc_extent()
5478 phba->sli4_hba.vfi_ids = kzalloc(rsrc_id_cnt * in lpfc_sli4_alloc_extent()
5481 if (unlikely(!phba->sli4_hba.vfi_ids)) { in lpfc_sli4_alloc_extent()
5482 kfree(phba->sli4_hba.vfi_bmask); in lpfc_sli4_alloc_extent()
5488 bmask = phba->sli4_hba.vfi_bmask; in lpfc_sli4_alloc_extent()
5489 ids = phba->sli4_hba.vfi_ids; in lpfc_sli4_alloc_extent()
5490 ext_blk_list = &phba->sli4_hba.lpfc_vfi_blk_list; in lpfc_sli4_alloc_extent()
5527 phba->sli4_hba.scsi_xri_start = rsrc_start + in lpfc_sli4_alloc_extent()
5528 lpfc_sli4_get_els_iocb_cnt(phba); in lpfc_sli4_alloc_extent()
5540 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_alloc_extent()
5554 lpfc_sli4_dealloc_extent(struct lpfc_hba *phba, uint16_t type) in lpfc_sli4_dealloc_extent() argument
5562 mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_dealloc_extent()
5573 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_dealloc_extent()
5578 rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, 0, type, in lpfc_sli4_dealloc_extent()
5584 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_dealloc_extent()
5585 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_dealloc_extent()
5587 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_dealloc_extent()
5588 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_dealloc_extent()
5598 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_INIT, in lpfc_sli4_dealloc_extent()
5614 kfree(phba->vpi_bmask); in lpfc_sli4_dealloc_extent()
5615 kfree(phba->vpi_ids); in lpfc_sli4_dealloc_extent()
5616 bf_set(lpfc_vpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_extent()
5618 &phba->lpfc_vpi_blk_list, list) { in lpfc_sli4_dealloc_extent()
5622 phba->sli4_hba.max_cfg_param.vpi_used = 0; in lpfc_sli4_dealloc_extent()
5625 kfree(phba->sli4_hba.xri_bmask); in lpfc_sli4_dealloc_extent()
5626 kfree(phba->sli4_hba.xri_ids); in lpfc_sli4_dealloc_extent()
5628 &phba->sli4_hba.lpfc_xri_blk_list, list) { in lpfc_sli4_dealloc_extent()
5634 kfree(phba->sli4_hba.vfi_bmask); in lpfc_sli4_dealloc_extent()
5635 kfree(phba->sli4_hba.vfi_ids); in lpfc_sli4_dealloc_extent()
5636 bf_set(lpfc_vfi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_extent()
5638 &phba->sli4_hba.lpfc_vfi_blk_list, list) { in lpfc_sli4_dealloc_extent()
5646 &phba->sli4_hba.lpfc_rpi_blk_list, list) { in lpfc_sli4_dealloc_extent()
5655 bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_extent()
5658 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_dealloc_extent()
5669 lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) in lpfc_sli4_alloc_resource_identifiers() argument
5675 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_alloc_resource_identifiers()
5676 phba->sli4_hba.next_rpi = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_alloc_resource_identifiers()
5677 if (phba->sli4_hba.extents_in_use) { in lpfc_sli4_alloc_resource_identifiers()
5683 if (bf_get(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags) == in lpfc_sli4_alloc_resource_identifiers()
5690 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba, in lpfc_sli4_alloc_resource_identifiers()
5694 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba, in lpfc_sli4_alloc_resource_identifiers()
5698 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba, in lpfc_sli4_alloc_resource_identifiers()
5702 rc = lpfc_sli4_chk_avail_extnt_rsrc(phba, in lpfc_sli4_alloc_resource_identifiers()
5714 lpfc_printf_log(phba, KERN_INFO, in lpfc_sli4_alloc_resource_identifiers()
5719 rc = lpfc_sli4_dealloc_extent(phba, in lpfc_sli4_alloc_resource_identifiers()
5721 rc = lpfc_sli4_dealloc_extent(phba, in lpfc_sli4_alloc_resource_identifiers()
5723 rc = lpfc_sli4_dealloc_extent(phba, in lpfc_sli4_alloc_resource_identifiers()
5725 rc = lpfc_sli4_dealloc_extent(phba, in lpfc_sli4_alloc_resource_identifiers()
5731 rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_VFI); in lpfc_sli4_alloc_resource_identifiers()
5735 rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_VPI); in lpfc_sli4_alloc_resource_identifiers()
5739 rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_RPI); in lpfc_sli4_alloc_resource_identifiers()
5743 rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_XRI); in lpfc_sli4_alloc_resource_identifiers()
5746 bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, in lpfc_sli4_alloc_resource_identifiers()
5757 if (bf_get(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags) == in lpfc_sli4_alloc_resource_identifiers()
5759 lpfc_sli4_dealloc_resource_identifiers(phba); in lpfc_sli4_alloc_resource_identifiers()
5760 lpfc_sli4_remove_rpis(phba); in lpfc_sli4_alloc_resource_identifiers()
5763 count = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_alloc_resource_identifiers()
5765 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_alloc_resource_identifiers()
5771 base = phba->sli4_hba.max_cfg_param.rpi_base; in lpfc_sli4_alloc_resource_identifiers()
5773 phba->sli4_hba.rpi_bmask = kzalloc(longs * in lpfc_sli4_alloc_resource_identifiers()
5776 if (unlikely(!phba->sli4_hba.rpi_bmask)) { in lpfc_sli4_alloc_resource_identifiers()
5780 phba->sli4_hba.rpi_ids = kzalloc(count * in lpfc_sli4_alloc_resource_identifiers()
5783 if (unlikely(!phba->sli4_hba.rpi_ids)) { in lpfc_sli4_alloc_resource_identifiers()
5789 phba->sli4_hba.rpi_ids[i] = base + i; in lpfc_sli4_alloc_resource_identifiers()
5792 count = phba->sli4_hba.max_cfg_param.max_vpi; in lpfc_sli4_alloc_resource_identifiers()
5794 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_alloc_resource_identifiers()
5800 base = phba->sli4_hba.max_cfg_param.vpi_base; in lpfc_sli4_alloc_resource_identifiers()
5802 phba->vpi_bmask = kzalloc(longs * in lpfc_sli4_alloc_resource_identifiers()
5805 if (unlikely(!phba->vpi_bmask)) { in lpfc_sli4_alloc_resource_identifiers()
5809 phba->vpi_ids = kzalloc(count * in lpfc_sli4_alloc_resource_identifiers()
5812 if (unlikely(!phba->vpi_ids)) { in lpfc_sli4_alloc_resource_identifiers()
5818 phba->vpi_ids[i] = base + i; in lpfc_sli4_alloc_resource_identifiers()
5821 count = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_sli4_alloc_resource_identifiers()
5823 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_alloc_resource_identifiers()
5829 base = phba->sli4_hba.max_cfg_param.xri_base; in lpfc_sli4_alloc_resource_identifiers()
5831 phba->sli4_hba.xri_bmask = kzalloc(longs * in lpfc_sli4_alloc_resource_identifiers()
5834 if (unlikely(!phba->sli4_hba.xri_bmask)) { in lpfc_sli4_alloc_resource_identifiers()
5838 phba->sli4_hba.max_cfg_param.xri_used = 0; in lpfc_sli4_alloc_resource_identifiers()
5839 phba->sli4_hba.xri_ids = kzalloc(count * in lpfc_sli4_alloc_resource_identifiers()
5842 if (unlikely(!phba->sli4_hba.xri_ids)) { in lpfc_sli4_alloc_resource_identifiers()
5848 phba->sli4_hba.xri_ids[i] = base + i; in lpfc_sli4_alloc_resource_identifiers()
5851 count = phba->sli4_hba.max_cfg_param.max_vfi; in lpfc_sli4_alloc_resource_identifiers()
5853 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_alloc_resource_identifiers()
5859 base = phba->sli4_hba.max_cfg_param.vfi_base; in lpfc_sli4_alloc_resource_identifiers()
5861 phba->sli4_hba.vfi_bmask = kzalloc(longs * in lpfc_sli4_alloc_resource_identifiers()
5864 if (unlikely(!phba->sli4_hba.vfi_bmask)) { in lpfc_sli4_alloc_resource_identifiers()
5868 phba->sli4_hba.vfi_ids = kzalloc(count * in lpfc_sli4_alloc_resource_identifiers()
5871 if (unlikely(!phba->sli4_hba.vfi_ids)) { in lpfc_sli4_alloc_resource_identifiers()
5877 phba->sli4_hba.vfi_ids[i] = base + i; in lpfc_sli4_alloc_resource_identifiers()
5883 bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, in lpfc_sli4_alloc_resource_identifiers()
5889 kfree(phba->sli4_hba.vfi_bmask); in lpfc_sli4_alloc_resource_identifiers()
5891 kfree(phba->sli4_hba.xri_ids); in lpfc_sli4_alloc_resource_identifiers()
5893 kfree(phba->sli4_hba.xri_bmask); in lpfc_sli4_alloc_resource_identifiers()
5895 kfree(phba->vpi_ids); in lpfc_sli4_alloc_resource_identifiers()
5897 kfree(phba->vpi_bmask); in lpfc_sli4_alloc_resource_identifiers()
5899 kfree(phba->sli4_hba.rpi_ids); in lpfc_sli4_alloc_resource_identifiers()
5901 kfree(phba->sli4_hba.rpi_bmask); in lpfc_sli4_alloc_resource_identifiers()
5914 lpfc_sli4_dealloc_resource_identifiers(struct lpfc_hba *phba) in lpfc_sli4_dealloc_resource_identifiers() argument
5916 if (phba->sli4_hba.extents_in_use) { in lpfc_sli4_dealloc_resource_identifiers()
5917 lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_VPI); in lpfc_sli4_dealloc_resource_identifiers()
5918 lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_RPI); in lpfc_sli4_dealloc_resource_identifiers()
5919 lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_XRI); in lpfc_sli4_dealloc_resource_identifiers()
5920 lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_VFI); in lpfc_sli4_dealloc_resource_identifiers()
5922 kfree(phba->vpi_bmask); in lpfc_sli4_dealloc_resource_identifiers()
5923 phba->sli4_hba.max_cfg_param.vpi_used = 0; in lpfc_sli4_dealloc_resource_identifiers()
5924 kfree(phba->vpi_ids); in lpfc_sli4_dealloc_resource_identifiers()
5925 bf_set(lpfc_vpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_resource_identifiers()
5926 kfree(phba->sli4_hba.xri_bmask); in lpfc_sli4_dealloc_resource_identifiers()
5927 kfree(phba->sli4_hba.xri_ids); in lpfc_sli4_dealloc_resource_identifiers()
5928 kfree(phba->sli4_hba.vfi_bmask); in lpfc_sli4_dealloc_resource_identifiers()
5929 kfree(phba->sli4_hba.vfi_ids); in lpfc_sli4_dealloc_resource_identifiers()
5930 bf_set(lpfc_vfi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_resource_identifiers()
5931 bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_dealloc_resource_identifiers()
5948 lpfc_sli4_get_allocated_extnts(struct lpfc_hba *phba, uint16_t type, in lpfc_sli4_get_allocated_extnts() argument
5966 blk_list_head = &phba->lpfc_vpi_blk_list; in lpfc_sli4_get_allocated_extnts()
5969 blk_list_head = &phba->sli4_hba.lpfc_xri_blk_list; in lpfc_sli4_get_allocated_extnts()
5972 blk_list_head = &phba->sli4_hba.lpfc_vfi_blk_list; in lpfc_sli4_get_allocated_extnts()
5975 blk_list_head = &phba->sli4_hba.lpfc_rpi_blk_list; in lpfc_sli4_get_allocated_extnts()
6016 mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_get_allocated_extnts()
6021 alloc_len = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_sli4_get_allocated_extnts()
6025 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_get_allocated_extnts()
6032 rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, curr_blks, type, emb); in lpfc_sli4_get_allocated_extnts()
6038 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_get_allocated_extnts()
6039 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_get_allocated_extnts()
6041 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_get_allocated_extnts()
6042 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_get_allocated_extnts()
6068 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_INIT, in lpfc_sli4_get_allocated_extnts()
6078 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_get_allocated_extnts()
6097 lpfc_sli4_repost_els_sgl_list(struct lpfc_hba *phba) in lpfc_sli4_repost_els_sgl_list() argument
6111 pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_sli4_repost_els_sgl_list()
6112 spin_lock_irq(&phba->hbalock); in lpfc_sli4_repost_els_sgl_list()
6114 list_splice_init(&phba->sli4_hba.lpfc_sgl_list, &allc_sgl_list); in lpfc_sli4_repost_els_sgl_list()
6116 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_repost_els_sgl_list()
6118 total_cnt = phba->sli4_hba.els_xri_cnt; in lpfc_sli4_repost_els_sgl_list()
6148 if (num_posted == phba->sli4_hba.els_xri_cnt) { in lpfc_sli4_repost_els_sgl_list()
6154 status = lpfc_sli4_post_sgl(phba, in lpfc_sli4_repost_els_sgl_list()
6163 lpfc_printf_log(phba, KERN_WARNING, in lpfc_sli4_repost_els_sgl_list()
6180 status = lpfc_sli4_post_els_sgl_list(phba, &blck_sgl_list, in lpfc_sli4_repost_els_sgl_list()
6191 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_repost_els_sgl_list()
6209 phba->sli4_hba.els_xri_cnt = total_cnt; in lpfc_sli4_repost_els_sgl_list()
6212 lpfc_free_sgl_list(phba, &free_sgl_list); in lpfc_sli4_repost_els_sgl_list()
6216 spin_lock_irq(&phba->hbalock); in lpfc_sli4_repost_els_sgl_list()
6219 &phba->sli4_hba.lpfc_sgl_list); in lpfc_sli4_repost_els_sgl_list()
6221 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_repost_els_sgl_list()
6223 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_repost_els_sgl_list()
6240 lpfc_sli4_hba_setup(struct lpfc_hba *phba) in lpfc_sli4_hba_setup() argument
6248 struct Scsi_Host *shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli4_hba_setup()
6249 struct lpfc_vport *vport = phba->pport; in lpfc_sli4_hba_setup()
6253 rc = lpfc_pci_function_reset(phba); in lpfc_sli4_hba_setup()
6258 rc = lpfc_sli4_post_status_check(phba); in lpfc_sli4_hba_setup()
6262 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6263 phba->sli.sli_flag |= LPFC_SLI_ACTIVE; in lpfc_sli4_hba_setup()
6264 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6271 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_hba_setup()
6283 rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size); in lpfc_sli4_hba_setup()
6290 phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev); in lpfc_sli4_hba_setup()
6292 phba->hba_flag |= HBA_FCOE_MODE; in lpfc_sli4_hba_setup()
6294 phba->hba_flag &= ~HBA_FCOE_MODE; in lpfc_sli4_hba_setup()
6298 phba->hba_flag |= HBA_FIP_SUPPORT; in lpfc_sli4_hba_setup()
6300 phba->hba_flag &= ~HBA_FIP_SUPPORT; in lpfc_sli4_hba_setup()
6302 phba->hba_flag &= ~HBA_FCP_IOQ_FLUSH; in lpfc_sli4_hba_setup()
6304 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_sli4_hba_setup()
6305 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6308 phba->sli_rev, phba->hba_flag & HBA_FCOE_MODE); in lpfc_sli4_hba_setup()
6319 if (phba->hba_flag & HBA_FCOE_MODE && in lpfc_sli4_hba_setup()
6320 lpfc_sli4_read_fcoe_params(phba)) in lpfc_sli4_hba_setup()
6321 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_INIT, in lpfc_sli4_hba_setup()
6328 rc = lpfc_sli4_retrieve_pport_name(phba); in lpfc_sli4_hba_setup()
6330 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6332 "physical port name: %s.\n", phba->Port); in lpfc_sli4_hba_setup()
6339 rc = lpfc_parse_vpd(phba, vpd, vpd_size); in lpfc_sli4_hba_setup()
6341 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6349 phba->vpd.rev.biuRev = mqe->un.read_rev.first_hw_rev; in lpfc_sli4_hba_setup()
6350 phba->vpd.rev.smRev = mqe->un.read_rev.second_hw_rev; in lpfc_sli4_hba_setup()
6351 phba->vpd.rev.endecRev = mqe->un.read_rev.third_hw_rev; in lpfc_sli4_hba_setup()
6352 phba->vpd.rev.fcphHigh = bf_get(lpfc_mbx_rd_rev_fcph_high, in lpfc_sli4_hba_setup()
6354 phba->vpd.rev.fcphLow = bf_get(lpfc_mbx_rd_rev_fcph_low, in lpfc_sli4_hba_setup()
6356 phba->vpd.rev.feaLevelHigh = bf_get(lpfc_mbx_rd_rev_ftr_lvl_high, in lpfc_sli4_hba_setup()
6358 phba->vpd.rev.feaLevelLow = bf_get(lpfc_mbx_rd_rev_ftr_lvl_low, in lpfc_sli4_hba_setup()
6360 phba->vpd.rev.sli1FwRev = mqe->un.read_rev.fw_id_rev; in lpfc_sli4_hba_setup()
6361 memcpy(phba->vpd.rev.sli1FwName, mqe->un.read_rev.fw_name, 16); in lpfc_sli4_hba_setup()
6362 phba->vpd.rev.sli2FwRev = mqe->un.read_rev.ulp_fw_id_rev; in lpfc_sli4_hba_setup()
6363 memcpy(phba->vpd.rev.sli2FwName, mqe->un.read_rev.ulp_fw_name, 16); in lpfc_sli4_hba_setup()
6364 phba->vpd.rev.opFwRev = mqe->un.read_rev.fw_id_rev; in lpfc_sli4_hba_setup()
6365 memcpy(phba->vpd.rev.opFwName, mqe->un.read_rev.fw_name, 16); in lpfc_sli4_hba_setup()
6366 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6371 phba->vpd.rev.opFwName, in lpfc_sli4_hba_setup()
6372 phba->vpd.rev.fcphHigh, phba->vpd.rev.fcphLow, in lpfc_sli4_hba_setup()
6373 phba->vpd.rev.feaLevelHigh, phba->vpd.rev.feaLevelLow); in lpfc_sli4_hba_setup()
6376 rc = (phba->sli4_hba.max_cfg_param.max_xri >> 3); in lpfc_sli4_hba_setup()
6377 if (phba->pport->cfg_lun_queue_depth > rc) { in lpfc_sli4_hba_setup()
6378 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_hba_setup()
6380 phba->pport->cfg_lun_queue_depth, rc); in lpfc_sli4_hba_setup()
6381 phba->pport->cfg_lun_queue_depth = rc; in lpfc_sli4_hba_setup()
6389 lpfc_request_features(phba, mboxq); in lpfc_sli4_hba_setup()
6390 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
6401 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6406 phba->sli3_options |= LPFC_SLI4_PERFH_ENABLED; in lpfc_sli4_hba_setup()
6408 phba->sli3_options &= ~LPFC_SLI4_PERFH_ENABLED; in lpfc_sli4_hba_setup()
6414 phba->sli3_options &= ~LPFC_SLI3_BG_ENABLED; in lpfc_sli4_hba_setup()
6415 if (phba->cfg_enable_bg) { in lpfc_sli4_hba_setup()
6417 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_sli4_hba_setup()
6422 if (phba->max_vpi && phba->cfg_enable_npiv && in lpfc_sli4_hba_setup()
6427 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6430 mqe->un.req_ftrs.word3, phba->cfg_enable_bg, in lpfc_sli4_hba_setup()
6431 phba->cfg_enable_npiv, phba->max_vpi); in lpfc_sli4_hba_setup()
6433 phba->cfg_enable_bg = 0; in lpfc_sli4_hba_setup()
6435 phba->cfg_enable_npiv = 0; in lpfc_sli4_hba_setup()
6439 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6440 phba->sli3_options |= (LPFC_SLI3_NPIV_ENABLED | LPFC_SLI3_HBQ_ENABLED); in lpfc_sli4_hba_setup()
6441 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6447 rc = lpfc_sli4_alloc_resource_identifiers(phba); in lpfc_sli4_hba_setup()
6449 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6456 rc = lpfc_read_sparam(phba, mboxq, vport->vpi); in lpfc_sli4_hba_setup()
6458 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_hba_setup()
6464 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
6475 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_hba_setup()
6479 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6483 phba->link_state = LPFC_HBA_ERROR; in lpfc_sli4_hba_setup()
6495 rc = lpfc_sli4_xri_sgl_update(phba); in lpfc_sli4_hba_setup()
6497 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6504 rc = lpfc_sli4_repost_els_sgl_list(phba); in lpfc_sli4_hba_setup()
6506 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6514 rc = lpfc_sli4_repost_scsi_sgl_list(phba); in lpfc_sli4_hba_setup()
6516 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6526 rc = lpfc_sli4_post_all_rpi_hdrs(phba); in lpfc_sli4_hba_setup()
6528 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6534 lpfc_sli4_node_prep(phba); in lpfc_sli4_hba_setup()
6537 rc = lpfc_sli4_queue_create(phba); in lpfc_sli4_hba_setup()
6539 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_hba_setup()
6545 rc = lpfc_sli4_queue_setup(phba); in lpfc_sli4_hba_setup()
6547 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_hba_setup()
6553 lpfc_sli4_arm_cqeq_intr(phba); in lpfc_sli4_hba_setup()
6556 phba->sli4_hba.intr_enable = 1; in lpfc_sli4_hba_setup()
6559 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6560 phba->sli.sli_flag &= ~LPFC_SLI_ASYNC_MBX_BLK; in lpfc_sli4_hba_setup()
6561 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6564 lpfc_sli4_rb_setup(phba); in lpfc_sli4_hba_setup()
6567 phba->fcf.fcf_flag = 0; in lpfc_sli4_hba_setup()
6568 phba->fcf.current_rec.flag = 0; in lpfc_sli4_hba_setup()
6572 jiffies + msecs_to_jiffies(1000 * (phba->fc_ratov * 2))); in lpfc_sli4_hba_setup()
6575 mod_timer(&phba->hb_tmofunc, in lpfc_sli4_hba_setup()
6577 phba->hb_outstanding = 0; in lpfc_sli4_hba_setup()
6578 phba->last_completion_time = jiffies; in lpfc_sli4_hba_setup()
6581 mod_timer(&phba->eratt_poll, in lpfc_sli4_hba_setup()
6585 if (phba->cfg_aer_support == 1 && !(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_sli4_hba_setup()
6586 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_sli4_hba_setup()
6588 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_hba_setup()
6591 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6592 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_sli4_hba_setup()
6593 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6595 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli4_hba_setup()
6598 phba->cfg_aer_support = 0; in lpfc_sli4_hba_setup()
6603 if (!(phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_sli4_hba_setup()
6607 lpfc_reg_fcfi(phba, mboxq); in lpfc_sli4_hba_setup()
6608 mboxq->vport = phba->pport; in lpfc_sli4_hba_setup()
6609 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
6613 phba->fcf.fcfi = bf_get(lpfc_reg_fcfi_fcfi, in lpfc_sli4_hba_setup()
6617 lpfc_sli_read_link_ste(phba); in lpfc_sli4_hba_setup()
6624 spin_lock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6625 phba->link_state = LPFC_LINK_DOWN; in lpfc_sli4_hba_setup()
6626 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_hba_setup()
6627 if (!(phba->hba_flag & HBA_FCOE_MODE) && in lpfc_sli4_hba_setup()
6628 (phba->hba_flag & LINK_DISABLED)) { in lpfc_sli4_hba_setup()
6629 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_SLI, in lpfc_sli4_hba_setup()
6631 lpfc_down_link(phba, mboxq); in lpfc_sli4_hba_setup()
6632 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_hba_setup()
6634 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_SLI, in lpfc_sli4_hba_setup()
6639 } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { in lpfc_sli4_hba_setup()
6641 if (!(phba->link_flag & LS_LOOPBACK_MODE)) { in lpfc_sli4_hba_setup()
6642 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_sli4_hba_setup()
6647 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_hba_setup()
6651 lpfc_sli4_queue_unset(phba); in lpfc_sli4_hba_setup()
6653 lpfc_sli4_queue_destroy(phba); in lpfc_sli4_hba_setup()
6655 lpfc_stop_hba_timers(phba); in lpfc_sli4_hba_setup()
6657 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_hba_setup()
6676 struct lpfc_hba *phba = (struct lpfc_hba *) ptr; in lpfc_mbox_timeout() local
6680 spin_lock_irqsave(&phba->pport->work_port_lock, iflag); in lpfc_mbox_timeout()
6681 tmo_posted = phba->pport->work_port_events & WORKER_MBOX_TMO; in lpfc_mbox_timeout()
6683 phba->pport->work_port_events |= WORKER_MBOX_TMO; in lpfc_mbox_timeout()
6684 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); in lpfc_mbox_timeout()
6687 lpfc_worker_wake_up(phba); in lpfc_mbox_timeout()
6700 lpfc_sli4_mbox_completions_pending(struct lpfc_hba *phba) in lpfc_sli4_mbox_completions_pending() argument
6708 if (unlikely(!phba) || (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_sli4_mbox_completions_pending()
6713 mcq = phba->sli4_hba.mbx_cq; in lpfc_sli4_mbox_completions_pending()
6742 lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba) in lpfc_sli4_process_missed_mbox_completions() argument
6750 if (unlikely(!phba) || (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_sli4_process_missed_mbox_completions()
6755 if (phba->sli4_hba.hba_eq) in lpfc_sli4_process_missed_mbox_completions()
6756 for (eqidx = 0; eqidx < phba->cfg_fcp_io_channel; eqidx++) in lpfc_sli4_process_missed_mbox_completions()
6757 if (phba->sli4_hba.hba_eq[eqidx]->queue_id == in lpfc_sli4_process_missed_mbox_completions()
6758 phba->sli4_hba.mbx_cq->assoc_qid) { in lpfc_sli4_process_missed_mbox_completions()
6759 fpeq = phba->sli4_hba.hba_eq[eqidx]; in lpfc_sli4_process_missed_mbox_completions()
6771 mbox_pending = lpfc_sli4_mbox_completions_pending(phba); in lpfc_sli4_process_missed_mbox_completions()
6782 lpfc_sli4_hba_handle_eqe(phba, eqe, eqidx); in lpfc_sli4_process_missed_mbox_completions()
6803 lpfc_mbox_timeout_handler(struct lpfc_hba *phba) in lpfc_mbox_timeout_handler() argument
6805 LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active; in lpfc_mbox_timeout_handler()
6808 struct lpfc_sli *psli = &phba->sli; in lpfc_mbox_timeout_handler()
6811 if (lpfc_sli4_process_missed_mbox_completions(phba)) in lpfc_mbox_timeout_handler()
6821 spin_lock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
6823 lpfc_printf_log(phba, KERN_WARNING, in lpfc_mbox_timeout_handler()
6827 spin_unlock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
6832 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_mbox_timeout_handler()
6835 phba->pport->port_state, in lpfc_mbox_timeout_handler()
6836 phba->sli.sli_flag, in lpfc_mbox_timeout_handler()
6837 phba->sli.mbox_active); in lpfc_mbox_timeout_handler()
6838 spin_unlock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
6844 spin_lock_irq(&phba->pport->work_port_lock); in lpfc_mbox_timeout_handler()
6845 phba->pport->work_port_events &= ~WORKER_MBOX_TMO; in lpfc_mbox_timeout_handler()
6846 spin_unlock_irq(&phba->pport->work_port_lock); in lpfc_mbox_timeout_handler()
6847 spin_lock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
6848 phba->link_state = LPFC_LINK_UNKNOWN; in lpfc_mbox_timeout_handler()
6850 spin_unlock_irq(&phba->hbalock); in lpfc_mbox_timeout_handler()
6852 lpfc_sli_abort_fcp_rings(phba); in lpfc_mbox_timeout_handler()
6854 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_mbox_timeout_handler()
6858 lpfc_reset_hba(phba); in lpfc_mbox_timeout_handler()
6888 lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, in lpfc_sli_issue_mbox_s3() argument
6892 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_issue_mbox_s3()
6902 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6904 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli_issue_mbox_s3()
6907 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6911 pmbox = lpfc_mbox_get(phba); in lpfc_sli_issue_mbox_s3()
6913 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6921 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6922 lpfc_printf_log(phba, KERN_ERR, in lpfc_sli_issue_mbox_s3()
6932 if (unlikely(pci_channel_offline(phba->pcidev))) { in lpfc_sli_issue_mbox_s3()
6933 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6938 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_issue_mbox_s3()
6939 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6943 psli = &phba->sli; in lpfc_sli_issue_mbox_s3()
6948 if (phba->link_state == LPFC_HBA_ERROR) { in lpfc_sli_issue_mbox_s3()
6949 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6952 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
6961 if (lpfc_readl(phba->HCregaddr, &hc_copy) || in lpfc_sli_issue_mbox_s3()
6963 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6964 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
6980 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6983 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
6993 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
6995 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
7007 lpfc_mbox_put(phba, pmbox); in lpfc_sli_issue_mbox_s3()
7010 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
7014 mbx->mbxCommand, phba->pport->port_state, in lpfc_sli_issue_mbox_s3()
7018 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
7028 lpfc_debugfs_disc_trc(phba->pport, in lpfc_sli_issue_mbox_s3()
7045 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
7047 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
7056 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) * in lpfc_sli_issue_mbox_s3()
7062 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s3()
7066 mbx->mbxCommand, phba->pport->port_state, in lpfc_sli_issue_mbox_s3()
7078 lpfc_debugfs_disc_trc(phba->pport, in lpfc_sli_issue_mbox_s3()
7096 = (uint8_t *)phba->mbox_ext in lpfc_sli_issue_mbox_s3()
7097 - (uint8_t *)phba->mbox; in lpfc_sli_issue_mbox_s3()
7103 (uint8_t *)phba->mbox_ext, in lpfc_sli_issue_mbox_s3()
7107 lpfc_sli_pcimem_bcopy(mbx, phba->mbox, MAILBOX_CMD_SIZE); in lpfc_sli_issue_mbox_s3()
7116 lpfc_memcpy_to_slim(phba->MBslimaddr + in lpfc_sli_issue_mbox_s3()
7123 lpfc_sli_pcimem_bcopy(mbx, phba->mbox, MAILBOX_CMD_SIZE); in lpfc_sli_issue_mbox_s3()
7128 to_slim = phba->MBslimaddr + sizeof (uint32_t); in lpfc_sli_issue_mbox_s3()
7134 to_slim = phba->MBslimaddr; in lpfc_sli_issue_mbox_s3()
7151 writel(CA_MBATT, phba->CAregaddr); in lpfc_sli_issue_mbox_s3()
7152 readl(phba->CAregaddr); /* flush */ in lpfc_sli_issue_mbox_s3()
7160 writel(CA_MBATT, phba->CAregaddr); in lpfc_sli_issue_mbox_s3()
7161 readl(phba->CAregaddr); /* flush */ in lpfc_sli_issue_mbox_s3()
7165 word0 = *((uint32_t *)phba->mbox); in lpfc_sli_issue_mbox_s3()
7169 if (lpfc_readl(phba->MBslimaddr, &word0)) { in lpfc_sli_issue_mbox_s3()
7170 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
7177 if (lpfc_readl(phba->HAregaddr, &ha_copy)) { in lpfc_sli_issue_mbox_s3()
7178 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
7182 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) * in lpfc_sli_issue_mbox_s3()
7188 (phba->link_state > LPFC_WARM_START))) { in lpfc_sli_issue_mbox_s3()
7191 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
7203 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
7206 spin_lock_irqsave(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
7211 word0 = *((uint32_t *)phba->mbox); in lpfc_sli_issue_mbox_s3()
7217 slimword0 = readl(phba->MBslimaddr); in lpfc_sli_issue_mbox_s3()
7228 word0 = readl(phba->MBslimaddr); in lpfc_sli_issue_mbox_s3()
7231 if (lpfc_readl(phba->HAregaddr, &ha_copy)) { in lpfc_sli_issue_mbox_s3()
7232 spin_unlock_irqrestore(&phba->hbalock, in lpfc_sli_issue_mbox_s3()
7240 lpfc_sli_pcimem_bcopy(phba->mbox, mbx, MAILBOX_CMD_SIZE); in lpfc_sli_issue_mbox_s3()
7243 lpfc_sli_pcimem_bcopy(phba->mbox_ext, in lpfc_sli_issue_mbox_s3()
7249 lpfc_memcpy_from_slim(mbx, phba->MBslimaddr, in lpfc_sli_issue_mbox_s3()
7254 phba->MBslimaddr + in lpfc_sli_issue_mbox_s3()
7260 writel(HA_MBATT, phba->HAregaddr); in lpfc_sli_issue_mbox_s3()
7261 readl(phba->HAregaddr); /* flush */ in lpfc_sli_issue_mbox_s3()
7267 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); in lpfc_sli_issue_mbox_s3()
7273 lpfc_mbox_cmpl_put(phba, pmbox); in lpfc_sli_issue_mbox_s3()
7291 lpfc_sli4_async_mbox_block(struct lpfc_hba *phba) in lpfc_sli4_async_mbox_block() argument
7293 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_async_mbox_block()
7298 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_block()
7303 if (phba->sli.mbox_active) in lpfc_sli4_async_mbox_block()
7304 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_sli4_async_mbox_block()
7305 phba->sli.mbox_active) * in lpfc_sli4_async_mbox_block()
7307 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_block()
7311 lpfc_sli4_process_missed_mbox_completions(phba); in lpfc_sli4_async_mbox_block()
7314 while (phba->sli.mbox_active) { in lpfc_sli4_async_mbox_block()
7326 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_block()
7328 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_block()
7345 lpfc_sli4_async_mbox_unblock(struct lpfc_hba *phba) in lpfc_sli4_async_mbox_unblock() argument
7347 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_async_mbox_unblock()
7349 spin_lock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_unblock()
7352 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_unblock()
7362 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_async_mbox_unblock()
7365 lpfc_worker_wake_up(phba); in lpfc_sli4_async_mbox_unblock()
7380 lpfc_sli4_wait_bmbx_ready(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_sli4_wait_bmbx_ready() argument
7386 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) in lpfc_sli4_wait_bmbx_ready()
7390 bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); in lpfc_sli4_wait_bmbx_ready()
7419 lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_sli4_post_sync_mbox() argument
7425 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_post_sync_mbox()
7434 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
7436 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
7437 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_post_sync_mbox()
7442 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_post_sync_mbox()
7443 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_post_sync_mbox()
7449 phba->sli.mbox_active = mboxq; in lpfc_sli4_post_sync_mbox()
7450 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
7453 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); in lpfc_sli4_post_sync_mbox()
7463 memset(phba->sli4_hba.bmbx.avirt, 0, sizeof(struct lpfc_bmbx_create)); in lpfc_sli4_post_sync_mbox()
7464 lpfc_sli_pcimem_bcopy(mb, phba->sli4_hba.bmbx.avirt, in lpfc_sli4_post_sync_mbox()
7468 dma_address = &phba->sli4_hba.bmbx.dma_address; in lpfc_sli4_post_sync_mbox()
7469 writel(dma_address->addr_hi, phba->sli4_hba.BMBXregaddr); in lpfc_sli4_post_sync_mbox()
7472 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); in lpfc_sli4_post_sync_mbox()
7477 writel(dma_address->addr_lo, phba->sli4_hba.BMBXregaddr); in lpfc_sli4_post_sync_mbox()
7480 rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq); in lpfc_sli4_post_sync_mbox()
7489 lpfc_sli_pcimem_bcopy(phba->sli4_hba.bmbx.avirt, mb, in lpfc_sli4_post_sync_mbox()
7491 mbox_rgn = (struct lpfc_bmbx_create *) phba->sli4_hba.bmbx.avirt; in lpfc_sli4_post_sync_mbox()
7506 lpfc_sli4_swap_str(phba, mboxq); in lpfc_sli4_post_sync_mbox()
7508 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_post_sync_mbox()
7513 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_post_sync_mbox()
7514 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_post_sync_mbox()
7527 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
7529 phba->sli.mbox_active = NULL; in lpfc_sli4_post_sync_mbox()
7530 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_post_sync_mbox()
7547 lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, in lpfc_sli_issue_mbox_s4() argument
7550 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_issue_mbox_s4()
7555 lpfc_idiag_mbxacc_dump_issue_mbox(phba, &mboxq->u.mb); in lpfc_sli_issue_mbox_s4()
7557 rc = lpfc_mbox_dev_check(phba); in lpfc_sli_issue_mbox_s4()
7559 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s4()
7564 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
7565 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
7571 if (!phba->sli4_hba.intr_enable) { in lpfc_sli_issue_mbox_s4()
7573 rc = lpfc_sli4_post_sync_mbox(phba, mboxq); in lpfc_sli_issue_mbox_s4()
7577 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s4()
7584 lpfc_sli_config_mbox_subsys_get(phba, in lpfc_sli_issue_mbox_s4()
7586 lpfc_sli_config_mbox_opcode_get(phba, in lpfc_sli_issue_mbox_s4()
7595 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s4()
7601 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
7602 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
7605 rc = lpfc_sli4_async_mbox_block(phba); in lpfc_sli_issue_mbox_s4()
7608 rc = lpfc_sli4_post_sync_mbox(phba, mboxq); in lpfc_sli_issue_mbox_s4()
7610 lpfc_printf_log(phba, KERN_WARNING, in lpfc_sli_issue_mbox_s4()
7618 lpfc_sli_config_mbox_subsys_get(phba, in lpfc_sli_issue_mbox_s4()
7620 lpfc_sli_config_mbox_opcode_get(phba, in lpfc_sli_issue_mbox_s4()
7628 lpfc_sli4_async_mbox_unblock(phba); in lpfc_sli_issue_mbox_s4()
7634 rc = lpfc_mbox_cmd_check(phba, mboxq); in lpfc_sli_issue_mbox_s4()
7636 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s4()
7641 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
7642 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
7649 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_issue_mbox_s4()
7650 lpfc_mbox_put(phba, mboxq); in lpfc_sli_issue_mbox_s4()
7651 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_issue_mbox_s4()
7652 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli_issue_mbox_s4()
7657 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
7658 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli_issue_mbox_s4()
7659 phba->pport->port_state, in lpfc_sli_issue_mbox_s4()
7662 lpfc_worker_wake_up(phba); in lpfc_sli_issue_mbox_s4()
7679 lpfc_sli4_post_async_mbox(struct lpfc_hba *phba) in lpfc_sli4_post_async_mbox() argument
7681 struct lpfc_sli *psli = &phba->sli; in lpfc_sli4_post_async_mbox()
7689 if (unlikely(!phba->sli4_hba.intr_enable)) in lpfc_sli4_post_async_mbox()
7693 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
7695 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
7699 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
7702 if (unlikely(phba->sli.mbox_active)) { in lpfc_sli4_post_async_mbox()
7703 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
7704 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_post_async_mbox()
7712 mboxq = lpfc_mbox_get(phba); in lpfc_sli4_post_async_mbox()
7717 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
7720 phba->sli.mbox_active = mboxq; in lpfc_sli4_post_async_mbox()
7721 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
7724 rc = lpfc_mbox_dev_check(phba); in lpfc_sli4_post_async_mbox()
7735 msecs_to_jiffies(1000 * lpfc_mbox_tmo_val(phba, mboxq)))); in lpfc_sli4_post_async_mbox()
7737 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, in lpfc_sli4_post_async_mbox()
7741 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_post_async_mbox()
7742 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_post_async_mbox()
7743 phba->pport->port_state, psli->sli_flag); in lpfc_sli4_post_async_mbox()
7753 lpfc_debugfs_disc_trc(phba->pport, in lpfc_sli4_post_async_mbox()
7763 rc = lpfc_sli4_mq_put(phba->sli4_hba.mbx_wq, mqe); in lpfc_sli4_post_async_mbox()
7765 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, in lpfc_sli4_post_async_mbox()
7770 lpfc_sli_config_mbox_subsys_get(phba, mboxq), in lpfc_sli4_post_async_mbox()
7771 lpfc_sli_config_mbox_opcode_get(phba, mboxq), in lpfc_sli4_post_async_mbox()
7779 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
7780 if (phba->sli.mbox_active) { in lpfc_sli4_post_async_mbox()
7782 __lpfc_mbox_cmpl_put(phba, mboxq); in lpfc_sli4_post_async_mbox()
7785 phba->sli.mbox_active = NULL; in lpfc_sli4_post_async_mbox()
7787 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_post_async_mbox()
7805 lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) in lpfc_sli_issue_mbox() argument
7807 return phba->lpfc_sli_issue_mbox(phba, pmbox, flag); in lpfc_sli_issue_mbox()
7820 lpfc_mbox_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_mbox_api_table_setup() argument
7825 phba->lpfc_sli_issue_mbox = lpfc_sli_issue_mbox_s3; in lpfc_mbox_api_table_setup()
7826 phba->lpfc_sli_handle_slow_ring_event = in lpfc_mbox_api_table_setup()
7828 phba->lpfc_sli_hbq_to_firmware = lpfc_sli_hbq_to_firmware_s3; in lpfc_mbox_api_table_setup()
7829 phba->lpfc_sli_brdrestart = lpfc_sli_brdrestart_s3; in lpfc_mbox_api_table_setup()
7830 phba->lpfc_sli_brdready = lpfc_sli_brdready_s3; in lpfc_mbox_api_table_setup()
7833 phba->lpfc_sli_issue_mbox = lpfc_sli_issue_mbox_s4; in lpfc_mbox_api_table_setup()
7834 phba->lpfc_sli_handle_slow_ring_event = in lpfc_mbox_api_table_setup()
7836 phba->lpfc_sli_hbq_to_firmware = lpfc_sli_hbq_to_firmware_s4; in lpfc_mbox_api_table_setup()
7837 phba->lpfc_sli_brdrestart = lpfc_sli_brdrestart_s4; in lpfc_mbox_api_table_setup()
7838 phba->lpfc_sli_brdready = lpfc_sli_brdready_s4; in lpfc_mbox_api_table_setup()
7841 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_mbox_api_table_setup()
7861 __lpfc_sli_ringtx_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in __lpfc_sli_ringtx_put() argument
7886 lpfc_sli_next_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_next_iocb() argument
7891 nextiocb = lpfc_sli_ringtx_get(phba, pring); in lpfc_sli_next_iocb()
7923 __lpfc_sli_issue_iocb_s3(struct lpfc_hba *phba, uint32_t ring_number, in __lpfc_sli_issue_iocb_s3() argument
7928 struct lpfc_sli_ring *pring = &phba->sli.ring[ring_number]; in __lpfc_sli_issue_iocb_s3()
7933 lpfc_printf_log(phba, KERN_ERR, in __lpfc_sli_issue_iocb_s3()
7943 if (unlikely(pci_channel_offline(phba->pcidev))) in __lpfc_sli_issue_iocb_s3()
7947 if (unlikely(phba->hba_flag & DEFER_ERATT)) in __lpfc_sli_issue_iocb_s3()
7953 if (unlikely(phba->link_state < LPFC_LINK_DOWN)) in __lpfc_sli_issue_iocb_s3()
7963 if (unlikely(phba->link_state == LPFC_LINK_DOWN)) { in __lpfc_sli_issue_iocb_s3()
7971 if (!(phba->sli.sli_flag & LPFC_MENLO_MAINT) || in __lpfc_sli_issue_iocb_s3()
8000 } else if (unlikely(pring->ringno == phba->sli.fcp_ring && in __lpfc_sli_issue_iocb_s3()
8001 !(phba->sli.sli_flag & LPFC_PROCESS_LA))) { in __lpfc_sli_issue_iocb_s3()
8005 while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) && in __lpfc_sli_issue_iocb_s3()
8006 (nextiocb = lpfc_sli_next_iocb(phba, pring, &piocb))) in __lpfc_sli_issue_iocb_s3()
8007 lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb); in __lpfc_sli_issue_iocb_s3()
8010 lpfc_sli_update_ring(phba, pring); in __lpfc_sli_issue_iocb_s3()
8012 lpfc_sli_update_full_ring(phba, pring); in __lpfc_sli_issue_iocb_s3()
8025 __lpfc_sli_ringtx_put(phba, pring, piocb); in __lpfc_sli_issue_iocb_s3()
8050 lpfc_sli4_bpl2sgl(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq, in lpfc_sli4_bpl2sgl() argument
8151 lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba) in lpfc_sli4_scmd_to_wqidx_distr() argument
8156 if (phba->cfg_fcp_io_sched == LPFC_FCP_SCHED_BY_CPU in lpfc_sli4_scmd_to_wqidx_distr()
8157 && phba->cfg_fcp_io_channel > 1) { in lpfc_sli4_scmd_to_wqidx_distr()
8159 if (cpu < phba->sli4_hba.num_present_cpu) { in lpfc_sli4_scmd_to_wqidx_distr()
8160 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_scmd_to_wqidx_distr()
8165 chann = atomic_add_return(1, &phba->fcp_qidx); in lpfc_sli4_scmd_to_wqidx_distr()
8166 chann = (chann % phba->cfg_fcp_io_channel); in lpfc_sli4_scmd_to_wqidx_distr()
8185 lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, in lpfc_sli4_iocb2wqe() argument
8205 fip = phba->hba_flag & HBA_FIP_SUPPORT; in lpfc_sli4_iocb2wqe()
8255 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_iocb2wqe()
8282 &phba->sli4_hba.sli_intf); in lpfc_sli4_iocb2wqe()
8293 !(phba->fc_topology == in lpfc_sli4_iocb2wqe()
8298 phba->vpi_ids[iocbq->vport->vpi]); in lpfc_sli4_iocb2wqe()
8302 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_sli4_iocb2wqe()
8306 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_sli4_iocb2wqe()
8323 if (phba->link_flag & LS_LOOPBACK_MODE) in lpfc_sli4_iocb2wqe()
8377 if (phba->cfg_XLanePriority) { in lpfc_sli4_iocb2wqe()
8380 (phba->cfg_XLanePriority << 1)); in lpfc_sli4_iocb2wqe()
8406 if (phba->cfg_XLanePriority) { in lpfc_sli4_iocb2wqe()
8409 (phba->cfg_XLanePriority << 1)); in lpfc_sli4_iocb2wqe()
8434 if (phba->cfg_XLanePriority) { in lpfc_sli4_iocb2wqe()
8437 (phba->cfg_XLanePriority << 1)); in lpfc_sli4_iocb2wqe()
8461 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_iocb2wqe()
8489 &phba->sli4_hba.sli_intf); in lpfc_sli4_iocb2wqe()
8508 phba->vpi_ids[iocbq->vport->vpi]); in lpfc_sli4_iocb2wqe()
8516 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_sli4_iocb2wqe()
8519 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_sli4_iocb2wqe()
8525 phba->vpi_ids[phba->pport->vpi]); in lpfc_sli4_iocb2wqe()
8535 if (abrt_iotag != 0 && abrt_iotag <= phba->sli.last_iotag) { in lpfc_sli4_iocb2wqe()
8536 abrtiocbq = phba->sli.iocbq_lookup[abrt_iotag]; in lpfc_sli4_iocb2wqe()
8604 phba->vpi_ids[phba->pport->vpi]); in lpfc_sli4_iocb2wqe()
8627 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_iocb2wqe()
8667 __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, uint32_t ring_number, in __lpfc_sli_issue_iocb_s4() argument
8673 struct lpfc_sli_ring *pring = &phba->sli.ring[ring_number]; in __lpfc_sli_issue_iocb_s4()
8682 __lpfc_sli_ringtx_put(phba, in __lpfc_sli_issue_iocb_s4()
8689 sglq = __lpfc_sli_get_sglq(phba, piocb); in __lpfc_sli_issue_iocb_s4()
8692 __lpfc_sli_ringtx_put(phba, in __lpfc_sli_issue_iocb_s4()
8709 sglq = __lpfc_get_active_sglq(phba, piocb->sli4_lxritag); in __lpfc_sli_issue_iocb_s4()
8717 if (NO_XRI == lpfc_sli4_bpl2sgl(phba, piocb, sglq)) in __lpfc_sli_issue_iocb_s4()
8721 if (lpfc_sli4_iocb2wqe(phba, piocb, &wqe)) in __lpfc_sli_issue_iocb_s4()
8726 if (!phba->cfg_fof || (!(piocb->iocb_flag & LPFC_IO_OAS))) { in __lpfc_sli_issue_iocb_s4()
8727 wq = phba->sli4_hba.fcp_wq[piocb->fcp_wqidx]; in __lpfc_sli_issue_iocb_s4()
8729 wq = phba->sli4_hba.oas_wq; in __lpfc_sli_issue_iocb_s4()
8734 if (unlikely(!phba->sli4_hba.els_wq)) in __lpfc_sli_issue_iocb_s4()
8736 if (lpfc_sli4_wq_put(phba->sli4_hba.els_wq, &wqe)) in __lpfc_sli_issue_iocb_s4()
8739 lpfc_sli_ringtxcmpl_put(phba, pring, piocb); in __lpfc_sli_issue_iocb_s4()
8756 __lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number, in __lpfc_sli_issue_iocb() argument
8759 return phba->__lpfc_sli_issue_iocb(phba, ring_number, piocb, flag); in __lpfc_sli_issue_iocb()
8772 lpfc_sli_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_sli_api_table_setup() argument
8777 phba->__lpfc_sli_issue_iocb = __lpfc_sli_issue_iocb_s3; in lpfc_sli_api_table_setup()
8778 phba->__lpfc_sli_release_iocbq = __lpfc_sli_release_iocbq_s3; in lpfc_sli_api_table_setup()
8781 phba->__lpfc_sli_issue_iocb = __lpfc_sli_issue_iocb_s4; in lpfc_sli_api_table_setup()
8782 phba->__lpfc_sli_release_iocbq = __lpfc_sli_release_iocbq_s4; in lpfc_sli_api_table_setup()
8785 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_api_table_setup()
8791 phba->lpfc_get_iocb_from_iocbq = lpfc_get_iocb_from_iocbq; in lpfc_sli_api_table_setup()
8796 lpfc_sli_calc_ring(struct lpfc_hba *phba, uint32_t ring_number, in lpfc_sli_calc_ring() argument
8801 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_calc_ring()
8807 if (!(phba->cfg_fof) || in lpfc_sli_calc_ring()
8809 if (unlikely(!phba->sli4_hba.fcp_wq)) in lpfc_sli_calc_ring()
8811 idx = lpfc_sli4_scmd_to_wqidx_distr(phba); in lpfc_sli_calc_ring()
8815 if (unlikely(!phba->sli4_hba.oas_wq)) in lpfc_sli_calc_ring()
8840 lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number, in lpfc_sli_issue_iocb() argument
8850 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_issue_iocb()
8851 ring_number = lpfc_sli_calc_ring(phba, ring_number, piocb); in lpfc_sli_issue_iocb()
8856 pring = &phba->sli.ring[ring_number]; in lpfc_sli_issue_iocb()
8858 rc = __lpfc_sli_issue_iocb(phba, ring_number, piocb, flag); in lpfc_sli_issue_iocb()
8862 fcp_eq_hdl = &phba->sli4_hba.fcp_eq_hdl[idx]; in lpfc_sli_issue_iocb()
8868 fpeq = phba->sli4_hba.hba_eq[idx]; in lpfc_sli_issue_iocb()
8877 lpfc_sli4_hba_handle_eqe(phba, in lpfc_sli_issue_iocb()
8890 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_issue_iocb()
8891 rc = __lpfc_sli_issue_iocb(phba, ring_number, piocb, flag); in lpfc_sli_issue_iocb()
8892 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_issue_iocb()
8909 lpfc_extra_ring_setup( struct lpfc_hba *phba) in lpfc_extra_ring_setup() argument
8914 psli = &phba->sli; in lpfc_extra_ring_setup()
8937 pring->prt[0].rctl = phba->cfg_multi_ring_rctl; in lpfc_extra_ring_setup()
8938 pring->prt[0].type = phba->cfg_multi_ring_type; in lpfc_extra_ring_setup()
8956 lpfc_sli_abts_err_handler(struct lpfc_hba *phba, in lpfc_sli_abts_err_handler() argument
8967 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli_abts_err_handler()
8972 vport = lpfc_find_vport_by_vpid(phba, vpi); in lpfc_sli_abts_err_handler()
8984 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_abts_err_handler()
9002 lpfc_sli4_abts_err_handler(struct lpfc_hba *phba, in lpfc_sli4_abts_err_handler() argument
9010 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_abts_err_handler()
9017 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_abts_err_handler()
9020 ndlp->vport->vpi, phba->sli4_hba.rpi_ids[ndlp->nlp_rpi], in lpfc_sli4_abts_err_handler()
9050 lpfc_sli_async_event_handler(struct lpfc_hba * phba, in lpfc_sli_async_event_handler() argument
9069 lpfc_printf_log(phba, KERN_ERR, LOG_TEMP, in lpfc_sli_async_event_handler()
9075 lpfc_printf_log(phba, KERN_ERR, LOG_TEMP, in lpfc_sli_async_event_handler()
9082 shost = lpfc_shost_from_vport(phba->pport); in lpfc_sli_async_event_handler()
9088 lpfc_sli_abts_err_handler(phba, iocbq); in lpfc_sli_async_event_handler()
9092 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_async_event_handler()
9122 lpfc_sli_setup(struct lpfc_hba *phba) in lpfc_sli_setup() argument
9125 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_setup()
9129 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_setup()
9130 psli->num_rings += phba->cfg_fcp_io_channel; in lpfc_sli_setup()
9155 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
9158 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
9163 (phba->cfg_hba_queue_depth * 2); in lpfc_sli_setup()
9171 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
9174 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
9177 pring->iotag_max = phba->cfg_hba_queue_depth; in lpfc_sli_setup()
9184 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
9187 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ? in lpfc_sli_setup()
9230 phba->brd_no, totiocbsize, in lpfc_sli_setup()
9233 if (phba->cfg_multi_ring_support == 2) in lpfc_sli_setup()
9234 lpfc_extra_ring_setup(phba); in lpfc_sli_setup()
9251 lpfc_sli_queue_setup(struct lpfc_hba *phba) in lpfc_sli_queue_setup() argument
9257 psli = &phba->sli; in lpfc_sli_queue_setup()
9258 spin_lock_irq(&phba->hbalock); in lpfc_sli_queue_setup()
9276 spin_unlock_irq(&phba->hbalock); in lpfc_sli_queue_setup()
9296 lpfc_sli_mbox_sys_flush(struct lpfc_hba *phba) in lpfc_sli_mbox_sys_flush() argument
9299 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_mbox_sys_flush()
9304 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_mbox_sys_flush()
9306 list_splice_init(&phba->sli.mboxq, &completions); in lpfc_sli_mbox_sys_flush()
9314 list_splice_init(&phba->sli.mboxq_cmpl, &completions); in lpfc_sli_mbox_sys_flush()
9315 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_mbox_sys_flush()
9322 pmb->mbox_cmpl(phba, pmb); in lpfc_sli_mbox_sys_flush()
9347 struct lpfc_hba *phba = vport->phba; in lpfc_sli_host_down() local
9348 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_host_down()
9357 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_host_down()
9365 set_bit(LPFC_DATA_READY, &phba->data_flags); in lpfc_sli_host_down()
9382 lpfc_sli_issue_abort_iotag(phba, pring, iocb); in lpfc_sli_host_down()
9388 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_host_down()
9391 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_sli_host_down()
9412 lpfc_sli_hba_down(struct lpfc_hba *phba) in lpfc_sli_hba_down() argument
9415 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_hba_down()
9422 lpfc_sli_mbox_sys_shutdown(phba, LPFC_MBX_WAIT); in lpfc_sli_hba_down()
9424 lpfc_hba_down_prep(phba); in lpfc_sli_hba_down()
9426 lpfc_fabric_abort_hba(phba); in lpfc_sli_hba_down()
9428 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_hba_down()
9435 set_bit(LPFC_DATA_READY, &phba->data_flags); in lpfc_sli_hba_down()
9444 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hba_down()
9447 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_sli_hba_down()
9450 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_sli_hba_down()
9451 list_splice_init(&phba->elsbuf, &completions); in lpfc_sli_hba_down()
9452 phba->elsbuf_cnt = 0; in lpfc_sli_hba_down()
9453 phba->elsbuf_prev_cnt = 0; in lpfc_sli_hba_down()
9454 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_sli_hba_down()
9459 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_sli_hba_down()
9466 spin_lock_irqsave(&phba->pport->work_port_lock, flags); in lpfc_sli_hba_down()
9467 phba->pport->work_port_events &= ~WORKER_MBOX_TMO; in lpfc_sli_hba_down()
9468 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); in lpfc_sli_hba_down()
9541 lpfc_sli_ringpostbuf_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_ringpostbuf_put() argument
9546 spin_lock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_put()
9549 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_put()
9565 lpfc_sli_get_buffer_tag(struct lpfc_hba *phba) in lpfc_sli_get_buffer_tag() argument
9567 spin_lock_irq(&phba->hbalock); in lpfc_sli_get_buffer_tag()
9568 phba->buffer_tag_count++; in lpfc_sli_get_buffer_tag()
9573 phba->buffer_tag_count |= QUE_BUFTAG_BIT; in lpfc_sli_get_buffer_tag()
9574 spin_unlock_irq(&phba->hbalock); in lpfc_sli_get_buffer_tag()
9575 return phba->buffer_tag_count; in lpfc_sli_get_buffer_tag()
9594 lpfc_sli_ring_taggedbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_ring_taggedbuf_get() argument
9601 spin_lock_irq(&phba->hbalock); in lpfc_sli_ring_taggedbuf_get()
9606 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ring_taggedbuf_get()
9611 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ring_taggedbuf_get()
9612 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_ring_taggedbuf_get()
9638 lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_ringpostbuf_get() argument
9645 spin_lock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_get()
9650 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_get()
9655 spin_unlock_irq(&phba->hbalock); in lpfc_sli_ringpostbuf_get()
9656 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_ringpostbuf_get()
9676 lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, in lpfc_sli_abort_els_cmpl() argument
9692 spin_lock_irq(&phba->hbalock); in lpfc_sli_abort_els_cmpl()
9693 if (phba->sli_rev < LPFC_SLI_REV4) { in lpfc_sli_abort_els_cmpl()
9695 abort_iotag <= phba->sli.last_iotag) in lpfc_sli_abort_els_cmpl()
9697 phba->sli.iocbq_lookup[abort_iotag]; in lpfc_sli_abort_els_cmpl()
9704 abort_iocb = phba->sli.iocbq_lookup[abort_context]; in lpfc_sli_abort_els_cmpl()
9706 lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_SLI, in lpfc_sli_abort_els_cmpl()
9713 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_els_cmpl()
9715 lpfc_sli_release_iocbq(phba, cmdiocb); in lpfc_sli_abort_els_cmpl()
9731 lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, in lpfc_ignore_els_cmpl() argument
9737 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, in lpfc_ignore_els_cmpl()
9743 lpfc_ct_free_iocb(phba, cmdiocb); in lpfc_ignore_els_cmpl()
9745 lpfc_els_free_iocb(phba, cmdiocb); in lpfc_ignore_els_cmpl()
9762 lpfc_sli_abort_iotag_issue(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_abort_iotag_issue() argument
9785 abtsiocbp = __lpfc_sli_get_iocbq(phba); in lpfc_sli_abort_iotag_issue()
9797 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_abort_iotag_issue()
9813 if (phba->link_state >= LPFC_LINK_UP) in lpfc_sli_abort_iotag_issue()
9827 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_abort_iotag_issue()
9829 lpfc_sli_calc_ring(phba, pring->ringno, abtsiocbp); in lpfc_sli_abort_iotag_issue()
9832 pring = &phba->sli.ring[ring_number]; in lpfc_sli_abort_iotag_issue()
9835 retval = __lpfc_sli_issue_iocb(phba, pring->ringno, in lpfc_sli_abort_iotag_issue()
9839 retval = __lpfc_sli_issue_iocb(phba, pring->ringno, in lpfc_sli_abort_iotag_issue()
9844 __lpfc_sli_release_iocbq(phba, abtsiocbp); in lpfc_sli_abort_iotag_issue()
9868 lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, in lpfc_sli_issue_abort_iotag() argument
9900 retval = lpfc_sli_abort_iotag_issue(phba, pring, cmdiocb); in lpfc_sli_issue_abort_iotag()
9918 lpfc_sli_hba_iocb_abort(struct lpfc_hba *phba) in lpfc_sli_hba_iocb_abort() argument
9920 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_hba_iocb_abort()
9926 lpfc_sli_abort_iocb_ring(phba, pring); in lpfc_sli_hba_iocb_abort()
10018 struct lpfc_hba *phba = vport->phba; in lpfc_sli_sum_iocb() local
10022 for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) { in lpfc_sli_sum_iocb()
10023 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli_sum_iocb()
10044 lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, in lpfc_sli_abort_fcp_cmpl() argument
10047 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_abort_fcp_cmpl()
10055 lpfc_sli_release_iocbq(phba, cmdiocb); in lpfc_sli_abort_fcp_cmpl()
10084 struct lpfc_hba *phba = vport->phba; in lpfc_sli_abort_iocb() local
10091 for (i = 1; i <= phba->sli.last_iotag; i++) { in lpfc_sli_abort_iocb()
10092 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli_abort_iocb()
10106 abtsiocb = lpfc_sli_get_iocbq(phba); in lpfc_sli_abort_iocb()
10118 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_abort_iocb()
10133 if (lpfc_is_link_up(phba)) in lpfc_sli_abort_iocb()
10140 ret_val = lpfc_sli_issue_iocb(phba, pring->ringno, in lpfc_sli_abort_iocb()
10143 lpfc_sli_release_iocbq(phba, abtsiocb); in lpfc_sli_abort_iocb()
10178 struct lpfc_hba *phba = vport->phba; in lpfc_sli_abort_taskmgmt() local
10189 spin_lock_irq(&phba->hbalock); in lpfc_sli_abort_taskmgmt()
10192 if (phba->hba_flag & HBA_FCP_IOQ_FLUSH) { in lpfc_sli_abort_taskmgmt()
10193 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_taskmgmt()
10198 for (i = 1; i <= phba->sli.last_iotag; i++) { in lpfc_sli_abort_taskmgmt()
10199 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli_abort_taskmgmt()
10213 abtsiocbq = __lpfc_sli_get_iocbq(phba); in lpfc_sli_abort_taskmgmt()
10220 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_sli_abort_taskmgmt()
10239 if (lpfc_is_link_up(phba) && in lpfc_sli_abort_taskmgmt()
10254 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_sli_abort_taskmgmt()
10257 pring_s4 = &phba->sli.ring[ring_number]; in lpfc_sli_abort_taskmgmt()
10260 ret_val = __lpfc_sli_issue_iocb(phba, pring_s4->ringno, in lpfc_sli_abort_taskmgmt()
10264 ret_val = __lpfc_sli_issue_iocb(phba, pring->ringno, in lpfc_sli_abort_taskmgmt()
10270 __lpfc_sli_release_iocbq(phba, abtsiocbq); in lpfc_sli_abort_taskmgmt()
10274 spin_unlock_irq(&phba->hbalock); in lpfc_sli_abort_taskmgmt()
10296 lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba, in lpfc_sli_wake_iocb_wait() argument
10304 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_wake_iocb_wait()
10313 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_wake_iocb_wait()
10317 (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, NULL); in lpfc_sli_wake_iocb_wait()
10319 lpfc_sli_release_iocbq(phba, cmdiocbq); in lpfc_sli_wake_iocb_wait()
10339 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_wake_iocb_wait()
10356 lpfc_chk_iocb_flg(struct lpfc_hba *phba, in lpfc_chk_iocb_flg() argument
10362 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_chk_iocb_flg()
10364 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_chk_iocb_flg()
10406 lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, in lpfc_sli_issue_iocb_wait() argument
10419 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_sli_issue_iocb_wait()
10438 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_sli_issue_iocb_wait()
10439 if (lpfc_readl(phba->HCregaddr, &creg_val)) in lpfc_sli_issue_iocb_wait()
10442 writel(creg_val, phba->HCregaddr); in lpfc_sli_issue_iocb_wait()
10443 readl(phba->HCregaddr); /* flush */ in lpfc_sli_issue_iocb_wait()
10446 retval = lpfc_sli_issue_iocb(phba, ring_number, piocb, in lpfc_sli_issue_iocb_wait()
10451 lpfc_chk_iocb_flg(phba, piocb, LPFC_IO_WAKE), in lpfc_sli_issue_iocb_wait()
10453 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli_issue_iocb_wait()
10464 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli_issue_iocb_wait()
10466 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_issue_iocb_wait()
10474 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_issue_iocb_wait()
10479 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli_issue_iocb_wait()
10486 if (phba->cfg_log_verbose & LOG_SLI) { in lpfc_sli_issue_iocb_wait()
10493 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_issue_iocb_wait()
10495 phba->iocb_cnt, txq_cnt, txcmplq_cnt); in lpfc_sli_issue_iocb_wait()
10499 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli_issue_iocb_wait()
10505 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { in lpfc_sli_issue_iocb_wait()
10506 if (lpfc_readl(phba->HCregaddr, &creg_val)) in lpfc_sli_issue_iocb_wait()
10509 writel(creg_val, phba->HCregaddr); in lpfc_sli_issue_iocb_wait()
10510 readl(phba->HCregaddr); /* flush */ in lpfc_sli_issue_iocb_wait()
10548 lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, in lpfc_sli_issue_mbox_wait() argument
10567 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); in lpfc_sli_issue_mbox_wait()
10573 spin_lock_irqsave(&phba->hbalock, flag); in lpfc_sli_issue_mbox_wait()
10586 spin_unlock_irqrestore(&phba->hbalock, flag); in lpfc_sli_issue_mbox_wait()
10611 lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) in lpfc_sli_mbox_sys_shutdown() argument
10613 struct lpfc_sli *psli = &phba->sli; in lpfc_sli_mbox_sys_shutdown()
10619 lpfc_sli_mbox_sys_flush(phba); in lpfc_sli_mbox_sys_shutdown()
10624 spin_lock_irq(&phba->hbalock); in lpfc_sli_mbox_sys_shutdown()
10631 if (phba->sli.mbox_active) in lpfc_sli_mbox_sys_shutdown()
10632 timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, in lpfc_sli_mbox_sys_shutdown()
10633 phba->sli.mbox_active) * in lpfc_sli_mbox_sys_shutdown()
10635 spin_unlock_irq(&phba->hbalock); in lpfc_sli_mbox_sys_shutdown()
10637 while (phba->sli.mbox_active) { in lpfc_sli_mbox_sys_shutdown()
10647 spin_unlock_irq(&phba->hbalock); in lpfc_sli_mbox_sys_shutdown()
10649 lpfc_sli_mbox_sys_flush(phba); in lpfc_sli_mbox_sys_shutdown()
10664 lpfc_sli_eratt_read(struct lpfc_hba *phba) in lpfc_sli_eratt_read() argument
10669 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_eratt_read()
10674 if (lpfc_sli_read_hs(phba)) in lpfc_sli_eratt_read()
10678 if ((HS_FFER1 & phba->work_hs) && in lpfc_sli_eratt_read()
10680 HS_FFER6 | HS_FFER7 | HS_FFER8) & phba->work_hs)) { in lpfc_sli_eratt_read()
10681 phba->hba_flag |= DEFER_ERATT; in lpfc_sli_eratt_read()
10683 writel(0, phba->HCregaddr); in lpfc_sli_eratt_read()
10684 readl(phba->HCregaddr); in lpfc_sli_eratt_read()
10688 phba->work_ha |= HA_ERATT; in lpfc_sli_eratt_read()
10690 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli_eratt_read()
10697 phba->work_hs |= UNPLUG_ERR; in lpfc_sli_eratt_read()
10699 phba->work_ha |= HA_ERATT; in lpfc_sli_eratt_read()
10701 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli_eratt_read()
10717 lpfc_sli4_eratt_read(struct lpfc_hba *phba) in lpfc_sli4_eratt_read() argument
10727 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_sli4_eratt_read()
10730 if (lpfc_readl(phba->sli4_hba.u.if_type0.UERRLOregaddr, in lpfc_sli4_eratt_read()
10732 lpfc_readl(phba->sli4_hba.u.if_type0.UERRHIregaddr, in lpfc_sli4_eratt_read()
10734 phba->work_hs |= UNPLUG_ERR; in lpfc_sli4_eratt_read()
10735 phba->work_ha |= HA_ERATT; in lpfc_sli4_eratt_read()
10736 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli4_eratt_read()
10739 if ((~phba->sli4_hba.ue_mask_lo & uerr_sta_lo) || in lpfc_sli4_eratt_read()
10740 (~phba->sli4_hba.ue_mask_hi & uerr_sta_hi)) { in lpfc_sli4_eratt_read()
10741 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_eratt_read()
10747 phba->sli4_hba.ue_mask_lo, in lpfc_sli4_eratt_read()
10748 phba->sli4_hba.ue_mask_hi); in lpfc_sli4_eratt_read()
10749 phba->work_status[0] = uerr_sta_lo; in lpfc_sli4_eratt_read()
10750 phba->work_status[1] = uerr_sta_hi; in lpfc_sli4_eratt_read()
10751 phba->work_ha |= HA_ERATT; in lpfc_sli4_eratt_read()
10752 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli4_eratt_read()
10757 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_eratt_read()
10759 lpfc_readl(phba->sli4_hba.PSMPHRregaddr, in lpfc_sli4_eratt_read()
10761 phba->work_hs |= UNPLUG_ERR; in lpfc_sli4_eratt_read()
10762 phba->work_ha |= HA_ERATT; in lpfc_sli4_eratt_read()
10763 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli4_eratt_read()
10767 phba->work_status[0] = in lpfc_sli4_eratt_read()
10768 readl(phba->sli4_hba.u.if_type2.ERR1regaddr); in lpfc_sli4_eratt_read()
10769 phba->work_status[1] = in lpfc_sli4_eratt_read()
10770 readl(phba->sli4_hba.u.if_type2.ERR2regaddr); in lpfc_sli4_eratt_read()
10771 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_eratt_read()
10778 phba->work_status[0], in lpfc_sli4_eratt_read()
10779 phba->work_status[1]); in lpfc_sli4_eratt_read()
10780 phba->work_ha |= HA_ERATT; in lpfc_sli4_eratt_read()
10781 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli4_eratt_read()
10787 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_eratt_read()
10807 lpfc_sli_check_eratt(struct lpfc_hba *phba) in lpfc_sli_check_eratt() argument
10814 if (phba->link_flag & LS_IGNORE_ERATT) in lpfc_sli_check_eratt()
10818 spin_lock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
10819 if (phba->hba_flag & HBA_ERATT_HANDLED) { in lpfc_sli_check_eratt()
10821 spin_unlock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
10829 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_check_eratt()
10830 spin_unlock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
10835 if (unlikely(pci_channel_offline(phba->pcidev))) { in lpfc_sli_check_eratt()
10836 spin_unlock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
10840 switch (phba->sli_rev) { in lpfc_sli_check_eratt()
10844 ha_copy = lpfc_sli_eratt_read(phba); in lpfc_sli_check_eratt()
10848 ha_copy = lpfc_sli4_eratt_read(phba); in lpfc_sli_check_eratt()
10851 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_check_eratt()
10853 phba->sli_rev); in lpfc_sli_check_eratt()
10857 spin_unlock_irq(&phba->hbalock); in lpfc_sli_check_eratt()
10873 lpfc_intr_state_check(struct lpfc_hba *phba) in lpfc_intr_state_check() argument
10876 if (unlikely(pci_channel_offline(phba->pcidev))) in lpfc_intr_state_check()
10880 phba->sli.slistat.sli_intr++; in lpfc_intr_state_check()
10883 if (unlikely(phba->link_state < LPFC_LINK_DOWN)) in lpfc_intr_state_check()
10913 struct lpfc_hba *phba; in lpfc_sli_sp_intr_handler() local
10931 phba = (struct lpfc_hba *)dev_id; in lpfc_sli_sp_intr_handler()
10933 if (unlikely(!phba)) in lpfc_sli_sp_intr_handler()
10940 if (phba->intr_type == MSIX) { in lpfc_sli_sp_intr_handler()
10942 if (lpfc_intr_state_check(phba)) in lpfc_sli_sp_intr_handler()
10945 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
10946 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_sp_intr_handler()
10951 if (phba->link_flag & LS_IGNORE_ERATT) in lpfc_sli_sp_intr_handler()
10955 if (phba->hba_flag & HBA_ERATT_HANDLED) in lpfc_sli_sp_intr_handler()
10960 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli_sp_intr_handler()
10967 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_sp_intr_handler()
10968 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
10973 if (lpfc_readl(phba->HCregaddr, &hc_copy)) in lpfc_sli_sp_intr_handler()
10978 phba->HCregaddr); in lpfc_sli_sp_intr_handler()
10980 phba->HAregaddr); in lpfc_sli_sp_intr_handler()
10981 writel(hc_copy, phba->HCregaddr); in lpfc_sli_sp_intr_handler()
10982 readl(phba->HAregaddr); /* flush */ in lpfc_sli_sp_intr_handler()
10983 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
10985 ha_copy = phba->ha_copy; in lpfc_sli_sp_intr_handler()
10987 work_ha_copy = ha_copy & phba->work_ha_mask; in lpfc_sli_sp_intr_handler()
10991 if (phba->sli.sli_flag & LPFC_PROCESS_LA) { in lpfc_sli_sp_intr_handler()
10996 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
10997 phba->sli.sli_flag &= ~LPFC_PROCESS_LA; in lpfc_sli_sp_intr_handler()
10998 if (lpfc_readl(phba->HCregaddr, &control)) in lpfc_sli_sp_intr_handler()
11001 writel(control, phba->HCregaddr); in lpfc_sli_sp_intr_handler()
11002 readl(phba->HCregaddr); /* flush */ in lpfc_sli_sp_intr_handler()
11003 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11018 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11019 if (lpfc_readl(phba->HCregaddr, &control)) in lpfc_sli_sp_intr_handler()
11022 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_sp_intr_handler()
11025 (uint32_t)phba->sli.slistat.sli_intr); in lpfc_sli_sp_intr_handler()
11028 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_sp_intr_handler()
11031 phba->work_ha, work_ha_copy, in lpfc_sli_sp_intr_handler()
11033 &phba->work_waitq)); in lpfc_sli_sp_intr_handler()
11037 writel(control, phba->HCregaddr); in lpfc_sli_sp_intr_handler()
11038 readl(phba->HCregaddr); /* flush */ in lpfc_sli_sp_intr_handler()
11041 lpfc_debugfs_slow_ring_trc(phba, in lpfc_sli_sp_intr_handler()
11044 phba->work_ha, work_ha_copy, in lpfc_sli_sp_intr_handler()
11046 &phba->work_waitq)); in lpfc_sli_sp_intr_handler()
11048 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11051 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11053 if (lpfc_sli_read_hs(phba)) in lpfc_sli_sp_intr_handler()
11059 if ((HS_FFER1 & phba->work_hs) && in lpfc_sli_sp_intr_handler()
11062 phba->work_hs)) { in lpfc_sli_sp_intr_handler()
11063 phba->hba_flag |= DEFER_ERATT; in lpfc_sli_sp_intr_handler()
11065 writel(0, phba->HCregaddr); in lpfc_sli_sp_intr_handler()
11066 readl(phba->HCregaddr); in lpfc_sli_sp_intr_handler()
11070 if ((work_ha_copy & HA_MBATT) && (phba->sli.mbox_active)) { in lpfc_sli_sp_intr_handler()
11071 pmb = phba->sli.mbox_active; in lpfc_sli_sp_intr_handler()
11073 mbox = phba->mbox; in lpfc_sli_sp_intr_handler()
11079 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11084 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | in lpfc_sli_sp_intr_handler()
11095 phba->sli.mbox_active = NULL; in lpfc_sli_sp_intr_handler()
11096 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11097 phba->last_completion_time = jiffies; in lpfc_sli_sp_intr_handler()
11098 del_timer(&phba->sli.mbox_tmo); in lpfc_sli_sp_intr_handler()
11105 phba->mbox_ext, in lpfc_sli_sp_intr_handler()
11130 lpfc_unreg_login(phba, in lpfc_sli_sp_intr_handler()
11139 rc = lpfc_sli_issue_mbox(phba, in lpfc_sli_sp_intr_handler()
11143 lpfc_printf_log(phba, in lpfc_sli_sp_intr_handler()
11153 &phba->pport->work_port_lock, in lpfc_sli_sp_intr_handler()
11155 phba->pport->work_port_events &= in lpfc_sli_sp_intr_handler()
11158 &phba->pport->work_port_lock, in lpfc_sli_sp_intr_handler()
11160 lpfc_mbox_cmpl_put(phba, pmb); in lpfc_sli_sp_intr_handler()
11163 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11166 (phba->sli.mbox_active == NULL)) { in lpfc_sli_sp_intr_handler()
11170 rc = lpfc_sli_issue_mbox(phba, NULL, in lpfc_sli_sp_intr_handler()
11174 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | in lpfc_sli_sp_intr_handler()
11179 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11180 phba->work_ha |= work_ha_copy; in lpfc_sli_sp_intr_handler()
11181 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11182 lpfc_worker_wake_up(phba); in lpfc_sli_sp_intr_handler()
11186 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_sp_intr_handler()
11213 struct lpfc_hba *phba; in lpfc_sli_fp_intr_handler() local
11221 phba = (struct lpfc_hba *) dev_id; in lpfc_sli_fp_intr_handler()
11223 if (unlikely(!phba)) in lpfc_sli_fp_intr_handler()
11230 if (phba->intr_type == MSIX) { in lpfc_sli_fp_intr_handler()
11232 if (lpfc_intr_state_check(phba)) in lpfc_sli_fp_intr_handler()
11235 if (lpfc_readl(phba->HAregaddr, &ha_copy)) in lpfc_sli_fp_intr_handler()
11238 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli_fp_intr_handler()
11243 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_fp_intr_handler()
11244 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_fp_intr_handler()
11248 phba->HAregaddr); in lpfc_sli_fp_intr_handler()
11249 readl(phba->HAregaddr); /* flush */ in lpfc_sli_fp_intr_handler()
11250 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli_fp_intr_handler()
11252 ha_copy = phba->ha_copy; in lpfc_sli_fp_intr_handler()
11257 ha_copy &= ~(phba->work_ha_mask); in lpfc_sli_fp_intr_handler()
11262 lpfc_sli_handle_fast_ring_event(phba, in lpfc_sli_fp_intr_handler()
11263 &phba->sli.ring[LPFC_FCP_RING], in lpfc_sli_fp_intr_handler()
11266 if (phba->cfg_multi_ring_support == 2) { in lpfc_sli_fp_intr_handler()
11274 lpfc_sli_handle_fast_ring_event(phba, in lpfc_sli_fp_intr_handler()
11275 &phba->sli.ring[LPFC_EXTRA_RING], in lpfc_sli_fp_intr_handler()
11302 struct lpfc_hba *phba; in lpfc_sli_intr_handler() local
11311 phba = (struct lpfc_hba *) dev_id; in lpfc_sli_intr_handler()
11313 if (unlikely(!phba)) in lpfc_sli_intr_handler()
11317 if (lpfc_intr_state_check(phba)) in lpfc_sli_intr_handler()
11320 spin_lock(&phba->hbalock); in lpfc_sli_intr_handler()
11321 if (lpfc_readl(phba->HAregaddr, &phba->ha_copy)) { in lpfc_sli_intr_handler()
11322 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
11326 if (unlikely(!phba->ha_copy)) { in lpfc_sli_intr_handler()
11327 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
11329 } else if (phba->ha_copy & HA_ERATT) { in lpfc_sli_intr_handler()
11330 if (phba->hba_flag & HBA_ERATT_HANDLED) in lpfc_sli_intr_handler()
11332 phba->ha_copy &= ~HA_ERATT; in lpfc_sli_intr_handler()
11335 phba->hba_flag |= HBA_ERATT_HANDLED; in lpfc_sli_intr_handler()
11341 if (unlikely(phba->hba_flag & DEFER_ERATT)) { in lpfc_sli_intr_handler()
11342 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
11347 if (lpfc_readl(phba->HCregaddr, &hc_copy)) { in lpfc_sli_intr_handler()
11348 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
11353 phba->HCregaddr); in lpfc_sli_intr_handler()
11354 writel((phba->ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); in lpfc_sli_intr_handler()
11355 writel(hc_copy, phba->HCregaddr); in lpfc_sli_intr_handler()
11356 readl(phba->HAregaddr); /* flush */ in lpfc_sli_intr_handler()
11357 spin_unlock(&phba->hbalock); in lpfc_sli_intr_handler()
11364 status1 = phba->ha_copy & (HA_MBATT | HA_LATT | HA_ERATT); in lpfc_sli_intr_handler()
11367 status2 = (phba->ha_copy & (HA_RXMASK << (4*LPFC_ELS_RING))); in lpfc_sli_intr_handler()
11380 status1 = (phba->ha_copy & (HA_RXMASK << (4*LPFC_FCP_RING))); in lpfc_sli_intr_handler()
11384 if (phba->cfg_multi_ring_support == 2) { in lpfc_sli_intr_handler()
11385 status2 = (phba->ha_copy & (HA_RXMASK << (4*LPFC_EXTRA_RING))); in lpfc_sli_intr_handler()
11406 void lpfc_sli4_fcp_xri_abort_event_proc(struct lpfc_hba *phba) in lpfc_sli4_fcp_xri_abort_event_proc() argument
11411 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcp_xri_abort_event_proc()
11412 phba->hba_flag &= ~FCP_XRI_ABORT_EVENT; in lpfc_sli4_fcp_xri_abort_event_proc()
11413 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcp_xri_abort_event_proc()
11415 while (!list_empty(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue)) { in lpfc_sli4_fcp_xri_abort_event_proc()
11417 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcp_xri_abort_event_proc()
11418 list_remove_head(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue, in lpfc_sli4_fcp_xri_abort_event_proc()
11420 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcp_xri_abort_event_proc()
11422 lpfc_sli4_fcp_xri_aborted(phba, &cq_event->cqe.wcqe_axri); in lpfc_sli4_fcp_xri_abort_event_proc()
11424 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_fcp_xri_abort_event_proc()
11435 void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba) in lpfc_sli4_els_xri_abort_event_proc() argument
11440 spin_lock_irq(&phba->hbalock); in lpfc_sli4_els_xri_abort_event_proc()
11441 phba->hba_flag &= ~ELS_XRI_ABORT_EVENT; in lpfc_sli4_els_xri_abort_event_proc()
11442 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_els_xri_abort_event_proc()
11444 while (!list_empty(&phba->sli4_hba.sp_els_xri_aborted_work_queue)) { in lpfc_sli4_els_xri_abort_event_proc()
11446 spin_lock_irq(&phba->hbalock); in lpfc_sli4_els_xri_abort_event_proc()
11447 list_remove_head(&phba->sli4_hba.sp_els_xri_aborted_work_queue, in lpfc_sli4_els_xri_abort_event_proc()
11449 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_els_xri_abort_event_proc()
11451 lpfc_sli4_els_xri_aborted(phba, &cq_event->cqe.wcqe_axri); in lpfc_sli4_els_xri_abort_event_proc()
11453 lpfc_sli4_cq_event_release(phba, cq_event); in lpfc_sli4_els_xri_abort_event_proc()
11469 lpfc_sli4_iocb_param_transfer(struct lpfc_hba *phba, in lpfc_sli4_iocb_param_transfer() argument
11567 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_iocb_param_transfer()
11569 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_iocb_param_transfer()
11585 lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba, in lpfc_sli4_els_wcqe_to_rspiocbq() argument
11588 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_sli4_els_wcqe_to_rspiocbq()
11597 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, in lpfc_sli4_els_wcqe_to_rspiocbq()
11602 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_els_wcqe_to_rspiocbq()
11606 lpfc_sli_release_iocbq(phba, irspiocbq); in lpfc_sli4_els_wcqe_to_rspiocbq()
11611 lpfc_sli4_iocb_param_transfer(phba, irspiocbq, cmdiocbq, wcqe); in lpfc_sli4_els_wcqe_to_rspiocbq()
11627 lpfc_sli4_sp_handle_async_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe) in lpfc_sli4_sp_handle_async_event() argument
11632 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_sp_handle_async_event()
11638 cq_event = lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_sp_handle_async_event()
11640 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_async_event()
11647 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_async_event()
11648 list_add_tail(&cq_event->list, &phba->sli4_hba.sp_asynce_work_queue); in lpfc_sli4_sp_handle_async_event()
11650 phba->hba_flag |= ASYNC_EVENT; in lpfc_sli4_sp_handle_async_event()
11651 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_async_event()
11667 lpfc_sli4_sp_handle_mbox_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe) in lpfc_sli4_sp_handle_mbox_event() argument
11685 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11686 pmb = phba->sli.mbox_active; in lpfc_sli4_sp_handle_mbox_event()
11688 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, in lpfc_sli4_sp_handle_mbox_event()
11690 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11693 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11696 mbox = phba->mbox; in lpfc_sli4_sp_handle_mbox_event()
11700 phba->last_completion_time = jiffies; in lpfc_sli4_sp_handle_mbox_event()
11701 del_timer(&phba->sli.mbox_tmo); in lpfc_sli4_sp_handle_mbox_event()
11729 lpfc_unreg_login(phba, vport->vpi, in lpfc_sli4_sp_handle_mbox_event()
11735 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); in lpfc_sli4_sp_handle_mbox_event()
11737 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | in lpfc_sli4_sp_handle_mbox_event()
11744 spin_lock_irqsave(&phba->pport->work_port_lock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11745 phba->pport->work_port_events &= ~WORKER_MBOX_TMO; in lpfc_sli4_sp_handle_mbox_event()
11746 spin_unlock_irqrestore(&phba->pport->work_port_lock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11749 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11750 __lpfc_mbox_cmpl_put(phba, pmb); in lpfc_sli4_sp_handle_mbox_event()
11751 phba->work_ha |= HA_MBATT; in lpfc_sli4_sp_handle_mbox_event()
11752 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11756 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11758 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; in lpfc_sli4_sp_handle_mbox_event()
11760 phba->sli.mbox_active = NULL; in lpfc_sli4_sp_handle_mbox_event()
11761 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_mbox_event()
11763 lpfc_worker_wake_up(phba); in lpfc_sli4_sp_handle_mbox_event()
11766 lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); in lpfc_sli4_sp_handle_mbox_event()
11782 lpfc_sli4_sp_handle_mcqe(struct lpfc_hba *phba, struct lpfc_cqe *cqe) in lpfc_sli4_sp_handle_mcqe() argument
11792 workposted = lpfc_sli4_sp_handle_mbox_event(phba, &mcqe); in lpfc_sli4_sp_handle_mcqe()
11794 workposted = lpfc_sli4_sp_handle_async_event(phba, &mcqe); in lpfc_sli4_sp_handle_mcqe()
11809 lpfc_sli4_sp_handle_els_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_sp_handle_els_wcqe() argument
11820 irspiocbq = lpfc_sli_get_iocbq(phba); in lpfc_sli4_sp_handle_els_wcqe()
11826 if (!list_empty(&phba->sli.ring[LPFC_FCP_RING].txcmplq)) in lpfc_sli4_sp_handle_els_wcqe()
11828 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_els_wcqe()
11831 txq_cnt, phba->iocb_cnt, in lpfc_sli4_sp_handle_els_wcqe()
11839 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_els_wcqe()
11841 &phba->sli4_hba.sp_queue_event); in lpfc_sli4_sp_handle_els_wcqe()
11842 phba->hba_flag |= HBA_SP_QUEUE_EVT; in lpfc_sli4_sp_handle_els_wcqe()
11843 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_els_wcqe()
11857 lpfc_sli4_sp_handle_rel_wcqe(struct lpfc_hba *phba, in lpfc_sli4_sp_handle_rel_wcqe() argument
11861 if (unlikely(!phba->sli4_hba.els_wq)) in lpfc_sli4_sp_handle_rel_wcqe()
11864 if (bf_get(lpfc_wcqe_r_wq_id, wcqe) == phba->sli4_hba.els_wq->queue_id) in lpfc_sli4_sp_handle_rel_wcqe()
11865 lpfc_sli4_wq_release(phba->sli4_hba.els_wq, in lpfc_sli4_sp_handle_rel_wcqe()
11868 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_sp_handle_rel_wcqe()
11872 phba->sli4_hba.els_wq->queue_id); in lpfc_sli4_sp_handle_rel_wcqe()
11886 lpfc_sli4_sp_handle_abort_xri_wcqe(struct lpfc_hba *phba, in lpfc_sli4_sp_handle_abort_xri_wcqe() argument
11895 cq_event = lpfc_sli4_cq_event_alloc(phba); in lpfc_sli4_sp_handle_abort_xri_wcqe()
11897 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_abort_xri_wcqe()
11906 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_abort_xri_wcqe()
11908 &phba->sli4_hba.sp_fcp_xri_aborted_work_queue); in lpfc_sli4_sp_handle_abort_xri_wcqe()
11910 phba->hba_flag |= FCP_XRI_ABORT_EVENT; in lpfc_sli4_sp_handle_abort_xri_wcqe()
11911 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_abort_xri_wcqe()
11915 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_abort_xri_wcqe()
11917 &phba->sli4_hba.sp_els_xri_aborted_work_queue); in lpfc_sli4_sp_handle_abort_xri_wcqe()
11919 phba->hba_flag |= ELS_XRI_ABORT_EVENT; in lpfc_sli4_sp_handle_abort_xri_wcqe()
11920 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_abort_xri_wcqe()
11924 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_abort_xri_wcqe()
11943 lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe) in lpfc_sli4_sp_handle_rcqe() argument
11946 struct lpfc_queue *hrq = phba->sli4_hba.hdr_rq; in lpfc_sli4_sp_handle_rcqe()
11947 struct lpfc_queue *drq = phba->sli4_hba.dat_rq; in lpfc_sli4_sp_handle_rcqe()
11966 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_rcqe()
11971 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
11972 dma_buf = lpfc_sli_hbqbuf_get(&phba->hbqs[0].hbq_buffer_list); in lpfc_sli4_sp_handle_rcqe()
11975 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
11982 &phba->sli4_hba.sp_queue_event); in lpfc_sli4_sp_handle_rcqe()
11984 phba->hba_flag |= HBA_SP_QUEUE_EVT; in lpfc_sli4_sp_handle_rcqe()
11985 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
11992 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
11993 phba->hba_flag |= HBA_POST_RECEIVE_BUFFER; in lpfc_sli4_sp_handle_rcqe()
11994 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_sp_handle_rcqe()
12014 lpfc_sli4_sp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_sp_handle_cqe() argument
12027 phba->last_completion_time = jiffies; in lpfc_sli4_sp_handle_cqe()
12028 workposted = lpfc_sli4_sp_handle_els_wcqe(phba, cq, in lpfc_sli4_sp_handle_cqe()
12033 lpfc_sli4_sp_handle_rel_wcqe(phba, in lpfc_sli4_sp_handle_cqe()
12038 phba->last_completion_time = jiffies; in lpfc_sli4_sp_handle_cqe()
12039 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq, in lpfc_sli4_sp_handle_cqe()
12045 phba->last_completion_time = jiffies; in lpfc_sli4_sp_handle_cqe()
12046 workposted = lpfc_sli4_sp_handle_rcqe(phba, in lpfc_sli4_sp_handle_cqe()
12050 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_cqe()
12072 lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, in lpfc_sli4_sp_handle_eqe() argument
12091 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_sli4_sp_handle_eqe()
12092 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_eqe()
12102 workposted |= lpfc_sli4_sp_handle_mcqe(phba, cqe); in lpfc_sli4_sp_handle_eqe()
12111 workposted |= lpfc_sli4_fp_handle_wcqe(phba, cq, in lpfc_sli4_sp_handle_eqe()
12114 workposted |= lpfc_sli4_sp_handle_cqe(phba, cq, in lpfc_sli4_sp_handle_eqe()
12125 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_eqe()
12133 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_sp_handle_eqe()
12142 lpfc_worker_wake_up(phba); in lpfc_sli4_sp_handle_eqe()
12155 lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_fp_handle_fcp_wcqe() argument
12172 phba->lpfc_rampdown_queue_depth(phba); in lpfc_sli4_fp_handle_fcp_wcqe()
12175 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_fp_handle_fcp_wcqe()
12188 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, in lpfc_sli4_fp_handle_fcp_wcqe()
12192 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_fp_handle_fcp_wcqe()
12199 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_fp_handle_fcp_wcqe()
12207 lpfc_sli4_iocb_param_transfer(phba, &irspiocbq, cmdiocbq, wcqe); in lpfc_sli4_fp_handle_fcp_wcqe()
12210 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_sli4_fp_handle_fcp_wcqe()
12212 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_sli4_fp_handle_fcp_wcqe()
12216 (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, &irspiocbq); in lpfc_sli4_fp_handle_fcp_wcqe()
12229 lpfc_sli4_fp_handle_rel_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_fp_handle_rel_wcqe() argument
12248 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_fp_handle_rel_wcqe()
12262 lpfc_sli4_fp_handle_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_sli4_fp_handle_wcqe() argument
12276 phba->last_completion_time = jiffies; in lpfc_sli4_fp_handle_wcqe()
12277 lpfc_sli4_fp_handle_fcp_wcqe(phba, cq, in lpfc_sli4_fp_handle_wcqe()
12283 lpfc_sli4_fp_handle_rel_wcqe(phba, cq, in lpfc_sli4_fp_handle_wcqe()
12289 phba->last_completion_time = jiffies; in lpfc_sli4_fp_handle_wcqe()
12290 workposted = lpfc_sli4_sp_handle_abort_xri_wcqe(phba, cq, in lpfc_sli4_fp_handle_wcqe()
12294 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_fp_handle_wcqe()
12315 lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe, in lpfc_sli4_hba_handle_eqe() argument
12325 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_hba_handle_eqe()
12337 if (unlikely(cqid != phba->sli4_hba.fcp_cq_map[qidx])) { in lpfc_sli4_hba_handle_eqe()
12338 lpfc_sli4_sp_handle_eqe(phba, eqe, in lpfc_sli4_hba_handle_eqe()
12339 phba->sli4_hba.hba_eq[qidx]); in lpfc_sli4_hba_handle_eqe()
12343 if (unlikely(!phba->sli4_hba.fcp_cq)) { in lpfc_sli4_hba_handle_eqe()
12344 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_hba_handle_eqe()
12349 cq = phba->sli4_hba.fcp_cq[qidx]; in lpfc_sli4_hba_handle_eqe()
12351 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_sli4_hba_handle_eqe()
12352 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_hba_handle_eqe()
12359 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_hba_handle_eqe()
12368 workposted |= lpfc_sli4_fp_handle_wcqe(phba, cq, cqe); in lpfc_sli4_hba_handle_eqe()
12379 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_hba_handle_eqe()
12388 lpfc_worker_wake_up(phba); in lpfc_sli4_hba_handle_eqe()
12392 lpfc_sli4_eq_flush(struct lpfc_hba *phba, struct lpfc_queue *eq) in lpfc_sli4_eq_flush() argument
12419 lpfc_sli4_fof_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe) in lpfc_sli4_fof_handle_eqe() argument
12428 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_fof_handle_eqe()
12440 cq = phba->sli4_hba.oas_cq; in lpfc_sli4_fof_handle_eqe()
12442 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) in lpfc_sli4_fof_handle_eqe()
12443 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_fof_handle_eqe()
12450 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_fof_handle_eqe()
12459 workposted |= lpfc_sli4_fp_handle_wcqe(phba, cq, cqe); in lpfc_sli4_fof_handle_eqe()
12470 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_fof_handle_eqe()
12479 lpfc_worker_wake_up(phba); in lpfc_sli4_fof_handle_eqe()
12506 struct lpfc_hba *phba; in lpfc_sli4_fof_intr_handler() local
12516 phba = fcp_eq_hdl->phba; in lpfc_sli4_fof_intr_handler()
12519 if (unlikely(!phba)) in lpfc_sli4_fof_intr_handler()
12523 eq = phba->sli4_hba.fof_eq; in lpfc_sli4_fof_intr_handler()
12528 if (unlikely(lpfc_intr_state_check(phba))) { in lpfc_sli4_fof_intr_handler()
12531 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_fof_intr_handler()
12532 if (phba->link_state < LPFC_LINK_DOWN) in lpfc_sli4_fof_intr_handler()
12534 lpfc_sli4_eq_flush(phba, eq); in lpfc_sli4_fof_intr_handler()
12535 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_fof_intr_handler()
12543 lpfc_sli4_fof_handle_eqe(phba, eqe); in lpfc_sli4_fof_intr_handler()
12557 if (phba->intr_type == MSIX) in lpfc_sli4_fof_intr_handler()
12559 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_fof_intr_handler()
12562 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_fof_intr_handler()
12602 struct lpfc_hba *phba; in lpfc_sli4_hba_intr_handler() local
12612 phba = fcp_eq_hdl->phba; in lpfc_sli4_hba_intr_handler()
12615 if (unlikely(!phba)) in lpfc_sli4_hba_intr_handler()
12617 if (unlikely(!phba->sli4_hba.hba_eq)) in lpfc_sli4_hba_intr_handler()
12621 fpeq = phba->sli4_hba.hba_eq[fcp_eqidx]; in lpfc_sli4_hba_intr_handler()
12635 if (unlikely(lpfc_intr_state_check(phba))) { in lpfc_sli4_hba_intr_handler()
12638 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_hba_intr_handler()
12639 if (phba->link_state < LPFC_LINK_DOWN) in lpfc_sli4_hba_intr_handler()
12641 lpfc_sli4_eq_flush(phba, fpeq); in lpfc_sli4_hba_intr_handler()
12642 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_hba_intr_handler()
12655 lpfc_sli4_hba_handle_eqe(phba, eqe, fcp_eqidx); in lpfc_sli4_hba_intr_handler()
12676 if (phba->intr_type == MSIX) in lpfc_sli4_hba_intr_handler()
12678 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_hba_intr_handler()
12710 struct lpfc_hba *phba; in lpfc_sli4_intr_handler() local
12716 phba = (struct lpfc_hba *)dev_id; in lpfc_sli4_intr_handler()
12718 if (unlikely(!phba)) in lpfc_sli4_intr_handler()
12724 for (fcp_eqidx = 0; fcp_eqidx < phba->cfg_fcp_io_channel; fcp_eqidx++) { in lpfc_sli4_intr_handler()
12726 &phba->sli4_hba.fcp_eq_hdl[fcp_eqidx]); in lpfc_sli4_intr_handler()
12731 if (phba->cfg_fof) { in lpfc_sli4_intr_handler()
12733 &phba->sli4_hba.fcp_eq_hdl[0]); in lpfc_sli4_intr_handler()
12760 dma_free_coherent(&queue->phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_sli4_queue_free()
12779 lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t entry_size, in lpfc_sli4_queue_alloc() argument
12786 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_sli4_queue_alloc()
12788 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_sli4_queue_alloc()
12804 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, in lpfc_sli4_queue_alloc()
12832 queue->phba = phba; in lpfc_sli4_queue_alloc()
12850 lpfc_dual_chute_pci_bar_map(struct lpfc_hba *phba, uint16_t pci_barset) in lpfc_dual_chute_pci_bar_map() argument
12854 if (!phba->pcidev) in lpfc_dual_chute_pci_bar_map()
12857 pdev = phba->pcidev; in lpfc_dual_chute_pci_bar_map()
12861 return phba->pci_bar0_memmap_p; in lpfc_dual_chute_pci_bar_map()
12863 return phba->pci_bar2_memmap_p; in lpfc_dual_chute_pci_bar_map()
12865 return phba->pci_bar4_memmap_p; in lpfc_dual_chute_pci_bar_map()
12889 lpfc_modify_fcp_eq_delay(struct lpfc_hba *phba, uint32_t startq) in lpfc_modify_fcp_eq_delay() argument
12901 if (startq >= phba->cfg_fcp_io_channel) in lpfc_modify_fcp_eq_delay()
12904 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_modify_fcp_eq_delay()
12909 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_modify_fcp_eq_delay()
12915 result = phba->cfg_fcp_imax / phba->cfg_fcp_io_channel; in lpfc_modify_fcp_eq_delay()
12922 for (fcp_eqidx = startq; fcp_eqidx < phba->cfg_fcp_io_channel; in lpfc_modify_fcp_eq_delay()
12924 eq = phba->sli4_hba.hba_eq[fcp_eqidx]; in lpfc_modify_fcp_eq_delay()
12936 mbox->vport = phba->pport; in lpfc_modify_fcp_eq_delay()
12939 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_modify_fcp_eq_delay()
12944 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_modify_fcp_eq_delay()
12950 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_modify_fcp_eq_delay()
12975 lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax) in lpfc_eq_create() argument
12984 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_eq_create()
12989 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_eq_create()
12992 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_eq_create()
12997 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_eq_create()
13012 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_eq_create()
13046 mbox->vport = phba->pport; in lpfc_eq_create()
13049 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_eq_create()
13054 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_eq_create()
13068 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_eq_create()
13094 lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, in lpfc_cq_create() argument
13103 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_cq_create()
13108 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_cq_create()
13111 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_cq_create()
13116 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_cq_create()
13126 phba->sli4_hba.pc_sli4_params.cqv); in lpfc_cq_create()
13127 if (phba->sli4_hba.pc_sli4_params.cqv == LPFC_Q_CREATE_VERSION_2) { in lpfc_cq_create()
13138 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_cq_create()
13166 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_cq_create()
13172 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cq_create()
13195 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_cq_create()
13214 lpfc_mq_create_fb_init(struct lpfc_hba *phba, struct lpfc_queue *mq, in lpfc_mq_create_fb_init() argument
13223 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_mq_create_fb_init()
13280 lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq, in lpfc_mq_create() argument
13290 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_mq_create()
13295 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_mq_create()
13298 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_mq_create()
13303 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_mq_create()
13323 phba->sli4_hba.pc_sli4_params.mqv); in lpfc_mq_create()
13324 if (phba->sli4_hba.pc_sli4_params.mqv == LPFC_Q_CREATE_VERSION_1) in lpfc_mq_create()
13332 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_mq_create()
13368 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_mq_create()
13372 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_mq_create()
13376 lpfc_mq_create_fb_init(phba, mq, mbox, cq); in lpfc_mq_create()
13378 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_mq_create()
13388 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_mq_create()
13408 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mq_create()
13435 lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq, in lpfc_wq_create() argument
13444 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_wq_create()
13453 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_wq_create()
13456 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_wq_create()
13461 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_wq_create()
13473 phba->sli4_hba.pc_sli4_params.wqv); in lpfc_wq_create()
13475 switch (phba->sli4_hba.pc_sli4_params.wqv) { in lpfc_wq_create()
13484 if (!(phba->sli4_hba.pc_sli4_params.wqsize & in lpfc_wq_create()
13518 if (!(phba->sli4_hba.pc_sli4_params.wqsize & in lpfc_wq_create()
13543 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) in lpfc_wq_create()
13546 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_wq_create()
13551 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_wq_create()
13563 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) { in lpfc_wq_create()
13568 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_wq_create()
13577 bar_memmap_p = lpfc_dual_chute_pci_bar_map(phba, pci_barset); in lpfc_wq_create()
13579 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_wq_create()
13589 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_wq_create()
13597 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_wq_create()
13603 wq->db_regaddr = phba->sli4_hba.WQDBregaddr; in lpfc_wq_create()
13615 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_wq_create()
13630 lpfc_rq_adjust_repost(struct lpfc_hba *phba, struct lpfc_queue *rq, int qno) in lpfc_rq_adjust_repost() argument
13671 lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq, in lpfc_rq_create() argument
13680 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; in lpfc_rq_create()
13688 if (!phba->sli4_hba.pc_sli4_params.supported) in lpfc_rq_create()
13693 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_rq_create()
13698 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_rq_create()
13704 phba->sli4_hba.pc_sli4_params.rqv); in lpfc_rq_create()
13705 if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) { in lpfc_rq_create()
13719 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_rq_create()
13762 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) in lpfc_rq_create()
13765 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_rq_create()
13770 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_rq_create()
13783 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) { in lpfc_rq_create()
13788 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_rq_create()
13798 bar_memmap_p = lpfc_dual_chute_pci_bar_map(phba, pci_barset); in lpfc_rq_create()
13800 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_rq_create()
13811 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_rq_create()
13819 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_rq_create()
13825 hrq->db_regaddr = phba->sli4_hba.RQDBregaddr; in lpfc_rq_create()
13834 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_rq_create()
13838 phba->sli4_hba.pc_sli4_params.rqv); in lpfc_rq_create()
13839 if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) { in lpfc_rq_create()
13850 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_rq_create()
13892 if (phba->sli4_hba.fw_func_mode & LPFC_DUA_MODE) in lpfc_rq_create()
13894 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_rq_create()
13919 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_rq_create()
13936 lpfc_eq_destroy(struct lpfc_hba *phba, struct lpfc_queue *eq) in lpfc_eq_destroy() argument
13946 mbox = mempool_alloc(eq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_eq_destroy()
13951 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_eq_destroy()
13956 mbox->vport = eq->phba->pport; in lpfc_eq_destroy()
13959 rc = lpfc_sli_issue_mbox(eq->phba, mbox, MBX_POLL); in lpfc_eq_destroy()
13966 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_eq_destroy()
13975 mempool_free(mbox, eq->phba->mbox_mem_pool); in lpfc_eq_destroy()
13992 lpfc_cq_destroy(struct lpfc_hba *phba, struct lpfc_queue *cq) in lpfc_cq_destroy() argument
14002 mbox = mempool_alloc(cq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_cq_destroy()
14007 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_cq_destroy()
14012 mbox->vport = cq->phba->pport; in lpfc_cq_destroy()
14014 rc = lpfc_sli_issue_mbox(cq->phba, mbox, MBX_POLL); in lpfc_cq_destroy()
14021 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_cq_destroy()
14029 mempool_free(mbox, cq->phba->mbox_mem_pool); in lpfc_cq_destroy()
14046 lpfc_mq_destroy(struct lpfc_hba *phba, struct lpfc_queue *mq) in lpfc_mq_destroy() argument
14056 mbox = mempool_alloc(mq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_mq_destroy()
14061 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_mq_destroy()
14066 mbox->vport = mq->phba->pport; in lpfc_mq_destroy()
14068 rc = lpfc_sli_issue_mbox(mq->phba, mbox, MBX_POLL); in lpfc_mq_destroy()
14075 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_mq_destroy()
14083 mempool_free(mbox, mq->phba->mbox_mem_pool); in lpfc_mq_destroy()
14100 lpfc_wq_destroy(struct lpfc_hba *phba, struct lpfc_queue *wq) in lpfc_wq_destroy() argument
14110 mbox = mempool_alloc(wq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_wq_destroy()
14115 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_wq_destroy()
14120 mbox->vport = wq->phba->pport; in lpfc_wq_destroy()
14122 rc = lpfc_sli_issue_mbox(wq->phba, mbox, MBX_POLL); in lpfc_wq_destroy()
14128 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_wq_destroy()
14136 mempool_free(mbox, wq->phba->mbox_mem_pool); in lpfc_wq_destroy()
14153 lpfc_rq_destroy(struct lpfc_hba *phba, struct lpfc_queue *hrq, in lpfc_rq_destroy() argument
14164 mbox = mempool_alloc(hrq->phba->mbox_mem_pool, GFP_KERNEL); in lpfc_rq_destroy()
14169 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_rq_destroy()
14174 mbox->vport = hrq->phba->pport; in lpfc_rq_destroy()
14176 rc = lpfc_sli_issue_mbox(hrq->phba, mbox, MBX_POLL); in lpfc_rq_destroy()
14183 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_rq_destroy()
14188 mempool_free(mbox, hrq->phba->mbox_mem_pool); in lpfc_rq_destroy()
14193 rc = lpfc_sli_issue_mbox(drq->phba, mbox, MBX_POLL); in lpfc_rq_destroy()
14199 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_rq_destroy()
14207 mempool_free(mbox, hrq->phba->mbox_mem_pool); in lpfc_rq_destroy()
14234 lpfc_sli4_post_sgl(struct lpfc_hba *phba, in lpfc_sli4_post_sgl() argument
14247 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_post_sgl()
14252 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_post_sgl()
14256 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_post_sgl()
14275 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_post_sgl()
14276 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_post_sgl()
14278 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_post_sgl()
14279 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_post_sgl()
14286 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_post_sgl()
14288 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_sgl()
14310 lpfc_sli4_alloc_xri(struct lpfc_hba *phba) in lpfc_sli4_alloc_xri() argument
14318 spin_lock_irq(&phba->hbalock); in lpfc_sli4_alloc_xri()
14319 xri = find_next_zero_bit(phba->sli4_hba.xri_bmask, in lpfc_sli4_alloc_xri()
14320 phba->sli4_hba.max_cfg_param.max_xri, 0); in lpfc_sli4_alloc_xri()
14321 if (xri >= phba->sli4_hba.max_cfg_param.max_xri) { in lpfc_sli4_alloc_xri()
14322 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_alloc_xri()
14325 set_bit(xri, phba->sli4_hba.xri_bmask); in lpfc_sli4_alloc_xri()
14326 phba->sli4_hba.max_cfg_param.xri_used++; in lpfc_sli4_alloc_xri()
14328 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_alloc_xri()
14340 __lpfc_sli4_free_xri(struct lpfc_hba *phba, int xri) in __lpfc_sli4_free_xri() argument
14342 if (test_and_clear_bit(xri, phba->sli4_hba.xri_bmask)) { in __lpfc_sli4_free_xri()
14343 phba->sli4_hba.max_cfg_param.xri_used--; in __lpfc_sli4_free_xri()
14355 lpfc_sli4_free_xri(struct lpfc_hba *phba, int xri) in lpfc_sli4_free_xri() argument
14357 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_xri()
14358 __lpfc_sli4_free_xri(phba, xri); in lpfc_sli4_free_xri()
14359 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_xri()
14373 lpfc_sli4_next_xritag(struct lpfc_hba *phba) in lpfc_sli4_next_xritag() argument
14377 xri_index = lpfc_sli4_alloc_xri(phba); in lpfc_sli4_next_xritag()
14379 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, in lpfc_sli4_next_xritag()
14383 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_sli4_next_xritag()
14384 phba->sli4_hba.max_cfg_param.xri_used); in lpfc_sli4_next_xritag()
14400 lpfc_sli4_post_els_sgl_list(struct lpfc_hba *phba, in lpfc_sli4_post_els_sgl_list() argument
14416 reqlen = phba->sli4_hba.els_xri_cnt * sizeof(struct sgl_page_pairs) + in lpfc_sli4_post_els_sgl_list()
14419 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_post_els_sgl_list()
14424 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_post_els_sgl_list()
14429 alloclen = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_post_els_sgl_list()
14434 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_els_sgl_list()
14438 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_els_sgl_list()
14467 bf_set(lpfc_post_sgl_pages_xricnt, sgl, phba->sli4_hba.els_xri_cnt); in lpfc_sli4_post_els_sgl_list()
14469 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_post_els_sgl_list()
14470 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_post_els_sgl_list()
14472 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_post_els_sgl_list()
14473 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_post_els_sgl_list()
14479 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_els_sgl_list()
14481 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_post_els_sgl_list()
14502 lpfc_sli4_post_scsi_sgl_block(struct lpfc_hba *phba, in lpfc_sli4_post_scsi_sgl_block() argument
14523 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, in lpfc_sli4_post_scsi_sgl_block()
14528 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_post_scsi_sgl_block()
14530 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_scsi_sgl_block()
14536 alloclen = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_post_scsi_sgl_block()
14541 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_scsi_sgl_block()
14545 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_scsi_sgl_block()
14563 if (phba->cfg_sg_dma_buf_size > SGL_PAGE_SIZE) in lpfc_sli4_post_scsi_sgl_block()
14582 if (!phba->sli4_hba.intr_enable) in lpfc_sli4_post_scsi_sgl_block()
14583 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_sli4_post_scsi_sgl_block()
14585 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_sli4_post_scsi_sgl_block()
14586 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_sli4_post_scsi_sgl_block()
14592 lpfc_sli4_mbox_cmd_free(phba, mbox); in lpfc_sli4_post_scsi_sgl_block()
14594 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_post_scsi_sgl_block()
14614 lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr) in lpfc_fc_frame_check() argument
14654 return lpfc_fc_frame_check(phba, fc_hdr); in lpfc_fc_frame_check()
14670 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, in lpfc_fc_frame_check()
14681 lpfc_printf_log(phba, KERN_WARNING, LOG_ELS, in lpfc_fc_frame_check()
14719 lpfc_fc_frame_to_vport(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr, in lpfc_fc_frame_to_vport() argument
14730 return phba->pport; in lpfc_fc_frame_to_vport()
14731 if ((phba->pport->fc_flag & FC_PT2PT) && in lpfc_fc_frame_to_vport()
14732 !(phba->link_state == LPFC_HBA_READY)) in lpfc_fc_frame_to_vport()
14733 return phba->pport; in lpfc_fc_frame_to_vport()
14735 vports = lpfc_create_vport_work_array(phba); in lpfc_fc_frame_to_vport()
14737 for (i = 0; i <= phba->max_vpi && vports[i] != NULL; i++) { in lpfc_fc_frame_to_vport()
14738 if (phba->fcf.fcfi == fcfi && in lpfc_fc_frame_to_vport()
14745 lpfc_destroy_vport_work_array(phba, vports); in lpfc_fc_frame_to_vport()
14796 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_cleanup_rcv_buffers()
14798 lpfc_in_buf_free(vport->phba, &dmabuf->dbuf); in lpfc_cleanup_rcv_buffers()
14823 timeout = (msecs_to_jiffies(vport->phba->fc_edtov) + in lpfc_rcv_seq_check_edtov()
14831 timeout = (msecs_to_jiffies(vport->phba->fc_edtov) + in lpfc_rcv_seq_check_edtov()
14840 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_rcv_seq_check_edtov()
14842 lpfc_in_buf_free(vport->phba, &dmabuf->dbuf); in lpfc_rcv_seq_check_edtov()
14973 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_sli4_abort_partial_seq()
14999 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_abort_ulp_seq() local
15003 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli4_abort_ulp_seq()
15007 handled = lpfc_ct_handle_unsol_abort(phba, dmabuf); in lpfc_sli4_abort_ulp_seq()
15025 lpfc_sli4_seq_abort_rsp_cmpl(struct lpfc_hba *phba, in lpfc_sli4_seq_abort_rsp_cmpl() argument
15035 lpfc_sli_release_iocbq(phba, cmd_iocbq); in lpfc_sli4_seq_abort_rsp_cmpl()
15040 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_seq_abort_rsp_cmpl()
15055 lpfc_sli4_xri_inrange(struct lpfc_hba *phba, in lpfc_sli4_xri_inrange() argument
15060 for (i = 0; i < phba->sli4_hba.max_cfg_param.max_xri; i++) { in lpfc_sli4_xri_inrange()
15061 if (xri == phba->sli4_hba.xri_ids[i]) in lpfc_sli4_xri_inrange()
15079 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_seq_abort_rsp() local
15087 if (!lpfc_is_link_up(phba)) in lpfc_sli4_seq_abort_rsp()
15096 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); in lpfc_sli4_seq_abort_rsp()
15118 ctiocb = lpfc_sli_get_iocbq(phba); in lpfc_sli4_seq_abort_rsp()
15137 icmd->ulpContext = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; in lpfc_sli4_seq_abort_rsp()
15141 ctiocb->vport = phba->pport; in lpfc_sli4_seq_abort_rsp()
15153 lxri = lpfc_sli4_xri_inrange(phba, xri); in lpfc_sli4_seq_abort_rsp()
15155 lpfc_set_rrq_active(phba, ndlp, lxri, in lpfc_sli4_seq_abort_rsp()
15163 (lxri > lpfc_sli4_get_els_iocb_cnt(phba))) { in lpfc_sli4_seq_abort_rsp()
15200 icmd->un.xseq64.w5.hcsw.Rctl, oxid, phba->link_state); in lpfc_sli4_seq_abort_rsp()
15202 rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, ctiocb, 0); in lpfc_sli4_seq_abort_rsp()
15208 phba->link_state); in lpfc_sli4_seq_abort_rsp()
15211 lpfc_sli_release_iocbq(phba, ctiocb); in lpfc_sli4_seq_abort_rsp()
15232 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_handle_unsol_abort() local
15250 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_unsol_abort()
15335 first_iocbq = lpfc_sli_get_iocbq(vport->phba); in lpfc_prep_seq()
15354 vport->phba->vpi_ids[vport->vpi]; in lpfc_prep_seq()
15379 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_prep_seq()
15399 iocbq = lpfc_sli_get_iocbq(vport->phba); in lpfc_prep_seq()
15407 lpfc_in_buf_free(vport->phba, d_buf); in lpfc_prep_seq()
15439 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_send_seq_to_ulp() local
15444 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_send_seq_to_ulp()
15451 if (!lpfc_complete_unsol_iocb(phba, in lpfc_sli4_send_seq_to_ulp()
15452 &phba->sli.ring[LPFC_ELS_RING], in lpfc_sli4_send_seq_to_ulp()
15455 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_send_seq_to_ulp()
15465 lpfc_sli_release_iocbq(phba, curr_iocb); in lpfc_sli4_send_seq_to_ulp()
15467 lpfc_sli_release_iocbq(phba, iocbq); in lpfc_sli4_send_seq_to_ulp()
15483 lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba, in lpfc_sli4_handle_received_buffer() argument
15495 if (lpfc_fc_frame_check(phba, fc_hdr)) { in lpfc_sli4_handle_received_buffer()
15496 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
15507 vport = lpfc_fc_frame_to_vport(phba, fc_hdr, fcfi); in lpfc_sli4_handle_received_buffer()
15510 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
15526 (phba->link_state == LPFC_HBA_READY)) { in lpfc_sli4_handle_received_buffer()
15527 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
15542 lpfc_in_buf_free(phba, &dmabuf->dbuf); in lpfc_sli4_handle_received_buffer()
15575 lpfc_sli4_post_all_rpi_hdrs(struct lpfc_hba *phba) in lpfc_sli4_post_all_rpi_hdrs() argument
15582 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_post_all_rpi_hdrs()
15584 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_post_all_rpi_hdrs()
15587 list_for_each_entry(rpi_page, &phba->sli4_hba.lpfc_rpi_hdr_list, list) { in lpfc_sli4_post_all_rpi_hdrs()
15593 if (bf_get(lpfc_rpi_rsrc_rdy, &phba->sli4_hba.sli4_flags) != in lpfc_sli4_post_all_rpi_hdrs()
15595 rpi_page->start_rpi = phba->sli4_hba.rpi_ids[lrpi]; in lpfc_sli4_post_all_rpi_hdrs()
15597 rc = lpfc_sli4_post_rpi_hdr(phba, rpi_page); in lpfc_sli4_post_all_rpi_hdrs()
15599 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_post_all_rpi_hdrs()
15608 bf_set(lpfc_rpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, in lpfc_sli4_post_all_rpi_hdrs()
15628 lpfc_sli4_post_rpi_hdr(struct lpfc_hba *phba, struct lpfc_rpi_hdr *rpi_page) in lpfc_sli4_post_rpi_hdr() argument
15637 if (!phba->sli4_hba.rpi_hdrs_in_use) in lpfc_sli4_post_rpi_hdr()
15639 if (phba->sli4_hba.extents_in_use) in lpfc_sli4_post_rpi_hdr()
15643 mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_post_rpi_hdr()
15645 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_post_rpi_hdr()
15653 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_post_rpi_hdr()
15668 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_post_rpi_hdr()
15673 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_post_rpi_hdr()
15675 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_post_rpi_hdr()
15698 lpfc_sli4_alloc_rpi(struct lpfc_hba *phba) in lpfc_sli4_alloc_rpi() argument
15710 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_alloc_rpi()
15711 max_rpi = phba->sli4_hba.max_cfg_param.max_rpi; in lpfc_sli4_alloc_rpi()
15712 rpi_limit = phba->sli4_hba.next_rpi; in lpfc_sli4_alloc_rpi()
15714 rpi = find_next_zero_bit(phba->sli4_hba.rpi_bmask, rpi_limit, 0); in lpfc_sli4_alloc_rpi()
15718 set_bit(rpi, phba->sli4_hba.rpi_bmask); in lpfc_sli4_alloc_rpi()
15719 phba->sli4_hba.max_cfg_param.rpi_used++; in lpfc_sli4_alloc_rpi()
15720 phba->sli4_hba.rpi_count++; in lpfc_sli4_alloc_rpi()
15722 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, in lpfc_sli4_alloc_rpi()
15731 (phba->sli4_hba.rpi_count >= max_rpi)) { in lpfc_sli4_alloc_rpi()
15732 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_alloc_rpi()
15740 if (!phba->sli4_hba.rpi_hdrs_in_use) { in lpfc_sli4_alloc_rpi()
15741 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_alloc_rpi()
15751 rpi_remaining = phba->sli4_hba.next_rpi - phba->sli4_hba.rpi_count; in lpfc_sli4_alloc_rpi()
15752 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_alloc_rpi()
15754 rpi_hdr = lpfc_sli4_create_rpi_hdr(phba); in lpfc_sli4_alloc_rpi()
15756 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_alloc_rpi()
15761 rpi_hdr->start_rpi = phba->sli4_hba.rpi_ids[lrpi]; in lpfc_sli4_alloc_rpi()
15762 lpfc_sli4_post_rpi_hdr(phba, rpi_hdr); in lpfc_sli4_alloc_rpi()
15777 __lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) in __lpfc_sli4_free_rpi() argument
15779 if (test_and_clear_bit(rpi, phba->sli4_hba.rpi_bmask)) { in __lpfc_sli4_free_rpi()
15780 phba->sli4_hba.rpi_count--; in __lpfc_sli4_free_rpi()
15781 phba->sli4_hba.max_cfg_param.rpi_used--; in __lpfc_sli4_free_rpi()
15793 lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) in lpfc_sli4_free_rpi() argument
15795 spin_lock_irq(&phba->hbalock); in lpfc_sli4_free_rpi()
15796 __lpfc_sli4_free_rpi(phba, rpi); in lpfc_sli4_free_rpi()
15797 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_free_rpi()
15808 lpfc_sli4_remove_rpis(struct lpfc_hba *phba) in lpfc_sli4_remove_rpis() argument
15810 kfree(phba->sli4_hba.rpi_bmask); in lpfc_sli4_remove_rpis()
15811 kfree(phba->sli4_hba.rpi_ids); in lpfc_sli4_remove_rpis()
15812 bf_set(lpfc_rpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0); in lpfc_sli4_remove_rpis()
15827 struct lpfc_hba *phba = ndlp->phba; in lpfc_sli4_resume_rpi() local
15831 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_resume_rpi()
15844 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_resume_rpi()
15846 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_resume_rpi()
15850 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_resume_rpi()
15873 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_init_vpi() local
15874 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_init_vpi()
15877 lpfc_init_vpi(phba, mboxq, vport->vpi); in lpfc_sli4_init_vpi()
15878 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq); in lpfc_sli4_init_vpi()
15879 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); in lpfc_sli4_init_vpi()
15888 mempool_free(mboxq, vport->phba->mbox_mem_pool); in lpfc_sli4_init_vpi()
15903 lpfc_mbx_cmpl_add_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) in lpfc_mbx_cmpl_add_fcf_record() argument
15917 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_mbx_cmpl_add_fcf_record()
15922 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_mbx_cmpl_add_fcf_record()
15935 lpfc_sli4_add_fcf_record(struct lpfc_hba *phba, struct fcf_record *fcf_record) in lpfc_sli4_add_fcf_record() argument
15946 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_add_fcf_record()
15948 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_add_fcf_record()
15957 alloc_len = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_add_fcf_record()
15961 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_add_fcf_record()
15965 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_add_fcf_record()
15991 mboxq->vport = phba->pport; in lpfc_sli4_add_fcf_record()
15993 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_add_fcf_record()
15995 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_add_fcf_record()
15998 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_add_fcf_record()
16017 lpfc_sli4_build_dflt_fcf_record(struct lpfc_hba *phba, in lpfc_sli4_build_dflt_fcf_record() argument
16025 bf_set(lpfc_fcf_record_mac_0, fcf_record, phba->fc_map[0]); in lpfc_sli4_build_dflt_fcf_record()
16026 bf_set(lpfc_fcf_record_mac_1, fcf_record, phba->fc_map[1]); in lpfc_sli4_build_dflt_fcf_record()
16027 bf_set(lpfc_fcf_record_mac_2, fcf_record, phba->fc_map[2]); in lpfc_sli4_build_dflt_fcf_record()
16031 bf_set(lpfc_fcf_record_fc_map_0, fcf_record, phba->fc_map[0]); in lpfc_sli4_build_dflt_fcf_record()
16032 bf_set(lpfc_fcf_record_fc_map_1, fcf_record, phba->fc_map[1]); in lpfc_sli4_build_dflt_fcf_record()
16033 bf_set(lpfc_fcf_record_fc_map_2, fcf_record, phba->fc_map[2]); in lpfc_sli4_build_dflt_fcf_record()
16040 if (phba->valid_vlan) { in lpfc_sli4_build_dflt_fcf_record()
16041 fcf_record->vlan_bitmap[phba->vlan_id / 8] in lpfc_sli4_build_dflt_fcf_record()
16042 = 1 << (phba->vlan_id % 8); in lpfc_sli4_build_dflt_fcf_record()
16059 lpfc_sli4_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_fcf_scan_read_fcf_rec() argument
16064 phba->fcoe_eventtag_at_fcf_scan = phba->fcoe_eventtag; in lpfc_sli4_fcf_scan_read_fcf_rec()
16065 phba->fcoe_cvl_eventtag_attn = phba->fcoe_cvl_eventtag; in lpfc_sli4_fcf_scan_read_fcf_rec()
16066 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_fcf_scan_read_fcf_rec()
16068 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_fcf_scan_read_fcf_rec()
16075 rc = lpfc_sli4_mbx_read_fcf_rec(phba, mboxq, fcf_index); in lpfc_sli4_fcf_scan_read_fcf_rec()
16081 mboxq->vport = phba->pport; in lpfc_sli4_fcf_scan_read_fcf_rec()
16084 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_scan_read_fcf_rec()
16085 phba->hba_flag |= FCF_TS_INPROG; in lpfc_sli4_fcf_scan_read_fcf_rec()
16086 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_scan_read_fcf_rec()
16088 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_fcf_scan_read_fcf_rec()
16094 phba->fcf.eligible_fcf_cnt = 0; in lpfc_sli4_fcf_scan_read_fcf_rec()
16100 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_fcf_scan_read_fcf_rec()
16102 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_scan_read_fcf_rec()
16103 phba->hba_flag &= ~FCF_TS_INPROG; in lpfc_sli4_fcf_scan_read_fcf_rec()
16104 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_scan_read_fcf_rec()
16121 lpfc_sli4_fcf_rr_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_fcf_rr_read_fcf_rec() argument
16126 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_fcf_rr_read_fcf_rec()
16128 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_INIT, in lpfc_sli4_fcf_rr_read_fcf_rec()
16135 rc = lpfc_sli4_mbx_read_fcf_rec(phba, mboxq, fcf_index); in lpfc_sli4_fcf_rr_read_fcf_rec()
16141 mboxq->vport = phba->pport; in lpfc_sli4_fcf_rr_read_fcf_rec()
16143 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_fcf_rr_read_fcf_rec()
16151 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_fcf_rr_read_fcf_rec()
16167 lpfc_sli4_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_read_fcf_rec() argument
16172 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_read_fcf_rec()
16174 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_INIT, in lpfc_sli4_read_fcf_rec()
16181 rc = lpfc_sli4_mbx_read_fcf_rec(phba, mboxq, fcf_index); in lpfc_sli4_read_fcf_rec()
16187 mboxq->vport = phba->pport; in lpfc_sli4_read_fcf_rec()
16189 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); in lpfc_sli4_read_fcf_rec()
16197 lpfc_sli4_mbox_cmd_free(phba, mboxq); in lpfc_sli4_read_fcf_rec()
16215 lpfc_check_next_fcf_pri_level(struct lpfc_hba *phba) in lpfc_check_next_fcf_pri_level() argument
16223 last_index = find_first_bit(phba->fcf.fcf_rr_bmask, in lpfc_check_next_fcf_pri_level()
16225 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_check_next_fcf_pri_level()
16229 spin_lock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16230 if (list_empty(&phba->fcf.fcf_pri_list) || in lpfc_check_next_fcf_pri_level()
16231 list_is_singular(&phba->fcf.fcf_pri_list)) { in lpfc_check_next_fcf_pri_level()
16232 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16233 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, in lpfc_check_next_fcf_pri_level()
16237 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16244 memset(phba->fcf.fcf_rr_bmask, 0, in lpfc_check_next_fcf_pri_level()
16245 sizeof(*phba->fcf.fcf_rr_bmask)); in lpfc_check_next_fcf_pri_level()
16246 spin_lock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16247 list_for_each_entry(fcf_pri, &phba->fcf.fcf_pri_list, list) { in lpfc_check_next_fcf_pri_level()
16256 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16258 rc = lpfc_sli4_fcf_rr_index_set(phba, in lpfc_check_next_fcf_pri_level()
16263 spin_lock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16270 if (!next_fcf_pri && !list_empty(&phba->fcf.fcf_pri_list)) { in lpfc_check_next_fcf_pri_level()
16271 list_for_each_entry(fcf_pri, &phba->fcf.fcf_pri_list, list) { in lpfc_check_next_fcf_pri_level()
16279 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16281 rc = lpfc_sli4_fcf_rr_index_set(phba, in lpfc_check_next_fcf_pri_level()
16286 spin_lock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16290 spin_unlock_irq(&phba->hbalock); in lpfc_check_next_fcf_pri_level()
16305 lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba) in lpfc_sli4_fcf_rr_next_index_get() argument
16311 next_fcf_index = phba->fcf.current_rec.fcf_indx; in lpfc_sli4_fcf_rr_next_index_get()
16316 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask, in lpfc_sli4_fcf_rr_next_index_get()
16327 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask, in lpfc_sli4_fcf_rr_next_index_get()
16334 next_fcf_index == phba->fcf.current_rec.fcf_indx) { in lpfc_sli4_fcf_rr_next_index_get()
16341 if (lpfc_check_next_fcf_pri_level(phba)) in lpfc_sli4_fcf_rr_next_index_get()
16343 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP, in lpfc_sli4_fcf_rr_next_index_get()
16348 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP, in lpfc_sli4_fcf_rr_next_index_get()
16351 phba->fcf.fcf_pri[next_fcf_index].fcf_rec.flag); in lpfc_sli4_fcf_rr_next_index_get()
16357 phba->fcf.fcf_pri[next_fcf_index].fcf_rec.flag & in lpfc_sli4_fcf_rr_next_index_get()
16361 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_rr_next_index_get()
16381 lpfc_sli4_fcf_rr_index_set(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_fcf_rr_index_set() argument
16384 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, in lpfc_sli4_fcf_rr_index_set()
16391 set_bit(fcf_index, phba->fcf.fcf_rr_bmask); in lpfc_sli4_fcf_rr_index_set()
16393 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_rr_index_set()
16410 lpfc_sli4_fcf_rr_index_clear(struct lpfc_hba *phba, uint16_t fcf_index) in lpfc_sli4_fcf_rr_index_clear() argument
16414 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, in lpfc_sli4_fcf_rr_index_clear()
16421 spin_lock_irq(&phba->hbalock); in lpfc_sli4_fcf_rr_index_clear()
16422 list_for_each_entry_safe(fcf_pri, fcf_pri_next, &phba->fcf.fcf_pri_list, in lpfc_sli4_fcf_rr_index_clear()
16429 spin_unlock_irq(&phba->hbalock); in lpfc_sli4_fcf_rr_index_clear()
16430 clear_bit(fcf_index, phba->fcf.fcf_rr_bmask); in lpfc_sli4_fcf_rr_index_clear()
16432 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_sli4_fcf_rr_index_clear()
16446 lpfc_mbx_cmpl_redisc_fcf_table(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) in lpfc_mbx_cmpl_redisc_fcf_table() argument
16458 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, in lpfc_mbx_cmpl_redisc_fcf_table()
16462 if (phba->fcf.fcf_flag & FCF_ACVL_DISC) { in lpfc_mbx_cmpl_redisc_fcf_table()
16463 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_redisc_fcf_table()
16464 phba->fcf.fcf_flag &= ~FCF_ACVL_DISC; in lpfc_mbx_cmpl_redisc_fcf_table()
16465 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_redisc_fcf_table()
16470 lpfc_retry_pport_discovery(phba); in lpfc_mbx_cmpl_redisc_fcf_table()
16472 spin_lock_irq(&phba->hbalock); in lpfc_mbx_cmpl_redisc_fcf_table()
16473 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC; in lpfc_mbx_cmpl_redisc_fcf_table()
16474 spin_unlock_irq(&phba->hbalock); in lpfc_mbx_cmpl_redisc_fcf_table()
16480 lpfc_sli4_fcf_dead_failthrough(phba); in lpfc_mbx_cmpl_redisc_fcf_table()
16483 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, in lpfc_mbx_cmpl_redisc_fcf_table()
16489 lpfc_fcf_redisc_wait_start_timer(phba); in lpfc_mbx_cmpl_redisc_fcf_table()
16492 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mbx_cmpl_redisc_fcf_table()
16503 lpfc_sli4_redisc_fcf_table(struct lpfc_hba *phba) in lpfc_sli4_redisc_fcf_table() argument
16510 lpfc_cancel_all_vport_retry_delay_timer(phba); in lpfc_sli4_redisc_fcf_table()
16512 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_redisc_fcf_table()
16514 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_sli4_redisc_fcf_table()
16522 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, in lpfc_sli4_redisc_fcf_table()
16531 mbox->vport = phba->pport; in lpfc_sli4_redisc_fcf_table()
16533 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); in lpfc_sli4_redisc_fcf_table()
16536 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_redisc_fcf_table()
16550 lpfc_sli4_fcf_dead_failthrough(struct lpfc_hba *phba) in lpfc_sli4_fcf_dead_failthrough() argument
16559 link_state = phba->link_state; in lpfc_sli4_fcf_dead_failthrough()
16560 lpfc_linkdown(phba); in lpfc_sli4_fcf_dead_failthrough()
16561 phba->link_state = link_state; in lpfc_sli4_fcf_dead_failthrough()
16564 lpfc_unregister_unused_fcf(phba); in lpfc_sli4_fcf_dead_failthrough()
16577 lpfc_sli_get_config_region23(struct lpfc_hba *phba, char *rgn23_data) in lpfc_sli_get_config_region23() argument
16587 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli_get_config_region23()
16589 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_get_config_region23()
16596 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_23); in lpfc_sli_get_config_region23()
16597 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); in lpfc_sli_get_config_region23()
16600 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_sli_get_config_region23()
16621 mempool_free(pmb, phba->mbox_mem_pool); in lpfc_sli_get_config_region23()
16635 lpfc_sli4_get_config_region23(struct lpfc_hba *phba, char *rgn23_data) in lpfc_sli4_get_config_region23() argument
16646 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_get_config_region23()
16648 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli4_get_config_region23()
16653 if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) in lpfc_sli4_get_config_region23()
16657 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); in lpfc_sli4_get_config_region23()
16669 mempool_free(mboxq, phba->mbox_mem_pool); in lpfc_sli4_get_config_region23()
16671 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_sli4_get_config_region23()
16686 lpfc_sli_read_link_ste(struct lpfc_hba *phba) in lpfc_sli_read_link_ste() argument
16697 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli_read_link_ste()
16698 data_size = lpfc_sli_get_config_region23(phba, rgn23_data); in lpfc_sli_read_link_ste()
16701 &phba->sli4_hba.sli_intf); in lpfc_sli_read_link_ste()
16704 data_size = lpfc_sli4_get_config_region23(phba, rgn23_data); in lpfc_sli_read_link_ste()
16712 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_read_link_ste()
16720 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_sli_read_link_ste()
16764 phba->hba_flag |= LINK_DISABLED; in lpfc_sli_read_link_ste()
16795 lpfc_wr_object(struct lpfc_hba *phba, struct list_head *dmabuf_list, in lpfc_wr_object() argument
16807 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_wr_object()
16811 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, in lpfc_wr_object()
16842 if (!phba->sli4_hba.intr_enable) in lpfc_wr_object()
16843 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); in lpfc_wr_object()
16845 mbox_tmo = lpfc_mbox_tmo_val(phba, mbox); in lpfc_wr_object()
16846 rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); in lpfc_wr_object()
16853 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_wr_object()
16855 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_wr_object()
16877 struct lpfc_hba *phba = vport->phba; in lpfc_cleanup_pending_mbox() local
16887 spin_lock_irq(&phba->hbalock); in lpfc_cleanup_pending_mbox()
16888 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { in lpfc_cleanup_pending_mbox()
16900 mb = phba->sli.mbox_active; in lpfc_cleanup_pending_mbox()
16916 list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) { in lpfc_cleanup_pending_mbox()
16935 spin_unlock_irq(&phba->hbalock); in lpfc_cleanup_pending_mbox()
16939 spin_lock_irq(&phba->hbalock); in lpfc_cleanup_pending_mbox()
16945 spin_unlock_irq(&phba->hbalock); in lpfc_cleanup_pending_mbox()
16953 __lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_cleanup_pending_mbox()
16965 mempool_free(mb, phba->mbox_mem_pool); in lpfc_cleanup_pending_mbox()
16989 lpfc_drain_txq(struct lpfc_hba *phba) in lpfc_drain_txq() argument
16992 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_drain_txq()
17013 piocbq = lpfc_sli_ringtx_get(phba, pring); in lpfc_drain_txq()
17016 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_drain_txq()
17021 sglq = __lpfc_sli_get_sglq(phba, piocbq); in lpfc_drain_txq()
17023 __lpfc_sli_ringtx_put(phba, pring, piocbq); in lpfc_drain_txq()
17034 if (NO_XRI == lpfc_sli4_bpl2sgl(phba, piocbq, sglq)) in lpfc_drain_txq()
17036 else if (lpfc_sli4_iocb2wqe(phba, piocbq, &wqe)) in lpfc_drain_txq()
17038 else if (lpfc_sli4_wq_put(phba->sli4_hba.els_wq, &wqe)) in lpfc_drain_txq()
17041 lpfc_sli_ringtxcmpl_put(phba, pring, piocbq); in lpfc_drain_txq()
17045 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, in lpfc_drain_txq()
17056 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, in lpfc_drain_txq()