diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c993069a6500..b903d3b7b730 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -1152,24 +1152,33 @@ lpfc_slave_alloc(struct scsi_device *sdev) | |||
1152 | /* | 1152 | /* |
1153 | * Populate the cmds_per_lun count scsi_bufs into this host's globally | 1153 | * Populate the cmds_per_lun count scsi_bufs into this host's globally |
1154 | * available list of scsi buffers. Don't allocate more than the | 1154 | * available list of scsi buffers. Don't allocate more than the |
1155 | * HBA limit conveyed to the midlayer via the host structure. Note | 1155 | * HBA limit conveyed to the midlayer via the host structure. The |
1156 | * that this list of scsi bufs exists for the lifetime of the driver. | 1156 | * formula accounts for the lun_queue_depth + error handlers + 1 |
1157 | * extra. This list of scsi bufs exists for the lifetime of the driver. | ||
1157 | */ | 1158 | */ |
1158 | total = phba->total_scsi_bufs; | 1159 | total = phba->total_scsi_bufs; |
1159 | num_to_alloc = LPFC_CMD_PER_LUN; | 1160 | num_to_alloc = phba->cfg_lun_queue_depth + 2; |
1160 | if (total >= phba->cfg_hba_queue_depth) { | 1161 | if (total >= phba->cfg_hba_queue_depth) { |
1161 | printk(KERN_WARNING "%s, At config limitation of " | 1162 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, |
1162 | "%d allocated scsi_bufs\n", __FUNCTION__, total); | 1163 | "%d:0704 At limitation of %d preallocated " |
1164 | "command buffers\n", phba->brd_no, total); | ||
1163 | return 0; | 1165 | return 0; |
1164 | } else if (total + num_to_alloc > phba->cfg_hba_queue_depth) { | 1166 | } else if (total + num_to_alloc > phba->cfg_hba_queue_depth) { |
1167 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | ||
1168 | "%d:0705 Allocation request of %d command " | ||
1169 | "buffers will exceed max of %d. Reducing " | ||
1170 | "allocation request to %d.\n", phba->brd_no, | ||
1171 | num_to_alloc, phba->cfg_hba_queue_depth, | ||
1172 | (phba->cfg_hba_queue_depth - total)); | ||
1165 | num_to_alloc = phba->cfg_hba_queue_depth - total; | 1173 | num_to_alloc = phba->cfg_hba_queue_depth - total; |
1166 | } | 1174 | } |
1167 | 1175 | ||
1168 | for (i = 0; i < num_to_alloc; i++) { | 1176 | for (i = 0; i < num_to_alloc; i++) { |
1169 | scsi_buf = lpfc_get_scsi_buf(phba); | 1177 | scsi_buf = lpfc_get_scsi_buf(phba); |
1170 | if (!scsi_buf) { | 1178 | if (!scsi_buf) { |
1171 | printk(KERN_ERR "%s, failed to allocate " | 1179 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1172 | "scsi_buf\n", __FUNCTION__); | 1180 | "%d:0706 Failed to allocate command " |
1181 | "buffer\n", phba->brd_no); | ||
1173 | break; | 1182 | break; |
1174 | } | 1183 | } |
1175 | 1184 | ||