diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 65 |
1 files changed, 55 insertions, 10 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c140f99772ca..e5eb40d2c512 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -3257,7 +3257,7 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
3257 | */ | 3257 | */ |
3258 | 3258 | ||
3259 | nseg = scsi_dma_map(scsi_cmnd); | 3259 | nseg = scsi_dma_map(scsi_cmnd); |
3260 | if (unlikely(!nseg)) | 3260 | if (unlikely(nseg <= 0)) |
3261 | return 1; | 3261 | return 1; |
3262 | sgl += 1; | 3262 | sgl += 1; |
3263 | /* clear the last flag in the fcp_rsp map entry */ | 3263 | /* clear the last flag in the fcp_rsp map entry */ |
@@ -3846,6 +3846,49 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
3846 | } | 3846 | } |
3847 | 3847 | ||
3848 | /** | 3848 | /** |
3849 | * lpfc_sli4_scmd_to_wqidx_distr - scsi command to SLI4 WQ index distribution | ||
3850 | * @phba: Pointer to HBA context object. | ||
3851 | * | ||
3852 | * This routine performs a roundrobin SCSI command to SLI4 FCP WQ index | ||
3853 | * distribution. This is called by __lpfc_sli_issue_iocb_s4() with the hbalock | ||
3854 | * held. | ||
3855 | * If scsi-mq is enabled, get the default block layer mapping of software queues | ||
3856 | * to hardware queues. This information is saved in request tag. | ||
3857 | * | ||
3858 | * Return: index into SLI4 fast-path FCP queue index. | ||
3859 | **/ | ||
3860 | int lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba, | ||
3861 | struct lpfc_scsi_buf *lpfc_cmd) | ||
3862 | { | ||
3863 | struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; | ||
3864 | struct lpfc_vector_map_info *cpup; | ||
3865 | int chann, cpu; | ||
3866 | uint32_t tag; | ||
3867 | uint16_t hwq; | ||
3868 | |||
3869 | if (shost_use_blk_mq(cmnd->device->host)) { | ||
3870 | tag = blk_mq_unique_tag(cmnd->request); | ||
3871 | hwq = blk_mq_unique_tag_to_hwq(tag); | ||
3872 | |||
3873 | return hwq; | ||
3874 | } | ||
3875 | |||
3876 | if (phba->cfg_fcp_io_sched == LPFC_FCP_SCHED_BY_CPU | ||
3877 | && phba->cfg_fcp_io_channel > 1) { | ||
3878 | cpu = smp_processor_id(); | ||
3879 | if (cpu < phba->sli4_hba.num_present_cpu) { | ||
3880 | cpup = phba->sli4_hba.cpu_map; | ||
3881 | cpup += cpu; | ||
3882 | return cpup->channel_id; | ||
3883 | } | ||
3884 | } | ||
3885 | chann = atomic_add_return(1, &phba->fcp_qidx); | ||
3886 | chann = (chann % phba->cfg_fcp_io_channel); | ||
3887 | return chann; | ||
3888 | } | ||
3889 | |||
3890 | |||
3891 | /** | ||
3849 | * lpfc_scsi_cmd_iocb_cmpl - Scsi cmnd IOCB completion routine | 3892 | * lpfc_scsi_cmd_iocb_cmpl - Scsi cmnd IOCB completion routine |
3850 | * @phba: The Hba for which this call is being executed. | 3893 | * @phba: The Hba for which this call is being executed. |
3851 | * @pIocbIn: The command IOCBQ for the scsi cmnd. | 3894 | * @pIocbIn: The command IOCBQ for the scsi cmnd. |
@@ -4537,7 +4580,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) | |||
4537 | if (lpfc_cmd == NULL) { | 4580 | if (lpfc_cmd == NULL) { |
4538 | lpfc_rampdown_queue_depth(phba); | 4581 | lpfc_rampdown_queue_depth(phba); |
4539 | 4582 | ||
4540 | lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, | 4583 | lpfc_printf_vlog(vport, KERN_INFO, LOG_MISC, |
4541 | "0707 driver's buffer pool is empty, " | 4584 | "0707 driver's buffer pool is empty, " |
4542 | "IO busied\n"); | 4585 | "IO busied\n"); |
4543 | goto out_host_busy; | 4586 | goto out_host_busy; |
@@ -4968,13 +5011,16 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata, | |||
4968 | iocbq, iocbqrsp, lpfc_cmd->timeout); | 5011 | iocbq, iocbqrsp, lpfc_cmd->timeout); |
4969 | if ((status != IOCB_SUCCESS) || | 5012 | if ((status != IOCB_SUCCESS) || |
4970 | (iocbqrsp->iocb.ulpStatus != IOSTAT_SUCCESS)) { | 5013 | (iocbqrsp->iocb.ulpStatus != IOSTAT_SUCCESS)) { |
4971 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, | 5014 | if (status != IOCB_SUCCESS || |
4972 | "0727 TMF %s to TGT %d LUN %llu failed (%d, %d) " | 5015 | iocbqrsp->iocb.ulpStatus != IOSTAT_FCP_RSP_ERROR) |
4973 | "iocb_flag x%x\n", | 5016 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
4974 | lpfc_taskmgmt_name(task_mgmt_cmd), | 5017 | "0727 TMF %s to TGT %d LUN %llu " |
4975 | tgt_id, lun_id, iocbqrsp->iocb.ulpStatus, | 5018 | "failed (%d, %d) iocb_flag x%x\n", |
4976 | iocbqrsp->iocb.un.ulpWord[4], | 5019 | lpfc_taskmgmt_name(task_mgmt_cmd), |
4977 | iocbq->iocb_flag); | 5020 | tgt_id, lun_id, |
5021 | iocbqrsp->iocb.ulpStatus, | ||
5022 | iocbqrsp->iocb.un.ulpWord[4], | ||
5023 | iocbq->iocb_flag); | ||
4978 | /* if ulpStatus != IOCB_SUCCESS, then status == IOCB_SUCCESS */ | 5024 | /* if ulpStatus != IOCB_SUCCESS, then status == IOCB_SUCCESS */ |
4979 | if (status == IOCB_SUCCESS) { | 5025 | if (status == IOCB_SUCCESS) { |
4980 | if (iocbqrsp->iocb.ulpStatus == IOSTAT_FCP_RSP_ERROR) | 5026 | if (iocbqrsp->iocb.ulpStatus == IOSTAT_FCP_RSP_ERROR) |
@@ -4988,7 +5034,6 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata, | |||
4988 | } else { | 5034 | } else { |
4989 | ret = FAILED; | 5035 | ret = FAILED; |
4990 | } | 5036 | } |
4991 | lpfc_cmd->status = IOSTAT_DRIVER_REJECT; | ||
4992 | } else | 5037 | } else |
4993 | ret = SUCCESS; | 5038 | ret = SUCCESS; |
4994 | 5039 | ||