Commit 0b91d116 authored by Chad Dupuis's avatar Chad Dupuis Committed by James Bottomley

[SCSI] qla2xxx: Handle failure cases during fabric_login

Make sure that all calls to ha->isp_ops->fabric_login() check the
return value for failure.
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarChad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 2b29d96d
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
* ---------------------------------------------------------------------- * ----------------------------------------------------------------------
* | Level | Last Value Used | Holes | * | Level | Last Value Used | Holes |
* ---------------------------------------------------------------------- * ----------------------------------------------------------------------
* | Module Init and Probe | 0x011f | 0x4b,0xfa | * | Module Init and Probe | 0x0120 | 0x4b,0xba,0xfa |
* | Mailbox commands | 0x1139 | 0x112c-0x112e | * | Mailbox commands | 0x1139 | 0x112c-0x112e |
* | Device Discovery | 0x2084 | | * | Device Discovery | 0x2085 | 0x2020-0x2022 |
* | Queue Command and IO tracing | 0x302f | 0x3006,0x3008 | * | Queue Command and IO tracing | 0x302f | 0x3006,0x3008 |
* | | | 0x302d-0x302e | * | | | 0x302d-0x302e |
* | DPC Thread | 0x401c | | * | DPC Thread | 0x401c | |
......
...@@ -1107,20 +1107,26 @@ qla2x00_sns_rnn_id(scsi_qla_host_t *vha) ...@@ -1107,20 +1107,26 @@ qla2x00_sns_rnn_id(scsi_qla_host_t *vha)
static int static int
qla2x00_mgmt_svr_login(scsi_qla_host_t *vha) qla2x00_mgmt_svr_login(scsi_qla_host_t *vha)
{ {
int ret; int ret, rval;
uint16_t mb[MAILBOX_REGISTER_COUNT]; uint16_t mb[MAILBOX_REGISTER_COUNT];
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
ret = QLA_SUCCESS; ret = QLA_SUCCESS;
if (vha->flags.management_server_logged_in) if (vha->flags.management_server_logged_in)
return ret; return ret;
ha->isp_ops->fabric_login(vha, vha->mgmt_svr_loop_id, 0xff, 0xff, 0xfa, rval = ha->isp_ops->fabric_login(vha, vha->mgmt_svr_loop_id, 0xff, 0xff,
mb, BIT_1|BIT_0); 0xfa, mb, BIT_1|BIT_0);
if (mb[0] != MBS_COMMAND_COMPLETE) { if (rval != QLA_SUCCESS || mb[0] != MBS_COMMAND_COMPLETE) {
if (rval == QLA_MEMORY_ALLOC_FAILED)
ql_dbg(ql_dbg_disc, vha, 0x2085,
"Failed management_server login: loopid=%x "
"rval=%d\n", vha->mgmt_svr_loop_id, rval);
else
ql_dbg(ql_dbg_disc, vha, 0x2024, ql_dbg(ql_dbg_disc, vha, 0x2024,
"Failed management_server login: loopid=%x mb[0]=%x " "Failed management_server login: loopid=%x "
"mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x.\n", "mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x.\n",
vha->mgmt_svr_loop_id, mb[0], mb[1], mb[2], mb[6], mb[7]); vha->mgmt_svr_loop_id, mb[0], mb[1], mb[2], mb[6],
mb[7]);
ret = QLA_FUNCTION_FAILED; ret = QLA_FUNCTION_FAILED;
} else } else
vha->flags.management_server_logged_in = 1; vha->flags.management_server_logged_in = 1;
......
...@@ -2949,8 +2949,12 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) ...@@ -2949,8 +2949,12 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
loop_id = NPH_SNS; loop_id = NPH_SNS;
else else
loop_id = SIMPLE_NAME_SERVER; loop_id = SIMPLE_NAME_SERVER;
ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff, rval = ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff,
0xfc, mb, BIT_1 | BIT_0); 0xfc, mb, BIT_1|BIT_0);
if (rval != QLA_SUCCESS) {
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
return rval;
}
if (mb[0] != MBS_COMMAND_COMPLETE) { if (mb[0] != MBS_COMMAND_COMPLETE) {
ql_dbg(ql_dbg_disc, vha, 0x2042, ql_dbg(ql_dbg_disc, vha, 0x2042,
"Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x " "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x "
...@@ -3487,6 +3491,9 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *vha, fc_port_t *fcport, ...@@ -3487,6 +3491,9 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *vha, fc_port_t *fcport,
} else { } else {
qla2x00_update_fcport(vha, fcport); qla2x00_update_fcport(vha, fcport);
} }
} else {
/* Retry Login. */
qla2x00_mark_device_lost(vha, fcport, 1, 0);
} }
return (rval); return (rval);
...@@ -3527,9 +3534,12 @@ qla2x00_fabric_login(scsi_qla_host_t *vha, fc_port_t *fcport, ...@@ -3527,9 +3534,12 @@ qla2x00_fabric_login(scsi_qla_host_t *vha, fc_port_t *fcport,
fcport->d_id.b.area, fcport->d_id.b.al_pa); fcport->d_id.b.area, fcport->d_id.b.al_pa);
/* Login fcport on switch. */ /* Login fcport on switch. */
ha->isp_ops->fabric_login(vha, fcport->loop_id, rval = ha->isp_ops->fabric_login(vha, fcport->loop_id,
fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.domain, fcport->d_id.b.area,
fcport->d_id.b.al_pa, mb, BIT_0); fcport->d_id.b.al_pa, mb, BIT_0);
if (rval != QLA_SUCCESS) {
return rval;
}
if (mb[0] == MBS_PORT_ID_USED) { if (mb[0] == MBS_PORT_ID_USED) {
/* /*
* Device has another loop ID. The firmware team * Device has another loop ID. The firmware team
...@@ -4844,6 +4854,7 @@ int ...@@ -4844,6 +4854,7 @@ int
qla24xx_configure_vhba(scsi_qla_host_t *vha) qla24xx_configure_vhba(scsi_qla_host_t *vha)
{ {
int rval = QLA_SUCCESS; int rval = QLA_SUCCESS;
int rval2;
uint16_t mb[MAILBOX_REGISTER_COUNT]; uint16_t mb[MAILBOX_REGISTER_COUNT];
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
...@@ -4868,11 +4879,17 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha) ...@@ -4868,11 +4879,17 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
vha->flags.management_server_logged_in = 0; vha->flags.management_server_logged_in = 0;
/* Login to SNS first */ /* Login to SNS first */
ha->isp_ops->fabric_login(vha, NPH_SNS, 0xff, 0xff, 0xfc, mb, BIT_1); rval2 = ha->isp_ops->fabric_login(vha, NPH_SNS, 0xff, 0xff, 0xfc, mb,
if (mb[0] != MBS_COMMAND_COMPLETE) { BIT_1);
if (rval2 != QLA_SUCCESS || mb[0] != MBS_COMMAND_COMPLETE) {
if (rval2 == QLA_MEMORY_ALLOC_FAILED)
ql_dbg(ql_dbg_init, vha, 0x0120,
"Failed SNS login: loop_id=%x, rval2=%d\n",
NPH_SNS, rval2);
else
ql_dbg(ql_dbg_init, vha, 0x0103, ql_dbg(ql_dbg_init, vha, 0x0103,
"Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x " "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "
"mb[6]=%x mb[7]=%x.\n", "mb[2]=%x mb[6]=%x mb[7]=%x.\n",
NPH_SNS, mb[0], mb[1], mb[2], mb[6], mb[7]); NPH_SNS, mb[0], mb[1], mb[2], mb[6], mb[7]);
return (QLA_FUNCTION_FAILED); return (QLA_FUNCTION_FAILED);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment