scsi: qla2xxx: Allow SNS fabric login to be retried
authorJoe Carnuccio <joe.carnuccio@cavium.com>
Wed, 23 Aug 2017 22:05:12 +0000 (15:05 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 25 Aug 2017 02:29:27 +0000 (22:29 -0400)
If SNS fabric login fails, set loop resync flag to retry via dpc.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_init.c

index d00e0129c51b7e4a6117e6fb33a166651ba91744..fe2d196833aa3a0420e5f2cbce2a51725d838bd2 100644 (file)
@@ -4752,24 +4752,16 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
                        qla2x00_fdmi_register(vha);
 
                /* Ensure we are logged into the SNS. */
-               if (IS_FWI2_CAPABLE(ha))
-                       loop_id = NPH_SNS;
-               else
-                       loop_id = SIMPLE_NAME_SERVER;
+               loop_id = NPH_SNS_LID(ha);
                rval = ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff,
                    0xfc, mb, BIT_1|BIT_0);
-               if (rval != QLA_SUCCESS) {
+               if (rval != QLA_SUCCESS || mb[0] != MBS_COMMAND_COMPLETE) {
+                       ql_dbg(ql_dbg_disc, vha, 0x20a1,
+                           "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x (%x).\n",
+                           loop_id, mb[0], mb[1], mb[2], mb[6], mb[7], rval);
                        set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
                        return rval;
                }
-               if (mb[0] != MBS_COMMAND_COMPLETE) {
-                       ql_dbg(ql_dbg_disc, vha, 0x20a1,
-                           "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x "
-                           "mb[6]=%x mb[7]=%x.\n", loop_id, mb[0], mb[1],
-                           mb[2], mb[6], mb[7]);
-                       return (QLA_SUCCESS);
-               }
-
                if (test_and_clear_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags)) {
                        if (qla2x00_rft_id(vha)) {
                                /* EMPTY */