Commit b98ae0d7 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen

scsi: qla2xxx: Fix name server relogin

Name server login is normally handle by FW. In some rare case where one
of the switches is being updated, name server login could get
affected. Trigger relogin to name server when driver detects this
condition.
Signed-off-by: default avatarQuinn Tran <quinn.tran@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f775bd14
...@@ -252,6 +252,8 @@ ...@@ -252,6 +252,8 @@
#define NPH_F_PORT 0x7fe /* FFFFFE */ #define NPH_F_PORT 0x7fe /* FFFFFE */
#define NPH_IP_BROADCAST 0x7ff /* FFFFFF */ #define NPH_IP_BROADCAST 0x7ff /* FFFFFF */
#define NPH_SNS_LID(ha) (IS_FWI2_CAPABLE(ha) ? NPH_SNS : SIMPLE_NAME_SERVER)
#define MAX_CMDSZ 16 /* SCSI maximum CDB size. */ #define MAX_CMDSZ 16 /* SCSI maximum CDB size. */
#include "qla_fw.h" #include "qla_fw.h"
......
...@@ -124,6 +124,7 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt, ...@@ -124,6 +124,7 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
int rval; int rval;
uint16_t comp_status; uint16_t comp_status;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
bool lid_is_sns = false;
rval = QLA_FUNCTION_FAILED; rval = QLA_FUNCTION_FAILED;
if (ms_pkt->entry_status != 0) { if (ms_pkt->entry_status != 0) {
...@@ -155,6 +156,25 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt, ...@@ -155,6 +156,25 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
} else } else
rval = QLA_SUCCESS; rval = QLA_SUCCESS;
break; break;
case CS_PORT_LOGGED_OUT:
if (IS_FWI2_CAPABLE(ha)) {
if (le16_to_cpu(ms_pkt->loop_id.extended) ==
NPH_SNS)
lid_is_sns = true;
} else {
if (le16_to_cpu(ms_pkt->loop_id.extended) ==
SIMPLE_NAME_SERVER)
lid_is_sns = true;
}
if (lid_is_sns) {
ql_dbg(ql_dbg_async, vha, 0x502b,
"%s failed, Name server has logged out",
routine);
rval = QLA_NOT_LOGGED_IN;
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
}
break;
default: default:
ql_dbg(ql_dbg_disc, vha, 0x2033, ql_dbg(ql_dbg_disc, vha, 0x2033,
"%s failed, completion status (%x) on port_id: " "%s failed, completion status (%x) on port_id: "
......
...@@ -1039,6 +1039,20 @@ void qla2x00_fcport_event_handler(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -1039,6 +1039,20 @@ void qla2x00_fcport_event_handler(scsi_qla_host_t *vha, struct event_arg *ea)
uint32_t id = 0, mask, rid; uint32_t id = 0, mask, rid;
int rc; int rc;
switch (ea->event) {
case FCME_RELOGIN:
case FCME_RSCN:
case FCME_GIDPN_DONE:
case FCME_GPSC_DONE:
case FCME_GPNID_DONE:
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) ||
test_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags))
return;
break;
default:
break;
}
switch (ea->event) { switch (ea->event) {
case FCME_RELOGIN: case FCME_RELOGIN:
if (test_bit(UNLOADING, &vha->dpc_flags)) if (test_bit(UNLOADING, &vha->dpc_flags))
...@@ -4451,20 +4465,31 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) ...@@ -4451,20 +4465,31 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
/* EMPTY */ /* EMPTY */
ql_dbg(ql_dbg_disc, vha, 0x2045, ql_dbg(ql_dbg_disc, vha, 0x2045,
"Register FC-4 TYPE failed.\n"); "Register FC-4 TYPE failed.\n");
if (test_bit(LOOP_RESYNC_NEEDED,
&vha->dpc_flags))
break;
} }
if (qla2x00_rff_id(vha)) { if (qla2x00_rff_id(vha)) {
/* EMPTY */ /* EMPTY */
ql_dbg(ql_dbg_disc, vha, 0x2049, ql_dbg(ql_dbg_disc, vha, 0x2049,
"Register FC-4 Features failed.\n"); "Register FC-4 Features failed.\n");
if (test_bit(LOOP_RESYNC_NEEDED,
&vha->dpc_flags))
break;
} }
if (qla2x00_rnn_id(vha)) { if (qla2x00_rnn_id(vha)) {
/* EMPTY */ /* EMPTY */
ql_dbg(ql_dbg_disc, vha, 0x204f, ql_dbg(ql_dbg_disc, vha, 0x204f,
"Register Node Name failed.\n"); "Register Node Name failed.\n");
if (test_bit(LOOP_RESYNC_NEEDED,
&vha->dpc_flags))
break;
} else if (qla2x00_rsnn_nn(vha)) { } else if (qla2x00_rsnn_nn(vha)) {
/* EMPTY */ /* EMPTY */
ql_dbg(ql_dbg_disc, vha, 0x2053, ql_dbg(ql_dbg_disc, vha, 0x2053,
"Register Symobilic Node Name failed.\n"); "Register Symobilic Node Name failed.\n");
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
break;
} }
} }
...@@ -4536,17 +4561,28 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha) ...@@ -4536,17 +4561,28 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
memset(swl, 0, ha->max_fibre_devices * sizeof(sw_info_t)); memset(swl, 0, ha->max_fibre_devices * sizeof(sw_info_t));
if (qla2x00_gid_pt(vha, swl) != QLA_SUCCESS) { if (qla2x00_gid_pt(vha, swl) != QLA_SUCCESS) {
swl = NULL; swl = NULL;
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
return rval;
} else if (qla2x00_gpn_id(vha, swl) != QLA_SUCCESS) { } else if (qla2x00_gpn_id(vha, swl) != QLA_SUCCESS) {
swl = NULL; swl = NULL;
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
return rval;
} else if (qla2x00_gnn_id(vha, swl) != QLA_SUCCESS) { } else if (qla2x00_gnn_id(vha, swl) != QLA_SUCCESS) {
swl = NULL; swl = NULL;
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
return rval;
} else if (qla2x00_gfpn_id(vha, swl) != QLA_SUCCESS) { } else if (qla2x00_gfpn_id(vha, swl) != QLA_SUCCESS) {
swl = NULL; swl = NULL;
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
return rval;
} }
/* If other queries succeeded probe for FC-4 type */ /* If other queries succeeded probe for FC-4 type */
if (swl) if (swl) {
qla2x00_gff_id(vha, swl); qla2x00_gff_id(vha, swl);
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
return rval;
}
} }
swl_idx = 0; swl_idx = 0;
......
...@@ -973,6 +973,23 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) ...@@ -973,6 +973,23 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
if (mb[1] == 0xffff) if (mb[1] == 0xffff)
goto global_port_update; goto global_port_update;
if (mb[1] == NPH_SNS_LID(ha)) {
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
break;
}
/* use handle_cnt for loop id/nport handle */
if (IS_FWI2_CAPABLE(ha))
handle_cnt = NPH_SNS;
else
handle_cnt = SIMPLE_NAME_SERVER;
if (mb[1] == handle_cnt) {
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
break;
}
/* Port logout */ /* Port logout */
fcport = qla2x00_find_fcport_by_loopid(vha, mb[1]); fcport = qla2x00_find_fcport_by_loopid(vha, mb[1]);
if (!fcport) if (!fcport)
......
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