The driver is sending a PRLI to each target port with both,
FCP _and_ NVMe enabled. The target is now free to respond with
either of those types logged in.
When evaluating the response we need to check which of the FC4
type had been logged in, and update the port properties accordingly.
Not doing so will cause the port to be removed due to a property
mismatch.

Signed-off-by: Hannes Reinecke <[email protected]>
---
 drivers/scsi/qla2xxx/qla_init.c | 8 ++++++--
 drivers/scsi/qla2xxx/qla_os.c   | 3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index aeeb0144bd55..88279c4d4d5e 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1228,10 +1228,14 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, 
struct event_arg *ea)
        if (fcport->disc_state == DSC_DELETE_PEND)
                return;
 
-       if (fcport->fc4f_nvme)
+       if (fcport->fc4f_nvme &&
+           (pd->current_login_state >> 4) == PDS_PRLI_COMPLETE)
                ls = pd->current_login_state >> 4;
-       else
+       else {
+               fcport->fc4_type = FC4_TYPE_FCP_SCSI;
+               fcport->fc4f_nvme = 0;
                ls = pd->current_login_state & 0xf;
+       }
 
        if (ea->sp->gen2 != fcport->login_gen) {
                /* target side must have changed it. */
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index c6ef83d0d99b..93191e323d06 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4871,7 +4871,8 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, 
struct qla_work_evt *e)
                        if (e->u.new_sess.fc4_type == FS_FC4TYPE_FCP)
                                fcport->fc4_type = FC4_TYPE_FCP_SCSI;
 
-                       if (e->u.new_sess.fc4_type == FS_FC4TYPE_NVME) {
+                       if (vha->flags.nvme_enabled &&
+                           e->u.new_sess.fc4_type == FS_FC4TYPE_NVME) {
                                fcport->fc4_type = FC4_TYPE_OTHER;
                                fcport->fc4f_nvme = FC4_TYPE_NVME;
                        }
-- 
2.16.4

Reply via email to