Commit 7d790f04 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Fix nvme port role handling in sysfs and debugfs handlers.

While debugging Devloss and recovery, debugfs and sysfs were found to
not show the NVME port roles consistently.

The port role FC_PORT_ROLE_NVME_DISCOVERY was added with the devloss
bringup and the other issues were just oversight.

Add NVME Target and DISCSRVC to debugfs nodeinfo and sysfs nvme info
handlers. The full port role was added to the NVME data only not the
generic nodelist.
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 80cc0043
...@@ -312,25 +312,23 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, ...@@ -312,25 +312,23 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
len += snprintf(buf + len, PAGE_SIZE - len, "DID x%06x ", len += snprintf(buf + len, PAGE_SIZE - len, "DID x%06x ",
nrport->port_id); nrport->port_id);
switch (nrport->port_role) { /* An NVME rport can have multiple roles. */
case FC_PORT_ROLE_NVME_INITIATOR: if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR)
len += snprintf(buf + len, PAGE_SIZE - len, len += snprintf(buf + len, PAGE_SIZE - len,
"INITIATOR "); "INITIATOR ");
break; if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET)
case FC_PORT_ROLE_NVME_TARGET:
len += snprintf(buf + len, PAGE_SIZE - len, len += snprintf(buf + len, PAGE_SIZE - len,
"TARGET "); "TARGET ");
break; if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY)
case FC_PORT_ROLE_NVME_DISCOVERY:
len += snprintf(buf + len, PAGE_SIZE - len, len += snprintf(buf + len, PAGE_SIZE - len,
"DISCOVERY "); "DISCSRVC ");
break; if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR |
default: FC_PORT_ROLE_NVME_TARGET |
FC_PORT_ROLE_NVME_DISCOVERY))
len += snprintf(buf + len, PAGE_SIZE - len, len += snprintf(buf + len, PAGE_SIZE - len,
"UNKNOWN_ROLE x%x", "UNKNOWN ROLE x%x",
nrport->port_role); nrport->port_role);
break;
}
len += snprintf(buf + len, PAGE_SIZE - len, "%s ", statep); len += snprintf(buf + len, PAGE_SIZE - len, "%s ", statep);
/* Terminate the string. */ /* Terminate the string. */
len += snprintf(buf + len, PAGE_SIZE - len, "\n"); len += snprintf(buf + len, PAGE_SIZE - len, "\n");
......
...@@ -621,6 +621,13 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) ...@@ -621,6 +621,13 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
ndlp->nlp_sid); ndlp->nlp_sid);
if (ndlp->nlp_type & NLP_FCP_INITIATOR) if (ndlp->nlp_type & NLP_FCP_INITIATOR)
len += snprintf(buf+len, size-len, "FCP_INITIATOR "); len += snprintf(buf+len, size-len, "FCP_INITIATOR ");
if (ndlp->nlp_type & NLP_NVME_TARGET)
len += snprintf(buf + len,
size - len, "NVME_TGT sid:%d ",
NLP_NO_SID);
if (ndlp->nlp_type & NLP_NVME_INITIATOR)
len += snprintf(buf + len,
size - len, "NVME_INITIATOR ");
len += snprintf(buf+len, size-len, "usgmap:%x ", len += snprintf(buf+len, size-len, "usgmap:%x ",
ndlp->nlp_usg_map); ndlp->nlp_usg_map);
len += snprintf(buf+len, size-len, "refcnt:%x", len += snprintf(buf+len, size-len, "refcnt:%x",
...@@ -698,26 +705,23 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) ...@@ -698,26 +705,23 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
nrport->port_name); nrport->port_name);
len += snprintf(buf + len, size - len, "WWNN x%llx ", len += snprintf(buf + len, size - len, "WWNN x%llx ",
nrport->node_name); nrport->node_name);
switch (nrport->port_role) {
case FC_PORT_ROLE_NVME_INITIATOR: /* An NVME rport can have multiple roles. */
if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR)
len += snprintf(buf + len, size - len, len += snprintf(buf + len, size - len,
"NVME INITIATOR "); "INITIATOR ");
break; if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET)
case FC_PORT_ROLE_NVME_TARGET:
len += snprintf(buf + len, size - len, len += snprintf(buf + len, size - len,
"NVME TARGET "); "TARGET ");
break; if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY)
case FC_PORT_ROLE_NVME_DISCOVERY:
len += snprintf(buf + len, size - len, len += snprintf(buf + len, size - len,
"NVME DISCOVERY "); "DISCSRVC ");
break; if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR |
default: FC_PORT_ROLE_NVME_TARGET |
FC_PORT_ROLE_NVME_DISCOVERY))
len += snprintf(buf + len, size - len, len += snprintf(buf + len, size - len,
"UNKNOWN ROLE x%x", "UNKNOWN ROLE x%x",
nrport->port_role); nrport->port_role);
break;
}
/* Terminate the string. */ /* Terminate the string. */
len += snprintf(buf + len, size - len, "\n"); len += snprintf(buf + len, size - len, "\n");
} }
......
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