diff options
author | James Smart <james.smart@emulex.com> | 2015-04-07 15:07:27 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-04-10 10:50:29 -0400 |
commit | 4fbdf9cbcc5c0e154d9eb9da4ac3a6d8f9df7ada (patch) | |
tree | d92578d7840ce8a5ef561a480be072cdce7e84af | |
parent | ad490b6e70c5756d0479ce1a7336626859b8b546 (diff) |
lpfc: Fix for lun discovery issue with saturn adapter.
FCP_CMD payload was not always properly initialized on SLI-3 devices.
Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index ea818f0ec218..32db4c24fe4a 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -1130,6 +1130,25 @@ lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) | |||
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | /** | 1132 | /** |
1133 | * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB | ||
1134 | * @data: A pointer to the immediate command data portion of the IOCB. | ||
1135 | * @fcp_cmnd: The FCP Command that is provided by the SCSI layer. | ||
1136 | * | ||
1137 | * The routine copies the entire FCP command from @fcp_cmnd to @data while | ||
1138 | * byte swapping the data to big endian format for transmission on the wire. | ||
1139 | **/ | ||
1140 | static void | ||
1141 | lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd) | ||
1142 | { | ||
1143 | int i, j; | ||
1144 | |||
1145 | for (i = 0, j = 0; i < sizeof(struct fcp_cmnd); | ||
1146 | i += sizeof(uint32_t), j++) { | ||
1147 | ((uint32_t *)data)[j] = cpu_to_be32(((uint32_t *)fcp_cmnd)[j]); | ||
1148 | } | ||
1149 | } | ||
1150 | |||
1151 | /** | ||
1133 | * lpfc_scsi_prep_dma_buf_s3 - DMA mapping for scsi buffer to SLI3 IF spec | 1152 | * lpfc_scsi_prep_dma_buf_s3 - DMA mapping for scsi buffer to SLI3 IF spec |
1134 | * @phba: The Hba for which this call is being executed. | 1153 | * @phba: The Hba for which this call is being executed. |
1135 | * @lpfc_cmd: The scsi buffer which is going to be mapped. | 1154 | * @lpfc_cmd: The scsi buffer which is going to be mapped. |
@@ -1264,6 +1283,7 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
1264 | * we need to set word 4 of IOCB here | 1283 | * we need to set word 4 of IOCB here |
1265 | */ | 1284 | */ |
1266 | iocb_cmd->un.fcpi.fcpi_parm = scsi_bufflen(scsi_cmnd); | 1285 | iocb_cmd->un.fcpi.fcpi_parm = scsi_bufflen(scsi_cmnd); |
1286 | lpfc_fcpcmd_to_iocb(iocb_cmd->unsli3.fcp_ext.icd, fcp_cmnd); | ||
1267 | return 0; | 1287 | return 0; |
1268 | } | 1288 | } |
1269 | 1289 | ||
@@ -4127,24 +4147,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
4127 | } | 4147 | } |
4128 | 4148 | ||
4129 | /** | 4149 | /** |
4130 | * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB | ||
4131 | * @data: A pointer to the immediate command data portion of the IOCB. | ||
4132 | * @fcp_cmnd: The FCP Command that is provided by the SCSI layer. | ||
4133 | * | ||
4134 | * The routine copies the entire FCP command from @fcp_cmnd to @data while | ||
4135 | * byte swapping the data to big endian format for transmission on the wire. | ||
4136 | **/ | ||
4137 | static void | ||
4138 | lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd) | ||
4139 | { | ||
4140 | int i, j; | ||
4141 | for (i = 0, j = 0; i < sizeof(struct fcp_cmnd); | ||
4142 | i += sizeof(uint32_t), j++) { | ||
4143 | ((uint32_t *)data)[j] = cpu_to_be32(((uint32_t *)fcp_cmnd)[j]); | ||
4144 | } | ||
4145 | } | ||
4146 | |||
4147 | /** | ||
4148 | * lpfc_scsi_prep_cmnd - Wrapper func for convert scsi cmnd to FCP info unit | 4150 | * lpfc_scsi_prep_cmnd - Wrapper func for convert scsi cmnd to FCP info unit |
4149 | * @vport: The virtual port for which this call is being executed. | 4151 | * @vport: The virtual port for which this call is being executed. |
4150 | * @lpfc_cmd: The scsi command which needs to send. | 4152 | * @lpfc_cmd: The scsi command which needs to send. |
@@ -4223,9 +4225,6 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
4223 | fcp_cmnd->fcpCntl3 = 0; | 4225 | fcp_cmnd->fcpCntl3 = 0; |
4224 | phba->fc4ControlRequests++; | 4226 | phba->fc4ControlRequests++; |
4225 | } | 4227 | } |
4226 | if (phba->sli_rev == 3 && | ||
4227 | !(phba->sli3_options & LPFC_SLI3_BG_ENABLED)) | ||
4228 | lpfc_fcpcmd_to_iocb(iocb_cmd->unsli3.fcp_ext.icd, fcp_cmnd); | ||
4229 | /* | 4228 | /* |
4230 | * Finish initializing those IOCB fields that are independent | 4229 | * Finish initializing those IOCB fields that are independent |
4231 | * of the scsi_cmnd request_buffer | 4230 | * of the scsi_cmnd request_buffer |