aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index bb9a2249b75d..f035f3c7ec09 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -3919,6 +3919,8 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
3919 struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq); 3919 struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq);
3920 int datadir = scsi_cmnd->sc_data_direction; 3920 int datadir = scsi_cmnd->sc_data_direction;
3921 char tag[2]; 3921 char tag[2];
3922 uint8_t *ptr;
3923 bool sli4;
3922 3924
3923 if (!pnode || !NLP_CHK_NODE_ACT(pnode)) 3925 if (!pnode || !NLP_CHK_NODE_ACT(pnode))
3924 return; 3926 return;
@@ -3930,8 +3932,13 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
3930 int_to_scsilun(lpfc_cmd->pCmd->device->lun, 3932 int_to_scsilun(lpfc_cmd->pCmd->device->lun,
3931 &lpfc_cmd->fcp_cmnd->fcp_lun); 3933 &lpfc_cmd->fcp_cmnd->fcp_lun);
3932 3934
3933 memset(&fcp_cmnd->fcpCdb[0], 0, LPFC_FCP_CDB_LEN); 3935 ptr = &fcp_cmnd->fcpCdb[0];
3934 memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, scsi_cmnd->cmd_len); 3936 memcpy(ptr, scsi_cmnd->cmnd, scsi_cmnd->cmd_len);
3937 if (scsi_cmnd->cmd_len < LPFC_FCP_CDB_LEN) {
3938 ptr += scsi_cmnd->cmd_len;
3939 memset(ptr, 0, (LPFC_FCP_CDB_LEN - scsi_cmnd->cmd_len));
3940 }
3941
3935 if (scsi_populate_tag_msg(scsi_cmnd, tag)) { 3942 if (scsi_populate_tag_msg(scsi_cmnd, tag)) {
3936 switch (tag[0]) { 3943 switch (tag[0]) {
3937 case HEAD_OF_QUEUE_TAG: 3944 case HEAD_OF_QUEUE_TAG:
@@ -3947,6 +3954,8 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
3947 } else 3954 } else
3948 fcp_cmnd->fcpCntl1 = 0; 3955 fcp_cmnd->fcpCntl1 = 0;
3949 3956
3957 sli4 = (phba->sli_rev == LPFC_SLI_REV4);
3958
3950 /* 3959 /*
3951 * There are three possibilities here - use scatter-gather segment, use 3960 * There are three possibilities here - use scatter-gather segment, use
3952 * the single mapping, or neither. Start the lpfc command prep by 3961 * the single mapping, or neither. Start the lpfc command prep by
@@ -3956,11 +3965,12 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
3956 if (scsi_sg_count(scsi_cmnd)) { 3965 if (scsi_sg_count(scsi_cmnd)) {
3957 if (datadir == DMA_TO_DEVICE) { 3966 if (datadir == DMA_TO_DEVICE) {
3958 iocb_cmd->ulpCommand = CMD_FCP_IWRITE64_CR; 3967 iocb_cmd->ulpCommand = CMD_FCP_IWRITE64_CR;
3959 if (phba->sli_rev < LPFC_SLI_REV4) { 3968 if (sli4)
3969 iocb_cmd->ulpPU = PARM_READ_CHECK;
3970 else {
3960 iocb_cmd->un.fcpi.fcpi_parm = 0; 3971 iocb_cmd->un.fcpi.fcpi_parm = 0;
3961 iocb_cmd->ulpPU = 0; 3972 iocb_cmd->ulpPU = 0;
3962 } else 3973 }
3963 iocb_cmd->ulpPU = PARM_READ_CHECK;
3964 fcp_cmnd->fcpCntl3 = WRITE_DATA; 3974 fcp_cmnd->fcpCntl3 = WRITE_DATA;
3965 phba->fc4OutputRequests++; 3975 phba->fc4OutputRequests++;
3966 } else { 3976 } else {
@@ -3984,7 +3994,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
3984 * of the scsi_cmnd request_buffer 3994 * of the scsi_cmnd request_buffer
3985 */ 3995 */
3986 piocbq->iocb.ulpContext = pnode->nlp_rpi; 3996 piocbq->iocb.ulpContext = pnode->nlp_rpi;
3987 if (phba->sli_rev == LPFC_SLI_REV4) 3997 if (sli4)
3988 piocbq->iocb.ulpContext = 3998 piocbq->iocb.ulpContext =
3989 phba->sli4_hba.rpi_ids[pnode->nlp_rpi]; 3999 phba->sli4_hba.rpi_ids[pnode->nlp_rpi];
3990 if (pnode->nlp_fcp_info & NLP_FCP_2_DEVICE) 4000 if (pnode->nlp_fcp_info & NLP_FCP_2_DEVICE)