aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>2019-03-20 15:56:53 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2019-03-27 21:34:20 -0400
commit3e6f7de43f4960fba8322b16531b0d6624a9322d (patch)
treea58b98cdcdff7ad6e286f316067b1900df9fd96c
parent95237c25d8d08ebc451dd2d793f7e765f57b0c9f (diff)
scsi: ibmvfc: Byte swap status and error codes when logging
Status and error codes are returned in big endian from the VIOS. The values are translated into a human readable format when logged, but the values are also logged. This patch byte swaps those values so that they are consistent between BE and LE platforms. Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 18ee2a8ec3d5..33dda4d32f65 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1497,7 +1497,7 @@ static void ibmvfc_log_error(struct ibmvfc_event *evt)
1497 1497
1498 scmd_printk(KERN_ERR, cmnd, "Command (%02X) : %s (%x:%x) " 1498 scmd_printk(KERN_ERR, cmnd, "Command (%02X) : %s (%x:%x) "
1499 "flags: %x fcp_rsp: %x, resid=%d, scsi_status: %x\n", 1499 "flags: %x fcp_rsp: %x, resid=%d, scsi_status: %x\n",
1500 cmnd->cmnd[0], err, vfc_cmd->status, vfc_cmd->error, 1500 cmnd->cmnd[0], err, be16_to_cpu(vfc_cmd->status), be16_to_cpu(vfc_cmd->error),
1501 rsp->flags, rsp_code, scsi_get_resid(cmnd), rsp->scsi_status); 1501 rsp->flags, rsp_code, scsi_get_resid(cmnd), rsp->scsi_status);
1502} 1502}
1503 1503
@@ -2023,7 +2023,7 @@ static int ibmvfc_reset_device(struct scsi_device *sdev, int type, char *desc)
2023 sdev_printk(KERN_ERR, sdev, "%s reset failed: %s (%x:%x) " 2023 sdev_printk(KERN_ERR, sdev, "%s reset failed: %s (%x:%x) "
2024 "flags: %x fcp_rsp: %x, scsi_status: %x\n", desc, 2024 "flags: %x fcp_rsp: %x, scsi_status: %x\n", desc,
2025 ibmvfc_get_cmd_error(be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error)), 2025 ibmvfc_get_cmd_error(be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error)),
2026 rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, 2026 be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error), fc_rsp->flags, rsp_code,
2027 fc_rsp->scsi_status); 2027 fc_rsp->scsi_status);
2028 rsp_rc = -EIO; 2028 rsp_rc = -EIO;
2029 } else 2029 } else
@@ -2382,7 +2382,7 @@ static int ibmvfc_abort_task_set(struct scsi_device *sdev)
2382 sdev_printk(KERN_ERR, sdev, "Abort failed: %s (%x:%x) " 2382 sdev_printk(KERN_ERR, sdev, "Abort failed: %s (%x:%x) "
2383 "flags: %x fcp_rsp: %x, scsi_status: %x\n", 2383 "flags: %x fcp_rsp: %x, scsi_status: %x\n",
2384 ibmvfc_get_cmd_error(be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error)), 2384 ibmvfc_get_cmd_error(be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error)),
2385 rsp_iu.cmd.status, rsp_iu.cmd.error, fc_rsp->flags, rsp_code, 2385 be16_to_cpu(rsp_iu.cmd.status), be16_to_cpu(rsp_iu.cmd.error), fc_rsp->flags, rsp_code,
2386 fc_rsp->scsi_status); 2386 fc_rsp->scsi_status);
2387 rsp_rc = -EIO; 2387 rsp_rc = -EIO;
2388 } else 2388 } else
@@ -3349,7 +3349,7 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt)
3349 3349
3350 tgt_log(tgt, level, "Process Login failed: %s (%x:%x) rc=0x%02X\n", 3350 tgt_log(tgt, level, "Process Login failed: %s (%x:%x) rc=0x%02X\n",
3351 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 3351 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)),
3352 rsp->status, rsp->error, status); 3352 be16_to_cpu(rsp->status), be16_to_cpu(rsp->error), status);
3353 break; 3353 break;
3354 } 3354 }
3355 3355
@@ -3447,9 +3447,10 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt)
3447 ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); 3447 ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT);
3448 3448
3449 tgt_log(tgt, level, "Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", 3449 tgt_log(tgt, level, "Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n",
3450 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), rsp->status, rsp->error, 3450 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)),
3451 ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), rsp->fc_type, 3451 be16_to_cpu(rsp->status), be16_to_cpu(rsp->error),
3452 ibmvfc_get_ls_explain(be16_to_cpu(rsp->fc_explain)), rsp->fc_explain, status); 3452 ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), be16_to_cpu(rsp->fc_type),
3453 ibmvfc_get_ls_explain(be16_to_cpu(rsp->fc_explain)), be16_to_cpu(rsp->fc_explain), status);
3453 break; 3454 break;
3454 } 3455 }
3455 3456
@@ -3620,7 +3621,7 @@ static void ibmvfc_tgt_adisc_done(struct ibmvfc_event *evt)
3620 fc_explain = (be32_to_cpu(mad->fc_iu.response[1]) & 0x0000ff00) >> 8; 3621 fc_explain = (be32_to_cpu(mad->fc_iu.response[1]) & 0x0000ff00) >> 8;
3621 tgt_info(tgt, "ADISC failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", 3622 tgt_info(tgt, "ADISC failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n",
3622 ibmvfc_get_cmd_error(be16_to_cpu(mad->iu.status), be16_to_cpu(mad->iu.error)), 3623 ibmvfc_get_cmd_error(be16_to_cpu(mad->iu.status), be16_to_cpu(mad->iu.error)),
3623 mad->iu.status, mad->iu.error, 3624 be16_to_cpu(mad->iu.status), be16_to_cpu(mad->iu.error),
3624 ibmvfc_get_fc_type(fc_reason), fc_reason, 3625 ibmvfc_get_fc_type(fc_reason), fc_reason,
3625 ibmvfc_get_ls_explain(fc_explain), fc_explain, status); 3626 ibmvfc_get_ls_explain(fc_explain), fc_explain, status);
3626 break; 3627 break;
@@ -3832,9 +3833,10 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt)
3832 3833
3833 tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", 3834 tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n",
3834 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 3835 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)),
3835 rsp->status, rsp->error, ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), 3836 be16_to_cpu(rsp->status), be16_to_cpu(rsp->error),
3836 rsp->fc_type, ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)), 3837 ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), be16_to_cpu(rsp->fc_type),
3837 rsp->fc_explain, status); 3838 ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)), be16_to_cpu(rsp->fc_explain),
3839 status);
3838 break; 3840 break;
3839 } 3841 }
3840 3842
@@ -3960,7 +3962,7 @@ static void ibmvfc_discover_targets_done(struct ibmvfc_event *evt)
3960 level += ibmvfc_retry_host_init(vhost); 3962 level += ibmvfc_retry_host_init(vhost);
3961 ibmvfc_log(vhost, level, "Discover Targets failed: %s (%x:%x)\n", 3963 ibmvfc_log(vhost, level, "Discover Targets failed: %s (%x:%x)\n",
3962 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 3964 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)),
3963 rsp->status, rsp->error); 3965 be16_to_cpu(rsp->status), be16_to_cpu(rsp->error));
3964 break; 3966 break;
3965 case IBMVFC_MAD_DRIVER_FAILED: 3967 case IBMVFC_MAD_DRIVER_FAILED:
3966 break; 3968 break;
@@ -4025,7 +4027,7 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt)
4025 ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); 4027 ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
4026 ibmvfc_log(vhost, level, "NPIV Login failed: %s (%x:%x)\n", 4028 ibmvfc_log(vhost, level, "NPIV Login failed: %s (%x:%x)\n",
4027 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)), 4029 ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)),
4028 rsp->status, rsp->error); 4030 be16_to_cpu(rsp->status), be16_to_cpu(rsp->error));
4029 ibmvfc_free_event(evt); 4031 ibmvfc_free_event(evt);
4030 return; 4032 return;
4031 case IBMVFC_MAD_CRQ_ERROR: 4033 case IBMVFC_MAD_CRQ_ERROR: