aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChad Dupuis <chad.dupuis@qlogic.com>2012-02-09 14:15:42 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 09:18:52 -0500
commit0b91d1169e5382040d80622fe79e40c60ff88555 (patch)
tree27bdb71932b6ebc4b3caf05a98931f531629afea /drivers
parent2b29d96d7122befe50727c7f5090e783ed910826 (diff)
[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: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_gs.c22
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c35
3 files changed, 42 insertions, 19 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index cd278a09bea0..b85ba1ea0106 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -11,9 +11,9 @@
11 * ---------------------------------------------------------------------- 11 * ----------------------------------------------------------------------
12 * | Level | Last Value Used | Holes | 12 * | Level | Last Value Used | Holes |
13 * ---------------------------------------------------------------------- 13 * ----------------------------------------------------------------------
14 * | Module Init and Probe | 0x011f | 0x4b,0xfa | 14 * | Module Init and Probe | 0x0120 | 0x4b,0xba,0xfa |
15 * | Mailbox commands | 0x1139 | 0x112c-0x112e | 15 * | Mailbox commands | 0x1139 | 0x112c-0x112e |
16 * | Device Discovery | 0x2084 | | 16 * | Device Discovery | 0x2085 | 0x2020-0x2022 |
17 * | Queue Command and IO tracing | 0x302f | 0x3006,0x3008 | 17 * | Queue Command and IO tracing | 0x302f | 0x3006,0x3008 |
18 * | | | 0x302d-0x302e | 18 * | | | 0x302d-0x302e |
19 * | DPC Thread | 0x401c | | 19 * | DPC Thread | 0x401c | |
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index dd8339928a5f..692430365297 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -1107,20 +1107,26 @@ qla2x00_sns_rnn_id(scsi_qla_host_t *vha)
1107static int 1107static int
1108qla2x00_mgmt_svr_login(scsi_qla_host_t *vha) 1108qla2x00_mgmt_svr_login(scsi_qla_host_t *vha)
1109{ 1109{
1110 int ret; 1110 int ret, rval;
1111 uint16_t mb[MAILBOX_REGISTER_COUNT]; 1111 uint16_t mb[MAILBOX_REGISTER_COUNT];
1112 struct qla_hw_data *ha = vha->hw; 1112 struct qla_hw_data *ha = vha->hw;
1113 ret = QLA_SUCCESS; 1113 ret = QLA_SUCCESS;
1114 if (vha->flags.management_server_logged_in) 1114 if (vha->flags.management_server_logged_in)
1115 return ret; 1115 return ret;
1116 1116
1117 ha->isp_ops->fabric_login(vha, vha->mgmt_svr_loop_id, 0xff, 0xff, 0xfa, 1117 rval = ha->isp_ops->fabric_login(vha, vha->mgmt_svr_loop_id, 0xff, 0xff,
1118 mb, BIT_1|BIT_0); 1118 0xfa, mb, BIT_1|BIT_0);
1119 if (mb[0] != MBS_COMMAND_COMPLETE) { 1119 if (rval != QLA_SUCCESS || mb[0] != MBS_COMMAND_COMPLETE) {
1120 ql_dbg(ql_dbg_disc, vha, 0x2024, 1120 if (rval == QLA_MEMORY_ALLOC_FAILED)
1121 "Failed management_server login: loopid=%x mb[0]=%x " 1121 ql_dbg(ql_dbg_disc, vha, 0x2085,
1122 "mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x.\n", 1122 "Failed management_server login: loopid=%x "
1123 vha->mgmt_svr_loop_id, mb[0], mb[1], mb[2], mb[6], mb[7]); 1123 "rval=%d\n", vha->mgmt_svr_loop_id, rval);
1124 else
1125 ql_dbg(ql_dbg_disc, vha, 0x2024,
1126 "Failed management_server login: loopid=%x "
1127 "mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x.\n",
1128 vha->mgmt_svr_loop_id, mb[0], mb[1], mb[2], mb[6],
1129 mb[7]);
1124 ret = QLA_FUNCTION_FAILED; 1130 ret = QLA_FUNCTION_FAILED;
1125 } else 1131 } else
1126 vha->flags.management_server_logged_in = 1; 1132 vha->flags.management_server_logged_in = 1;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index ff841d7172f2..abd095c400d8 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2949,8 +2949,12 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
2949 loop_id = NPH_SNS; 2949 loop_id = NPH_SNS;
2950 else 2950 else
2951 loop_id = SIMPLE_NAME_SERVER; 2951 loop_id = SIMPLE_NAME_SERVER;
2952 ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff, 2952 rval = ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff,
2953 0xfc, mb, BIT_1 | BIT_0); 2953 0xfc, mb, BIT_1|BIT_0);
2954 if (rval != QLA_SUCCESS) {
2955 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
2956 return rval;
2957 }
2954 if (mb[0] != MBS_COMMAND_COMPLETE) { 2958 if (mb[0] != MBS_COMMAND_COMPLETE) {
2955 ql_dbg(ql_dbg_disc, vha, 0x2042, 2959 ql_dbg(ql_dbg_disc, vha, 0x2042,
2956 "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x " 2960 "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 } else { 3491 } else {
3488 qla2x00_update_fcport(vha, fcport); 3492 qla2x00_update_fcport(vha, fcport);
3489 } 3493 }
3494 } else {
3495 /* Retry Login. */
3496 qla2x00_mark_device_lost(vha, fcport, 1, 0);
3490 } 3497 }
3491 3498
3492 return (rval); 3499 return (rval);
@@ -3527,9 +3534,12 @@ qla2x00_fabric_login(scsi_qla_host_t *vha, fc_port_t *fcport,
3527 fcport->d_id.b.area, fcport->d_id.b.al_pa); 3534 fcport->d_id.b.area, fcport->d_id.b.al_pa);
3528 3535
3529 /* Login fcport on switch. */ 3536 /* Login fcport on switch. */
3530 ha->isp_ops->fabric_login(vha, fcport->loop_id, 3537 rval = ha->isp_ops->fabric_login(vha, fcport->loop_id,
3531 fcport->d_id.b.domain, fcport->d_id.b.area, 3538 fcport->d_id.b.domain, fcport->d_id.b.area,
3532 fcport->d_id.b.al_pa, mb, BIT_0); 3539 fcport->d_id.b.al_pa, mb, BIT_0);
3540 if (rval != QLA_SUCCESS) {
3541 return rval;
3542 }
3533 if (mb[0] == MBS_PORT_ID_USED) { 3543 if (mb[0] == MBS_PORT_ID_USED) {
3534 /* 3544 /*
3535 * Device has another loop ID. The firmware team 3545 * Device has another loop ID. The firmware team
@@ -4844,6 +4854,7 @@ int
4844qla24xx_configure_vhba(scsi_qla_host_t *vha) 4854qla24xx_configure_vhba(scsi_qla_host_t *vha)
4845{ 4855{
4846 int rval = QLA_SUCCESS; 4856 int rval = QLA_SUCCESS;
4857 int rval2;
4847 uint16_t mb[MAILBOX_REGISTER_COUNT]; 4858 uint16_t mb[MAILBOX_REGISTER_COUNT];
4848 struct qla_hw_data *ha = vha->hw; 4859 struct qla_hw_data *ha = vha->hw;
4849 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); 4860 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
@@ -4868,12 +4879,18 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
4868 vha->flags.management_server_logged_in = 0; 4879 vha->flags.management_server_logged_in = 0;
4869 4880
4870 /* Login to SNS first */ 4881 /* Login to SNS first */
4871 ha->isp_ops->fabric_login(vha, NPH_SNS, 0xff, 0xff, 0xfc, mb, BIT_1); 4882 rval2 = ha->isp_ops->fabric_login(vha, NPH_SNS, 0xff, 0xff, 0xfc, mb,
4872 if (mb[0] != MBS_COMMAND_COMPLETE) { 4883 BIT_1);
4873 ql_dbg(ql_dbg_init, vha, 0x0103, 4884 if (rval2 != QLA_SUCCESS || mb[0] != MBS_COMMAND_COMPLETE) {
4874 "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x " 4885 if (rval2 == QLA_MEMORY_ALLOC_FAILED)
4875 "mb[6]=%x mb[7]=%x.\n", 4886 ql_dbg(ql_dbg_init, vha, 0x0120,
4876 NPH_SNS, mb[0], mb[1], mb[2], mb[6], mb[7]); 4887 "Failed SNS login: loop_id=%x, rval2=%d\n",
4888 NPH_SNS, rval2);
4889 else
4890 ql_dbg(ql_dbg_init, vha, 0x0103,
4891 "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "
4892 "mb[2]=%x mb[6]=%x mb[7]=%x.\n",
4893 NPH_SNS, mb[0], mb[1], mb[2], mb[6], mb[7]);
4877 return (QLA_FUNCTION_FAILED); 4894 return (QLA_FUNCTION_FAILED);
4878 } 4895 }
4879 4896