aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2010-06-08 18:31:54 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:01:38 -0400
commitd7c479929b6804f4e9d5fb5f721aba31622f3d97 (patch)
treee849efe2d961fd7e1a8d8c9410f6c68ab5a6c03c /drivers/scsi/lpfc/lpfc_sli.c
parentdbb6b3ab10464aa11df74c0d0a14e869a8c6fd1b (diff)
[SCSI] lpfc 8.3.14: SCSI and SLI API fixes
- Fixed accounting of allocated SCSI buffers when post sgl fails. - Restrict scsi buffer allocation based on LUN count (sdev_cnt). - Create __lpfc_sli_free_rpi that doesn't take out the hbalock. - Modify lpfc_sli_free_rpi to call __lpfc_sli_free_rpi. - Call __lpfc_sli_free_rpi in lpfc_cleanup_pending_mbox. - Do not swap the strings returned in mailbox commands and do not swap byte aligned data in VPD. Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index f38c05dc5635..7ddf52682271 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,
4236 if (mqe->un.read_rev.avail_vpd_len < *vpd_size) 4236 if (mqe->un.read_rev.avail_vpd_len < *vpd_size)
4237 *vpd_size = mqe->un.read_rev.avail_vpd_len; 4237 *vpd_size = mqe->un.read_rev.avail_vpd_len;
4238 4238
4239 lpfc_sli_pcimem_bcopy(dmabuf->virt, vpd, *vpd_size); 4239 memcpy(vpd, dmabuf->virt, *vpd_size);
4240
4240 dma_free_coherent(&phba->pcidev->dev, dma_size, 4241 dma_free_coherent(&phba->pcidev->dev, dma_size,
4241 dmabuf->virt, dmabuf->phys); 4242 dmabuf->virt, dmabuf->phys);
4242 kfree(dmabuf); 4243 kfree(dmabuf);
@@ -5305,7 +5306,8 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
5305 if (mcqe_status != MB_CQE_STATUS_SUCCESS) { 5306 if (mcqe_status != MB_CQE_STATUS_SUCCESS) {
5306 bf_set(lpfc_mqe_status, mb, LPFC_MBX_ERROR_RANGE | mcqe_status); 5307 bf_set(lpfc_mqe_status, mb, LPFC_MBX_ERROR_RANGE | mcqe_status);
5307 rc = MBXERR_ERROR; 5308 rc = MBXERR_ERROR;
5308 } 5309 } else
5310 lpfc_sli4_swap_str(phba, mboxq);
5309 5311
5310 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, 5312 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
5311 "(%d):0356 Mailbox cmd x%x (x%x) Status x%x " 5313 "(%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,
7790 * if LPFC_MBX_WAKE flag is set the mailbox is completed 7792 * if LPFC_MBX_WAKE flag is set the mailbox is completed
7791 * else do not free the resources. 7793 * else do not free the resources.
7792 */ 7794 */
7793 if (pmboxq->mbox_flag & LPFC_MBX_WAKE) 7795 if (pmboxq->mbox_flag & LPFC_MBX_WAKE) {
7794 retval = MBX_SUCCESS; 7796 retval = MBX_SUCCESS;
7795 else { 7797 lpfc_sli4_swap_str(phba, pmboxq);
7798 } else {
7796 retval = MBX_TIMEOUT; 7799 retval = MBX_TIMEOUT;
7797 pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 7800 pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
7798 } 7801 }
@@ -11975,12 +11978,26 @@ lpfc_sli4_alloc_rpi(struct lpfc_hba *phba)
11975 * available rpis maintained by the driver. 11978 * available rpis maintained by the driver.
11976 **/ 11979 **/
11977void 11980void
11981__lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi)
11982{
11983 if (test_and_clear_bit(rpi, phba->sli4_hba.rpi_bmask)) {
11984 phba->sli4_hba.rpi_count--;
11985 phba->sli4_hba.max_cfg_param.rpi_used--;
11986 }
11987}
11988
11989/**
11990 * lpfc_sli4_free_rpi - Release an rpi for reuse.
11991 * @phba: pointer to lpfc hba data structure.
11992 *
11993 * This routine is invoked to release an rpi to the pool of
11994 * available rpis maintained by the driver.
11995 **/
11996void
11978lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) 11997lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi)
11979{ 11998{
11980 spin_lock_irq(&phba->hbalock); 11999 spin_lock_irq(&phba->hbalock);
11981 clear_bit(rpi, phba->sli4_hba.rpi_bmask); 12000 __lpfc_sli4_free_rpi(phba, rpi);
11982 phba->sli4_hba.rpi_count--;
11983 phba->sli4_hba.max_cfg_param.rpi_used--;
11984 spin_unlock_irq(&phba->hbalock); 12001 spin_unlock_irq(&phba->hbalock);
11985} 12002}
11986 12003
@@ -12751,6 +12768,9 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport)
12751 continue; 12768 continue;
12752 12769
12753 if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 12770 if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) {
12771 if (phba->sli_rev == LPFC_SLI_REV4)
12772 __lpfc_sli4_free_rpi(phba,
12773 mb->u.mb.un.varRegLogin.rpi);
12754 mp = (struct lpfc_dmabuf *) (mb->context1); 12774 mp = (struct lpfc_dmabuf *) (mb->context1);
12755 if (mp) { 12775 if (mp) {
12756 __lpfc_mbuf_free(phba, mp->virt, mp->phys); 12776 __lpfc_mbuf_free(phba, mp->virt, mp->phys);