diff options
author | Tyrel Datwyler <tyreld@linux.vnet.ibm.com> | 2014-06-26 20:03:55 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-07-25 17:16:55 -0400 |
commit | 0aab6c3f125e9efcc493caae0cffefe501202a71 (patch) | |
tree | c427657709f0b70e9ef04975855ed0fab51f1dd3 | |
parent | 0ea85b50f8e25649fa711be560b282263d3e756c (diff) |
ibmvfc: fix little endian issues
Added big endian annotations to relevant data structure fields, and necessary
byte swappings to support little endian builds.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvfc.c | 473 | ||||
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvfc.h | 268 |
2 files changed, 374 insertions, 367 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 6eb47b683569..598c42cba5a8 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -166,13 +166,13 @@ static void ibmvfc_trc_start(struct ibmvfc_event *evt) | |||
166 | switch (entry->fmt) { | 166 | switch (entry->fmt) { |
167 | case IBMVFC_CMD_FORMAT: | 167 | case IBMVFC_CMD_FORMAT: |
168 | entry->op_code = vfc_cmd->iu.cdb[0]; | 168 | entry->op_code = vfc_cmd->iu.cdb[0]; |
169 | entry->scsi_id = vfc_cmd->tgt_scsi_id; | 169 | entry->scsi_id = be64_to_cpu(vfc_cmd->tgt_scsi_id); |
170 | entry->lun = scsilun_to_int(&vfc_cmd->iu.lun); | 170 | entry->lun = scsilun_to_int(&vfc_cmd->iu.lun); |
171 | entry->tmf_flags = vfc_cmd->iu.tmf_flags; | 171 | entry->tmf_flags = vfc_cmd->iu.tmf_flags; |
172 | entry->u.start.xfer_len = vfc_cmd->iu.xfer_len; | 172 | entry->u.start.xfer_len = be32_to_cpu(vfc_cmd->iu.xfer_len); |
173 | break; | 173 | break; |
174 | case IBMVFC_MAD_FORMAT: | 174 | case IBMVFC_MAD_FORMAT: |
175 | entry->op_code = mad->opcode; | 175 | entry->op_code = be32_to_cpu(mad->opcode); |
176 | break; | 176 | break; |
177 | default: | 177 | default: |
178 | break; | 178 | break; |
@@ -199,18 +199,18 @@ static void ibmvfc_trc_end(struct ibmvfc_event *evt) | |||
199 | switch (entry->fmt) { | 199 | switch (entry->fmt) { |
200 | case IBMVFC_CMD_FORMAT: | 200 | case IBMVFC_CMD_FORMAT: |
201 | entry->op_code = vfc_cmd->iu.cdb[0]; | 201 | entry->op_code = vfc_cmd->iu.cdb[0]; |
202 | entry->scsi_id = vfc_cmd->tgt_scsi_id; | 202 | entry->scsi_id = be64_to_cpu(vfc_cmd->tgt_scsi_id); |
203 | entry->lun = scsilun_to_int(&vfc_cmd->iu.lun); | 203 | entry->lun = scsilun_to_int(&vfc_cmd->iu.lun); |
204 | entry->tmf_flags = vfc_cmd->iu.tmf_flags; | 204 | entry->tmf_flags = vfc_cmd->iu.tmf_flags; |
205 | entry->u.end.status = vfc_cmd->status; | 205 | entry->u.end.status = be16_to_cpu(vfc_cmd->status); |
206 | entry->u.end.error = vfc_cmd->error; | 206 | entry->u.end.error = be16_to_cpu(vfc_cmd->error); |
207 | entry->u.end.fcp_rsp_flags = vfc_cmd->rsp.flags; | 207 | entry->u.end.fcp_rsp_flags = vfc_cmd->rsp.flags; |
208 | entry->u.end.rsp_code = vfc_cmd->rsp.data.info.rsp_code; | 208 | entry->u.end.rsp_code = vfc_cmd->rsp.data.info.rsp_code; |
209 | entry->u.end.scsi_status = vfc_cmd->rsp.scsi_status; | 209 | entry->u.end.scsi_status = vfc_cmd->rsp.scsi_status; |
210 | break; | 210 | break; |
211 | case IBMVFC_MAD_FORMAT: | 211 | case IBMVFC_MAD_FORMAT: |
212 | entry->op_code = mad->opcode; | 212 | entry->op_code = be32_to_cpu(mad->opcode); |
213 | entry->u.end.status = mad->status; | 213 | entry->u.end.status = be16_to_cpu(mad->status); |
214 | break; | 214 | break; |
215 | default: | 215 | default: |
216 | break; | 216 | break; |
@@ -270,14 +270,14 @@ static int ibmvfc_get_err_result(struct ibmvfc_cmd *vfc_cmd) | |||
270 | { | 270 | { |
271 | int err; | 271 | int err; |
272 | struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; | 272 | struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; |
273 | int fc_rsp_len = rsp->fcp_rsp_len; | 273 | int fc_rsp_len = be32_to_cpu(rsp->fcp_rsp_len); |
274 | 274 | ||
275 | if ((rsp->flags & FCP_RSP_LEN_VALID) && | 275 | if ((rsp->flags & FCP_RSP_LEN_VALID) && |
276 | ((fc_rsp_len && fc_rsp_len != 4 && fc_rsp_len != 8) || | 276 | ((fc_rsp_len && fc_rsp_len != 4 && fc_rsp_len != 8) || |
277 | rsp->data.info.rsp_code)) | 277 | rsp->data.info.rsp_code)) |
278 | return DID_ERROR << 16; | 278 | return DID_ERROR << 16; |
279 | 279 | ||
280 | err = ibmvfc_get_err_index(vfc_cmd->status, vfc_cmd->error); | 280 | err = ibmvfc_get_err_index(be16_to_cpu(vfc_cmd->status), be16_to_cpu(vfc_cmd->error)); |
281 | if (err >= 0) | 281 | if (err >= 0) |
282 | return rsp->scsi_status | (cmd_status[err].result << 16); | 282 | return rsp->scsi_status | (cmd_status[err].result << 16); |
283 | return rsp->scsi_status | (DID_ERROR << 16); | 283 | return rsp->scsi_status | (DID_ERROR << 16); |
@@ -807,7 +807,7 @@ static void ibmvfc_fail_request(struct ibmvfc_event *evt, int error_code) | |||
807 | evt->cmnd->result = (error_code << 16); | 807 | evt->cmnd->result = (error_code << 16); |
808 | evt->done = ibmvfc_scsi_eh_done; | 808 | evt->done = ibmvfc_scsi_eh_done; |
809 | } else | 809 | } else |
810 | evt->xfer_iu->mad_common.status = IBMVFC_MAD_DRIVER_FAILED; | 810 | evt->xfer_iu->mad_common.status = cpu_to_be16(IBMVFC_MAD_DRIVER_FAILED); |
811 | 811 | ||
812 | list_del(&evt->queue); | 812 | list_del(&evt->queue); |
813 | del_timer(&evt->timer); | 813 | del_timer(&evt->timer); |
@@ -955,7 +955,7 @@ static void ibmvfc_get_host_speed(struct Scsi_Host *shost) | |||
955 | 955 | ||
956 | spin_lock_irqsave(shost->host_lock, flags); | 956 | spin_lock_irqsave(shost->host_lock, flags); |
957 | if (vhost->state == IBMVFC_ACTIVE) { | 957 | if (vhost->state == IBMVFC_ACTIVE) { |
958 | switch (vhost->login_buf->resp.link_speed / 100) { | 958 | switch (be64_to_cpu(vhost->login_buf->resp.link_speed) / 100) { |
959 | case 1: | 959 | case 1: |
960 | fc_host_speed(shost) = FC_PORTSPEED_1GBIT; | 960 | fc_host_speed(shost) = FC_PORTSPEED_1GBIT; |
961 | break; | 961 | break; |
@@ -976,7 +976,7 @@ static void ibmvfc_get_host_speed(struct Scsi_Host *shost) | |||
976 | break; | 976 | break; |
977 | default: | 977 | default: |
978 | ibmvfc_log(vhost, 3, "Unknown port speed: %lld Gbit\n", | 978 | ibmvfc_log(vhost, 3, "Unknown port speed: %lld Gbit\n", |
979 | vhost->login_buf->resp.link_speed / 100); | 979 | be64_to_cpu(vhost->login_buf->resp.link_speed) / 100); |
980 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; | 980 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; |
981 | break; | 981 | break; |
982 | } | 982 | } |
@@ -1171,21 +1171,21 @@ static void ibmvfc_set_login_info(struct ibmvfc_host *vhost) | |||
1171 | 1171 | ||
1172 | memset(login_info, 0, sizeof(*login_info)); | 1172 | memset(login_info, 0, sizeof(*login_info)); |
1173 | 1173 | ||
1174 | login_info->ostype = IBMVFC_OS_LINUX; | 1174 | login_info->ostype = cpu_to_be32(IBMVFC_OS_LINUX); |
1175 | login_info->max_dma_len = IBMVFC_MAX_SECTORS << 9; | 1175 | login_info->max_dma_len = cpu_to_be64(IBMVFC_MAX_SECTORS << 9); |
1176 | login_info->max_payload = sizeof(struct ibmvfc_fcp_cmd_iu); | 1176 | login_info->max_payload = cpu_to_be32(sizeof(struct ibmvfc_fcp_cmd_iu)); |
1177 | login_info->max_response = sizeof(struct ibmvfc_fcp_rsp); | 1177 | login_info->max_response = cpu_to_be32(sizeof(struct ibmvfc_fcp_rsp)); |
1178 | login_info->partition_num = vhost->partition_number; | 1178 | login_info->partition_num = cpu_to_be32(vhost->partition_number); |
1179 | login_info->vfc_frame_version = 1; | 1179 | login_info->vfc_frame_version = cpu_to_be32(1); |
1180 | login_info->fcp_version = 3; | 1180 | login_info->fcp_version = cpu_to_be16(3); |
1181 | login_info->flags = IBMVFC_FLUSH_ON_HALT; | 1181 | login_info->flags = cpu_to_be16(IBMVFC_FLUSH_ON_HALT); |
1182 | if (vhost->client_migrated) | 1182 | if (vhost->client_migrated) |
1183 | login_info->flags |= IBMVFC_CLIENT_MIGRATED; | 1183 | login_info->flags |= cpu_to_be16(IBMVFC_CLIENT_MIGRATED); |
1184 | 1184 | ||
1185 | login_info->max_cmds = max_requests + IBMVFC_NUM_INTERNAL_REQ; | 1185 | login_info->max_cmds = cpu_to_be32(max_requests + IBMVFC_NUM_INTERNAL_REQ); |
1186 | login_info->capabilities = IBMVFC_CAN_MIGRATE; | 1186 | login_info->capabilities = cpu_to_be64(IBMVFC_CAN_MIGRATE); |
1187 | login_info->async.va = vhost->async_crq.msg_token; | 1187 | login_info->async.va = cpu_to_be64(vhost->async_crq.msg_token); |
1188 | login_info->async.len = vhost->async_crq.size * sizeof(*vhost->async_crq.msgs); | 1188 | login_info->async.len = cpu_to_be32(vhost->async_crq.size * sizeof(*vhost->async_crq.msgs)); |
1189 | strncpy(login_info->partition_name, vhost->partition_name, IBMVFC_MAX_NAME); | 1189 | strncpy(login_info->partition_name, vhost->partition_name, IBMVFC_MAX_NAME); |
1190 | strncpy(login_info->device_name, | 1190 | strncpy(login_info->device_name, |
1191 | dev_name(&vhost->host->shost_gendev), IBMVFC_MAX_NAME); | 1191 | dev_name(&vhost->host->shost_gendev), IBMVFC_MAX_NAME); |
@@ -1225,7 +1225,7 @@ static int ibmvfc_init_event_pool(struct ibmvfc_host *vhost) | |||
1225 | struct ibmvfc_event *evt = &pool->events[i]; | 1225 | struct ibmvfc_event *evt = &pool->events[i]; |
1226 | atomic_set(&evt->free, 1); | 1226 | atomic_set(&evt->free, 1); |
1227 | evt->crq.valid = 0x80; | 1227 | evt->crq.valid = 0x80; |
1228 | evt->crq.ioba = pool->iu_token + (sizeof(*evt->xfer_iu) * i); | 1228 | evt->crq.ioba = cpu_to_be64(pool->iu_token + (sizeof(*evt->xfer_iu) * i)); |
1229 | evt->xfer_iu = pool->iu_storage + i; | 1229 | evt->xfer_iu = pool->iu_storage + i; |
1230 | evt->vhost = vhost; | 1230 | evt->vhost = vhost; |
1231 | evt->ext_list = NULL; | 1231 | evt->ext_list = NULL; |
@@ -1310,8 +1310,8 @@ static void ibmvfc_map_sg_list(struct scsi_cmnd *scmd, int nseg, | |||
1310 | struct scatterlist *sg; | 1310 | struct scatterlist *sg; |
1311 | 1311 | ||
1312 | scsi_for_each_sg(scmd, sg, nseg, i) { | 1312 | scsi_for_each_sg(scmd, sg, nseg, i) { |
1313 | md[i].va = sg_dma_address(sg); | 1313 | md[i].va = cpu_to_be64(sg_dma_address(sg)); |
1314 | md[i].len = sg_dma_len(sg); | 1314 | md[i].len = cpu_to_be32(sg_dma_len(sg)); |
1315 | md[i].key = 0; | 1315 | md[i].key = 0; |
1316 | } | 1316 | } |
1317 | } | 1317 | } |
@@ -1337,7 +1337,7 @@ static int ibmvfc_map_sg_data(struct scsi_cmnd *scmd, | |||
1337 | 1337 | ||
1338 | sg_mapped = scsi_dma_map(scmd); | 1338 | sg_mapped = scsi_dma_map(scmd); |
1339 | if (!sg_mapped) { | 1339 | if (!sg_mapped) { |
1340 | vfc_cmd->flags |= IBMVFC_NO_MEM_DESC; | 1340 | vfc_cmd->flags |= cpu_to_be16(IBMVFC_NO_MEM_DESC); |
1341 | return 0; | 1341 | return 0; |
1342 | } else if (unlikely(sg_mapped < 0)) { | 1342 | } else if (unlikely(sg_mapped < 0)) { |
1343 | if (vhost->log_level > IBMVFC_DEFAULT_LOG_LEVEL) | 1343 | if (vhost->log_level > IBMVFC_DEFAULT_LOG_LEVEL) |
@@ -1346,10 +1346,10 @@ static int ibmvfc_map_sg_data(struct scsi_cmnd *scmd, | |||
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | if (scmd->sc_data_direction == DMA_TO_DEVICE) { | 1348 | if (scmd->sc_data_direction == DMA_TO_DEVICE) { |
1349 | vfc_cmd->flags |= IBMVFC_WRITE; | 1349 | vfc_cmd->flags |= cpu_to_be16(IBMVFC_WRITE); |
1350 | vfc_cmd->iu.add_cdb_len |= IBMVFC_WRDATA; | 1350 | vfc_cmd->iu.add_cdb_len |= IBMVFC_WRDATA; |
1351 | } else { | 1351 | } else { |
1352 | vfc_cmd->flags |= IBMVFC_READ; | 1352 | vfc_cmd->flags |= cpu_to_be16(IBMVFC_READ); |
1353 | vfc_cmd->iu.add_cdb_len |= IBMVFC_RDDATA; | 1353 | vfc_cmd->iu.add_cdb_len |= IBMVFC_RDDATA; |
1354 | } | 1354 | } |
1355 | 1355 | ||
@@ -1358,7 +1358,7 @@ static int ibmvfc_map_sg_data(struct scsi_cmnd *scmd, | |||
1358 | return 0; | 1358 | return 0; |
1359 | } | 1359 | } |
1360 | 1360 | ||
1361 | vfc_cmd->flags |= IBMVFC_SCATTERLIST; | 1361 | vfc_cmd->flags |= cpu_to_be16(IBMVFC_SCATTERLIST); |
1362 | 1362 | ||
1363 | if (!evt->ext_list) { | 1363 | if (!evt->ext_list) { |
1364 | evt->ext_list = dma_pool_alloc(vhost->sg_pool, GFP_ATOMIC, | 1364 | evt->ext_list = dma_pool_alloc(vhost->sg_pool, GFP_ATOMIC, |
@@ -1374,8 +1374,8 @@ static int ibmvfc_map_sg_data(struct scsi_cmnd *scmd, | |||
1374 | 1374 | ||
1375 | ibmvfc_map_sg_list(scmd, sg_mapped, evt->ext_list); | 1375 | ibmvfc_map_sg_list(scmd, sg_mapped, evt->ext_list); |
1376 | 1376 | ||
1377 | data->va = evt->ext_list_token; | 1377 | data->va = cpu_to_be64(evt->ext_list_token); |
1378 | data->len = sg_mapped * sizeof(struct srp_direct_buf); | 1378 | data->len = cpu_to_be32(sg_mapped * sizeof(struct srp_direct_buf)); |
1379 | data->key = 0; | 1379 | data->key = 0; |
1380 | return 0; | 1380 | return 0; |
1381 | } | 1381 | } |
@@ -1404,15 +1404,15 @@ static void ibmvfc_timeout(struct ibmvfc_event *evt) | |||
1404 | static int ibmvfc_send_event(struct ibmvfc_event *evt, | 1404 | static int ibmvfc_send_event(struct ibmvfc_event *evt, |
1405 | struct ibmvfc_host *vhost, unsigned long timeout) | 1405 | struct ibmvfc_host *vhost, unsigned long timeout) |
1406 | { | 1406 | { |
1407 | u64 *crq_as_u64 = (u64 *) &evt->crq; | 1407 | __be64 *crq_as_u64 = (__be64 *) &evt->crq; |
1408 | int rc; | 1408 | int rc; |
1409 | 1409 | ||
1410 | /* Copy the IU into the transfer area */ | 1410 | /* Copy the IU into the transfer area */ |
1411 | *evt->xfer_iu = evt->iu; | 1411 | *evt->xfer_iu = evt->iu; |
1412 | if (evt->crq.format == IBMVFC_CMD_FORMAT) | 1412 | if (evt->crq.format == IBMVFC_CMD_FORMAT) |
1413 | evt->xfer_iu->cmd.tag = (u64)evt; | 1413 | evt->xfer_iu->cmd.tag = cpu_to_be64((u64)evt); |
1414 | else if (evt->crq.format == IBMVFC_MAD_FORMAT) | 1414 | else if (evt->crq.format == IBMVFC_MAD_FORMAT) |
1415 | evt->xfer_iu->mad_common.tag = (u64)evt; | 1415 | evt->xfer_iu->mad_common.tag = cpu_to_be64((u64)evt); |
1416 | else | 1416 | else |
1417 | BUG(); | 1417 | BUG(); |
1418 | 1418 | ||
@@ -1428,7 +1428,8 @@ static int ibmvfc_send_event(struct ibmvfc_event *evt, | |||
1428 | 1428 | ||
1429 | mb(); | 1429 | mb(); |
1430 | 1430 | ||
1431 | if ((rc = ibmvfc_send_crq(vhost, crq_as_u64[0], crq_as_u64[1]))) { | 1431 | if ((rc = ibmvfc_send_crq(vhost, be64_to_cpu(crq_as_u64[0]), |
1432 | be64_to_cpu(crq_as_u64[1])))) { | ||
1432 | list_del(&evt->queue); | 1433 | list_del(&evt->queue); |
1433 | del_timer(&evt->timer); | 1434 | del_timer(&evt->timer); |
1434 | 1435 | ||
@@ -1451,7 +1452,7 @@ static int ibmvfc_send_event(struct ibmvfc_event *evt, | |||
1451 | evt->cmnd->result = DID_ERROR << 16; | 1452 | evt->cmnd->result = DID_ERROR << 16; |
1452 | evt->done = ibmvfc_scsi_eh_done; | 1453 | evt->done = ibmvfc_scsi_eh_done; |
1453 | } else | 1454 | } else |
1454 | evt->xfer_iu->mad_common.status = IBMVFC_MAD_CRQ_ERROR; | 1455 | evt->xfer_iu->mad_common.status = cpu_to_be16(IBMVFC_MAD_CRQ_ERROR); |
1455 | 1456 | ||
1456 | evt->done(evt); | 1457 | evt->done(evt); |
1457 | } else | 1458 | } else |
@@ -1472,7 +1473,7 @@ static void ibmvfc_log_error(struct ibmvfc_event *evt) | |||
1472 | struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; | 1473 | struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; |
1473 | struct scsi_cmnd *cmnd = evt->cmnd; | 1474 | struct scsi_cmnd *cmnd = evt->cmnd; |
1474 | const char *err = unknown_error; | 1475 | const char *err = unknown_error; |
1475 | int index = ibmvfc_get_err_index(vfc_cmd->status, vfc_cmd->error); | 1476 | int index = ibmvfc_get_err_index(be16_to_cpu(vfc_cmd->status), be16_to_cpu(vfc_cmd->error)); |
1476 | int logerr = 0; | 1477 | int logerr = 0; |
1477 | int rsp_code = 0; | 1478 | int rsp_code = 0; |
1478 | 1479 | ||
@@ -1526,13 +1527,13 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt) | |||
1526 | struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; | 1527 | struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; |
1527 | struct scsi_cmnd *cmnd = evt->cmnd; | 1528 | struct scsi_cmnd *cmnd = evt->cmnd; |
1528 | u32 rsp_len = 0; | 1529 | u32 rsp_len = 0; |
1529 | u32 sense_len = rsp->fcp_sense_len; | 1530 | u32 sense_len = be32_to_cpu(rsp->fcp_sense_len); |
1530 | 1531 | ||
1531 | if (cmnd) { | 1532 | if (cmnd) { |
1532 | if (vfc_cmd->response_flags & IBMVFC_ADAPTER_RESID_VALID) | 1533 | if (be16_to_cpu(vfc_cmd->response_flags) & IBMVFC_ADAPTER_RESID_VALID) |
1533 | scsi_set_resid(cmnd, vfc_cmd->adapter_resid); | 1534 | scsi_set_resid(cmnd, be32_to_cpu(vfc_cmd->adapter_resid)); |
1534 | else if (rsp->flags & FCP_RESID_UNDER) | 1535 | else if (rsp->flags & FCP_RESID_UNDER) |
1535 | scsi_set_resid(cmnd, rsp->fcp_resid); | 1536 | scsi_set_resid(cmnd, be32_to_cpu(rsp->fcp_resid)); |
1536 | else | 1537 | else |
1537 | scsi_set_resid(cmnd, 0); | 1538 | scsi_set_resid(cmnd, 0); |
1538 | 1539 | ||
@@ -1540,12 +1541,13 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt) | |||
1540 | cmnd->result = ibmvfc_get_err_result(vfc_cmd); | 1541 | cmnd->result = ibmvfc_get_err_result(vfc_cmd); |
1541 | 1542 | ||
1542 | if (rsp->flags & FCP_RSP_LEN_VALID) | 1543 | if (rsp->flags & FCP_RSP_LEN_VALID) |
1543 | rsp_len = rsp->fcp_rsp_len; | 1544 | rsp_len = be32_to_cpu(rsp->fcp_rsp_len); |
1544 | if ((sense_len + rsp_len) > SCSI_SENSE_BUFFERSIZE) | 1545 | if ((sense_len + rsp_len) > SCSI_SENSE_BUFFERSIZE) |
1545 | sense_len = SCSI_SENSE_BUFFERSIZE - rsp_len; | 1546 | sense_len = SCSI_SENSE_BUFFERSIZE - rsp_len; |
1546 | if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len && rsp_len <= 8) | 1547 | if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len && rsp_len <= 8) |
1547 | memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len); | 1548 | memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len); |
1548 | if ((vfc_cmd->status & IBMVFC_VIOS_FAILURE) && (vfc_cmd->error == IBMVFC_PLOGI_REQUIRED)) | 1549 | if ((be16_to_cpu(vfc_cmd->status) & IBMVFC_VIOS_FAILURE) && |
1550 | (be16_to_cpu(vfc_cmd->error) == IBMVFC_PLOGI_REQUIRED)) | ||
1549 | ibmvfc_relogin(cmnd->device); | 1551 | ibmvfc_relogin(cmnd->device); |
1550 | 1552 | ||
1551 | if (!cmnd->result && (!scsi_get_resid(cmnd) || (rsp->flags & FCP_RESID_OVER))) | 1553 | if (!cmnd->result && (!scsi_get_resid(cmnd) || (rsp->flags & FCP_RESID_OVER))) |
@@ -1630,19 +1632,19 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd, | |||
1630 | cmnd->scsi_done = done; | 1632 | cmnd->scsi_done = done; |
1631 | vfc_cmd = &evt->iu.cmd; | 1633 | vfc_cmd = &evt->iu.cmd; |
1632 | memset(vfc_cmd, 0, sizeof(*vfc_cmd)); | 1634 | memset(vfc_cmd, 0, sizeof(*vfc_cmd)); |
1633 | vfc_cmd->resp.va = (u64)evt->crq.ioba + offsetof(struct ibmvfc_cmd, rsp); | 1635 | vfc_cmd->resp.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + offsetof(struct ibmvfc_cmd, rsp)); |
1634 | vfc_cmd->resp.len = sizeof(vfc_cmd->rsp); | 1636 | vfc_cmd->resp.len = cpu_to_be32(sizeof(vfc_cmd->rsp)); |
1635 | vfc_cmd->frame_type = IBMVFC_SCSI_FCP_TYPE; | 1637 | vfc_cmd->frame_type = cpu_to_be32(IBMVFC_SCSI_FCP_TYPE); |
1636 | vfc_cmd->payload_len = sizeof(vfc_cmd->iu); | 1638 | vfc_cmd->payload_len = cpu_to_be32(sizeof(vfc_cmd->iu)); |
1637 | vfc_cmd->resp_len = sizeof(vfc_cmd->rsp); | 1639 | vfc_cmd->resp_len = cpu_to_be32(sizeof(vfc_cmd->rsp)); |
1638 | vfc_cmd->cancel_key = (unsigned long)cmnd->device->hostdata; | 1640 | vfc_cmd->cancel_key = cpu_to_be32((unsigned long)cmnd->device->hostdata); |
1639 | vfc_cmd->tgt_scsi_id = rport->port_id; | 1641 | vfc_cmd->tgt_scsi_id = cpu_to_be64(rport->port_id); |
1640 | vfc_cmd->iu.xfer_len = scsi_bufflen(cmnd); | 1642 | vfc_cmd->iu.xfer_len = cpu_to_be32(scsi_bufflen(cmnd)); |
1641 | int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun); | 1643 | int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun); |
1642 | memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len); | 1644 | memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len); |
1643 | 1645 | ||
1644 | if (scsi_populate_tag_msg(cmnd, tag)) { | 1646 | if (scsi_populate_tag_msg(cmnd, tag)) { |
1645 | vfc_cmd->task_tag = tag[1]; | 1647 | vfc_cmd->task_tag = cpu_to_be64(tag[1]); |
1646 | switch (tag[0]) { | 1648 | switch (tag[0]) { |
1647 | case MSG_SIMPLE_TAG: | 1649 | case MSG_SIMPLE_TAG: |
1648 | vfc_cmd->iu.pri_task_attr = IBMVFC_SIMPLE_TASK; | 1650 | vfc_cmd->iu.pri_task_attr = IBMVFC_SIMPLE_TASK; |
@@ -1732,12 +1734,12 @@ static int ibmvfc_bsg_timeout(struct fc_bsg_job *job) | |||
1732 | 1734 | ||
1733 | tmf = &evt->iu.tmf; | 1735 | tmf = &evt->iu.tmf; |
1734 | memset(tmf, 0, sizeof(*tmf)); | 1736 | memset(tmf, 0, sizeof(*tmf)); |
1735 | tmf->common.version = 1; | 1737 | tmf->common.version = cpu_to_be32(1); |
1736 | tmf->common.opcode = IBMVFC_TMF_MAD; | 1738 | tmf->common.opcode = cpu_to_be32(IBMVFC_TMF_MAD); |
1737 | tmf->common.length = sizeof(*tmf); | 1739 | tmf->common.length = cpu_to_be16(sizeof(*tmf)); |
1738 | tmf->scsi_id = port_id; | 1740 | tmf->scsi_id = cpu_to_be64(port_id); |
1739 | tmf->cancel_key = IBMVFC_PASSTHRU_CANCEL_KEY; | 1741 | tmf->cancel_key = cpu_to_be32(IBMVFC_PASSTHRU_CANCEL_KEY); |
1740 | tmf->my_cancel_key = IBMVFC_INTERNAL_CANCEL_KEY; | 1742 | tmf->my_cancel_key = cpu_to_be32(IBMVFC_INTERNAL_CANCEL_KEY); |
1741 | rc = ibmvfc_send_event(evt, vhost, default_timeout); | 1743 | rc = ibmvfc_send_event(evt, vhost, default_timeout); |
1742 | 1744 | ||
1743 | if (rc != 0) { | 1745 | if (rc != 0) { |
@@ -1789,10 +1791,10 @@ static int ibmvfc_bsg_plogi(struct ibmvfc_host *vhost, unsigned int port_id) | |||
1789 | ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); | 1791 | ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); |
1790 | plogi = &evt->iu.plogi; | 1792 | plogi = &evt->iu.plogi; |
1791 | memset(plogi, 0, sizeof(*plogi)); | 1793 | memset(plogi, 0, sizeof(*plogi)); |
1792 | plogi->common.version = 1; | 1794 | plogi->common.version = cpu_to_be32(1); |
1793 | plogi->common.opcode = IBMVFC_PORT_LOGIN; | 1795 | plogi->common.opcode = cpu_to_be32(IBMVFC_PORT_LOGIN); |
1794 | plogi->common.length = sizeof(*plogi); | 1796 | plogi->common.length = cpu_to_be16(sizeof(*plogi)); |
1795 | plogi->scsi_id = port_id; | 1797 | plogi->scsi_id = cpu_to_be64(port_id); |
1796 | evt->sync_iu = &rsp_iu; | 1798 | evt->sync_iu = &rsp_iu; |
1797 | init_completion(&evt->comp); | 1799 | init_completion(&evt->comp); |
1798 | 1800 | ||
@@ -1904,26 +1906,26 @@ static int ibmvfc_bsg_request(struct fc_bsg_job *job) | |||
1904 | mad = &evt->iu.passthru; | 1906 | mad = &evt->iu.passthru; |
1905 | 1907 | ||
1906 | memset(mad, 0, sizeof(*mad)); | 1908 | memset(mad, 0, sizeof(*mad)); |
1907 | mad->common.version = 1; | 1909 | mad->common.version = cpu_to_be32(1); |
1908 | mad->common.opcode = IBMVFC_PASSTHRU; | 1910 | mad->common.opcode = cpu_to_be32(IBMVFC_PASSTHRU); |
1909 | mad->common.length = sizeof(*mad) - sizeof(mad->fc_iu) - sizeof(mad->iu); | 1911 | mad->common.length = cpu_to_be16(sizeof(*mad) - sizeof(mad->fc_iu) - sizeof(mad->iu)); |
1910 | 1912 | ||
1911 | mad->cmd_ioba.va = (u64)evt->crq.ioba + | 1913 | mad->cmd_ioba.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + |
1912 | offsetof(struct ibmvfc_passthru_mad, iu); | 1914 | offsetof(struct ibmvfc_passthru_mad, iu)); |
1913 | mad->cmd_ioba.len = sizeof(mad->iu); | 1915 | mad->cmd_ioba.len = cpu_to_be32(sizeof(mad->iu)); |
1914 | 1916 | ||
1915 | mad->iu.cmd_len = job->request_payload.payload_len; | 1917 | mad->iu.cmd_len = cpu_to_be32(job->request_payload.payload_len); |
1916 | mad->iu.rsp_len = job->reply_payload.payload_len; | 1918 | mad->iu.rsp_len = cpu_to_be32(job->reply_payload.payload_len); |
1917 | mad->iu.flags = fc_flags; | 1919 | mad->iu.flags = cpu_to_be32(fc_flags); |
1918 | mad->iu.cancel_key = IBMVFC_PASSTHRU_CANCEL_KEY; | 1920 | mad->iu.cancel_key = cpu_to_be32(IBMVFC_PASSTHRU_CANCEL_KEY); |
1919 | 1921 | ||
1920 | mad->iu.cmd.va = sg_dma_address(job->request_payload.sg_list); | 1922 | mad->iu.cmd.va = cpu_to_be64(sg_dma_address(job->request_payload.sg_list)); |
1921 | mad->iu.cmd.len = sg_dma_len(job->request_payload.sg_list); | 1923 | mad->iu.cmd.len = cpu_to_be32(sg_dma_len(job->request_payload.sg_list)); |
1922 | mad->iu.rsp.va = sg_dma_address(job->reply_payload.sg_list); | 1924 | mad->iu.rsp.va = cpu_to_be64(sg_dma_address(job->reply_payload.sg_list)); |
1923 | mad->iu.rsp.len = sg_dma_len(job->reply_payload.sg_list); | 1925 | mad->iu.rsp.len = cpu_to_be32(sg_dma_len(job->reply_payload.sg_list)); |
1924 | mad->iu.scsi_id = port_id; | 1926 | mad->iu.scsi_id = cpu_to_be64(port_id); |
1925 | mad->iu.tag = (u64)evt; | 1927 | mad->iu.tag = cpu_to_be64((u64)evt); |
1926 | rsp_len = mad->iu.rsp.len; | 1928 | rsp_len = be32_to_cpu(mad->iu.rsp.len); |
1927 | 1929 | ||
1928 | evt->sync_iu = &rsp_iu; | 1930 | evt->sync_iu = &rsp_iu; |
1929 | init_completion(&evt->comp); | 1931 | init_completion(&evt->comp); |
@@ -1986,15 +1988,15 @@ static int ibmvfc_reset_device(struct scsi_device *sdev, int type, char *desc) | |||
1986 | 1988 | ||
1987 | tmf = &evt->iu.cmd; | 1989 | tmf = &evt->iu.cmd; |
1988 | memset(tmf, 0, sizeof(*tmf)); | 1990 | memset(tmf, 0, sizeof(*tmf)); |
1989 | tmf->resp.va = (u64)evt->crq.ioba + offsetof(struct ibmvfc_cmd, rsp); | 1991 | tmf->resp.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + offsetof(struct ibmvfc_cmd, rsp)); |
1990 | tmf->resp.len = sizeof(tmf->rsp); | 1992 | tmf->resp.len = cpu_to_be32(sizeof(tmf->rsp)); |
1991 | tmf->frame_type = IBMVFC_SCSI_FCP_TYPE; | 1993 | tmf->frame_type = cpu_to_be32(IBMVFC_SCSI_FCP_TYPE); |
1992 | tmf->payload_len = sizeof(tmf->iu); | 1994 | tmf->payload_len = cpu_to_be32(sizeof(tmf->iu)); |
1993 | tmf->resp_len = sizeof(tmf->rsp); | 1995 | tmf->resp_len = cpu_to_be32(sizeof(tmf->rsp)); |
1994 | tmf->cancel_key = (unsigned long)sdev->hostdata; | 1996 | tmf->cancel_key = cpu_to_be32((unsigned long)sdev->hostdata); |
1995 | tmf->tgt_scsi_id = rport->port_id; | 1997 | tmf->tgt_scsi_id = cpu_to_be64(rport->port_id); |
1996 | int_to_scsilun(sdev->lun, &tmf->iu.lun); | 1998 | int_to_scsilun(sdev->lun, &tmf->iu.lun); |
1997 | tmf->flags = (IBMVFC_NO_MEM_DESC | IBMVFC_TMF); | 1999 | tmf->flags = cpu_to_be16((IBMVFC_NO_MEM_DESC | IBMVFC_TMF)); |
1998 | tmf->iu.tmf_flags = type; | 2000 | tmf->iu.tmf_flags = type; |
1999 | evt->sync_iu = &rsp_iu; | 2001 | evt->sync_iu = &rsp_iu; |
2000 | 2002 | ||
@@ -2020,8 +2022,8 @@ static int ibmvfc_reset_device(struct scsi_device *sdev, int type, char *desc) | |||
2020 | rsp_code = fc_rsp->data.info.rsp_code; | 2022 | rsp_code = fc_rsp->data.info.rsp_code; |
2021 | 2023 | ||
2022 | sdev_printk(KERN_ERR, sdev, "%s reset failed: %s (%x:%x) " | 2024 | sdev_printk(KERN_ERR, sdev, "%s reset failed: %s (%x:%x) " |
2023 | "flags: %x fcp_rsp: %x, scsi_status: %x\n", | 2025 | "flags: %x fcp_rsp: %x, scsi_status: %x\n", desc, |
2024 | desc, ibmvfc_get_cmd_error(rsp_iu.cmd.status, rsp_iu.cmd.error), | 2026 | ibmvfc_get_cmd_error(be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error)), |
2025 | rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, | 2027 | rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, |
2026 | fc_rsp->scsi_status); | 2028 | fc_rsp->scsi_status); |
2027 | rsp_rc = -EIO; | 2029 | rsp_rc = -EIO; |
@@ -2185,19 +2187,19 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) | |||
2185 | 2187 | ||
2186 | tmf = &evt->iu.tmf; | 2188 | tmf = &evt->iu.tmf; |
2187 | memset(tmf, 0, sizeof(*tmf)); | 2189 | memset(tmf, 0, sizeof(*tmf)); |
2188 | tmf->common.version = 1; | 2190 | tmf->common.version = cpu_to_be32(1); |
2189 | tmf->common.opcode = IBMVFC_TMF_MAD; | 2191 | tmf->common.opcode = cpu_to_be32(IBMVFC_TMF_MAD); |
2190 | tmf->common.length = sizeof(*tmf); | 2192 | tmf->common.length = cpu_to_be16(sizeof(*tmf)); |
2191 | tmf->scsi_id = rport->port_id; | 2193 | tmf->scsi_id = cpu_to_be64(rport->port_id); |
2192 | int_to_scsilun(sdev->lun, &tmf->lun); | 2194 | int_to_scsilun(sdev->lun, &tmf->lun); |
2193 | if (!(vhost->login_buf->resp.capabilities & IBMVFC_CAN_SUPPRESS_ABTS)) | 2195 | if (!(be64_to_cpu(vhost->login_buf->resp.capabilities) & IBMVFC_CAN_SUPPRESS_ABTS)) |
2194 | type &= ~IBMVFC_TMF_SUPPRESS_ABTS; | 2196 | type &= ~IBMVFC_TMF_SUPPRESS_ABTS; |
2195 | if (vhost->state == IBMVFC_ACTIVE) | 2197 | if (vhost->state == IBMVFC_ACTIVE) |
2196 | tmf->flags = (type | IBMVFC_TMF_LUA_VALID); | 2198 | tmf->flags = cpu_to_be32((type | IBMVFC_TMF_LUA_VALID)); |
2197 | else | 2199 | else |
2198 | tmf->flags = ((type & IBMVFC_TMF_SUPPRESS_ABTS) | IBMVFC_TMF_LUA_VALID); | 2200 | tmf->flags = cpu_to_be32(((type & IBMVFC_TMF_SUPPRESS_ABTS) | IBMVFC_TMF_LUA_VALID)); |
2199 | tmf->cancel_key = (unsigned long)sdev->hostdata; | 2201 | tmf->cancel_key = cpu_to_be32((unsigned long)sdev->hostdata); |
2200 | tmf->my_cancel_key = (unsigned long)starget->hostdata; | 2202 | tmf->my_cancel_key = cpu_to_be32((unsigned long)starget->hostdata); |
2201 | 2203 | ||
2202 | evt->sync_iu = &rsp; | 2204 | evt->sync_iu = &rsp; |
2203 | init_completion(&evt->comp); | 2205 | init_completion(&evt->comp); |
@@ -2217,7 +2219,7 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) | |||
2217 | sdev_printk(KERN_INFO, sdev, "Cancelling outstanding commands.\n"); | 2219 | sdev_printk(KERN_INFO, sdev, "Cancelling outstanding commands.\n"); |
2218 | 2220 | ||
2219 | wait_for_completion(&evt->comp); | 2221 | wait_for_completion(&evt->comp); |
2220 | status = rsp.mad_common.status; | 2222 | status = be16_to_cpu(rsp.mad_common.status); |
2221 | spin_lock_irqsave(vhost->host->host_lock, flags); | 2223 | spin_lock_irqsave(vhost->host->host_lock, flags); |
2222 | ibmvfc_free_event(evt); | 2224 | ibmvfc_free_event(evt); |
2223 | spin_unlock_irqrestore(vhost->host->host_lock, flags); | 2225 | spin_unlock_irqrestore(vhost->host->host_lock, flags); |
@@ -2252,7 +2254,7 @@ static int ibmvfc_match_key(struct ibmvfc_event *evt, void *key) | |||
2252 | unsigned long cancel_key = (unsigned long)key; | 2254 | unsigned long cancel_key = (unsigned long)key; |
2253 | 2255 | ||
2254 | if (evt->crq.format == IBMVFC_CMD_FORMAT && | 2256 | if (evt->crq.format == IBMVFC_CMD_FORMAT && |
2255 | evt->iu.cmd.cancel_key == cancel_key) | 2257 | be32_to_cpu(evt->iu.cmd.cancel_key) == cancel_key) |
2256 | return 1; | 2258 | return 1; |
2257 | return 0; | 2259 | return 0; |
2258 | } | 2260 | } |
@@ -2316,15 +2318,15 @@ static int ibmvfc_abort_task_set(struct scsi_device *sdev) | |||
2316 | 2318 | ||
2317 | tmf = &evt->iu.cmd; | 2319 | tmf = &evt->iu.cmd; |
2318 | memset(tmf, 0, sizeof(*tmf)); | 2320 | memset(tmf, 0, sizeof(*tmf)); |
2319 | tmf->resp.va = (u64)evt->crq.ioba + offsetof(struct ibmvfc_cmd, rsp); | 2321 | tmf->resp.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + offsetof(struct ibmvfc_cmd, rsp)); |
2320 | tmf->resp.len = sizeof(tmf->rsp); | 2322 | tmf->resp.len = cpu_to_be32(sizeof(tmf->rsp)); |
2321 | tmf->frame_type = IBMVFC_SCSI_FCP_TYPE; | 2323 | tmf->frame_type = cpu_to_be32(IBMVFC_SCSI_FCP_TYPE); |
2322 | tmf->payload_len = sizeof(tmf->iu); | 2324 | tmf->payload_len = cpu_to_be32(sizeof(tmf->iu)); |
2323 | tmf->resp_len = sizeof(tmf->rsp); | 2325 | tmf->resp_len = cpu_to_be32(sizeof(tmf->rsp)); |
2324 | tmf->cancel_key = (unsigned long)sdev->hostdata; | 2326 | tmf->cancel_key = cpu_to_be32((unsigned long)sdev->hostdata); |
2325 | tmf->tgt_scsi_id = rport->port_id; | 2327 | tmf->tgt_scsi_id = cpu_to_be64(rport->port_id); |
2326 | int_to_scsilun(sdev->lun, &tmf->iu.lun); | 2328 | int_to_scsilun(sdev->lun, &tmf->iu.lun); |
2327 | tmf->flags = (IBMVFC_NO_MEM_DESC | IBMVFC_TMF); | 2329 | tmf->flags = cpu_to_be16((IBMVFC_NO_MEM_DESC | IBMVFC_TMF)); |
2328 | tmf->iu.tmf_flags = IBMVFC_ABORT_TASK_SET; | 2330 | tmf->iu.tmf_flags = IBMVFC_ABORT_TASK_SET; |
2329 | evt->sync_iu = &rsp_iu; | 2331 | evt->sync_iu = &rsp_iu; |
2330 | 2332 | ||
@@ -2380,7 +2382,7 @@ static int ibmvfc_abort_task_set(struct scsi_device *sdev) | |||
2380 | 2382 | ||
2381 | sdev_printk(KERN_ERR, sdev, "Abort failed: %s (%x:%x) " | 2383 | sdev_printk(KERN_ERR, sdev, "Abort failed: %s (%x:%x) " |
2382 | "flags: %x fcp_rsp: %x, scsi_status: %x\n", | 2384 | "flags: %x fcp_rsp: %x, scsi_status: %x\n", |
2383 | ibmvfc_get_cmd_error(rsp_iu.cmd.status, rsp_iu.cmd.error), | 2385 | ibmvfc_get_cmd_error(be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error)), |
2384 | rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, | 2386 | rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, |
2385 | fc_rsp->scsi_status); | 2387 | fc_rsp->scsi_status); |
2386 | rsp_rc = -EIO; | 2388 | rsp_rc = -EIO; |
@@ -2641,14 +2643,14 @@ static const char *ibmvfc_get_link_state(enum ibmvfc_ae_link_state state) | |||
2641 | static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, | 2643 | static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, |
2642 | struct ibmvfc_host *vhost) | 2644 | struct ibmvfc_host *vhost) |
2643 | { | 2645 | { |
2644 | const struct ibmvfc_async_desc *desc = ibmvfc_get_ae_desc(crq->event); | 2646 | const struct ibmvfc_async_desc *desc = ibmvfc_get_ae_desc(be64_to_cpu(crq->event)); |
2645 | struct ibmvfc_target *tgt; | 2647 | struct ibmvfc_target *tgt; |
2646 | 2648 | ||
2647 | ibmvfc_log(vhost, desc->log_level, "%s event received. scsi_id: %llx, wwpn: %llx," | 2649 | ibmvfc_log(vhost, desc->log_level, "%s event received. scsi_id: %llx, wwpn: %llx," |
2648 | " node_name: %llx%s\n", desc->desc, crq->scsi_id, crq->wwpn, crq->node_name, | 2650 | " node_name: %llx%s\n", desc->desc, crq->scsi_id, crq->wwpn, crq->node_name, |
2649 | ibmvfc_get_link_state(crq->link_state)); | 2651 | ibmvfc_get_link_state(crq->link_state)); |
2650 | 2652 | ||
2651 | switch (crq->event) { | 2653 | switch (be64_to_cpu(crq->event)) { |
2652 | case IBMVFC_AE_RESUME: | 2654 | case IBMVFC_AE_RESUME: |
2653 | switch (crq->link_state) { | 2655 | switch (crq->link_state) { |
2654 | case IBMVFC_AE_LS_LINK_DOWN: | 2656 | case IBMVFC_AE_LS_LINK_DOWN: |
@@ -2691,15 +2693,15 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, | |||
2691 | list_for_each_entry(tgt, &vhost->targets, queue) { | 2693 | list_for_each_entry(tgt, &vhost->targets, queue) { |
2692 | if (!crq->scsi_id && !crq->wwpn && !crq->node_name) | 2694 | if (!crq->scsi_id && !crq->wwpn && !crq->node_name) |
2693 | break; | 2695 | break; |
2694 | if (crq->scsi_id && tgt->scsi_id != crq->scsi_id) | 2696 | if (crq->scsi_id && cpu_to_be64(tgt->scsi_id) != crq->scsi_id) |
2695 | continue; | 2697 | continue; |
2696 | if (crq->wwpn && tgt->ids.port_name != crq->wwpn) | 2698 | if (crq->wwpn && cpu_to_be64(tgt->ids.port_name) != crq->wwpn) |
2697 | continue; | 2699 | continue; |
2698 | if (crq->node_name && tgt->ids.node_name != crq->node_name) | 2700 | if (crq->node_name && cpu_to_be64(tgt->ids.node_name) != crq->node_name) |
2699 | continue; | 2701 | continue; |
2700 | if (tgt->need_login && crq->event == IBMVFC_AE_ELS_LOGO) | 2702 | if (tgt->need_login && be64_to_cpu(crq->event) == IBMVFC_AE_ELS_LOGO) |
2701 | tgt->logo_rcvd = 1; | 2703 | tgt->logo_rcvd = 1; |
2702 | if (!tgt->need_login || crq->event == IBMVFC_AE_ELS_PLOGI) { | 2704 | if (!tgt->need_login || be64_to_cpu(crq->event) == IBMVFC_AE_ELS_PLOGI) { |
2703 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 2705 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
2704 | ibmvfc_reinit_host(vhost); | 2706 | ibmvfc_reinit_host(vhost); |
2705 | } | 2707 | } |
@@ -2730,7 +2732,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, | |||
2730 | static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost) | 2732 | static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost) |
2731 | { | 2733 | { |
2732 | long rc; | 2734 | long rc; |
2733 | struct ibmvfc_event *evt = (struct ibmvfc_event *)crq->ioba; | 2735 | struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); |
2734 | 2736 | ||
2735 | switch (crq->valid) { | 2737 | switch (crq->valid) { |
2736 | case IBMVFC_CRQ_INIT_RSP: | 2738 | case IBMVFC_CRQ_INIT_RSP: |
@@ -3336,7 +3338,7 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt) | |||
3336 | struct ibmvfc_host *vhost = evt->vhost; | 3338 | struct ibmvfc_host *vhost = evt->vhost; |
3337 | struct ibmvfc_process_login *rsp = &evt->xfer_iu->prli; | 3339 | struct ibmvfc_process_login *rsp = &evt->xfer_iu->prli; |
3338 | struct ibmvfc_prli_svc_parms *parms = &rsp->parms; | 3340 | struct ibmvfc_prli_svc_parms *parms = &rsp->parms; |
3339 | u32 status = rsp->common.status; | 3341 | u32 status = be16_to_cpu(rsp->common.status); |
3340 | int index, level = IBMVFC_DEFAULT_LOG_LEVEL; | 3342 | int index, level = IBMVFC_DEFAULT_LOG_LEVEL; |
3341 | 3343 | ||
3342 | vhost->discovery_threads--; | 3344 | vhost->discovery_threads--; |
@@ -3347,14 +3349,14 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt) | |||
3347 | parms->type, parms->flags, parms->service_parms); | 3349 | parms->type, parms->flags, parms->service_parms); |
3348 | 3350 | ||
3349 | if (parms->type == IBMVFC_SCSI_FCP_TYPE) { | 3351 | if (parms->type == IBMVFC_SCSI_FCP_TYPE) { |
3350 | index = ibmvfc_get_prli_rsp(parms->flags); | 3352 | index = ibmvfc_get_prli_rsp(be16_to_cpu(parms->flags)); |
3351 | if (prli_rsp[index].logged_in) { | 3353 | if (prli_rsp[index].logged_in) { |
3352 | if (parms->flags & IBMVFC_PRLI_EST_IMG_PAIR) { | 3354 | if (be16_to_cpu(parms->flags) & IBMVFC_PRLI_EST_IMG_PAIR) { |
3353 | tgt->need_login = 0; | 3355 | tgt->need_login = 0; |
3354 | tgt->ids.roles = 0; | 3356 | tgt->ids.roles = 0; |
3355 | if (parms->service_parms & IBMVFC_PRLI_TARGET_FUNC) | 3357 | if (be32_to_cpu(parms->service_parms) & IBMVFC_PRLI_TARGET_FUNC) |
3356 | tgt->ids.roles |= FC_PORT_ROLE_FCP_TARGET; | 3358 | tgt->ids.roles |= FC_PORT_ROLE_FCP_TARGET; |
3357 | if (parms->service_parms & IBMVFC_PRLI_INITIATOR_FUNC) | 3359 | if (be32_to_cpu(parms->service_parms) & IBMVFC_PRLI_INITIATOR_FUNC) |
3358 | tgt->ids.roles |= FC_PORT_ROLE_FCP_INITIATOR; | 3360 | tgt->ids.roles |= FC_PORT_ROLE_FCP_INITIATOR; |
3359 | tgt->add_rport = 1; | 3361 | tgt->add_rport = 1; |
3360 | } else | 3362 | } else |
@@ -3373,17 +3375,18 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt) | |||
3373 | break; | 3375 | break; |
3374 | case IBMVFC_MAD_FAILED: | 3376 | case IBMVFC_MAD_FAILED: |
3375 | default: | 3377 | default: |
3376 | if ((rsp->status & IBMVFC_VIOS_FAILURE) && rsp->error == IBMVFC_PLOGI_REQUIRED) | 3378 | if ((be16_to_cpu(rsp->status) & IBMVFC_VIOS_FAILURE) && |
3379 | be16_to_cpu(rsp->error) == IBMVFC_PLOGI_REQUIRED) | ||
3377 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_plogi); | 3380 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_plogi); |
3378 | else if (tgt->logo_rcvd) | 3381 | else if (tgt->logo_rcvd) |
3379 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_plogi); | 3382 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_plogi); |
3380 | else if (ibmvfc_retry_cmd(rsp->status, rsp->error)) | 3383 | else if (ibmvfc_retry_cmd(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error))) |
3381 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_prli); | 3384 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_prli); |
3382 | else | 3385 | else |
3383 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 3386 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
3384 | 3387 | ||
3385 | tgt_log(tgt, level, "Process Login failed: %s (%x:%x) rc=0x%02X\n", | 3388 | tgt_log(tgt, level, "Process Login failed: %s (%x:%x) rc=0x%02X\n", |
3386 | ibmvfc_get_cmd_error(rsp->status, rsp->error), | 3389 | ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), |
3387 | rsp->status, rsp->error, status); | 3390 | rsp->status, rsp->error, status); |
3388 | break; | 3391 | break; |
3389 | }; | 3392 | }; |
@@ -3414,14 +3417,14 @@ static void ibmvfc_tgt_send_prli(struct ibmvfc_target *tgt) | |||
3414 | evt->tgt = tgt; | 3417 | evt->tgt = tgt; |
3415 | prli = &evt->iu.prli; | 3418 | prli = &evt->iu.prli; |
3416 | memset(prli, 0, sizeof(*prli)); | 3419 | memset(prli, 0, sizeof(*prli)); |
3417 | prli->common.version = 1; | 3420 | prli->common.version = cpu_to_be32(1); |
3418 | prli->common.opcode = IBMVFC_PROCESS_LOGIN; | 3421 | prli->common.opcode = cpu_to_be32(IBMVFC_PROCESS_LOGIN); |
3419 | prli->common.length = sizeof(*prli); | 3422 | prli->common.length = cpu_to_be16(sizeof(*prli)); |
3420 | prli->scsi_id = tgt->scsi_id; | 3423 | prli->scsi_id = cpu_to_be64(tgt->scsi_id); |
3421 | 3424 | ||
3422 | prli->parms.type = IBMVFC_SCSI_FCP_TYPE; | 3425 | prli->parms.type = IBMVFC_SCSI_FCP_TYPE; |
3423 | prli->parms.flags = IBMVFC_PRLI_EST_IMG_PAIR; | 3426 | prli->parms.flags = cpu_to_be16(IBMVFC_PRLI_EST_IMG_PAIR); |
3424 | prli->parms.service_parms = IBMVFC_PRLI_INITIATOR_FUNC; | 3427 | prli->parms.service_parms = cpu_to_be32(IBMVFC_PRLI_INITIATOR_FUNC); |
3425 | 3428 | ||
3426 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); | 3429 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); |
3427 | if (ibmvfc_send_event(evt, vhost, default_timeout)) { | 3430 | if (ibmvfc_send_event(evt, vhost, default_timeout)) { |
@@ -3442,7 +3445,7 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt) | |||
3442 | struct ibmvfc_target *tgt = evt->tgt; | 3445 | struct ibmvfc_target *tgt = evt->tgt; |
3443 | struct ibmvfc_host *vhost = evt->vhost; | 3446 | struct ibmvfc_host *vhost = evt->vhost; |
3444 | struct ibmvfc_port_login *rsp = &evt->xfer_iu->plogi; | 3447 | struct ibmvfc_port_login *rsp = &evt->xfer_iu->plogi; |
3445 | u32 status = rsp->common.status; | 3448 | u32 status = be16_to_cpu(rsp->common.status); |
3446 | int level = IBMVFC_DEFAULT_LOG_LEVEL; | 3449 | int level = IBMVFC_DEFAULT_LOG_LEVEL; |
3447 | 3450 | ||
3448 | vhost->discovery_threads--; | 3451 | vhost->discovery_threads--; |
@@ -3472,15 +3475,15 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt) | |||
3472 | break; | 3475 | break; |
3473 | case IBMVFC_MAD_FAILED: | 3476 | case IBMVFC_MAD_FAILED: |
3474 | default: | 3477 | default: |
3475 | if (ibmvfc_retry_cmd(rsp->status, rsp->error)) | 3478 | if (ibmvfc_retry_cmd(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error))) |
3476 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_plogi); | 3479 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_plogi); |
3477 | else | 3480 | else |
3478 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 3481 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
3479 | 3482 | ||
3480 | tgt_log(tgt, level, "Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", | 3483 | tgt_log(tgt, level, "Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", |
3481 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error, | 3484 | ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), rsp->status, rsp->error, |
3482 | ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type, | 3485 | ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), rsp->fc_type, |
3483 | ibmvfc_get_ls_explain(rsp->fc_explain), rsp->fc_explain, status); | 3486 | ibmvfc_get_ls_explain(be16_to_cpu(rsp->fc_explain)), rsp->fc_explain, status); |
3484 | break; | 3487 | break; |
3485 | }; | 3488 | }; |
3486 | 3489 | ||
@@ -3512,10 +3515,10 @@ static void ibmvfc_tgt_send_plogi(struct ibmvfc_target *tgt) | |||
3512 | evt->tgt = tgt; | 3515 | evt->tgt = tgt; |
3513 | plogi = &evt->iu.plogi; | 3516 | plogi = &evt->iu.plogi; |
3514 | memset(plogi, 0, sizeof(*plogi)); | 3517 | memset(plogi, 0, sizeof(*plogi)); |
3515 | plogi->common.version = 1; | 3518 | plogi->common.version = cpu_to_be32(1); |
3516 | plogi->common.opcode = IBMVFC_PORT_LOGIN; | 3519 | plogi->common.opcode = cpu_to_be32(IBMVFC_PORT_LOGIN); |
3517 | plogi->common.length = sizeof(*plogi); | 3520 | plogi->common.length = cpu_to_be16(sizeof(*plogi)); |
3518 | plogi->scsi_id = tgt->scsi_id; | 3521 | plogi->scsi_id = cpu_to_be64(tgt->scsi_id); |
3519 | 3522 | ||
3520 | if (ibmvfc_send_event(evt, vhost, default_timeout)) { | 3523 | if (ibmvfc_send_event(evt, vhost, default_timeout)) { |
3521 | vhost->discovery_threads--; | 3524 | vhost->discovery_threads--; |
@@ -3535,7 +3538,7 @@ static void ibmvfc_tgt_implicit_logout_done(struct ibmvfc_event *evt) | |||
3535 | struct ibmvfc_target *tgt = evt->tgt; | 3538 | struct ibmvfc_target *tgt = evt->tgt; |
3536 | struct ibmvfc_host *vhost = evt->vhost; | 3539 | struct ibmvfc_host *vhost = evt->vhost; |
3537 | struct ibmvfc_implicit_logout *rsp = &evt->xfer_iu->implicit_logout; | 3540 | struct ibmvfc_implicit_logout *rsp = &evt->xfer_iu->implicit_logout; |
3538 | u32 status = rsp->common.status; | 3541 | u32 status = be16_to_cpu(rsp->common.status); |
3539 | 3542 | ||
3540 | vhost->discovery_threads--; | 3543 | vhost->discovery_threads--; |
3541 | ibmvfc_free_event(evt); | 3544 | ibmvfc_free_event(evt); |
@@ -3585,10 +3588,10 @@ static void ibmvfc_tgt_implicit_logout(struct ibmvfc_target *tgt) | |||
3585 | evt->tgt = tgt; | 3588 | evt->tgt = tgt; |
3586 | mad = &evt->iu.implicit_logout; | 3589 | mad = &evt->iu.implicit_logout; |
3587 | memset(mad, 0, sizeof(*mad)); | 3590 | memset(mad, 0, sizeof(*mad)); |
3588 | mad->common.version = 1; | 3591 | mad->common.version = cpu_to_be32(1); |
3589 | mad->common.opcode = IBMVFC_IMPLICIT_LOGOUT; | 3592 | mad->common.opcode = cpu_to_be32(IBMVFC_IMPLICIT_LOGOUT); |
3590 | mad->common.length = sizeof(*mad); | 3593 | mad->common.length = cpu_to_be16(sizeof(*mad)); |
3591 | mad->old_scsi_id = tgt->scsi_id; | 3594 | mad->old_scsi_id = cpu_to_be64(tgt->scsi_id); |
3592 | 3595 | ||
3593 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); | 3596 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); |
3594 | if (ibmvfc_send_event(evt, vhost, default_timeout)) { | 3597 | if (ibmvfc_send_event(evt, vhost, default_timeout)) { |
@@ -3616,7 +3619,7 @@ static int ibmvfc_adisc_needs_plogi(struct ibmvfc_passthru_mad *mad, | |||
3616 | if (memcmp(&mad->fc_iu.response[4], &tgt->ids.node_name, | 3619 | if (memcmp(&mad->fc_iu.response[4], &tgt->ids.node_name, |
3617 | sizeof(tgt->ids.node_name))) | 3620 | sizeof(tgt->ids.node_name))) |
3618 | return 1; | 3621 | return 1; |
3619 | if (mad->fc_iu.response[6] != tgt->scsi_id) | 3622 | if (be32_to_cpu(mad->fc_iu.response[6]) != tgt->scsi_id) |
3620 | return 1; | 3623 | return 1; |
3621 | return 0; | 3624 | return 0; |
3622 | } | 3625 | } |
@@ -3631,7 +3634,7 @@ static void ibmvfc_tgt_adisc_done(struct ibmvfc_event *evt) | |||
3631 | struct ibmvfc_target *tgt = evt->tgt; | 3634 | struct ibmvfc_target *tgt = evt->tgt; |
3632 | struct ibmvfc_host *vhost = evt->vhost; | 3635 | struct ibmvfc_host *vhost = evt->vhost; |
3633 | struct ibmvfc_passthru_mad *mad = &evt->xfer_iu->passthru; | 3636 | struct ibmvfc_passthru_mad *mad = &evt->xfer_iu->passthru; |
3634 | u32 status = mad->common.status; | 3637 | u32 status = be16_to_cpu(mad->common.status); |
3635 | u8 fc_reason, fc_explain; | 3638 | u8 fc_reason, fc_explain; |
3636 | 3639 | ||
3637 | vhost->discovery_threads--; | 3640 | vhost->discovery_threads--; |
@@ -3649,10 +3652,10 @@ static void ibmvfc_tgt_adisc_done(struct ibmvfc_event *evt) | |||
3649 | case IBMVFC_MAD_FAILED: | 3652 | case IBMVFC_MAD_FAILED: |
3650 | default: | 3653 | default: |
3651 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 3654 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
3652 | fc_reason = (mad->fc_iu.response[1] & 0x00ff0000) >> 16; | 3655 | fc_reason = (be32_to_cpu(mad->fc_iu.response[1]) & 0x00ff0000) >> 16; |
3653 | fc_explain = (mad->fc_iu.response[1] & 0x0000ff00) >> 8; | 3656 | fc_explain = (be32_to_cpu(mad->fc_iu.response[1]) & 0x0000ff00) >> 8; |
3654 | tgt_info(tgt, "ADISC failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", | 3657 | tgt_info(tgt, "ADISC failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", |
3655 | ibmvfc_get_cmd_error(mad->iu.status, mad->iu.error), | 3658 | ibmvfc_get_cmd_error(be16_to_cpu(mad->iu.status), be16_to_cpu(mad->iu.error)), |
3656 | mad->iu.status, mad->iu.error, | 3659 | mad->iu.status, mad->iu.error, |
3657 | ibmvfc_get_fc_type(fc_reason), fc_reason, | 3660 | ibmvfc_get_fc_type(fc_reason), fc_reason, |
3658 | ibmvfc_get_ls_explain(fc_explain), fc_explain, status); | 3661 | ibmvfc_get_ls_explain(fc_explain), fc_explain, status); |
@@ -3674,22 +3677,22 @@ static void ibmvfc_init_passthru(struct ibmvfc_event *evt) | |||
3674 | struct ibmvfc_passthru_mad *mad = &evt->iu.passthru; | 3677 | struct ibmvfc_passthru_mad *mad = &evt->iu.passthru; |
3675 | 3678 | ||
3676 | memset(mad, 0, sizeof(*mad)); | 3679 | memset(mad, 0, sizeof(*mad)); |
3677 | mad->common.version = 1; | 3680 | mad->common.version = cpu_to_be32(1); |
3678 | mad->common.opcode = IBMVFC_PASSTHRU; | 3681 | mad->common.opcode = cpu_to_be32(IBMVFC_PASSTHRU); |
3679 | mad->common.length = sizeof(*mad) - sizeof(mad->fc_iu) - sizeof(mad->iu); | 3682 | mad->common.length = cpu_to_be16(sizeof(*mad) - sizeof(mad->fc_iu) - sizeof(mad->iu)); |
3680 | mad->cmd_ioba.va = (u64)evt->crq.ioba + | 3683 | mad->cmd_ioba.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + |
3681 | offsetof(struct ibmvfc_passthru_mad, iu); | 3684 | offsetof(struct ibmvfc_passthru_mad, iu)); |
3682 | mad->cmd_ioba.len = sizeof(mad->iu); | 3685 | mad->cmd_ioba.len = cpu_to_be32(sizeof(mad->iu)); |
3683 | mad->iu.cmd_len = sizeof(mad->fc_iu.payload); | 3686 | mad->iu.cmd_len = cpu_to_be32(sizeof(mad->fc_iu.payload)); |
3684 | mad->iu.rsp_len = sizeof(mad->fc_iu.response); | 3687 | mad->iu.rsp_len = cpu_to_be32(sizeof(mad->fc_iu.response)); |
3685 | mad->iu.cmd.va = (u64)evt->crq.ioba + | 3688 | mad->iu.cmd.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + |
3686 | offsetof(struct ibmvfc_passthru_mad, fc_iu) + | 3689 | offsetof(struct ibmvfc_passthru_mad, fc_iu) + |
3687 | offsetof(struct ibmvfc_passthru_fc_iu, payload); | 3690 | offsetof(struct ibmvfc_passthru_fc_iu, payload)); |
3688 | mad->iu.cmd.len = sizeof(mad->fc_iu.payload); | 3691 | mad->iu.cmd.len = cpu_to_be32(sizeof(mad->fc_iu.payload)); |
3689 | mad->iu.rsp.va = (u64)evt->crq.ioba + | 3692 | mad->iu.rsp.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + |
3690 | offsetof(struct ibmvfc_passthru_mad, fc_iu) + | 3693 | offsetof(struct ibmvfc_passthru_mad, fc_iu) + |
3691 | offsetof(struct ibmvfc_passthru_fc_iu, response); | 3694 | offsetof(struct ibmvfc_passthru_fc_iu, response)); |
3692 | mad->iu.rsp.len = sizeof(mad->fc_iu.response); | 3695 | mad->iu.rsp.len = cpu_to_be32(sizeof(mad->fc_iu.response)); |
3693 | } | 3696 | } |
3694 | 3697 | ||
3695 | /** | 3698 | /** |
@@ -3748,11 +3751,11 @@ static void ibmvfc_adisc_timeout(struct ibmvfc_target *tgt) | |||
3748 | evt->tgt = tgt; | 3751 | evt->tgt = tgt; |
3749 | tmf = &evt->iu.tmf; | 3752 | tmf = &evt->iu.tmf; |
3750 | memset(tmf, 0, sizeof(*tmf)); | 3753 | memset(tmf, 0, sizeof(*tmf)); |
3751 | tmf->common.version = 1; | 3754 | tmf->common.version = cpu_to_be32(1); |
3752 | tmf->common.opcode = IBMVFC_TMF_MAD; | 3755 | tmf->common.opcode = cpu_to_be32(IBMVFC_TMF_MAD); |
3753 | tmf->common.length = sizeof(*tmf); | 3756 | tmf->common.length = cpu_to_be16(sizeof(*tmf)); |
3754 | tmf->scsi_id = tgt->scsi_id; | 3757 | tmf->scsi_id = cpu_to_be64(tgt->scsi_id); |
3755 | tmf->cancel_key = tgt->cancel_key; | 3758 | tmf->cancel_key = cpu_to_be32(tgt->cancel_key); |
3756 | 3759 | ||
3757 | rc = ibmvfc_send_event(evt, vhost, default_timeout); | 3760 | rc = ibmvfc_send_event(evt, vhost, default_timeout); |
3758 | 3761 | ||
@@ -3794,16 +3797,16 @@ static void ibmvfc_tgt_adisc(struct ibmvfc_target *tgt) | |||
3794 | 3797 | ||
3795 | ibmvfc_init_passthru(evt); | 3798 | ibmvfc_init_passthru(evt); |
3796 | mad = &evt->iu.passthru; | 3799 | mad = &evt->iu.passthru; |
3797 | mad->iu.flags = IBMVFC_FC_ELS; | 3800 | mad->iu.flags = cpu_to_be32(IBMVFC_FC_ELS); |
3798 | mad->iu.scsi_id = tgt->scsi_id; | 3801 | mad->iu.scsi_id = cpu_to_be64(tgt->scsi_id); |
3799 | mad->iu.cancel_key = tgt->cancel_key; | 3802 | mad->iu.cancel_key = cpu_to_be32(tgt->cancel_key); |
3800 | 3803 | ||
3801 | mad->fc_iu.payload[0] = IBMVFC_ADISC; | 3804 | mad->fc_iu.payload[0] = cpu_to_be32(IBMVFC_ADISC); |
3802 | memcpy(&mad->fc_iu.payload[2], &vhost->login_buf->resp.port_name, | 3805 | memcpy(&mad->fc_iu.payload[2], &vhost->login_buf->resp.port_name, |
3803 | sizeof(vhost->login_buf->resp.port_name)); | 3806 | sizeof(vhost->login_buf->resp.port_name)); |
3804 | memcpy(&mad->fc_iu.payload[4], &vhost->login_buf->resp.node_name, | 3807 | memcpy(&mad->fc_iu.payload[4], &vhost->login_buf->resp.node_name, |
3805 | sizeof(vhost->login_buf->resp.node_name)); | 3808 | sizeof(vhost->login_buf->resp.node_name)); |
3806 | mad->fc_iu.payload[6] = vhost->login_buf->resp.scsi_id & 0x00ffffff; | 3809 | mad->fc_iu.payload[6] = cpu_to_be32(be64_to_cpu(vhost->login_buf->resp.scsi_id) & 0x00ffffff); |
3807 | 3810 | ||
3808 | if (timer_pending(&tgt->timer)) | 3811 | if (timer_pending(&tgt->timer)) |
3809 | mod_timer(&tgt->timer, jiffies + (IBMVFC_ADISC_TIMEOUT * HZ)); | 3812 | mod_timer(&tgt->timer, jiffies + (IBMVFC_ADISC_TIMEOUT * HZ)); |
@@ -3834,7 +3837,7 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt) | |||
3834 | struct ibmvfc_target *tgt = evt->tgt; | 3837 | struct ibmvfc_target *tgt = evt->tgt; |
3835 | struct ibmvfc_host *vhost = evt->vhost; | 3838 | struct ibmvfc_host *vhost = evt->vhost; |
3836 | struct ibmvfc_query_tgt *rsp = &evt->xfer_iu->query_tgt; | 3839 | struct ibmvfc_query_tgt *rsp = &evt->xfer_iu->query_tgt; |
3837 | u32 status = rsp->common.status; | 3840 | u32 status = be16_to_cpu(rsp->common.status); |
3838 | int level = IBMVFC_DEFAULT_LOG_LEVEL; | 3841 | int level = IBMVFC_DEFAULT_LOG_LEVEL; |
3839 | 3842 | ||
3840 | vhost->discovery_threads--; | 3843 | vhost->discovery_threads--; |
@@ -3842,8 +3845,8 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt) | |||
3842 | switch (status) { | 3845 | switch (status) { |
3843 | case IBMVFC_MAD_SUCCESS: | 3846 | case IBMVFC_MAD_SUCCESS: |
3844 | tgt_dbg(tgt, "Query Target succeeded\n"); | 3847 | tgt_dbg(tgt, "Query Target succeeded\n"); |
3845 | tgt->new_scsi_id = rsp->scsi_id; | 3848 | tgt->new_scsi_id = be64_to_cpu(rsp->scsi_id); |
3846 | if (rsp->scsi_id != tgt->scsi_id) | 3849 | if (be64_to_cpu(rsp->scsi_id) != tgt->scsi_id) |
3847 | ibmvfc_init_tgt(tgt, ibmvfc_tgt_implicit_logout); | 3850 | ibmvfc_init_tgt(tgt, ibmvfc_tgt_implicit_logout); |
3848 | else | 3851 | else |
3849 | ibmvfc_init_tgt(tgt, ibmvfc_tgt_adisc); | 3852 | ibmvfc_init_tgt(tgt, ibmvfc_tgt_adisc); |
@@ -3855,19 +3858,20 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt) | |||
3855 | break; | 3858 | break; |
3856 | case IBMVFC_MAD_FAILED: | 3859 | case IBMVFC_MAD_FAILED: |
3857 | default: | 3860 | default: |
3858 | if ((rsp->status & IBMVFC_FABRIC_MAPPED) == IBMVFC_FABRIC_MAPPED && | 3861 | if ((be16_to_cpu(rsp->status) & IBMVFC_FABRIC_MAPPED) == IBMVFC_FABRIC_MAPPED && |
3859 | rsp->error == IBMVFC_UNABLE_TO_PERFORM_REQ && | 3862 | be16_to_cpu(rsp->error) == IBMVFC_UNABLE_TO_PERFORM_REQ && |
3860 | rsp->fc_explain == IBMVFC_PORT_NAME_NOT_REG) | 3863 | be16_to_cpu(rsp->fc_explain) == IBMVFC_PORT_NAME_NOT_REG) |
3861 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 3864 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
3862 | else if (ibmvfc_retry_cmd(rsp->status, rsp->error)) | 3865 | else if (ibmvfc_retry_cmd(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error))) |
3863 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_query_target); | 3866 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_query_target); |
3864 | else | 3867 | else |
3865 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 3868 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
3866 | 3869 | ||
3867 | tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", | 3870 | tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", |
3868 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error, | 3871 | ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), |
3869 | ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type, | 3872 | rsp->status, rsp->error, ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), |
3870 | ibmvfc_get_gs_explain(rsp->fc_explain), rsp->fc_explain, status); | 3873 | rsp->fc_type, ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)), |
3874 | rsp->fc_explain, status); | ||
3871 | break; | 3875 | break; |
3872 | }; | 3876 | }; |
3873 | 3877 | ||
@@ -3897,10 +3901,10 @@ static void ibmvfc_tgt_query_target(struct ibmvfc_target *tgt) | |||
3897 | ibmvfc_init_event(evt, ibmvfc_tgt_query_target_done, IBMVFC_MAD_FORMAT); | 3901 | ibmvfc_init_event(evt, ibmvfc_tgt_query_target_done, IBMVFC_MAD_FORMAT); |
3898 | query_tgt = &evt->iu.query_tgt; | 3902 | query_tgt = &evt->iu.query_tgt; |
3899 | memset(query_tgt, 0, sizeof(*query_tgt)); | 3903 | memset(query_tgt, 0, sizeof(*query_tgt)); |
3900 | query_tgt->common.version = 1; | 3904 | query_tgt->common.version = cpu_to_be32(1); |
3901 | query_tgt->common.opcode = IBMVFC_QUERY_TARGET; | 3905 | query_tgt->common.opcode = cpu_to_be32(IBMVFC_QUERY_TARGET); |
3902 | query_tgt->common.length = sizeof(*query_tgt); | 3906 | query_tgt->common.length = cpu_to_be16(sizeof(*query_tgt)); |
3903 | query_tgt->wwpn = tgt->ids.port_name; | 3907 | query_tgt->wwpn = cpu_to_be64(tgt->ids.port_name); |
3904 | 3908 | ||
3905 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); | 3909 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); |
3906 | if (ibmvfc_send_event(evt, vhost, default_timeout)) { | 3910 | if (ibmvfc_send_event(evt, vhost, default_timeout)) { |
@@ -3971,7 +3975,8 @@ static int ibmvfc_alloc_targets(struct ibmvfc_host *vhost) | |||
3971 | 3975 | ||
3972 | for (i = 0, rc = 0; !rc && i < vhost->num_targets; i++) | 3976 | for (i = 0, rc = 0; !rc && i < vhost->num_targets; i++) |
3973 | rc = ibmvfc_alloc_target(vhost, | 3977 | rc = ibmvfc_alloc_target(vhost, |
3974 | vhost->disc_buf->scsi_id[i] & IBMVFC_DISC_TGT_SCSI_ID_MASK); | 3978 | be32_to_cpu(vhost->disc_buf->scsi_id[i]) & |
3979 | IBMVFC_DISC_TGT_SCSI_ID_MASK); | ||
3975 | 3980 | ||
3976 | return rc; | 3981 | return rc; |
3977 | } | 3982 | } |
@@ -3985,19 +3990,20 @@ static void ibmvfc_discover_targets_done(struct ibmvfc_event *evt) | |||
3985 | { | 3990 | { |
3986 | struct ibmvfc_host *vhost = evt->vhost; | 3991 | struct ibmvfc_host *vhost = evt->vhost; |
3987 | struct ibmvfc_discover_targets *rsp = &evt->xfer_iu->discover_targets; | 3992 | struct ibmvfc_discover_targets *rsp = &evt->xfer_iu->discover_targets; |
3988 | u32 mad_status = rsp->common.status; | 3993 | u32 mad_status = be16_to_cpu(rsp->common.status); |
3989 | int level = IBMVFC_DEFAULT_LOG_LEVEL; | 3994 | int level = IBMVFC_DEFAULT_LOG_LEVEL; |
3990 | 3995 | ||
3991 | switch (mad_status) { | 3996 | switch (mad_status) { |
3992 | case IBMVFC_MAD_SUCCESS: | 3997 | case IBMVFC_MAD_SUCCESS: |
3993 | ibmvfc_dbg(vhost, "Discover Targets succeeded\n"); | 3998 | ibmvfc_dbg(vhost, "Discover Targets succeeded\n"); |
3994 | vhost->num_targets = rsp->num_written; | 3999 | vhost->num_targets = be32_to_cpu(rsp->num_written); |
3995 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_ALLOC_TGTS); | 4000 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_ALLOC_TGTS); |
3996 | break; | 4001 | break; |
3997 | case IBMVFC_MAD_FAILED: | 4002 | case IBMVFC_MAD_FAILED: |
3998 | level += ibmvfc_retry_host_init(vhost); | 4003 | level += ibmvfc_retry_host_init(vhost); |
3999 | ibmvfc_log(vhost, level, "Discover Targets failed: %s (%x:%x)\n", | 4004 | ibmvfc_log(vhost, level, "Discover Targets failed: %s (%x:%x)\n", |
4000 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error); | 4005 | ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), |
4006 | rsp->status, rsp->error); | ||
4001 | break; | 4007 | break; |
4002 | case IBMVFC_MAD_DRIVER_FAILED: | 4008 | case IBMVFC_MAD_DRIVER_FAILED: |
4003 | break; | 4009 | break; |
@@ -4024,12 +4030,12 @@ static void ibmvfc_discover_targets(struct ibmvfc_host *vhost) | |||
4024 | ibmvfc_init_event(evt, ibmvfc_discover_targets_done, IBMVFC_MAD_FORMAT); | 4030 | ibmvfc_init_event(evt, ibmvfc_discover_targets_done, IBMVFC_MAD_FORMAT); |
4025 | mad = &evt->iu.discover_targets; | 4031 | mad = &evt->iu.discover_targets; |
4026 | memset(mad, 0, sizeof(*mad)); | 4032 | memset(mad, 0, sizeof(*mad)); |
4027 | mad->common.version = 1; | 4033 | mad->common.version = cpu_to_be32(1); |
4028 | mad->common.opcode = IBMVFC_DISC_TARGETS; | 4034 | mad->common.opcode = cpu_to_be32(IBMVFC_DISC_TARGETS); |
4029 | mad->common.length = sizeof(*mad); | 4035 | mad->common.length = cpu_to_be16(sizeof(*mad)); |
4030 | mad->bufflen = vhost->disc_buf_sz; | 4036 | mad->bufflen = cpu_to_be32(vhost->disc_buf_sz); |
4031 | mad->buffer.va = vhost->disc_buf_dma; | 4037 | mad->buffer.va = cpu_to_be64(vhost->disc_buf_dma); |
4032 | mad->buffer.len = vhost->disc_buf_sz; | 4038 | mad->buffer.len = cpu_to_be32(vhost->disc_buf_sz); |
4033 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); | 4039 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); |
4034 | 4040 | ||
4035 | if (!ibmvfc_send_event(evt, vhost, default_timeout)) | 4041 | if (!ibmvfc_send_event(evt, vhost, default_timeout)) |
@@ -4046,7 +4052,7 @@ static void ibmvfc_discover_targets(struct ibmvfc_host *vhost) | |||
4046 | static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) | 4052 | static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) |
4047 | { | 4053 | { |
4048 | struct ibmvfc_host *vhost = evt->vhost; | 4054 | struct ibmvfc_host *vhost = evt->vhost; |
4049 | u32 mad_status = evt->xfer_iu->npiv_login.common.status; | 4055 | u32 mad_status = be16_to_cpu(evt->xfer_iu->npiv_login.common.status); |
4050 | struct ibmvfc_npiv_login_resp *rsp = &vhost->login_buf->resp; | 4056 | struct ibmvfc_npiv_login_resp *rsp = &vhost->login_buf->resp; |
4051 | unsigned int npiv_max_sectors; | 4057 | unsigned int npiv_max_sectors; |
4052 | int level = IBMVFC_DEFAULT_LOG_LEVEL; | 4058 | int level = IBMVFC_DEFAULT_LOG_LEVEL; |
@@ -4056,12 +4062,13 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) | |||
4056 | ibmvfc_free_event(evt); | 4062 | ibmvfc_free_event(evt); |
4057 | break; | 4063 | break; |
4058 | case IBMVFC_MAD_FAILED: | 4064 | case IBMVFC_MAD_FAILED: |
4059 | if (ibmvfc_retry_cmd(rsp->status, rsp->error)) | 4065 | if (ibmvfc_retry_cmd(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error))) |
4060 | level += ibmvfc_retry_host_init(vhost); | 4066 | level += ibmvfc_retry_host_init(vhost); |
4061 | else | 4067 | else |
4062 | ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); | 4068 | ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); |
4063 | ibmvfc_log(vhost, level, "NPIV Login failed: %s (%x:%x)\n", | 4069 | ibmvfc_log(vhost, level, "NPIV Login failed: %s (%x:%x)\n", |
4064 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error); | 4070 | ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), |
4071 | rsp->status, rsp->error); | ||
4065 | ibmvfc_free_event(evt); | 4072 | ibmvfc_free_event(evt); |
4066 | return; | 4073 | return; |
4067 | case IBMVFC_MAD_CRQ_ERROR: | 4074 | case IBMVFC_MAD_CRQ_ERROR: |
@@ -4078,7 +4085,7 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) | |||
4078 | 4085 | ||
4079 | vhost->client_migrated = 0; | 4086 | vhost->client_migrated = 0; |
4080 | 4087 | ||
4081 | if (!(rsp->flags & IBMVFC_NATIVE_FC)) { | 4088 | if (!(be32_to_cpu(rsp->flags) & IBMVFC_NATIVE_FC)) { |
4082 | dev_err(vhost->dev, "Virtual adapter does not support FC. %x\n", | 4089 | dev_err(vhost->dev, "Virtual adapter does not support FC. %x\n", |
4083 | rsp->flags); | 4090 | rsp->flags); |
4084 | ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); | 4091 | ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); |
@@ -4086,7 +4093,7 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) | |||
4086 | return; | 4093 | return; |
4087 | } | 4094 | } |
4088 | 4095 | ||
4089 | if (rsp->max_cmds <= IBMVFC_NUM_INTERNAL_REQ) { | 4096 | if (be32_to_cpu(rsp->max_cmds) <= IBMVFC_NUM_INTERNAL_REQ) { |
4090 | dev_err(vhost->dev, "Virtual adapter supported queue depth too small: %d\n", | 4097 | dev_err(vhost->dev, "Virtual adapter supported queue depth too small: %d\n", |
4091 | rsp->max_cmds); | 4098 | rsp->max_cmds); |
4092 | ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); | 4099 | ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); |
@@ -4095,27 +4102,27 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) | |||
4095 | } | 4102 | } |
4096 | 4103 | ||
4097 | vhost->logged_in = 1; | 4104 | vhost->logged_in = 1; |
4098 | npiv_max_sectors = min((uint)(rsp->max_dma_len >> 9), IBMVFC_MAX_SECTORS); | 4105 | npiv_max_sectors = min((uint)(be64_to_cpu(rsp->max_dma_len) >> 9), IBMVFC_MAX_SECTORS); |
4099 | dev_info(vhost->dev, "Host partition: %s, device: %s %s %s max sectors %u\n", | 4106 | dev_info(vhost->dev, "Host partition: %s, device: %s %s %s max sectors %u\n", |
4100 | rsp->partition_name, rsp->device_name, rsp->port_loc_code, | 4107 | rsp->partition_name, rsp->device_name, rsp->port_loc_code, |
4101 | rsp->drc_name, npiv_max_sectors); | 4108 | rsp->drc_name, npiv_max_sectors); |
4102 | 4109 | ||
4103 | fc_host_fabric_name(vhost->host) = rsp->node_name; | 4110 | fc_host_fabric_name(vhost->host) = be64_to_cpu(rsp->node_name); |
4104 | fc_host_node_name(vhost->host) = rsp->node_name; | 4111 | fc_host_node_name(vhost->host) = be64_to_cpu(rsp->node_name); |
4105 | fc_host_port_name(vhost->host) = rsp->port_name; | 4112 | fc_host_port_name(vhost->host) = be64_to_cpu(rsp->port_name); |
4106 | fc_host_port_id(vhost->host) = rsp->scsi_id; | 4113 | fc_host_port_id(vhost->host) = be64_to_cpu(rsp->scsi_id); |
4107 | fc_host_port_type(vhost->host) = FC_PORTTYPE_NPIV; | 4114 | fc_host_port_type(vhost->host) = FC_PORTTYPE_NPIV; |
4108 | fc_host_supported_classes(vhost->host) = 0; | 4115 | fc_host_supported_classes(vhost->host) = 0; |
4109 | if (rsp->service_parms.class1_parms[0] & 0x80000000) | 4116 | if (be32_to_cpu(rsp->service_parms.class1_parms[0]) & 0x80000000) |
4110 | fc_host_supported_classes(vhost->host) |= FC_COS_CLASS1; | 4117 | fc_host_supported_classes(vhost->host) |= FC_COS_CLASS1; |
4111 | if (rsp->service_parms.class2_parms[0] & 0x80000000) | 4118 | if (be32_to_cpu(rsp->service_parms.class2_parms[0]) & 0x80000000) |
4112 | fc_host_supported_classes(vhost->host) |= FC_COS_CLASS2; | 4119 | fc_host_supported_classes(vhost->host) |= FC_COS_CLASS2; |
4113 | if (rsp->service_parms.class3_parms[0] & 0x80000000) | 4120 | if (be32_to_cpu(rsp->service_parms.class3_parms[0]) & 0x80000000) |
4114 | fc_host_supported_classes(vhost->host) |= FC_COS_CLASS3; | 4121 | fc_host_supported_classes(vhost->host) |= FC_COS_CLASS3; |
4115 | fc_host_maxframe_size(vhost->host) = | 4122 | fc_host_maxframe_size(vhost->host) = |
4116 | rsp->service_parms.common.bb_rcv_sz & 0x0fff; | 4123 | be16_to_cpu(rsp->service_parms.common.bb_rcv_sz) & 0x0fff; |
4117 | 4124 | ||
4118 | vhost->host->can_queue = rsp->max_cmds - IBMVFC_NUM_INTERNAL_REQ; | 4125 | vhost->host->can_queue = be32_to_cpu(rsp->max_cmds) - IBMVFC_NUM_INTERNAL_REQ; |
4119 | vhost->host->max_sectors = npiv_max_sectors; | 4126 | vhost->host->max_sectors = npiv_max_sectors; |
4120 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); | 4127 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); |
4121 | wake_up(&vhost->work_wait_q); | 4128 | wake_up(&vhost->work_wait_q); |
@@ -4138,11 +4145,11 @@ static void ibmvfc_npiv_login(struct ibmvfc_host *vhost) | |||
4138 | memcpy(vhost->login_buf, &vhost->login_info, sizeof(vhost->login_info)); | 4145 | memcpy(vhost->login_buf, &vhost->login_info, sizeof(vhost->login_info)); |
4139 | mad = &evt->iu.npiv_login; | 4146 | mad = &evt->iu.npiv_login; |
4140 | memset(mad, 0, sizeof(struct ibmvfc_npiv_login_mad)); | 4147 | memset(mad, 0, sizeof(struct ibmvfc_npiv_login_mad)); |
4141 | mad->common.version = 1; | 4148 | mad->common.version = cpu_to_be32(1); |
4142 | mad->common.opcode = IBMVFC_NPIV_LOGIN; | 4149 | mad->common.opcode = cpu_to_be32(IBMVFC_NPIV_LOGIN); |
4143 | mad->common.length = sizeof(struct ibmvfc_npiv_login_mad); | 4150 | mad->common.length = cpu_to_be16(sizeof(struct ibmvfc_npiv_login_mad)); |
4144 | mad->buffer.va = vhost->login_buf_dma; | 4151 | mad->buffer.va = cpu_to_be64(vhost->login_buf_dma); |
4145 | mad->buffer.len = sizeof(*vhost->login_buf); | 4152 | mad->buffer.len = cpu_to_be32(sizeof(*vhost->login_buf)); |
4146 | 4153 | ||
4147 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); | 4154 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); |
4148 | 4155 | ||
@@ -4160,7 +4167,7 @@ static void ibmvfc_npiv_login(struct ibmvfc_host *vhost) | |||
4160 | static void ibmvfc_npiv_logout_done(struct ibmvfc_event *evt) | 4167 | static void ibmvfc_npiv_logout_done(struct ibmvfc_event *evt) |
4161 | { | 4168 | { |
4162 | struct ibmvfc_host *vhost = evt->vhost; | 4169 | struct ibmvfc_host *vhost = evt->vhost; |
4163 | u32 mad_status = evt->xfer_iu->npiv_logout.common.status; | 4170 | u32 mad_status = be16_to_cpu(evt->xfer_iu->npiv_logout.common.status); |
4164 | 4171 | ||
4165 | ibmvfc_free_event(evt); | 4172 | ibmvfc_free_event(evt); |
4166 | 4173 | ||
@@ -4199,9 +4206,9 @@ static void ibmvfc_npiv_logout(struct ibmvfc_host *vhost) | |||
4199 | 4206 | ||
4200 | mad = &evt->iu.npiv_logout; | 4207 | mad = &evt->iu.npiv_logout; |
4201 | memset(mad, 0, sizeof(*mad)); | 4208 | memset(mad, 0, sizeof(*mad)); |
4202 | mad->common.version = 1; | 4209 | mad->common.version = cpu_to_be32(1); |
4203 | mad->common.opcode = IBMVFC_NPIV_LOGOUT; | 4210 | mad->common.opcode = cpu_to_be32(IBMVFC_NPIV_LOGOUT); |
4204 | mad->common.length = sizeof(struct ibmvfc_npiv_logout_mad); | 4211 | mad->common.length = cpu_to_be16(sizeof(struct ibmvfc_npiv_logout_mad)); |
4205 | 4212 | ||
4206 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_LOGO_WAIT); | 4213 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_LOGO_WAIT); |
4207 | 4214 | ||
@@ -4343,14 +4350,14 @@ static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt) | |||
4343 | if (rport) { | 4350 | if (rport) { |
4344 | tgt_dbg(tgt, "rport add succeeded\n"); | 4351 | tgt_dbg(tgt, "rport add succeeded\n"); |
4345 | tgt->rport = rport; | 4352 | tgt->rport = rport; |
4346 | rport->maxframe_size = tgt->service_parms.common.bb_rcv_sz & 0x0fff; | 4353 | rport->maxframe_size = be16_to_cpu(tgt->service_parms.common.bb_rcv_sz) & 0x0fff; |
4347 | rport->supported_classes = 0; | 4354 | rport->supported_classes = 0; |
4348 | tgt->target_id = rport->scsi_target_id; | 4355 | tgt->target_id = rport->scsi_target_id; |
4349 | if (tgt->service_parms.class1_parms[0] & 0x80000000) | 4356 | if (be32_to_cpu(tgt->service_parms.class1_parms[0]) & 0x80000000) |
4350 | rport->supported_classes |= FC_COS_CLASS1; | 4357 | rport->supported_classes |= FC_COS_CLASS1; |
4351 | if (tgt->service_parms.class2_parms[0] & 0x80000000) | 4358 | if (be32_to_cpu(tgt->service_parms.class2_parms[0]) & 0x80000000) |
4352 | rport->supported_classes |= FC_COS_CLASS2; | 4359 | rport->supported_classes |= FC_COS_CLASS2; |
4353 | if (tgt->service_parms.class3_parms[0] & 0x80000000) | 4360 | if (be32_to_cpu(tgt->service_parms.class3_parms[0]) & 0x80000000) |
4354 | rport->supported_classes |= FC_COS_CLASS3; | 4361 | rport->supported_classes |= FC_COS_CLASS3; |
4355 | if (rport->rqst_q) | 4362 | if (rport->rqst_q) |
4356 | blk_queue_max_segments(rport->rqst_q, 1); | 4363 | blk_queue_max_segments(rport->rqst_q, 1); |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 017a5290e8c1..8fae03215a85 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h | |||
@@ -135,12 +135,12 @@ enum ibmvfc_mad_types { | |||
135 | }; | 135 | }; |
136 | 136 | ||
137 | struct ibmvfc_mad_common { | 137 | struct ibmvfc_mad_common { |
138 | u32 version; | 138 | __be32 version; |
139 | u32 reserved; | 139 | __be32 reserved; |
140 | u32 opcode; | 140 | __be32 opcode; |
141 | u16 status; | 141 | __be16 status; |
142 | u16 length; | 142 | __be16 length; |
143 | u64 tag; | 143 | __be64 tag; |
144 | }__attribute__((packed, aligned (8))); | 144 | }__attribute__((packed, aligned (8))); |
145 | 145 | ||
146 | struct ibmvfc_npiv_login_mad { | 146 | struct ibmvfc_npiv_login_mad { |
@@ -155,76 +155,76 @@ struct ibmvfc_npiv_logout_mad { | |||
155 | #define IBMVFC_MAX_NAME 256 | 155 | #define IBMVFC_MAX_NAME 256 |
156 | 156 | ||
157 | struct ibmvfc_npiv_login { | 157 | struct ibmvfc_npiv_login { |
158 | u32 ostype; | 158 | __be32 ostype; |
159 | #define IBMVFC_OS_LINUX 0x02 | 159 | #define IBMVFC_OS_LINUX 0x02 |
160 | u32 pad; | 160 | __be32 pad; |
161 | u64 max_dma_len; | 161 | __be64 max_dma_len; |
162 | u32 max_payload; | 162 | __be32 max_payload; |
163 | u32 max_response; | 163 | __be32 max_response; |
164 | u32 partition_num; | 164 | __be32 partition_num; |
165 | u32 vfc_frame_version; | 165 | __be32 vfc_frame_version; |
166 | u16 fcp_version; | 166 | __be16 fcp_version; |
167 | u16 flags; | 167 | __be16 flags; |
168 | #define IBMVFC_CLIENT_MIGRATED 0x01 | 168 | #define IBMVFC_CLIENT_MIGRATED 0x01 |
169 | #define IBMVFC_FLUSH_ON_HALT 0x02 | 169 | #define IBMVFC_FLUSH_ON_HALT 0x02 |
170 | u32 max_cmds; | 170 | __be32 max_cmds; |
171 | u64 capabilities; | 171 | __be64 capabilities; |
172 | #define IBMVFC_CAN_MIGRATE 0x01 | 172 | #define IBMVFC_CAN_MIGRATE 0x01 |
173 | u64 node_name; | 173 | __be64 node_name; |
174 | struct srp_direct_buf async; | 174 | struct srp_direct_buf async; |
175 | u8 partition_name[IBMVFC_MAX_NAME]; | 175 | u8 partition_name[IBMVFC_MAX_NAME]; |
176 | u8 device_name[IBMVFC_MAX_NAME]; | 176 | u8 device_name[IBMVFC_MAX_NAME]; |
177 | u8 drc_name[IBMVFC_MAX_NAME]; | 177 | u8 drc_name[IBMVFC_MAX_NAME]; |
178 | u64 reserved2[2]; | 178 | __be64 reserved2[2]; |
179 | }__attribute__((packed, aligned (8))); | 179 | }__attribute__((packed, aligned (8))); |
180 | 180 | ||
181 | struct ibmvfc_common_svc_parms { | 181 | struct ibmvfc_common_svc_parms { |
182 | u16 fcph_version; | 182 | __be16 fcph_version; |
183 | u16 b2b_credit; | 183 | __be16 b2b_credit; |
184 | u16 features; | 184 | __be16 features; |
185 | u16 bb_rcv_sz; /* upper nibble is BB_SC_N */ | 185 | __be16 bb_rcv_sz; /* upper nibble is BB_SC_N */ |
186 | u32 ratov; | 186 | __be32 ratov; |
187 | u32 edtov; | 187 | __be32 edtov; |
188 | }__attribute__((packed, aligned (4))); | 188 | }__attribute__((packed, aligned (4))); |
189 | 189 | ||
190 | struct ibmvfc_service_parms { | 190 | struct ibmvfc_service_parms { |
191 | struct ibmvfc_common_svc_parms common; | 191 | struct ibmvfc_common_svc_parms common; |
192 | u8 port_name[8]; | 192 | u8 port_name[8]; |
193 | u8 node_name[8]; | 193 | u8 node_name[8]; |
194 | u32 class1_parms[4]; | 194 | __be32 class1_parms[4]; |
195 | u32 class2_parms[4]; | 195 | __be32 class2_parms[4]; |
196 | u32 class3_parms[4]; | 196 | __be32 class3_parms[4]; |
197 | u32 obsolete[4]; | 197 | __be32 obsolete[4]; |
198 | u32 vendor_version[4]; | 198 | __be32 vendor_version[4]; |
199 | u32 services_avail[2]; | 199 | __be32 services_avail[2]; |
200 | u32 ext_len; | 200 | __be32 ext_len; |
201 | u32 reserved[30]; | 201 | __be32 reserved[30]; |
202 | u32 clk_sync_qos[2]; | 202 | __be32 clk_sync_qos[2]; |
203 | }__attribute__((packed, aligned (4))); | 203 | }__attribute__((packed, aligned (4))); |
204 | 204 | ||
205 | struct ibmvfc_npiv_login_resp { | 205 | struct ibmvfc_npiv_login_resp { |
206 | u32 version; | 206 | __be32 version; |
207 | u16 status; | 207 | __be16 status; |
208 | u16 error; | 208 | __be16 error; |
209 | u32 flags; | 209 | __be32 flags; |
210 | #define IBMVFC_NATIVE_FC 0x01 | 210 | #define IBMVFC_NATIVE_FC 0x01 |
211 | u32 reserved; | 211 | __be32 reserved; |
212 | u64 capabilities; | 212 | __be64 capabilities; |
213 | #define IBMVFC_CAN_FLUSH_ON_HALT 0x08 | 213 | #define IBMVFC_CAN_FLUSH_ON_HALT 0x08 |
214 | #define IBMVFC_CAN_SUPPRESS_ABTS 0x10 | 214 | #define IBMVFC_CAN_SUPPRESS_ABTS 0x10 |
215 | u32 max_cmds; | 215 | __be32 max_cmds; |
216 | u32 scsi_id_sz; | 216 | __be32 scsi_id_sz; |
217 | u64 max_dma_len; | 217 | __be64 max_dma_len; |
218 | u64 scsi_id; | 218 | __be64 scsi_id; |
219 | u64 port_name; | 219 | __be64 port_name; |
220 | u64 node_name; | 220 | __be64 node_name; |
221 | u64 link_speed; | 221 | __be64 link_speed; |
222 | u8 partition_name[IBMVFC_MAX_NAME]; | 222 | u8 partition_name[IBMVFC_MAX_NAME]; |
223 | u8 device_name[IBMVFC_MAX_NAME]; | 223 | u8 device_name[IBMVFC_MAX_NAME]; |
224 | u8 port_loc_code[IBMVFC_MAX_NAME]; | 224 | u8 port_loc_code[IBMVFC_MAX_NAME]; |
225 | u8 drc_name[IBMVFC_MAX_NAME]; | 225 | u8 drc_name[IBMVFC_MAX_NAME]; |
226 | struct ibmvfc_service_parms service_parms; | 226 | struct ibmvfc_service_parms service_parms; |
227 | u64 reserved2; | 227 | __be64 reserved2; |
228 | }__attribute__((packed, aligned (8))); | 228 | }__attribute__((packed, aligned (8))); |
229 | 229 | ||
230 | union ibmvfc_npiv_login_data { | 230 | union ibmvfc_npiv_login_data { |
@@ -233,20 +233,20 @@ union ibmvfc_npiv_login_data { | |||
233 | }__attribute__((packed, aligned (8))); | 233 | }__attribute__((packed, aligned (8))); |
234 | 234 | ||
235 | struct ibmvfc_discover_targets_buf { | 235 | struct ibmvfc_discover_targets_buf { |
236 | u32 scsi_id[1]; | 236 | __be32 scsi_id[1]; |
237 | #define IBMVFC_DISC_TGT_SCSI_ID_MASK 0x00ffffff | 237 | #define IBMVFC_DISC_TGT_SCSI_ID_MASK 0x00ffffff |
238 | }; | 238 | }; |
239 | 239 | ||
240 | struct ibmvfc_discover_targets { | 240 | struct ibmvfc_discover_targets { |
241 | struct ibmvfc_mad_common common; | 241 | struct ibmvfc_mad_common common; |
242 | struct srp_direct_buf buffer; | 242 | struct srp_direct_buf buffer; |
243 | u32 flags; | 243 | __be32 flags; |
244 | u16 status; | 244 | __be16 status; |
245 | u16 error; | 245 | __be16 error; |
246 | u32 bufflen; | 246 | __be32 bufflen; |
247 | u32 num_avail; | 247 | __be32 num_avail; |
248 | u32 num_written; | 248 | __be32 num_written; |
249 | u64 reserved[2]; | 249 | __be64 reserved[2]; |
250 | }__attribute__((packed, aligned (8))); | 250 | }__attribute__((packed, aligned (8))); |
251 | 251 | ||
252 | enum ibmvfc_fc_reason { | 252 | enum ibmvfc_fc_reason { |
@@ -278,32 +278,32 @@ enum ibmvfc_gs_explain { | |||
278 | 278 | ||
279 | struct ibmvfc_port_login { | 279 | struct ibmvfc_port_login { |
280 | struct ibmvfc_mad_common common; | 280 | struct ibmvfc_mad_common common; |
281 | u64 scsi_id; | 281 | __be64 scsi_id; |
282 | u16 reserved; | 282 | __be16 reserved; |
283 | u16 fc_service_class; | 283 | __be16 fc_service_class; |
284 | u32 blksz; | 284 | __be32 blksz; |
285 | u32 hdr_per_blk; | 285 | __be32 hdr_per_blk; |
286 | u16 status; | 286 | __be16 status; |
287 | u16 error; /* also fc_reason */ | 287 | __be16 error; /* also fc_reason */ |
288 | u16 fc_explain; | 288 | __be16 fc_explain; |
289 | u16 fc_type; | 289 | __be16 fc_type; |
290 | u32 reserved2; | 290 | __be32 reserved2; |
291 | struct ibmvfc_service_parms service_parms; | 291 | struct ibmvfc_service_parms service_parms; |
292 | struct ibmvfc_service_parms service_parms_change; | 292 | struct ibmvfc_service_parms service_parms_change; |
293 | u64 reserved3[2]; | 293 | __be64 reserved3[2]; |
294 | }__attribute__((packed, aligned (8))); | 294 | }__attribute__((packed, aligned (8))); |
295 | 295 | ||
296 | struct ibmvfc_prli_svc_parms { | 296 | struct ibmvfc_prli_svc_parms { |
297 | u8 type; | 297 | u8 type; |
298 | #define IBMVFC_SCSI_FCP_TYPE 0x08 | 298 | #define IBMVFC_SCSI_FCP_TYPE 0x08 |
299 | u8 type_ext; | 299 | u8 type_ext; |
300 | u16 flags; | 300 | __be16 flags; |
301 | #define IBMVFC_PRLI_ORIG_PA_VALID 0x8000 | 301 | #define IBMVFC_PRLI_ORIG_PA_VALID 0x8000 |
302 | #define IBMVFC_PRLI_RESP_PA_VALID 0x4000 | 302 | #define IBMVFC_PRLI_RESP_PA_VALID 0x4000 |
303 | #define IBMVFC_PRLI_EST_IMG_PAIR 0x2000 | 303 | #define IBMVFC_PRLI_EST_IMG_PAIR 0x2000 |
304 | u32 orig_pa; | 304 | __be32 orig_pa; |
305 | u32 resp_pa; | 305 | __be32 resp_pa; |
306 | u32 service_parms; | 306 | __be32 service_parms; |
307 | #define IBMVFC_PRLI_TASK_RETRY 0x00000200 | 307 | #define IBMVFC_PRLI_TASK_RETRY 0x00000200 |
308 | #define IBMVFC_PRLI_RETRY 0x00000100 | 308 | #define IBMVFC_PRLI_RETRY 0x00000100 |
309 | #define IBMVFC_PRLI_DATA_OVERLAY 0x00000040 | 309 | #define IBMVFC_PRLI_DATA_OVERLAY 0x00000040 |
@@ -315,47 +315,47 @@ struct ibmvfc_prli_svc_parms { | |||
315 | 315 | ||
316 | struct ibmvfc_process_login { | 316 | struct ibmvfc_process_login { |
317 | struct ibmvfc_mad_common common; | 317 | struct ibmvfc_mad_common common; |
318 | u64 scsi_id; | 318 | __be64 scsi_id; |
319 | struct ibmvfc_prli_svc_parms parms; | 319 | struct ibmvfc_prli_svc_parms parms; |
320 | u8 reserved[48]; | 320 | u8 reserved[48]; |
321 | u16 status; | 321 | __be16 status; |
322 | u16 error; /* also fc_reason */ | 322 | __be16 error; /* also fc_reason */ |
323 | u32 reserved2; | 323 | __be32 reserved2; |
324 | u64 reserved3[2]; | 324 | __be64 reserved3[2]; |
325 | }__attribute__((packed, aligned (8))); | 325 | }__attribute__((packed, aligned (8))); |
326 | 326 | ||
327 | struct ibmvfc_query_tgt { | 327 | struct ibmvfc_query_tgt { |
328 | struct ibmvfc_mad_common common; | 328 | struct ibmvfc_mad_common common; |
329 | u64 wwpn; | 329 | __be64 wwpn; |
330 | u64 scsi_id; | 330 | __be64 scsi_id; |
331 | u16 status; | 331 | __be16 status; |
332 | u16 error; | 332 | __be16 error; |
333 | u16 fc_explain; | 333 | __be16 fc_explain; |
334 | u16 fc_type; | 334 | __be16 fc_type; |
335 | u64 reserved[2]; | 335 | __be64 reserved[2]; |
336 | }__attribute__((packed, aligned (8))); | 336 | }__attribute__((packed, aligned (8))); |
337 | 337 | ||
338 | struct ibmvfc_implicit_logout { | 338 | struct ibmvfc_implicit_logout { |
339 | struct ibmvfc_mad_common common; | 339 | struct ibmvfc_mad_common common; |
340 | u64 old_scsi_id; | 340 | __be64 old_scsi_id; |
341 | u64 reserved[2]; | 341 | __be64 reserved[2]; |
342 | }__attribute__((packed, aligned (8))); | 342 | }__attribute__((packed, aligned (8))); |
343 | 343 | ||
344 | struct ibmvfc_tmf { | 344 | struct ibmvfc_tmf { |
345 | struct ibmvfc_mad_common common; | 345 | struct ibmvfc_mad_common common; |
346 | u64 scsi_id; | 346 | __be64 scsi_id; |
347 | struct scsi_lun lun; | 347 | struct scsi_lun lun; |
348 | u32 flags; | 348 | __be32 flags; |
349 | #define IBMVFC_TMF_ABORT_TASK 0x02 | 349 | #define IBMVFC_TMF_ABORT_TASK 0x02 |
350 | #define IBMVFC_TMF_ABORT_TASK_SET 0x04 | 350 | #define IBMVFC_TMF_ABORT_TASK_SET 0x04 |
351 | #define IBMVFC_TMF_LUN_RESET 0x10 | 351 | #define IBMVFC_TMF_LUN_RESET 0x10 |
352 | #define IBMVFC_TMF_TGT_RESET 0x20 | 352 | #define IBMVFC_TMF_TGT_RESET 0x20 |
353 | #define IBMVFC_TMF_LUA_VALID 0x40 | 353 | #define IBMVFC_TMF_LUA_VALID 0x40 |
354 | #define IBMVFC_TMF_SUPPRESS_ABTS 0x80 | 354 | #define IBMVFC_TMF_SUPPRESS_ABTS 0x80 |
355 | u32 cancel_key; | 355 | __be32 cancel_key; |
356 | u32 my_cancel_key; | 356 | __be32 my_cancel_key; |
357 | u32 pad; | 357 | __be32 pad; |
358 | u64 reserved[2]; | 358 | __be64 reserved[2]; |
359 | }__attribute__((packed, aligned (8))); | 359 | }__attribute__((packed, aligned (8))); |
360 | 360 | ||
361 | enum ibmvfc_fcp_rsp_info_codes { | 361 | enum ibmvfc_fcp_rsp_info_codes { |
@@ -366,7 +366,7 @@ enum ibmvfc_fcp_rsp_info_codes { | |||
366 | }; | 366 | }; |
367 | 367 | ||
368 | struct ibmvfc_fcp_rsp_info { | 368 | struct ibmvfc_fcp_rsp_info { |
369 | u16 reserved; | 369 | __be16 reserved; |
370 | u8 rsp_code; | 370 | u8 rsp_code; |
371 | u8 reserved2[4]; | 371 | u8 reserved2[4]; |
372 | }__attribute__((packed, aligned (2))); | 372 | }__attribute__((packed, aligned (2))); |
@@ -388,13 +388,13 @@ union ibmvfc_fcp_rsp_data { | |||
388 | }__attribute__((packed, aligned (8))); | 388 | }__attribute__((packed, aligned (8))); |
389 | 389 | ||
390 | struct ibmvfc_fcp_rsp { | 390 | struct ibmvfc_fcp_rsp { |
391 | u64 reserved; | 391 | __be64 reserved; |
392 | u16 retry_delay_timer; | 392 | __be16 retry_delay_timer; |
393 | u8 flags; | 393 | u8 flags; |
394 | u8 scsi_status; | 394 | u8 scsi_status; |
395 | u32 fcp_resid; | 395 | __be32 fcp_resid; |
396 | u32 fcp_sense_len; | 396 | __be32 fcp_sense_len; |
397 | u32 fcp_rsp_len; | 397 | __be32 fcp_rsp_len; |
398 | union ibmvfc_fcp_rsp_data data; | 398 | union ibmvfc_fcp_rsp_data data; |
399 | }__attribute__((packed, aligned (8))); | 399 | }__attribute__((packed, aligned (8))); |
400 | 400 | ||
@@ -429,58 +429,58 @@ struct ibmvfc_fcp_cmd_iu { | |||
429 | #define IBMVFC_RDDATA 0x02 | 429 | #define IBMVFC_RDDATA 0x02 |
430 | #define IBMVFC_WRDATA 0x01 | 430 | #define IBMVFC_WRDATA 0x01 |
431 | u8 cdb[IBMVFC_MAX_CDB_LEN]; | 431 | u8 cdb[IBMVFC_MAX_CDB_LEN]; |
432 | u32 xfer_len; | 432 | __be32 xfer_len; |
433 | }__attribute__((packed, aligned (4))); | 433 | }__attribute__((packed, aligned (4))); |
434 | 434 | ||
435 | struct ibmvfc_cmd { | 435 | struct ibmvfc_cmd { |
436 | u64 task_tag; | 436 | __be64 task_tag; |
437 | u32 frame_type; | 437 | __be32 frame_type; |
438 | u32 payload_len; | 438 | __be32 payload_len; |
439 | u32 resp_len; | 439 | __be32 resp_len; |
440 | u32 adapter_resid; | 440 | __be32 adapter_resid; |
441 | u16 status; | 441 | __be16 status; |
442 | u16 error; | 442 | __be16 error; |
443 | u16 flags; | 443 | __be16 flags; |
444 | u16 response_flags; | 444 | __be16 response_flags; |
445 | #define IBMVFC_ADAPTER_RESID_VALID 0x01 | 445 | #define IBMVFC_ADAPTER_RESID_VALID 0x01 |
446 | u32 cancel_key; | 446 | __be32 cancel_key; |
447 | u32 exchange_id; | 447 | __be32 exchange_id; |
448 | struct srp_direct_buf ext_func; | 448 | struct srp_direct_buf ext_func; |
449 | struct srp_direct_buf ioba; | 449 | struct srp_direct_buf ioba; |
450 | struct srp_direct_buf resp; | 450 | struct srp_direct_buf resp; |
451 | u64 correlation; | 451 | __be64 correlation; |
452 | u64 tgt_scsi_id; | 452 | __be64 tgt_scsi_id; |
453 | u64 tag; | 453 | __be64 tag; |
454 | u64 reserved3[2]; | 454 | __be64 reserved3[2]; |
455 | struct ibmvfc_fcp_cmd_iu iu; | 455 | struct ibmvfc_fcp_cmd_iu iu; |
456 | struct ibmvfc_fcp_rsp rsp; | 456 | struct ibmvfc_fcp_rsp rsp; |
457 | }__attribute__((packed, aligned (8))); | 457 | }__attribute__((packed, aligned (8))); |
458 | 458 | ||
459 | struct ibmvfc_passthru_fc_iu { | 459 | struct ibmvfc_passthru_fc_iu { |
460 | u32 payload[7]; | 460 | __be32 payload[7]; |
461 | #define IBMVFC_ADISC 0x52000000 | 461 | #define IBMVFC_ADISC 0x52000000 |
462 | u32 response[7]; | 462 | __be32 response[7]; |
463 | }; | 463 | }; |
464 | 464 | ||
465 | struct ibmvfc_passthru_iu { | 465 | struct ibmvfc_passthru_iu { |
466 | u64 task_tag; | 466 | __be64 task_tag; |
467 | u32 cmd_len; | 467 | __be32 cmd_len; |
468 | u32 rsp_len; | 468 | __be32 rsp_len; |
469 | u16 status; | 469 | __be16 status; |
470 | u16 error; | 470 | __be16 error; |
471 | u32 flags; | 471 | __be32 flags; |
472 | #define IBMVFC_FC_ELS 0x01 | 472 | #define IBMVFC_FC_ELS 0x01 |
473 | #define IBMVFC_FC_CT_IU 0x02 | 473 | #define IBMVFC_FC_CT_IU 0x02 |
474 | u32 cancel_key; | 474 | __be32 cancel_key; |
475 | #define IBMVFC_PASSTHRU_CANCEL_KEY 0x80000000 | 475 | #define IBMVFC_PASSTHRU_CANCEL_KEY 0x80000000 |
476 | #define IBMVFC_INTERNAL_CANCEL_KEY 0x80000001 | 476 | #define IBMVFC_INTERNAL_CANCEL_KEY 0x80000001 |
477 | u32 reserved; | 477 | __be32 reserved; |
478 | struct srp_direct_buf cmd; | 478 | struct srp_direct_buf cmd; |
479 | struct srp_direct_buf rsp; | 479 | struct srp_direct_buf rsp; |
480 | u64 correlation; | 480 | __be64 correlation; |
481 | u64 scsi_id; | 481 | __be64 scsi_id; |
482 | u64 tag; | 482 | __be64 tag; |
483 | u64 reserved2[2]; | 483 | __be64 reserved2[2]; |
484 | }__attribute__((packed, aligned (8))); | 484 | }__attribute__((packed, aligned (8))); |
485 | 485 | ||
486 | struct ibmvfc_passthru_mad { | 486 | struct ibmvfc_passthru_mad { |
@@ -552,7 +552,7 @@ struct ibmvfc_crq { | |||
552 | volatile u8 valid; | 552 | volatile u8 valid; |
553 | volatile u8 format; | 553 | volatile u8 format; |
554 | u8 reserved[6]; | 554 | u8 reserved[6]; |
555 | volatile u64 ioba; | 555 | volatile __be64 ioba; |
556 | }__attribute__((packed, aligned (8))); | 556 | }__attribute__((packed, aligned (8))); |
557 | 557 | ||
558 | struct ibmvfc_crq_queue { | 558 | struct ibmvfc_crq_queue { |
@@ -572,12 +572,12 @@ struct ibmvfc_async_crq { | |||
572 | volatile u8 valid; | 572 | volatile u8 valid; |
573 | u8 link_state; | 573 | u8 link_state; |
574 | u8 pad[2]; | 574 | u8 pad[2]; |
575 | u32 pad2; | 575 | __be32 pad2; |
576 | volatile u64 event; | 576 | volatile __be64 event; |
577 | volatile u64 scsi_id; | 577 | volatile __be64 scsi_id; |
578 | volatile u64 wwpn; | 578 | volatile __be64 wwpn; |
579 | volatile u64 node_name; | 579 | volatile __be64 node_name; |
580 | u64 reserved; | 580 | __be64 reserved; |
581 | }__attribute__((packed, aligned (8))); | 581 | }__attribute__((packed, aligned (8))); |
582 | 582 | ||
583 | struct ibmvfc_async_crq_queue { | 583 | struct ibmvfc_async_crq_queue { |