aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_scsi.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_scsi.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_scsi.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index f68753ea941f..7b66b71a14fe 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -747,7 +747,6 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
747 int status = 0, index; 747 int status = 0, index;
748 int bcnt; 748 int bcnt;
749 int non_sequential_xri = 0; 749 int non_sequential_xri = 0;
750 int rc = 0;
751 LIST_HEAD(sblist); 750 LIST_HEAD(sblist);
752 751
753 for (bcnt = 0; bcnt < num_to_alloc; bcnt++) { 752 for (bcnt = 0; bcnt < num_to_alloc; bcnt++) {
@@ -860,7 +859,6 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
860 if (status) { 859 if (status) {
861 /* Put this back on the abort scsi list */ 860 /* Put this back on the abort scsi list */
862 psb->exch_busy = 1; 861 psb->exch_busy = 1;
863 rc++;
864 } else { 862 } else {
865 psb->exch_busy = 0; 863 psb->exch_busy = 0;
866 psb->status = IOSTAT_SUCCESS; 864 psb->status = IOSTAT_SUCCESS;
@@ -879,7 +877,6 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
879 if (status) { 877 if (status) {
880 /* Put this back on the abort scsi list */ 878 /* Put this back on the abort scsi list */
881 psb->exch_busy = 1; 879 psb->exch_busy = 1;
882 rc++;
883 } else { 880 } else {
884 psb->exch_busy = 0; 881 psb->exch_busy = 0;
885 psb->status = IOSTAT_SUCCESS; 882 psb->status = IOSTAT_SUCCESS;
@@ -889,7 +886,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
889 } 886 }
890 } 887 }
891 888
892 return bcnt + non_sequential_xri - rc; 889 return bcnt + non_sequential_xri;
893} 890}
894 891
895/** 892/**
@@ -3572,11 +3569,13 @@ lpfc_slave_alloc(struct scsi_device *sdev)
3572 uint32_t total = 0; 3569 uint32_t total = 0;
3573 uint32_t num_to_alloc = 0; 3570 uint32_t num_to_alloc = 0;
3574 int num_allocated = 0; 3571 int num_allocated = 0;
3572 uint32_t sdev_cnt;
3575 3573
3576 if (!rport || fc_remote_port_chkready(rport)) 3574 if (!rport || fc_remote_port_chkready(rport))
3577 return -ENXIO; 3575 return -ENXIO;
3578 3576
3579 sdev->hostdata = rport->dd_data; 3577 sdev->hostdata = rport->dd_data;
3578 sdev_cnt = atomic_inc_return(&phba->sdev_cnt);
3580 3579
3581 /* 3580 /*
3582 * Populate the cmds_per_lun count scsi_bufs into this host's globally 3581 * Populate the cmds_per_lun count scsi_bufs into this host's globally
@@ -3588,6 +3587,10 @@ lpfc_slave_alloc(struct scsi_device *sdev)
3588 total = phba->total_scsi_bufs; 3587 total = phba->total_scsi_bufs;
3589 num_to_alloc = vport->cfg_lun_queue_depth + 2; 3588 num_to_alloc = vport->cfg_lun_queue_depth + 2;
3590 3589
3590 /* If allocated buffers are enough do nothing */
3591 if ((sdev_cnt * (vport->cfg_lun_queue_depth + 2)) < total)
3592 return 0;
3593
3591 /* Allow some exchanges to be available always to complete discovery */ 3594 /* Allow some exchanges to be available always to complete discovery */
3592 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { 3595 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) {
3593 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, 3596 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
@@ -3669,6 +3672,9 @@ lpfc_slave_configure(struct scsi_device *sdev)
3669static void 3672static void
3670lpfc_slave_destroy(struct scsi_device *sdev) 3673lpfc_slave_destroy(struct scsi_device *sdev)
3671{ 3674{
3675 struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata;
3676 struct lpfc_hba *phba = vport->phba;
3677 atomic_dec(&phba->sdev_cnt);
3672 sdev->hostdata = NULL; 3678 sdev->hostdata = NULL;
3673 return; 3679 return;
3674} 3680}