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

scsi: qla2xxx: Replace GPDB with async ADISC command

Replace call to Get Port DataBase MB with PDO_FORCE_ADISC
flag with async ADISC command so driver can see ADISC command
has error or not.
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 ad0a0b01
...@@ -2277,6 +2277,7 @@ enum discovery_state { ...@@ -2277,6 +2277,7 @@ enum discovery_state {
DSC_GPSC, DSC_GPSC,
DSC_UPD_FCPORT, DSC_UPD_FCPORT,
DSC_LOGIN_COMPLETE, DSC_LOGIN_COMPLETE,
DSC_ADISC,
DSC_DELETE_PEND, DSC_DELETE_PEND,
}; };
...@@ -2303,6 +2304,7 @@ enum fcport_mgt_event { ...@@ -2303,6 +2304,7 @@ enum fcport_mgt_event {
FCME_GPNID_DONE, FCME_GPNID_DONE,
FCME_GFFID_DONE, FCME_GFFID_DONE,
FCME_DELETE_DONE, FCME_DELETE_DONE,
FCME_ADISC_DONE,
}; };
enum rscn_addr_format { enum rscn_addr_format {
......
...@@ -2823,15 +2823,19 @@ void qla24xx_handle_gidpn_event(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -2823,15 +2823,19 @@ void qla24xx_handle_gidpn_event(scsi_qla_host_t *vha, struct event_arg *ea)
"%s %d %8phC post %s\n", __func__, "%s %d %8phC post %s\n", __func__,
__LINE__, fcport->port_name, __LINE__, fcport->port_name,
(atomic_read(&fcport->state) == (atomic_read(&fcport->state) ==
FCS_ONLINE) ? "gpdb" : "gnl"); FCS_ONLINE) ? "adisc" : "gnl");
if (atomic_read(&fcport->state) == if (atomic_read(&fcport->state) ==
FCS_ONLINE) FCS_ONLINE) {
qla24xx_post_gpdb_work(vha, u16 data[2];
fcport, PDO_FORCE_ADISC);
else data[0] = data[1] = 0;
qla2x00_post_async_adisc_work(
vha, fcport, data);
} else {
qla24xx_post_gnl_work(vha, qla24xx_post_gnl_work(vha,
fcport); fcport);
}
break; break;
} }
} else { /* fcport->d_id.b24 != ea->id.b24 */ } else { /* fcport->d_id.b24 != ea->id.b24 */
...@@ -3172,6 +3176,7 @@ void qla24xx_async_gpnid_done(scsi_qla_host_t *vha, srb_t *sp) ...@@ -3172,6 +3176,7 @@ void qla24xx_async_gpnid_done(scsi_qla_host_t *vha, srb_t *sp)
void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea) void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
{ {
fc_port_t *fcport, *conflict, *t; fc_port_t *fcport, *conflict, *t;
u16 data[2];
ql_dbg(ql_dbg_disc, vha, 0xffff, ql_dbg(ql_dbg_disc, vha, 0xffff,
"%s %d port_id: %06x\n", "%s %d port_id: %06x\n",
...@@ -3246,8 +3251,9 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -3246,8 +3251,9 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
ql_dbg(ql_dbg_disc, vha, 0x210d, ql_dbg(ql_dbg_disc, vha, 0x210d,
"%s %d %8phC revalidate session with ADISC\n", "%s %d %8phC revalidate session with ADISC\n",
__func__, __LINE__, fcport->port_name); __func__, __LINE__, fcport->port_name);
qla24xx_post_gpdb_work(vha, fcport, data[0] = data[1] = 0;
PDO_FORCE_ADISC); qla2x00_post_async_adisc_work(vha, fcport,
data);
break; break;
case DSC_DELETED: case DSC_DELETED:
ql_dbg(ql_dbg_disc, vha, 0x210d, ql_dbg(ql_dbg_disc, vha, 0x210d,
......
...@@ -41,6 +41,7 @@ static void qla24xx_handle_plogi_done_event(struct scsi_qla_host *, ...@@ -41,6 +41,7 @@ static void qla24xx_handle_plogi_done_event(struct scsi_qla_host *,
struct event_arg *); struct event_arg *);
static void qla24xx_handle_prli_done_event(struct scsi_qla_host *, static void qla24xx_handle_prli_done_event(struct scsi_qla_host *,
struct event_arg *); struct event_arg *);
static void qla24xx_handle_gpdb_event(scsi_qla_host_t *, struct event_arg *);
/* SRB Extensions ---------------------------------------------------------- */ /* SRB Extensions ---------------------------------------------------------- */
...@@ -277,17 +278,31 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport) ...@@ -277,17 +278,31 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport)
fcport->flags &= ~FCF_ASYNC_SENT; fcport->flags &= ~FCF_ASYNC_SENT;
return rval; return rval;
} }
static
void qla24xx_handle_adisc_event(scsi_qla_host_t *vha, struct event_arg *ea)
{
qla24xx_handle_gpdb_event(vha, ea);
}
static void static void
qla2x00_async_adisc_sp_done(void *ptr, int res) qla2x00_async_adisc_sp_done(void *ptr, int res)
{ {
srb_t *sp = ptr; srb_t *sp = ptr;
struct scsi_qla_host *vha = sp->vha; struct scsi_qla_host *vha = sp->vha;
struct srb_iocb *lio = &sp->u.iocb_cmd; struct event_arg ea;
ql_dbg(ql_dbg_disc, vha, 0x2066,
"Async done-%s res %x %8phC\n",
sp->name, res, sp->fcport->port_name);
memset(&ea, 0, sizeof(ea));
ea.event = FCME_ADISC_DONE;
ea.rc = res;
ea.fcport = sp->fcport;
ea.sp = sp;
qla2x00_fcport_event_handler(vha, &ea);
if (!test_bit(UNLOADING, &vha->dpc_flags))
qla2x00_post_async_adisc_done_work(sp->vha, sp->fcport,
lio->u.logio.data);
sp->free(sp); sp->free(sp);
} }
...@@ -319,15 +334,15 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport, ...@@ -319,15 +334,15 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport,
goto done_free_sp; goto done_free_sp;
ql_dbg(ql_dbg_disc, vha, 0x206f, ql_dbg(ql_dbg_disc, vha, 0x206f,
"Async-adisc - hdl=%x loopid=%x portid=%02x%02x%02x.\n", "Async-adisc - hdl=%x loopid=%x portid=%06x %8phC.\n",
sp->handle, fcport->loop_id, fcport->d_id.b.domain, sp->handle, fcport->loop_id, fcport->d_id.b24, fcport->port_name);
fcport->d_id.b.area, fcport->d_id.b.al_pa);
return rval; return rval;
done_free_sp: done_free_sp:
sp->free(sp); sp->free(sp);
done: done:
fcport->flags &= ~FCF_ASYNC_SENT; fcport->flags &= ~FCF_ASYNC_SENT;
qla2x00_post_async_adisc_work(vha, fcport, data);
return rval; return rval;
} }
...@@ -869,7 +884,6 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -869,7 +884,6 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
int rval = ea->rc; int rval = ea->rc;
fc_port_t *fcport = ea->fcport; fc_port_t *fcport = ea->fcport;
unsigned long flags; unsigned long flags;
u16 opt = ea->sp->u.iocb_cmd.u.mbx.out_mb[10];
fcport->flags &= ~FCF_ASYNC_SENT; fcport->flags &= ~FCF_ASYNC_SENT;
...@@ -900,8 +914,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -900,8 +914,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
} }
spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
if (opt != PDO_FORCE_ADISC) ea->fcport->login_gen++;
ea->fcport->login_gen++;
ea->fcport->deleted = 0; ea->fcport->deleted = 0;
ea->fcport->logout_on_delete = 1; ea->fcport->logout_on_delete = 1;
...@@ -941,6 +954,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -941,6 +954,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
{ {
u16 data[2];
if (fcport->login_retry == 0) if (fcport->login_retry == 0)
return 0; return 0;
...@@ -999,23 +1013,11 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) ...@@ -999,23 +1013,11 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
break; break;
} }
if (fcport->flags & FCF_FCP2_DEVICE) { ql_dbg(ql_dbg_disc, vha, 0x20cf,
u8 opt = PDO_FORCE_ADISC; "%s %d %8phC post login\n",
__func__, __LINE__, fcport->port_name);
ql_dbg(ql_dbg_disc, vha, 0x20c9, fcport->disc_state = DSC_LOGIN_PEND;
"%s %d %8phC post gpdb\n", qla2x00_post_async_login_work(vha, fcport, NULL);
__func__, __LINE__, fcport->port_name);
fcport->disc_state = DSC_GPDB;
qla24xx_post_gpdb_work(vha, fcport, opt);
} else {
ql_dbg(ql_dbg_disc, vha, 0x20cf,
"%s %d %8phC post login\n",
__func__, __LINE__, fcport->port_name);
fcport->disc_state = DSC_LOGIN_PEND;
qla2x00_post_async_login_work(vha, fcport, NULL);
}
break; break;
case DSC_LOGIN_FAILED: case DSC_LOGIN_FAILED:
...@@ -1029,10 +1031,10 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) ...@@ -1029,10 +1031,10 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
case DSC_LOGIN_COMPLETE: case DSC_LOGIN_COMPLETE:
/* recheck login state */ /* recheck login state */
ql_dbg(ql_dbg_disc, vha, 0x20d1, ql_dbg(ql_dbg_disc, vha, 0x20d1,
"%s %d %8phC post gpdb\n", "%s %d %8phC post adisc\n",
__func__, __LINE__, fcport->port_name); __func__, __LINE__, fcport->port_name);
data[0] = data[1] = 0;
qla24xx_post_gpdb_work(vha, fcport, PDO_FORCE_ADISC); qla2x00_post_async_adisc_work(vha, fcport, data);
break; break;
default: default:
...@@ -1264,6 +1266,9 @@ void qla2x00_fcport_event_handler(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -1264,6 +1266,9 @@ void qla2x00_fcport_event_handler(scsi_qla_host_t *vha, struct event_arg *ea)
case FCME_DELETE_DONE: case FCME_DELETE_DONE:
qla24xx_handle_delete_done_event(vha, ea); qla24xx_handle_delete_done_event(vha, ea);
break; break;
case FCME_ADISC_DONE:
qla24xx_handle_adisc_event(vha, ea);
break;
default: default:
BUG_ON(1); BUG_ON(1);
break; break;
......
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