From c4793a793d296d6f704e99a89b9ea91802e8356f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 3 Jun 2019 03:34:16 +0000 Subject: [PATCH] qla2x00t-32gbit: display FC-NVMe port roles Currently the FC-NVMe driver is leveraging the SCSI FC transport class to access the remote ports. Which means that all FC-NVMe remote ports will be visible to the fc transport layer, but due to missing definitions the port roles will always be 'unknown'. This patch adds the missing definitions to the fc transport class to that the port roles are correctly displayed. Signed-off-by: Hannes Reinecke [ bvanassche: Ported this patch to SCST ] See also upstream commit a6a6d0589ac4 ("scsi: scsi_transport_fc: nvme: display FC-NVMe port roles") # v5.2-rc1. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8414 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_init.c | 15 +++++++++++---- scst/include/backport.h | 13 +++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/qla2x00t-32gbit/qla_init.c b/qla2x00t-32gbit/qla_init.c index 2fc011fbf..b5b42107d 100644 --- a/qla2x00t-32gbit/qla_init.c +++ b/qla2x00t-32gbit/qla_init.c @@ -5348,15 +5348,22 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport) rport->supported_classes = fcport->supported_classes; - rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; + rport_ids.roles = FC_PORT_ROLE_UNKNOWN; if (fcport->port_type == FCT_INITIATOR) - rport_ids.roles |= FC_RPORT_ROLE_FCP_INITIATOR; + rport_ids.roles |= FC_PORT_ROLE_FCP_INITIATOR; if (fcport->port_type == FCT_TARGET) - rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; + rport_ids.roles |= FC_PORT_ROLE_FCP_TARGET; + if (fcport->port_type & FCT_NVME_INITIATOR) + rport_ids.roles |= FC_PORT_ROLE_NVME_INITIATOR; + if (fcport->port_type & FCT_NVME_TARGET) + rport_ids.roles |= FC_PORT_ROLE_NVME_TARGET; + if (fcport->port_type & FCT_NVME_DISCOVERY) + rport_ids.roles |= FC_PORT_ROLE_NVME_DISCOVERY; ql_dbg(ql_dbg_disc, vha, 0x20ee, "%s %s. rport %p is %s mode\n", __func__, wwn_to_str(fcport->port_name), rport, - (fcport->port_type == FCT_TARGET) ? "tgt" : "ini"); + (fcport->port_type == FCT_TARGET) ? "tgt" : + ((fcport->port_type & FCT_NVME) ? "nvme" :"ini")); fc_remote_port_rolechg(rport, rport_ids.roles); } diff --git a/scst/include/backport.h b/scst/include/backport.h index 11bf6bcc2..0d18619a9 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1629,6 +1629,19 @@ enum { #endif #endif +#ifndef FC_PORT_ROLE_UNKNOWN +#define FC_PORT_ROLE_UNKNOWN 0x00 +#define FC_PORT_ROLE_FCP_TARGET 0x01 +#define FC_PORT_ROLE_FCP_INITIATOR 0x02 +#define FC_PORT_ROLE_IP_PORT 0x04 +#endif + +#ifndef FC_PORT_ROLE_NVME_INITIATOR +#define FC_PORT_ROLE_NVME_INITIATOR 0x10 +#define FC_PORT_ROLE_NVME_TARGET 0x20 +#define FC_PORT_ROLE_NVME_DISCOVERY 0x40 +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) #define wwn_to_u64(wwn) get_unaligned_be64(wwn) #endif