aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuinn Tran <quinn.tran@cavium.com>2018-08-02 16:16:45 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2018-08-02 16:56:18 -0400
commit23dd98a6555897f65306c6937b428c8742fef610 (patch)
tree62ab5c8bd762b84441776f4d9c1b4d92b9a559de
parent48acad099074984f6b0b6e4da011856ba25d12ba (diff)
scsi: qla2xxx: Fix login retry count
Login retry count was not properly decrementing which lead to endless retry. Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/qla2xxx/qla_gs.c16
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c23
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c90
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c3
5 files changed, 70 insertions, 63 deletions
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 4bc2b66b299f..5139a3577bb3 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -3475,6 +3475,14 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
3475 fcport->rscn_gen++; 3475 fcport->rscn_gen++;
3476 fcport->scan_state = QLA_FCPORT_FOUND; 3476 fcport->scan_state = QLA_FCPORT_FOUND;
3477 fcport->flags |= FCF_FABRIC_DEVICE; 3477 fcport->flags |= FCF_FABRIC_DEVICE;
3478 if (fcport->login_retry == 0) {
3479 fcport->login_retry =
3480 vha->hw->login_retry_count;
3481 ql_dbg(ql_dbg_disc, vha, 0xffff,
3482 "Port login retry %8phN, lid 0x%04x cnt=%d.\n",
3483 fcport->port_name, fcport->loop_id,
3484 fcport->login_retry);
3485 }
3478 switch (fcport->disc_state) { 3486 switch (fcport->disc_state) {
3479 case DSC_LOGIN_COMPLETE: 3487 case DSC_LOGIN_COMPLETE:
3480 /* recheck session is still intact. */ 3488 /* recheck session is still intact. */
@@ -3967,6 +3975,14 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
3967 } else { 3975 } else {
3968 if (fcport->rscn_rcvd || 3976 if (fcport->rscn_rcvd ||
3969 fcport->disc_state != DSC_LOGIN_COMPLETE) { 3977 fcport->disc_state != DSC_LOGIN_COMPLETE) {
3978 if (fcport->login_retry == 0) {
3979 fcport->login_retry =
3980 vha->hw->login_retry_count;
3981 ql_dbg(ql_dbg_disc, vha, 0x20a3,
3982 "Port login retry %8phN, lid 0x%04x retry cnt=%d.\n",
3983 fcport->port_name, fcport->loop_id,
3984 fcport->login_retry);
3985 }
3970 fcport->rscn_rcvd = 0; 3986 fcport->rscn_rcvd = 0;
3971 qla24xx_fcport_handle_login(vha, fcport); 3987 qla24xx_fcport_handle_login(vha, fcport);
3972 } 3988 }
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 52e163553e90..aea264100673 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -213,8 +213,6 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
213 if (fcport->fc4f_nvme) 213 if (fcport->fc4f_nvme)
214 lio->u.logio.flags |= SRB_LOGIN_SKIP_PRLI; 214 lio->u.logio.flags |= SRB_LOGIN_SKIP_PRLI;
215 215
216 if (data[1] & QLA_LOGIO_LOGIN_RETRIED)
217 lio->u.logio.flags |= SRB_LOGIN_RETRIED;
218 } 216 }
219 217
220 rval = qla2x00_start_sp(sp); 218 rval = qla2x00_start_sp(sp);
@@ -485,7 +483,6 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
485 483
486 if (ea->rc) { /* rval */ 484 if (ea->rc) { /* rval */
487 if (fcport->login_retry == 0) { 485 if (fcport->login_retry == 0) {
488 fcport->login_retry = vha->hw->login_retry_count;
489 ql_dbg(ql_dbg_disc, vha, 0x20de, 486 ql_dbg(ql_dbg_disc, vha, 0x20de,
490 "GNL failed Port login retry %8phN, retry cnt=%d.\n", 487 "GNL failed Port login retry %8phN, retry cnt=%d.\n",
491 fcport->port_name, fcport->login_retry); 488 fcport->port_name, fcport->login_retry);
@@ -1256,11 +1253,10 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
1256 return 0; 1253 return 0;
1257 } 1254 }
1258 1255
1259 if (fcport->login_retry > 0)
1260 fcport->login_retry--;
1261 1256
1262 switch (fcport->disc_state) { 1257 switch (fcport->disc_state) {
1263 case DSC_DELETED: 1258 case DSC_DELETED:
1259 fcport->login_retry--;
1264 wwn = wwn_to_u64(fcport->node_name); 1260 wwn = wwn_to_u64(fcport->node_name);
1265 if (wwn == 0) { 1261 if (wwn == 0) {
1266 ql_dbg(ql_dbg_disc, vha, 0xffff, 1262 ql_dbg(ql_dbg_disc, vha, 0xffff,
@@ -1273,6 +1269,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
1273 __func__, __LINE__, fcport->port_name); 1269 __func__, __LINE__, fcport->port_name);
1274 qla24xx_post_gnl_work(vha, fcport); 1270 qla24xx_post_gnl_work(vha, fcport);
1275 } else { 1271 } else {
1272 fcport->login_retry--;
1276 qla_chk_n2n_b4_login(vha, fcport); 1273 qla_chk_n2n_b4_login(vha, fcport);
1277 } 1274 }
1278 break; 1275 break;
@@ -1289,6 +1286,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
1289 break; 1286 break;
1290 1287
1291 case DSC_LOGIN_FAILED: 1288 case DSC_LOGIN_FAILED:
1289 fcport->login_retry--;
1292 ql_dbg(ql_dbg_disc, vha, 0x20d0, 1290 ql_dbg(ql_dbg_disc, vha, 0x20d0,
1293 "%s %d %8phC post gidpn\n", 1291 "%s %d %8phC post gidpn\n",
1294 __func__, __LINE__, fcport->port_name); 1292 __func__, __LINE__, fcport->port_name);
@@ -1303,6 +1301,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
1303 ql_dbg(ql_dbg_disc, vha, 0x20d1, 1301 ql_dbg(ql_dbg_disc, vha, 0x20d1,
1304 "%s %d %8phC post adisc\n", 1302 "%s %d %8phC post adisc\n",
1305 __func__, __LINE__, fcport->port_name); 1303 __func__, __LINE__, fcport->port_name);
1304 fcport->login_retry--;
1306 data[0] = data[1] = 0; 1305 data[0] = data[1] = 0;
1307 qla2x00_post_async_adisc_work(vha, fcport, data); 1306 qla2x00_post_async_adisc_work(vha, fcport, data);
1308 break; 1307 break;
@@ -1386,17 +1385,6 @@ void qla24xx_handle_relogin_event(scsi_qla_host_t *vha,
1386 } 1385 }
1387 } 1386 }
1388 1387
1389 if (fcport->flags & FCF_ASYNC_SENT) {
1390 fcport->login_retry++;
1391 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
1392 return;
1393 }
1394
1395 if (fcport->disc_state == DSC_DELETE_PEND) {
1396 fcport->login_retry++;
1397 return;
1398 }
1399
1400 if (fcport->last_rscn_gen != fcport->rscn_gen) { 1388 if (fcport->last_rscn_gen != fcport->rscn_gen) {
1401 ql_dbg(ql_dbg_disc, vha, 0x20e9, "%s %d %8phC post gidpn\n", 1389 ql_dbg(ql_dbg_disc, vha, 0x20e9, "%s %d %8phC post gidpn\n",
1402 __func__, __LINE__, fcport->port_name); 1390 __func__, __LINE__, fcport->port_name);
@@ -1882,7 +1870,6 @@ void
1882qla2x00_async_logout_done(struct scsi_qla_host *vha, fc_port_t *fcport, 1870qla2x00_async_logout_done(struct scsi_qla_host *vha, fc_port_t *fcport,
1883 uint16_t *data) 1871 uint16_t *data)
1884{ 1872{
1885 qla2x00_mark_device_lost(vha, fcport, 1, 0);
1886 qlt_logo_completion_handler(fcport, data[0]); 1873 qlt_logo_completion_handler(fcport, data[0]);
1887 fcport->login_gen++; 1874 fcport->login_gen++;
1888 fcport->flags &= ~FCF_ASYNC_ACTIVE; 1875 fcport->flags &= ~FCF_ASYNC_ACTIVE;
@@ -5076,11 +5063,11 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
5076 if (IS_QLAFX00(vha->hw)) { 5063 if (IS_QLAFX00(vha->hw)) {
5077 qla2x00_set_fcport_state(fcport, FCS_ONLINE); 5064 qla2x00_set_fcport_state(fcport, FCS_ONLINE);
5078 } else { 5065 } else {
5079 fcport->login_retry = 0;
5080 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); 5066 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT);
5081 fcport->disc_state = DSC_LOGIN_COMPLETE; 5067 fcport->disc_state = DSC_LOGIN_COMPLETE;
5082 fcport->deleted = 0; 5068 fcport->deleted = 0;
5083 fcport->logout_on_delete = 1; 5069 fcport->logout_on_delete = 1;
5070 fcport->login_retry = vha->hw->login_retry_count;
5084 qla2x00_set_fcport_state(fcport, FCS_ONLINE); 5071 qla2x00_set_fcport_state(fcport, FCS_ONLINE);
5085 } 5072 }
5086 5073
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 4e42ce057a37..17537f0b3b54 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3912,6 +3912,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
3912 rptid_entry->u.f2.port_name, 1); 3912 rptid_entry->u.f2.port_name, 1);
3913 3913
3914 if (fcport) { 3914 if (fcport) {
3915 fcport->login_retry = vha->hw->login_retry_count;
3915 fcport->plogi_nack_done_deadline = jiffies + HZ; 3916 fcport->plogi_nack_done_deadline = jiffies + HZ;
3916 fcport->scan_state = QLA_FCPORT_FOUND; 3917 fcport->scan_state = QLA_FCPORT_FOUND;
3917 } 3918 }
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index eb804e2feedf..e218d68de532 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3838,14 +3838,6 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport,
3838 return; 3838 return;
3839 3839
3840 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); 3840 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
3841
3842 if (fcport->login_retry == 0) {
3843 fcport->login_retry = vha->hw->login_retry_count;
3844
3845 ql_dbg(ql_dbg_disc, vha, 0x20a3,
3846 "Port login retry %8phN, lid 0x%04x retry cnt=%d.\n",
3847 fcport->port_name, fcport->loop_id, fcport->login_retry);
3848 }
3849} 3841}
3850 3842
3851/* 3843/*
@@ -5098,7 +5090,7 @@ int qla24xx_post_relogin_work(struct scsi_qla_host *vha)
5098void qla2x00_relogin(struct scsi_qla_host *vha) 5090void qla2x00_relogin(struct scsi_qla_host *vha)
5099{ 5091{
5100 fc_port_t *fcport; 5092 fc_port_t *fcport;
5101 int status; 5093 int status, relogin_needed = 0;
5102 struct event_arg ea; 5094 struct event_arg ea;
5103 5095
5104 list_for_each_entry(fcport, &vha->vp_fcports, list) { 5096 list_for_each_entry(fcport, &vha->vp_fcports, list) {
@@ -5107,47 +5099,59 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
5107 * to it if we haven't run out of retries. 5099 * to it if we haven't run out of retries.
5108 */ 5100 */
5109 if (atomic_read(&fcport->state) != FCS_ONLINE && 5101 if (atomic_read(&fcport->state) != FCS_ONLINE &&
5110 fcport->login_retry && 5102 fcport->login_retry) {
5111 !(fcport->flags & (FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE))) { 5103 if (fcport->scan_state != QLA_FCPORT_FOUND ||
5112 if (vha->hw->current_topology != ISP_CFG_NL) { 5104 fcport->disc_state == DSC_LOGIN_COMPLETE)
5113 ql_dbg(ql_dbg_disc, fcport->vha, 0x2108, 5105 continue;
5114 "%s %8phC DS %d LS %d\n", __func__,
5115 fcport->port_name, fcport->disc_state,
5116 fcport->fw_login_state);
5117 memset(&ea, 0, sizeof(ea));
5118 ea.event = FCME_RELOGIN;
5119 ea.fcport = fcport;
5120 qla2x00_fcport_event_handler(vha, &ea);
5121 } else if (vha->hw->current_topology == ISP_CFG_NL) {
5122 fcport->login_retry--;
5123 status = qla2x00_local_device_login(vha,
5124 fcport);
5125 if (status == QLA_SUCCESS) {
5126 fcport->old_loop_id = fcport->loop_id;
5127 ql_dbg(ql_dbg_disc, vha, 0x2003,
5128 "Port login OK: logged in ID 0x%x.\n",
5129 fcport->loop_id);
5130 qla2x00_update_fcport(vha, fcport);
5131 } else if (status == 1) {
5132 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
5133 /* retry the login again */
5134 ql_dbg(ql_dbg_disc, vha, 0x2007,
5135 "Retrying %d login again loop_id 0x%x.\n",
5136 fcport->login_retry,
5137 fcport->loop_id);
5138 } else {
5139 fcport->login_retry = 0;
5140 }
5141 5106
5142 if (fcport->login_retry == 0 && 5107 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) ||
5143 status != QLA_SUCCESS) 5108 fcport->disc_state == DSC_DELETE_PEND) {
5144 qla2x00_clear_loop_id(fcport); 5109 relogin_needed = 1;
5110 } else {
5111 if (vha->hw->current_topology != ISP_CFG_NL) {
5112 memset(&ea, 0, sizeof(ea));
5113 ea.event = FCME_RELOGIN;
5114 ea.fcport = fcport;
5115 qla2x00_fcport_event_handler(vha, &ea);
5116 } else if (vha->hw->current_topology ==
5117 ISP_CFG_NL) {
5118 fcport->login_retry--;
5119 status =
5120 qla2x00_local_device_login(vha,
5121 fcport);
5122 if (status == QLA_SUCCESS) {
5123 fcport->old_loop_id =
5124 fcport->loop_id;
5125 ql_dbg(ql_dbg_disc, vha, 0x2003,
5126 "Port login OK: logged in ID 0x%x.\n",
5127 fcport->loop_id);
5128 qla2x00_update_fcport
5129 (vha, fcport);
5130 } else if (status == 1) {
5131 set_bit(RELOGIN_NEEDED,
5132 &vha->dpc_flags);
5133 /* retry the login again */
5134 ql_dbg(ql_dbg_disc, vha, 0x2007,
5135 "Retrying %d login again loop_id 0x%x.\n",
5136 fcport->login_retry,
5137 fcport->loop_id);
5138 } else {
5139 fcport->login_retry = 0;
5140 }
5141
5142 if (fcport->login_retry == 0 &&
5143 status != QLA_SUCCESS)
5144 qla2x00_clear_loop_id(fcport);
5145 }
5145 } 5146 }
5146 } 5147 }
5147 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) 5148 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
5148 break; 5149 break;
5149 } 5150 }
5150 5151
5152 if (relogin_needed)
5153 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
5154
5151 ql_dbg(ql_dbg_disc, vha, 0x400e, 5155 ql_dbg(ql_dbg_disc, vha, 0x400e,
5152 "Relogin end.\n"); 5156 "Relogin end.\n");
5153} 5157}
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 9d10989ed027..4f9c315813df 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1057,7 +1057,6 @@ void qlt_free_session_done(struct work_struct *work)
1057 sess->disc_state = DSC_DELETED; 1057 sess->disc_state = DSC_DELETED;
1058 sess->fw_login_state = DSC_LS_PORT_UNAVAIL; 1058 sess->fw_login_state = DSC_LS_PORT_UNAVAIL;
1059 sess->deleted = QLA_SESS_DELETED; 1059 sess->deleted = QLA_SESS_DELETED;
1060 sess->login_retry = vha->hw->login_retry_count;
1061 1060
1062 if (sess->login_succ && !IS_SW_RESV_ADDR(sess->d_id)) { 1061 if (sess->login_succ && !IS_SW_RESV_ADDR(sess->d_id)) {
1063 vha->fcport_count--; 1062 vha->fcport_count--;
@@ -1161,7 +1160,7 @@ void qlt_unreg_sess(struct fc_port *sess)
1161 if (sess->se_sess) 1160 if (sess->se_sess)
1162 vha->hw->tgt.tgt_ops->clear_nacl_from_fcport_map(sess); 1161 vha->hw->tgt.tgt_ops->clear_nacl_from_fcport_map(sess);
1163 1162
1164 qla2x00_mark_device_lost(vha, sess, 1, 1); 1163 qla2x00_mark_device_lost(vha, sess, 0, 0);
1165 1164
1166 sess->deleted = QLA_SESS_DELETION_IN_PROGRESS; 1165 sess->deleted = QLA_SESS_DELETION_IN_PROGRESS;
1167 sess->disc_state = DSC_DELETE_PEND; 1166 sess->disc_state = DSC_DELETE_PEND;