Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tyrel Datwyler and committed by
Christoph Hellwig
0aab6c3f 0ea85b50

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