Commit 49b3d5f6 authored by himanshu.madhani@cavium.com's avatar himanshu.madhani@cavium.com Committed by Martin K. Petersen

scsi: qla2xxx: Fix remoteport disconnect for FC-NVMe

Signed-off-by: default avatarDuane Grigsby <duane.grigsby@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5621b0dd
......@@ -1856,17 +1856,42 @@ qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
fd->transferred_length = fd->payload_length -
le32_to_cpu(sts->residual_len);
/*
* If transport error then Failure (HBA rejects request)
* otherwise transport will handle.
*/
if (sts->entry_status) {
ql_log(ql_log_warn, fcport->vha, 0x5038,
"NVME-%s error - hdl=%x entry-status(%x).\n",
sp->name, sp->handle, sts->entry_status);
ret = QLA_FUNCTION_FAILED;
} else if (sts->comp_status != cpu_to_le16(CS_COMPLETE)) {
ql_log(ql_log_warn, fcport->vha, 0x5039,
"NVME-%s error - hdl=%x completion status(%x) resid=%x ox_id=%x\n",
sp->name, sp->handle, sts->comp_status,
le32_to_cpu(sts->residual_len), sts->ox_id);
ret = QLA_FUNCTION_FAILED;
} else {
switch (le16_to_cpu(sts->comp_status)) {
case CS_COMPLETE:
ret = 0;
break;
case CS_ABORTED:
case CS_RESET:
case CS_PORT_UNAVAILABLE:
case CS_PORT_LOGGED_OUT:
case CS_PORT_BUSY:
ql_log(ql_log_warn, fcport->vha, 0x5060,
"NVME-%s ERR Handling - hdl=%x completion status(%x) resid=%x ox_id=%x\n",
sp->name, sp->handle, sts->comp_status,
le32_to_cpu(sts->residual_len), sts->ox_id);
fd->transferred_length = fd->payload_length;
ret = QLA_ABORTED;
break;
default:
ql_log(ql_log_warn, fcport->vha, 0x5060,
"NVME-%s error - hdl=%x completion status(%x) resid=%x ox_id=%x\n",
sp->name, sp->handle, sts->comp_status,
le32_to_cpu(sts->residual_len), sts->ox_id);
ret = QLA_FUNCTION_FAILED;
break;
}
}
sp->done(sp, ret);
}
......
......@@ -169,8 +169,8 @@ static void qla_nvme_sp_done(void *ptr, int res)
if (!(sp->fcport->nvme_flag & NVME_FLAG_REGISTERED))
goto rel;
if (unlikely(nvme->u.nvme.comp_status || res))
fd->status = -EINVAL;
if (unlikely(res == QLA_FUNCTION_FAILED))
fd->status = NVME_SC_FC_TRANSPORT_ERROR;
else
fd->status = 0;
......@@ -635,13 +635,18 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
if (!IS_ENABLED(CONFIG_NVME_FC))
return;
ql_log(ql_log_warn, NULL, 0x2112,
"%s: unregister remoteport on %p\n",__func__, fcport);
list_for_each_entry_safe(rport, trport,
&fcport->vha->nvme_rport_list, list) {
if (rport->fcport == fcport) {
ql_log(ql_log_info, fcport->vha, 0x2113,
"%s: fcport=%p\n", __func__, fcport);
init_completion(&fcport->nvme_del_done);
nvme_fc_unregister_remoteport(
fcport->nvme_remote_port);
qla_nvme_wait_on_rport_del(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