diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 128 |
1 files changed, 63 insertions, 65 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index b1bd3fc7bae8..167b66dd34c7 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -112,7 +112,7 @@ lpfc_debug_save_dif(struct scsi_cmnd *cmnd) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * lpfc_update_stats: Update statistical data for the command completion. | 115 | * lpfc_update_stats - Update statistical data for the command completion |
116 | * @phba: Pointer to HBA object. | 116 | * @phba: Pointer to HBA object. |
117 | * @lpfc_cmd: lpfc scsi command object pointer. | 117 | * @lpfc_cmd: lpfc scsi command object pointer. |
118 | * | 118 | * |
@@ -165,8 +165,7 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * lpfc_send_sdev_queuedepth_change_event: Posts a queuedepth change | 168 | * lpfc_send_sdev_queuedepth_change_event - Posts a queuedepth change event |
169 | * event. | ||
170 | * @phba: Pointer to HBA context object. | 169 | * @phba: Pointer to HBA context object. |
171 | * @vport: Pointer to vport object. | 170 | * @vport: Pointer to vport object. |
172 | * @ndlp: Pointer to FC node associated with the target. | 171 | * @ndlp: Pointer to FC node associated with the target. |
@@ -220,7 +219,7 @@ lpfc_send_sdev_queuedepth_change_event(struct lpfc_hba *phba, | |||
220 | } | 219 | } |
221 | 220 | ||
222 | /** | 221 | /** |
223 | * lpfc_rampdown_queue_depth: Post RAMP_DOWN_QUEUE event to worker thread. | 222 | * lpfc_rampdown_queue_depth - Post RAMP_DOWN_QUEUE event to worker thread |
224 | * @phba: The Hba for which this call is being executed. | 223 | * @phba: The Hba for which this call is being executed. |
225 | * | 224 | * |
226 | * This routine is called when there is resource error in driver or firmware. | 225 | * This routine is called when there is resource error in driver or firmware. |
@@ -261,7 +260,7 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba) | |||
261 | } | 260 | } |
262 | 261 | ||
263 | /** | 262 | /** |
264 | * lpfc_rampup_queue_depth: Post RAMP_UP_QUEUE event for worker thread. | 263 | * lpfc_rampup_queue_depth - Post RAMP_UP_QUEUE event for worker thread |
265 | * @phba: The Hba for which this call is being executed. | 264 | * @phba: The Hba for which this call is being executed. |
266 | * | 265 | * |
267 | * This routine post WORKER_RAMP_UP_QUEUE event for @phba vport. This routine | 266 | * This routine post WORKER_RAMP_UP_QUEUE event for @phba vport. This routine |
@@ -273,14 +272,14 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba) | |||
273 | **/ | 272 | **/ |
274 | static inline void | 273 | static inline void |
275 | lpfc_rampup_queue_depth(struct lpfc_vport *vport, | 274 | lpfc_rampup_queue_depth(struct lpfc_vport *vport, |
276 | struct scsi_device *sdev) | 275 | uint32_t queue_depth) |
277 | { | 276 | { |
278 | unsigned long flags; | 277 | unsigned long flags; |
279 | struct lpfc_hba *phba = vport->phba; | 278 | struct lpfc_hba *phba = vport->phba; |
280 | uint32_t evt_posted; | 279 | uint32_t evt_posted; |
281 | atomic_inc(&phba->num_cmd_success); | 280 | atomic_inc(&phba->num_cmd_success); |
282 | 281 | ||
283 | if (vport->cfg_lun_queue_depth <= sdev->queue_depth) | 282 | if (vport->cfg_lun_queue_depth <= queue_depth) |
284 | return; | 283 | return; |
285 | spin_lock_irqsave(&phba->hbalock, flags); | 284 | spin_lock_irqsave(&phba->hbalock, flags); |
286 | if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || | 285 | if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || |
@@ -303,7 +302,7 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport, | |||
303 | } | 302 | } |
304 | 303 | ||
305 | /** | 304 | /** |
306 | * lpfc_ramp_down_queue_handler: WORKER_RAMP_DOWN_QUEUE event handler. | 305 | * lpfc_ramp_down_queue_handler - WORKER_RAMP_DOWN_QUEUE event handler |
307 | * @phba: The Hba for which this call is being executed. | 306 | * @phba: The Hba for which this call is being executed. |
308 | * | 307 | * |
309 | * This routine is called to process WORKER_RAMP_DOWN_QUEUE event for worker | 308 | * This routine is called to process WORKER_RAMP_DOWN_QUEUE event for worker |
@@ -361,7 +360,7 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) | |||
361 | } | 360 | } |
362 | 361 | ||
363 | /** | 362 | /** |
364 | * lpfc_ramp_up_queue_handler: WORKER_RAMP_UP_QUEUE event handler. | 363 | * lpfc_ramp_up_queue_handler - WORKER_RAMP_UP_QUEUE event handler |
365 | * @phba: The Hba for which this call is being executed. | 364 | * @phba: The Hba for which this call is being executed. |
366 | * | 365 | * |
367 | * This routine is called to process WORKER_RAMP_UP_QUEUE event for worker | 366 | * This routine is called to process WORKER_RAMP_UP_QUEUE event for worker |
@@ -410,7 +409,7 @@ lpfc_ramp_up_queue_handler(struct lpfc_hba *phba) | |||
410 | } | 409 | } |
411 | 410 | ||
412 | /** | 411 | /** |
413 | * lpfc_scsi_dev_block: set all scsi hosts to block state. | 412 | * lpfc_scsi_dev_block - set all scsi hosts to block state |
414 | * @phba: Pointer to HBA context object. | 413 | * @phba: Pointer to HBA context object. |
415 | * | 414 | * |
416 | * This function walks vport list and set each SCSI host to block state | 415 | * This function walks vport list and set each SCSI host to block state |
@@ -439,7 +438,7 @@ lpfc_scsi_dev_block(struct lpfc_hba *phba) | |||
439 | } | 438 | } |
440 | 439 | ||
441 | /** | 440 | /** |
442 | * lpfc_new_scsi_buf: Scsi buffer allocator. | 441 | * lpfc_new_scsi_buf - Scsi buffer allocator |
443 | * @vport: The virtual port for which this call being executed. | 442 | * @vport: The virtual port for which this call being executed. |
444 | * | 443 | * |
445 | * This routine allocates a scsi buffer, which contains all the necessary | 444 | * This routine allocates a scsi buffer, which contains all the necessary |
@@ -563,7 +562,7 @@ lpfc_new_scsi_buf(struct lpfc_vport *vport) | |||
563 | } | 562 | } |
564 | 563 | ||
565 | /** | 564 | /** |
566 | * lpfc_get_scsi_buf: Get a scsi buffer from lpfc_scsi_buf_list list of Hba. | 565 | * lpfc_get_scsi_buf - Get a scsi buffer from lpfc_scsi_buf_list list of Hba |
567 | * @phba: The Hba for which this call is being executed. | 566 | * @phba: The Hba for which this call is being executed. |
568 | * | 567 | * |
569 | * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list | 568 | * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list |
@@ -592,7 +591,7 @@ lpfc_get_scsi_buf(struct lpfc_hba * phba) | |||
592 | } | 591 | } |
593 | 592 | ||
594 | /** | 593 | /** |
595 | * lpfc_release_scsi_buf: Return a scsi buffer back to hba lpfc_scsi_buf_list list. | 594 | * lpfc_release_scsi_buf - Return a scsi buffer back to hba's lpfc_scsi_buf_list |
596 | * @phba: The Hba for which this call is being executed. | 595 | * @phba: The Hba for which this call is being executed. |
597 | * @psb: The scsi buffer which is being released. | 596 | * @psb: The scsi buffer which is being released. |
598 | * | 597 | * |
@@ -611,7 +610,7 @@ lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) | |||
611 | } | 610 | } |
612 | 611 | ||
613 | /** | 612 | /** |
614 | * lpfc_scsi_prep_dma_buf: Routine to do DMA mapping for scsi buffer. | 613 | * lpfc_scsi_prep_dma_buf - Routine to do DMA mapping for scsi buffer |
615 | * @phba: The Hba for which this call is being executed. | 614 | * @phba: The Hba for which this call is being executed. |
616 | * @lpfc_cmd: The scsi buffer which is going to be mapped. | 615 | * @lpfc_cmd: The scsi buffer which is going to be mapped. |
617 | * | 616 | * |
@@ -738,7 +737,7 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
738 | * Due to difference in data length between DIF/non-DIF paths, | 737 | * Due to difference in data length between DIF/non-DIF paths, |
739 | * we need to set word 4 of IOCB here | 738 | * we need to set word 4 of IOCB here |
740 | */ | 739 | */ |
741 | iocb_cmd->un.fcpi.fcpi_parm = le32_to_cpu(scsi_bufflen(scsi_cmnd)); | 740 | iocb_cmd->un.fcpi.fcpi_parm = scsi_bufflen(scsi_cmnd); |
742 | return 0; | 741 | return 0; |
743 | } | 742 | } |
744 | 743 | ||
@@ -823,9 +822,9 @@ lpfc_cmd_blksize(struct scsi_cmnd *sc) | |||
823 | /** | 822 | /** |
824 | * lpfc_get_cmd_dif_parms - Extract DIF parameters from SCSI command | 823 | * lpfc_get_cmd_dif_parms - Extract DIF parameters from SCSI command |
825 | * @sc: in: SCSI command | 824 | * @sc: in: SCSI command |
826 | * @apptagmask out: app tag mask | 825 | * @apptagmask: out: app tag mask |
827 | * @apptagval out: app tag value | 826 | * @apptagval: out: app tag value |
828 | * @reftag out: ref tag (reference tag) | 827 | * @reftag: out: ref tag (reference tag) |
829 | * | 828 | * |
830 | * Description: | 829 | * Description: |
831 | * Extract DIF paramters from the command if possible. Otherwise, | 830 | * Extract DIF paramters from the command if possible. Otherwise, |
@@ -1394,7 +1393,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, | |||
1394 | */ | 1393 | */ |
1395 | cmd->sense_buffer[8] = 0; /* Information */ | 1394 | cmd->sense_buffer[8] = 0; /* Information */ |
1396 | cmd->sense_buffer[9] = 0xa; /* Add. length */ | 1395 | cmd->sense_buffer[9] = 0xa; /* Add. length */ |
1397 | do_div(bghm, cmd->device->sector_size); | 1396 | bghm /= cmd->device->sector_size; |
1398 | 1397 | ||
1399 | failing_sector = scsi_get_lba(cmd); | 1398 | failing_sector = scsi_get_lba(cmd); |
1400 | failing_sector += bghm; | 1399 | failing_sector += bghm; |
@@ -1413,7 +1412,7 @@ out: | |||
1413 | } | 1412 | } |
1414 | 1413 | ||
1415 | /** | 1414 | /** |
1416 | * lpfc_send_scsi_error_event: Posts an event when there is SCSI error. | 1415 | * lpfc_send_scsi_error_event - Posts an event when there is SCSI error |
1417 | * @phba: Pointer to hba context object. | 1416 | * @phba: Pointer to hba context object. |
1418 | * @vport: Pointer to vport object. | 1417 | * @vport: Pointer to vport object. |
1419 | * @lpfc_cmd: Pointer to lpfc scsi command which reported the error. | 1418 | * @lpfc_cmd: Pointer to lpfc scsi command which reported the error. |
@@ -1505,7 +1504,7 @@ lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, | |||
1505 | } | 1504 | } |
1506 | 1505 | ||
1507 | /** | 1506 | /** |
1508 | * lpfc_scsi_unprep_dma_buf: Routine to un-map DMA mapping of scatter gather. | 1507 | * lpfc_scsi_unprep_dma_buf - Routine to un-map DMA mapping of scatter gather |
1509 | * @phba: The Hba for which this call is being executed. | 1508 | * @phba: The Hba for which this call is being executed. |
1510 | * @psb: The scsi buffer which is going to be un-mapped. | 1509 | * @psb: The scsi buffer which is going to be un-mapped. |
1511 | * | 1510 | * |
@@ -1530,7 +1529,7 @@ lpfc_scsi_unprep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) | |||
1530 | } | 1529 | } |
1531 | 1530 | ||
1532 | /** | 1531 | /** |
1533 | * lpfc_handler_fcp_err: FCP response handler. | 1532 | * lpfc_handler_fcp_err - FCP response handler |
1534 | * @vport: The virtual port for which this call is being executed. | 1533 | * @vport: The virtual port for which this call is being executed. |
1535 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure. | 1534 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure. |
1536 | * @rsp_iocb: The response IOCB which contains FCP error. | 1535 | * @rsp_iocb: The response IOCB which contains FCP error. |
@@ -1674,7 +1673,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
1674 | } | 1673 | } |
1675 | 1674 | ||
1676 | /** | 1675 | /** |
1677 | * lpfc_scsi_cmd_iocb_cmpl: Scsi cmnd IOCB completion routine. | 1676 | * lpfc_scsi_cmd_iocb_cmpl - Scsi cmnd IOCB completion routine |
1678 | * @phba: The Hba for which this call is being executed. | 1677 | * @phba: The Hba for which this call is being executed. |
1679 | * @pIocbIn: The command IOCBQ for the scsi cmnd. | 1678 | * @pIocbIn: The command IOCBQ for the scsi cmnd. |
1680 | * @pIocbOut: The response IOCBQ for the scsi cmnd . | 1679 | * @pIocbOut: The response IOCBQ for the scsi cmnd . |
@@ -1694,10 +1693,12 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
1694 | struct lpfc_nodelist *pnode = rdata->pnode; | 1693 | struct lpfc_nodelist *pnode = rdata->pnode; |
1695 | struct scsi_cmnd *cmd = lpfc_cmd->pCmd; | 1694 | struct scsi_cmnd *cmd = lpfc_cmd->pCmd; |
1696 | int result; | 1695 | int result; |
1697 | struct scsi_device *sdev, *tmp_sdev; | 1696 | struct scsi_device *tmp_sdev; |
1698 | int depth = 0; | 1697 | int depth = 0; |
1699 | unsigned long flags; | 1698 | unsigned long flags; |
1700 | struct lpfc_fast_path_event *fast_path_evt; | 1699 | struct lpfc_fast_path_event *fast_path_evt; |
1700 | struct Scsi_Host *shost = cmd->device->host; | ||
1701 | uint32_t queue_depth, scsi_id; | ||
1701 | 1702 | ||
1702 | lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4]; | 1703 | lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4]; |
1703 | lpfc_cmd->status = pIocbOut->iocb.ulpStatus; | 1704 | lpfc_cmd->status = pIocbOut->iocb.ulpStatus; |
@@ -1808,11 +1809,10 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
1808 | 1809 | ||
1809 | lpfc_update_stats(phba, lpfc_cmd); | 1810 | lpfc_update_stats(phba, lpfc_cmd); |
1810 | result = cmd->result; | 1811 | result = cmd->result; |
1811 | sdev = cmd->device; | ||
1812 | if (vport->cfg_max_scsicmpl_time && | 1812 | if (vport->cfg_max_scsicmpl_time && |
1813 | time_after(jiffies, lpfc_cmd->start_time + | 1813 | time_after(jiffies, lpfc_cmd->start_time + |
1814 | msecs_to_jiffies(vport->cfg_max_scsicmpl_time))) { | 1814 | msecs_to_jiffies(vport->cfg_max_scsicmpl_time))) { |
1815 | spin_lock_irqsave(sdev->host->host_lock, flags); | 1815 | spin_lock_irqsave(shost->host_lock, flags); |
1816 | if (pnode && NLP_CHK_NODE_ACT(pnode)) { | 1816 | if (pnode && NLP_CHK_NODE_ACT(pnode)) { |
1817 | if (pnode->cmd_qdepth > | 1817 | if (pnode->cmd_qdepth > |
1818 | atomic_read(&pnode->cmd_pending) && | 1818 | atomic_read(&pnode->cmd_pending) && |
@@ -1825,22 +1825,26 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
1825 | 1825 | ||
1826 | pnode->last_change_time = jiffies; | 1826 | pnode->last_change_time = jiffies; |
1827 | } | 1827 | } |
1828 | spin_unlock_irqrestore(sdev->host->host_lock, flags); | 1828 | spin_unlock_irqrestore(shost->host_lock, flags); |
1829 | } else if (pnode && NLP_CHK_NODE_ACT(pnode)) { | 1829 | } else if (pnode && NLP_CHK_NODE_ACT(pnode)) { |
1830 | if ((pnode->cmd_qdepth < LPFC_MAX_TGT_QDEPTH) && | 1830 | if ((pnode->cmd_qdepth < LPFC_MAX_TGT_QDEPTH) && |
1831 | time_after(jiffies, pnode->last_change_time + | 1831 | time_after(jiffies, pnode->last_change_time + |
1832 | msecs_to_jiffies(LPFC_TGTQ_INTERVAL))) { | 1832 | msecs_to_jiffies(LPFC_TGTQ_INTERVAL))) { |
1833 | spin_lock_irqsave(sdev->host->host_lock, flags); | 1833 | spin_lock_irqsave(shost->host_lock, flags); |
1834 | pnode->cmd_qdepth += pnode->cmd_qdepth * | 1834 | pnode->cmd_qdepth += pnode->cmd_qdepth * |
1835 | LPFC_TGTQ_RAMPUP_PCENT / 100; | 1835 | LPFC_TGTQ_RAMPUP_PCENT / 100; |
1836 | if (pnode->cmd_qdepth > LPFC_MAX_TGT_QDEPTH) | 1836 | if (pnode->cmd_qdepth > LPFC_MAX_TGT_QDEPTH) |
1837 | pnode->cmd_qdepth = LPFC_MAX_TGT_QDEPTH; | 1837 | pnode->cmd_qdepth = LPFC_MAX_TGT_QDEPTH; |
1838 | pnode->last_change_time = jiffies; | 1838 | pnode->last_change_time = jiffies; |
1839 | spin_unlock_irqrestore(sdev->host->host_lock, flags); | 1839 | spin_unlock_irqrestore(shost->host_lock, flags); |
1840 | } | 1840 | } |
1841 | } | 1841 | } |
1842 | 1842 | ||
1843 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); | 1843 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); |
1844 | |||
1845 | /* The sdev is not guaranteed to be valid post scsi_done upcall. */ | ||
1846 | queue_depth = cmd->device->queue_depth; | ||
1847 | scsi_id = cmd->device->id; | ||
1844 | cmd->scsi_done(cmd); | 1848 | cmd->scsi_done(cmd); |
1845 | 1849 | ||
1846 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | 1850 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { |
@@ -1848,28 +1852,28 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
1848 | * If there is a thread waiting for command completion | 1852 | * If there is a thread waiting for command completion |
1849 | * wake up the thread. | 1853 | * wake up the thread. |
1850 | */ | 1854 | */ |
1851 | spin_lock_irqsave(sdev->host->host_lock, flags); | 1855 | spin_lock_irqsave(shost->host_lock, flags); |
1852 | lpfc_cmd->pCmd = NULL; | 1856 | lpfc_cmd->pCmd = NULL; |
1853 | if (lpfc_cmd->waitq) | 1857 | if (lpfc_cmd->waitq) |
1854 | wake_up(lpfc_cmd->waitq); | 1858 | wake_up(lpfc_cmd->waitq); |
1855 | spin_unlock_irqrestore(sdev->host->host_lock, flags); | 1859 | spin_unlock_irqrestore(shost->host_lock, flags); |
1856 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 1860 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
1857 | return; | 1861 | return; |
1858 | } | 1862 | } |
1859 | 1863 | ||
1860 | 1864 | ||
1861 | if (!result) | 1865 | if (!result) |
1862 | lpfc_rampup_queue_depth(vport, sdev); | 1866 | lpfc_rampup_queue_depth(vport, queue_depth); |
1863 | 1867 | ||
1864 | if (!result && pnode && NLP_CHK_NODE_ACT(pnode) && | 1868 | if (!result && pnode && NLP_CHK_NODE_ACT(pnode) && |
1865 | ((jiffies - pnode->last_ramp_up_time) > | 1869 | ((jiffies - pnode->last_ramp_up_time) > |
1866 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | 1870 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && |
1867 | ((jiffies - pnode->last_q_full_time) > | 1871 | ((jiffies - pnode->last_q_full_time) > |
1868 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | 1872 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && |
1869 | (vport->cfg_lun_queue_depth > sdev->queue_depth)) { | 1873 | (vport->cfg_lun_queue_depth > queue_depth)) { |
1870 | shost_for_each_device(tmp_sdev, sdev->host) { | 1874 | shost_for_each_device(tmp_sdev, shost) { |
1871 | if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){ | 1875 | if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){ |
1872 | if (tmp_sdev->id != sdev->id) | 1876 | if (tmp_sdev->id != scsi_id) |
1873 | continue; | 1877 | continue; |
1874 | if (tmp_sdev->ordered_tags) | 1878 | if (tmp_sdev->ordered_tags) |
1875 | scsi_adjust_queue_depth(tmp_sdev, | 1879 | scsi_adjust_queue_depth(tmp_sdev, |
@@ -1885,7 +1889,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
1885 | } | 1889 | } |
1886 | lpfc_send_sdev_queuedepth_change_event(phba, vport, pnode, | 1890 | lpfc_send_sdev_queuedepth_change_event(phba, vport, pnode, |
1887 | 0xFFFFFFFF, | 1891 | 0xFFFFFFFF, |
1888 | sdev->queue_depth - 1, sdev->queue_depth); | 1892 | queue_depth , queue_depth + 1); |
1889 | } | 1893 | } |
1890 | 1894 | ||
1891 | /* | 1895 | /* |
@@ -1896,8 +1900,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
1896 | NLP_CHK_NODE_ACT(pnode)) { | 1900 | NLP_CHK_NODE_ACT(pnode)) { |
1897 | pnode->last_q_full_time = jiffies; | 1901 | pnode->last_q_full_time = jiffies; |
1898 | 1902 | ||
1899 | shost_for_each_device(tmp_sdev, sdev->host) { | 1903 | shost_for_each_device(tmp_sdev, shost) { |
1900 | if (tmp_sdev->id != sdev->id) | 1904 | if (tmp_sdev->id != scsi_id) |
1901 | continue; | 1905 | continue; |
1902 | depth = scsi_track_queue_full(tmp_sdev, | 1906 | depth = scsi_track_queue_full(tmp_sdev, |
1903 | tmp_sdev->queue_depth - 1); | 1907 | tmp_sdev->queue_depth - 1); |
@@ -1909,7 +1913,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
1909 | * scsi_track_queue_full. | 1913 | * scsi_track_queue_full. |
1910 | */ | 1914 | */ |
1911 | if (depth == -1) | 1915 | if (depth == -1) |
1912 | depth = sdev->host->cmd_per_lun; | 1916 | depth = shost->cmd_per_lun; |
1913 | 1917 | ||
1914 | if (depth) { | 1918 | if (depth) { |
1915 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, | 1919 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
@@ -1925,17 +1929,17 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
1925 | * If there is a thread waiting for command completion | 1929 | * If there is a thread waiting for command completion |
1926 | * wake up the thread. | 1930 | * wake up the thread. |
1927 | */ | 1931 | */ |
1928 | spin_lock_irqsave(sdev->host->host_lock, flags); | 1932 | spin_lock_irqsave(shost->host_lock, flags); |
1929 | lpfc_cmd->pCmd = NULL; | 1933 | lpfc_cmd->pCmd = NULL; |
1930 | if (lpfc_cmd->waitq) | 1934 | if (lpfc_cmd->waitq) |
1931 | wake_up(lpfc_cmd->waitq); | 1935 | wake_up(lpfc_cmd->waitq); |
1932 | spin_unlock_irqrestore(sdev->host->host_lock, flags); | 1936 | spin_unlock_irqrestore(shost->host_lock, flags); |
1933 | 1937 | ||
1934 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 1938 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
1935 | } | 1939 | } |
1936 | 1940 | ||
1937 | /** | 1941 | /** |
1938 | * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB. | 1942 | * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB |
1939 | * @data: A pointer to the immediate command data portion of the IOCB. | 1943 | * @data: A pointer to the immediate command data portion of the IOCB. |
1940 | * @fcp_cmnd: The FCP Command that is provided by the SCSI layer. | 1944 | * @fcp_cmnd: The FCP Command that is provided by the SCSI layer. |
1941 | * | 1945 | * |
@@ -1953,7 +1957,7 @@ lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd) | |||
1953 | } | 1957 | } |
1954 | 1958 | ||
1955 | /** | 1959 | /** |
1956 | * lpfc_scsi_prep_cmnd: Routine to convert scsi cmnd to FCP information unit. | 1960 | * lpfc_scsi_prep_cmnd - Routine to convert scsi cmnd to FCP information unit |
1957 | * @vport: The virtual port for which this call is being executed. | 1961 | * @vport: The virtual port for which this call is being executed. |
1958 | * @lpfc_cmd: The scsi command which needs to send. | 1962 | * @lpfc_cmd: The scsi command which needs to send. |
1959 | * @pnode: Pointer to lpfc_nodelist. | 1963 | * @pnode: Pointer to lpfc_nodelist. |
@@ -2047,7 +2051,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
2047 | } | 2051 | } |
2048 | 2052 | ||
2049 | /** | 2053 | /** |
2050 | * lpfc_scsi_prep_task_mgmt_cmnd: Convert scsi TM cmnd to FCP information unit. | 2054 | * lpfc_scsi_prep_task_mgmt_cmnd - Convert scsi TM cmnd to FCP information unit |
2051 | * @vport: The virtual port for which this call is being executed. | 2055 | * @vport: The virtual port for which this call is being executed. |
2052 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure. | 2056 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure. |
2053 | * @lun: Logical unit number. | 2057 | * @lun: Logical unit number. |
@@ -2110,7 +2114,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport, | |||
2110 | } | 2114 | } |
2111 | 2115 | ||
2112 | /** | 2116 | /** |
2113 | * lpc_taskmgmt_def_cmpl: IOCB completion routine for task management command. | 2117 | * lpfc_taskmgmt_def_cmpl - IOCB completion routine for task management command |
2114 | * @phba: The Hba for which this call is being executed. | 2118 | * @phba: The Hba for which this call is being executed. |
2115 | * @cmdiocbq: Pointer to lpfc_iocbq data structure. | 2119 | * @cmdiocbq: Pointer to lpfc_iocbq data structure. |
2116 | * @rspiocbq: Pointer to lpfc_iocbq data structure. | 2120 | * @rspiocbq: Pointer to lpfc_iocbq data structure. |
@@ -2131,7 +2135,7 @@ lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, | |||
2131 | } | 2135 | } |
2132 | 2136 | ||
2133 | /** | 2137 | /** |
2134 | * lpfc_scsi_tgt_reset: Target reset handler. | 2138 | * lpfc_scsi_tgt_reset - Target reset handler |
2135 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure | 2139 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure |
2136 | * @vport: The virtual port for which this call is being executed. | 2140 | * @vport: The virtual port for which this call is being executed. |
2137 | * @tgt_id: Target ID. | 2141 | * @tgt_id: Target ID. |
@@ -2198,7 +2202,7 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport, | |||
2198 | } | 2202 | } |
2199 | 2203 | ||
2200 | /** | 2204 | /** |
2201 | * lpfc_info: Info entry point of scsi_host_template data structure. | 2205 | * lpfc_info - Info entry point of scsi_host_template data structure |
2202 | * @host: The scsi host for which this call is being executed. | 2206 | * @host: The scsi host for which this call is being executed. |
2203 | * | 2207 | * |
2204 | * This routine provides module information about hba. | 2208 | * This routine provides module information about hba. |
@@ -2236,7 +2240,7 @@ lpfc_info(struct Scsi_Host *host) | |||
2236 | } | 2240 | } |
2237 | 2241 | ||
2238 | /** | 2242 | /** |
2239 | * lpfc_poll_rearm_time: Routine to modify fcp_poll timer of hba. | 2243 | * lpfc_poll_rearm_time - Routine to modify fcp_poll timer of hba |
2240 | * @phba: The Hba for which this call is being executed. | 2244 | * @phba: The Hba for which this call is being executed. |
2241 | * | 2245 | * |
2242 | * This routine modifies fcp_poll_timer field of @phba by cfg_poll_tmo. | 2246 | * This routine modifies fcp_poll_timer field of @phba by cfg_poll_tmo. |
@@ -2253,7 +2257,7 @@ static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) | |||
2253 | } | 2257 | } |
2254 | 2258 | ||
2255 | /** | 2259 | /** |
2256 | * lpfc_poll_start_timer: Routine to start fcp_poll_timer of HBA. | 2260 | * lpfc_poll_start_timer - Routine to start fcp_poll_timer of HBA |
2257 | * @phba: The Hba for which this call is being executed. | 2261 | * @phba: The Hba for which this call is being executed. |
2258 | * | 2262 | * |
2259 | * This routine starts the fcp_poll_timer of @phba. | 2263 | * This routine starts the fcp_poll_timer of @phba. |
@@ -2264,7 +2268,7 @@ void lpfc_poll_start_timer(struct lpfc_hba * phba) | |||
2264 | } | 2268 | } |
2265 | 2269 | ||
2266 | /** | 2270 | /** |
2267 | * lpfc_poll_timeout: Restart polling timer. | 2271 | * lpfc_poll_timeout - Restart polling timer |
2268 | * @ptr: Map to lpfc_hba data structure pointer. | 2272 | * @ptr: Map to lpfc_hba data structure pointer. |
2269 | * | 2273 | * |
2270 | * This routine restarts fcp_poll timer, when FCP ring polling is enable | 2274 | * This routine restarts fcp_poll timer, when FCP ring polling is enable |
@@ -2283,8 +2287,7 @@ void lpfc_poll_timeout(unsigned long ptr) | |||
2283 | } | 2287 | } |
2284 | 2288 | ||
2285 | /** | 2289 | /** |
2286 | * lpfc_queuecommand: Queuecommand entry point of Scsi Host Templater data | 2290 | * lpfc_queuecommand - scsi_host_template queuecommand entry point |
2287 | * structure. | ||
2288 | * @cmnd: Pointer to scsi_cmnd data structure. | 2291 | * @cmnd: Pointer to scsi_cmnd data structure. |
2289 | * @done: Pointer to done routine. | 2292 | * @done: Pointer to done routine. |
2290 | * | 2293 | * |
@@ -2450,7 +2453,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
2450 | } | 2453 | } |
2451 | 2454 | ||
2452 | /** | 2455 | /** |
2453 | * lpfc_block_error_handler: Routine to block error handler. | 2456 | * lpfc_block_error_handler - Routine to block error handler |
2454 | * @cmnd: Pointer to scsi_cmnd data structure. | 2457 | * @cmnd: Pointer to scsi_cmnd data structure. |
2455 | * | 2458 | * |
2456 | * This routine blocks execution till fc_rport state is not FC_PORSTAT_BLCOEKD. | 2459 | * This routine blocks execution till fc_rport state is not FC_PORSTAT_BLCOEKD. |
@@ -2472,8 +2475,7 @@ lpfc_block_error_handler(struct scsi_cmnd *cmnd) | |||
2472 | } | 2475 | } |
2473 | 2476 | ||
2474 | /** | 2477 | /** |
2475 | * lpfc_abort_handler: Eh_abort_handler entry point of Scsi Host Template data | 2478 | * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point |
2476 | *structure. | ||
2477 | * @cmnd: Pointer to scsi_cmnd data structure. | 2479 | * @cmnd: Pointer to scsi_cmnd data structure. |
2478 | * | 2480 | * |
2479 | * This routine aborts @cmnd pending in base driver. | 2481 | * This routine aborts @cmnd pending in base driver. |
@@ -2578,8 +2580,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
2578 | } | 2580 | } |
2579 | 2581 | ||
2580 | /** | 2582 | /** |
2581 | * lpfc_device_reset_handler: eh_device_reset entry point of Scsi Host Template | 2583 | * lpfc_device_reset_handler - scsi_host_template eh_device_reset entry point |
2582 | *data structure. | ||
2583 | * @cmnd: Pointer to scsi_cmnd data structure. | 2584 | * @cmnd: Pointer to scsi_cmnd data structure. |
2584 | * | 2585 | * |
2585 | * This routine does a device reset by sending a TARGET_RESET task management | 2586 | * This routine does a device reset by sending a TARGET_RESET task management |
@@ -2587,7 +2588,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
2587 | * | 2588 | * |
2588 | * Return code : | 2589 | * Return code : |
2589 | * 0x2003 - Error | 2590 | * 0x2003 - Error |
2590 | * 0ex2002 - Success | 2591 | * 0x2002 - Success |
2591 | **/ | 2592 | **/ |
2592 | static int | 2593 | static int |
2593 | lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | 2594 | lpfc_device_reset_handler(struct scsi_cmnd *cmnd) |
@@ -2707,8 +2708,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
2707 | } | 2708 | } |
2708 | 2709 | ||
2709 | /** | 2710 | /** |
2710 | * lpfc_bus_reset_handler: eh_bus_reset_handler entry point of Scsi Host | 2711 | * lpfc_bus_reset_handler - scsi_host_template eh_bus_reset_handler entry point |
2711 | * Template data structure. | ||
2712 | * @cmnd: Pointer to scsi_cmnd data structure. | 2712 | * @cmnd: Pointer to scsi_cmnd data structure. |
2713 | * | 2713 | * |
2714 | * This routine does target reset to all target on @cmnd->device->host. | 2714 | * This routine does target reset to all target on @cmnd->device->host. |
@@ -2808,8 +2808,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
2808 | } | 2808 | } |
2809 | 2809 | ||
2810 | /** | 2810 | /** |
2811 | * lpfc_slave_alloc: slave_alloc entry point of Scsi Host Template data | 2811 | * lpfc_slave_alloc - scsi_host_template slave_alloc entry point |
2812 | * structure. | ||
2813 | * @sdev: Pointer to scsi_device. | 2812 | * @sdev: Pointer to scsi_device. |
2814 | * | 2813 | * |
2815 | * This routine populates the cmds_per_lun count + 2 scsi_bufs into this host's | 2814 | * This routine populates the cmds_per_lun count + 2 scsi_bufs into this host's |
@@ -2883,8 +2882,7 @@ lpfc_slave_alloc(struct scsi_device *sdev) | |||
2883 | } | 2882 | } |
2884 | 2883 | ||
2885 | /** | 2884 | /** |
2886 | * lpfc_slave_configure: slave_configure entry point of Scsi Host Templater data | 2885 | * lpfc_slave_configure - scsi_host_template slave_configure entry point |
2887 | * structure. | ||
2888 | * @sdev: Pointer to scsi_device. | 2886 | * @sdev: Pointer to scsi_device. |
2889 | * | 2887 | * |
2890 | * This routine configures following items | 2888 | * This routine configures following items |
@@ -2925,7 +2923,7 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
2925 | } | 2923 | } |
2926 | 2924 | ||
2927 | /** | 2925 | /** |
2928 | * lpfc_slave_destroy: slave_destroy entry point of SHT data structure. | 2926 | * lpfc_slave_destroy - slave_destroy entry point of SHT data structure |
2929 | * @sdev: Pointer to scsi_device. | 2927 | * @sdev: Pointer to scsi_device. |
2930 | * | 2928 | * |
2931 | * This routine sets @sdev hostatdata filed to null. | 2929 | * This routine sets @sdev hostatdata filed to null. |