diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index f38c05dc563..7ddf5268227 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -4236,7 +4236,8 @@ lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, if (mqe->un.read_rev.avail_vpd_len < *vpd_size) *vpd_size = mqe->un.read_rev.avail_vpd_len; - lpfc_sli_pcimem_bcopy(dmabuf->virt, vpd, *vpd_size); + memcpy(vpd, dmabuf->virt, *vpd_size); + dma_free_coherent(&phba->pcidev->dev, dma_size, dmabuf->virt, dmabuf->phys); kfree(dmabuf); @@ -5305,7 +5306,8 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) if (mcqe_status != MB_CQE_STATUS_SUCCESS) { bf_set(lpfc_mqe_status, mb, LPFC_MBX_ERROR_RANGE | mcqe_status); rc = MBXERR_ERROR; - } + } else + lpfc_sli4_swap_str(phba, mboxq); lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, "(%d):0356 Mailbox cmd x%x (x%x) Status x%x " @@ -7790,9 +7792,10 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, * if LPFC_MBX_WAKE flag is set the mailbox is completed * else do not free the resources. */ - if (pmboxq->mbox_flag & LPFC_MBX_WAKE) + if (pmboxq->mbox_flag & LPFC_MBX_WAKE) { retval = MBX_SUCCESS; - else { + lpfc_sli4_swap_str(phba, pmboxq); + } else { retval = MBX_TIMEOUT; pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; } @@ -11975,12 +11978,26 @@ lpfc_sli4_alloc_rpi(struct lpfc_hba *phba) * available rpis maintained by the driver. **/ void +__lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) +{ + if (test_and_clear_bit(rpi, phba->sli4_hba.rpi_bmask)) { + phba->sli4_hba.rpi_count--; + phba->sli4_hba.max_cfg_param.rpi_used--; + } +} + +/** + * lpfc_sli4_free_rpi - Release an rpi for reuse. + * @phba: pointer to lpfc hba data structure. + * + * This routine is invoked to release an rpi to the pool of + * available rpis maintained by the driver. + **/ +void lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) { spin_lock_irq(&phba->hbalock); - clear_bit(rpi, phba->sli4_hba.rpi_bmask); - phba->sli4_hba.rpi_count--; - phba->sli4_hba.max_cfg_param.rpi_used--; + __lpfc_sli4_free_rpi(phba, rpi); spin_unlock_irq(&phba->hbalock); } @@ -12751,6 +12768,9 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) continue; if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { + if (phba->sli_rev == LPFC_SLI_REV4) + __lpfc_sli4_free_rpi(phba, + mb->u.mb.un.varRegLogin.rpi); mp = (struct lpfc_dmabuf *) (mb->context1); if (mp) { __lpfc_mbuf_free(phba, mp->virt, mp->phys); |