diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 1242b6c4308b..c913e8cc3b26 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -926,10 +926,10 @@ lpfc_sli4_repost_scsi_sgl_list(struct lpfc_hba *phba) | |||
926 | 926 | ||
927 | /* get all SCSI buffers need to repost to a local list */ | 927 | /* get all SCSI buffers need to repost to a local list */ |
928 | spin_lock_irq(&phba->scsi_buf_list_get_lock); | 928 | spin_lock_irq(&phba->scsi_buf_list_get_lock); |
929 | spin_lock_irq(&phba->scsi_buf_list_put_lock); | 929 | spin_lock(&phba->scsi_buf_list_put_lock); |
930 | list_splice_init(&phba->lpfc_scsi_buf_list_get, &post_sblist); | 930 | list_splice_init(&phba->lpfc_scsi_buf_list_get, &post_sblist); |
931 | list_splice(&phba->lpfc_scsi_buf_list_put, &post_sblist); | 931 | list_splice(&phba->lpfc_scsi_buf_list_put, &post_sblist); |
932 | spin_unlock_irq(&phba->scsi_buf_list_put_lock); | 932 | spin_unlock(&phba->scsi_buf_list_put_lock); |
933 | spin_unlock_irq(&phba->scsi_buf_list_get_lock); | 933 | spin_unlock_irq(&phba->scsi_buf_list_get_lock); |
934 | 934 | ||
935 | /* post the list of scsi buffer sgls to port if available */ | 935 | /* post the list of scsi buffer sgls to port if available */ |
@@ -1000,9 +1000,12 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc) | |||
1000 | } | 1000 | } |
1001 | memset(psb->data, 0, phba->cfg_sg_dma_buf_size); | 1001 | memset(psb->data, 0, phba->cfg_sg_dma_buf_size); |
1002 | 1002 | ||
1003 | /* Page alignment is CRITICAL, double check to be sure */ | 1003 | /* |
1004 | if (((unsigned long)(psb->data) & | 1004 | * 4K Page alignment is CRITICAL to BlockGuard, double check |
1005 | (unsigned long)(SLI4_PAGE_SIZE - 1)) != 0) { | 1005 | * to be sure. |
1006 | */ | ||
1007 | if (phba->cfg_enable_bg && (((unsigned long)(psb->data) & | ||
1008 | (unsigned long)(SLI4_PAGE_SIZE - 1)) != 0)) { | ||
1006 | pci_pool_free(phba->lpfc_scsi_dma_buf_pool, | 1009 | pci_pool_free(phba->lpfc_scsi_dma_buf_pool, |
1007 | psb->data, psb->dma_handle); | 1010 | psb->data, psb->dma_handle); |
1008 | kfree(psb); | 1011 | kfree(psb); |
@@ -1134,22 +1137,21 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
1134 | { | 1137 | { |
1135 | struct lpfc_scsi_buf * lpfc_cmd = NULL; | 1138 | struct lpfc_scsi_buf * lpfc_cmd = NULL; |
1136 | struct list_head *scsi_buf_list_get = &phba->lpfc_scsi_buf_list_get; | 1139 | struct list_head *scsi_buf_list_get = &phba->lpfc_scsi_buf_list_get; |
1137 | unsigned long gflag = 0; | 1140 | unsigned long iflag = 0; |
1138 | unsigned long pflag = 0; | ||
1139 | 1141 | ||
1140 | spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); | 1142 | spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag); |
1141 | list_remove_head(scsi_buf_list_get, lpfc_cmd, struct lpfc_scsi_buf, | 1143 | list_remove_head(scsi_buf_list_get, lpfc_cmd, struct lpfc_scsi_buf, |
1142 | list); | 1144 | list); |
1143 | if (!lpfc_cmd) { | 1145 | if (!lpfc_cmd) { |
1144 | spin_lock_irqsave(&phba->scsi_buf_list_put_lock, pflag); | 1146 | spin_lock(&phba->scsi_buf_list_put_lock); |
1145 | list_splice(&phba->lpfc_scsi_buf_list_put, | 1147 | list_splice(&phba->lpfc_scsi_buf_list_put, |
1146 | &phba->lpfc_scsi_buf_list_get); | 1148 | &phba->lpfc_scsi_buf_list_get); |
1147 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); | 1149 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); |
1148 | list_remove_head(scsi_buf_list_get, lpfc_cmd, | 1150 | list_remove_head(scsi_buf_list_get, lpfc_cmd, |
1149 | struct lpfc_scsi_buf, list); | 1151 | struct lpfc_scsi_buf, list); |
1150 | spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); | 1152 | spin_unlock(&phba->scsi_buf_list_put_lock); |
1151 | } | 1153 | } |
1152 | spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, gflag); | 1154 | spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag); |
1153 | return lpfc_cmd; | 1155 | return lpfc_cmd; |
1154 | } | 1156 | } |
1155 | /** | 1157 | /** |
@@ -1167,11 +1169,10 @@ static struct lpfc_scsi_buf* | |||
1167 | lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | 1169 | lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) |
1168 | { | 1170 | { |
1169 | struct lpfc_scsi_buf *lpfc_cmd, *lpfc_cmd_next; | 1171 | struct lpfc_scsi_buf *lpfc_cmd, *lpfc_cmd_next; |
1170 | unsigned long gflag = 0; | 1172 | unsigned long iflag = 0; |
1171 | unsigned long pflag = 0; | ||
1172 | int found = 0; | 1173 | int found = 0; |
1173 | 1174 | ||
1174 | spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); | 1175 | spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag); |
1175 | list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, | 1176 | list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, |
1176 | &phba->lpfc_scsi_buf_list_get, list) { | 1177 | &phba->lpfc_scsi_buf_list_get, list) { |
1177 | if (lpfc_test_rrq_active(phba, ndlp, | 1178 | if (lpfc_test_rrq_active(phba, ndlp, |
@@ -1182,11 +1183,11 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
1182 | break; | 1183 | break; |
1183 | } | 1184 | } |
1184 | if (!found) { | 1185 | if (!found) { |
1185 | spin_lock_irqsave(&phba->scsi_buf_list_put_lock, pflag); | 1186 | spin_lock(&phba->scsi_buf_list_put_lock); |
1186 | list_splice(&phba->lpfc_scsi_buf_list_put, | 1187 | list_splice(&phba->lpfc_scsi_buf_list_put, |
1187 | &phba->lpfc_scsi_buf_list_get); | 1188 | &phba->lpfc_scsi_buf_list_get); |
1188 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); | 1189 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); |
1189 | spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); | 1190 | spin_unlock(&phba->scsi_buf_list_put_lock); |
1190 | list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, | 1191 | list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, |
1191 | &phba->lpfc_scsi_buf_list_get, list) { | 1192 | &phba->lpfc_scsi_buf_list_get, list) { |
1192 | if (lpfc_test_rrq_active( | 1193 | if (lpfc_test_rrq_active( |
@@ -1197,7 +1198,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
1197 | break; | 1198 | break; |
1198 | } | 1199 | } |
1199 | } | 1200 | } |
1200 | spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, gflag); | 1201 | spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag); |
1201 | if (!found) | 1202 | if (!found) |
1202 | return NULL; | 1203 | return NULL; |
1203 | return lpfc_cmd; | 1204 | return lpfc_cmd; |
@@ -3966,11 +3967,11 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
3966 | 3967 | ||
3967 | /* | 3968 | /* |
3968 | * Check SLI validation that all the transfer was actually done | 3969 | * Check SLI validation that all the transfer was actually done |
3969 | * (fcpi_parm should be zero). | 3970 | * (fcpi_parm should be zero). Apply check only to reads. |
3970 | */ | 3971 | */ |
3971 | } else if (fcpi_parm) { | 3972 | } else if (fcpi_parm && (cmnd->sc_data_direction == DMA_FROM_DEVICE)) { |
3972 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR, | 3973 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR, |
3973 | "9029 FCP Data Transfer Check Error: " | 3974 | "9029 FCP Read Check Error Data: " |
3974 | "x%x x%x x%x x%x x%x\n", | 3975 | "x%x x%x x%x x%x x%x\n", |
3975 | be32_to_cpu(fcpcmd->fcpDl), | 3976 | be32_to_cpu(fcpcmd->fcpDl), |
3976 | be32_to_cpu(fcprsp->rspResId), | 3977 | be32_to_cpu(fcprsp->rspResId), |
@@ -4342,6 +4343,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
4342 | char tag[2]; | 4343 | char tag[2]; |
4343 | uint8_t *ptr; | 4344 | uint8_t *ptr; |
4344 | bool sli4; | 4345 | bool sli4; |
4346 | uint32_t fcpdl; | ||
4345 | 4347 | ||
4346 | if (!pnode || !NLP_CHK_NODE_ACT(pnode)) | 4348 | if (!pnode || !NLP_CHK_NODE_ACT(pnode)) |
4347 | return; | 4349 | return; |
@@ -4389,8 +4391,12 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
4389 | iocb_cmd->ulpPU = PARM_READ_CHECK; | 4391 | iocb_cmd->ulpPU = PARM_READ_CHECK; |
4390 | if (vport->cfg_first_burst_size && | 4392 | if (vport->cfg_first_burst_size && |
4391 | (pnode->nlp_flag & NLP_FIRSTBURST)) { | 4393 | (pnode->nlp_flag & NLP_FIRSTBURST)) { |
4392 | piocbq->iocb.un.fcpi.fcpi_XRdy = | 4394 | fcpdl = scsi_bufflen(scsi_cmnd); |
4393 | vport->cfg_first_burst_size; | 4395 | if (fcpdl < vport->cfg_first_burst_size) |
4396 | piocbq->iocb.un.fcpi.fcpi_XRdy = fcpdl; | ||
4397 | else | ||
4398 | piocbq->iocb.un.fcpi.fcpi_XRdy = | ||
4399 | vport->cfg_first_burst_size; | ||
4394 | } | 4400 | } |
4395 | fcp_cmnd->fcpCntl3 = WRITE_DATA; | 4401 | fcp_cmnd->fcpCntl3 = WRITE_DATA; |
4396 | phba->fc4OutputRequests++; | 4402 | phba->fc4OutputRequests++; |
@@ -4878,6 +4884,9 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
4878 | goto out_unlock; | 4884 | goto out_unlock; |
4879 | } | 4885 | } |
4880 | 4886 | ||
4887 | /* Indicate the IO is being aborted by the driver. */ | ||
4888 | iocb->iocb_flag |= LPFC_DRIVER_ABORTED; | ||
4889 | |||
4881 | /* | 4890 | /* |
4882 | * The scsi command can not be in txq and it is in flight because the | 4891 | * The scsi command can not be in txq and it is in flight because the |
4883 | * pCmd is still pointig at the SCSI command we have to abort. There | 4892 | * pCmd is still pointig at the SCSI command we have to abort. There |
@@ -5006,7 +5015,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata, | |||
5006 | lpfc_cmd = lpfc_get_scsi_buf(phba, rdata->pnode); | 5015 | lpfc_cmd = lpfc_get_scsi_buf(phba, rdata->pnode); |
5007 | if (lpfc_cmd == NULL) | 5016 | if (lpfc_cmd == NULL) |
5008 | return FAILED; | 5017 | return FAILED; |
5009 | lpfc_cmd->timeout = 60; | 5018 | lpfc_cmd->timeout = phba->cfg_task_mgmt_tmo; |
5010 | lpfc_cmd->rdata = rdata; | 5019 | lpfc_cmd->rdata = rdata; |
5011 | 5020 | ||
5012 | status = lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun_id, | 5021 | status = lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun_id, |