Skip to content

Commit 3e6f7de

Browse files
Tyrel Datwylermartinkpetersen
authored andcommitted
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>
1 parent 95237c2 commit 3e6f7de

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ static void ibmvfc_log_error(struct ibmvfc_event *evt)
14971497

14981498
scmd_printk(KERN_ERR, cmnd, "Command (%02X) : %s (%x:%x) "
14991499
"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),
15011501
rsp->flags, rsp_code, scsi_get_resid(cmnd), rsp->scsi_status);
15021502
}
15031503

@@ -2023,7 +2023,7 @@ static int ibmvfc_reset_device(struct scsi_device *sdev, int type, char *desc)
20232023
sdev_printk(KERN_ERR, sdev, "%s reset failed: %s (%x:%x) "
20242024
"flags: %x fcp_rsp: %x, scsi_status: %x\n", desc,
20252025
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,
20272027
fc_rsp->scsi_status);
20282028
rsp_rc = -EIO;
20292029
} else
@@ -2382,7 +2382,7 @@ static int ibmvfc_abort_task_set(struct scsi_device *sdev)
23822382
sdev_printk(KERN_ERR, sdev, "Abort failed: %s (%x:%x) "
23832383
"flags: %x fcp_rsp: %x, scsi_status: %x\n",
23842384
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,
23862386
fc_rsp->scsi_status);
23872387
rsp_rc = -EIO;
23882388
} else
@@ -3349,7 +3349,7 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt)
33493349

33503350
tgt_log(tgt, level, "Process Login failed: %s (%x:%x) rc=0x%02X\n",
33513351
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);
33533353
break;
33543354
}
33553355

@@ -3447,9 +3447,10 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt)
34473447
ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT);
34483448

34493449
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,
3451-
ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), rsp->fc_type,
3452-
ibmvfc_get_ls_explain(be16_to_cpu(rsp->fc_explain)), rsp->fc_explain, status);
3450+
ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), be16_to_cpu(rsp->error)),
3451+
be16_to_cpu(rsp->status), be16_to_cpu(rsp->error),
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);
34533454
break;
34543455
}
34553456

@@ -3620,7 +3621,7 @@ static void ibmvfc_tgt_adisc_done(struct ibmvfc_event *evt)
36203621
fc_explain = (be32_to_cpu(mad->fc_iu.response[1]) & 0x0000ff00) >> 8;
36213622
tgt_info(tgt, "ADISC failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n",
36223623
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),
36243625
ibmvfc_get_fc_type(fc_reason), fc_reason,
36253626
ibmvfc_get_ls_explain(fc_explain), fc_explain, status);
36263627
break;
@@ -3832,9 +3833,10 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt)
38323833

38333834
tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n",
38343835
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-
rsp->fc_type, ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)),
3837-
rsp->fc_explain, status);
3836+
be16_to_cpu(rsp->status), be16_to_cpu(rsp->error),
3837+
ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), be16_to_cpu(rsp->fc_type),
3838+
ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)), be16_to_cpu(rsp->fc_explain),
3839+
status);
38383840
break;
38393841
}
38403842

@@ -3960,7 +3962,7 @@ static void ibmvfc_discover_targets_done(struct ibmvfc_event *evt)
39603962
level += ibmvfc_retry_host_init(vhost);
39613963
ibmvfc_log(vhost, level, "Discover Targets failed: %s (%x:%x)\n",
39623964
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));
39643966
break;
39653967
case IBMVFC_MAD_DRIVER_FAILED:
39663968
break;
@@ -4025,7 +4027,7 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt)
40254027
ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
40264028
ibmvfc_log(vhost, level, "NPIV Login failed: %s (%x:%x)\n",
40274029
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));
40294031
ibmvfc_free_event(evt);
40304032
return;
40314033
case IBMVFC_MAD_CRQ_ERROR:

0 commit comments

Comments
 (0)