qla2x00t-32gbit: Check if port is online before sending ELS

CT Ping and ELS cmds fail for NVMe targets.  Check if port is online before
sending ELS instead of sending login.

Cc: stable@vger.kernel.org
Signed-off-by: Shreyas Deodhar <sdeodhar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 0c227dc22ca1 upstream ]
This commit is contained in:
Gleb Chesnokov
2023-03-12 13:24:07 +03:00
parent 527fed012f
commit dabc4a4e78
+5 -4
View File
@@ -281,8 +281,8 @@ qla2x00_process_els(BSG_JOB_TYPE *bsg_job)
const char *type;
int req_sg_cnt, rsp_sg_cnt;
int rval = (DID_ERROR << 16);
uint16_t nextlid = 0;
uint32_t els_cmd = 0;
int qla_port_allocated = 0;
if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
rport = fc_bsg_to_rport(bsg_job);
@@ -332,9 +332,9 @@ qla2x00_process_els(BSG_JOB_TYPE *bsg_job)
/* make sure the rport is logged in,
* if not perform fabric login
*/
if (qla2x00_fabric_login(vha, fcport, &nextlid)) {
if (atomic_read(&fcport->state) != FCS_ONLINE) {
ql_dbg(ql_dbg_user, vha, 0x7003,
"Failed to login port %06X for ELS passthru.\n",
"Port %06X is not online for ELS passthru.\n",
fcport->d_id.b24);
rval = -EIO;
goto done;
@@ -351,6 +351,7 @@ qla2x00_process_els(BSG_JOB_TYPE *bsg_job)
goto done;
}
qla_port_allocated = 1;
/* Initialize all required fields of fcport */
fcport->vha = vha;
fcport->d_id.b.al_pa =
@@ -435,7 +436,7 @@ done_unmap_sg:
goto done_free_fcport;
done_free_fcport:
if (bsg_request->msgcode != FC_BSG_RPT_ELS)
if (qla_port_allocated)
qla2x00_free_fcport(fcport);
done:
return rval;