[PATCH 7/7] lpfc_nvmet: implement 'host_traddr'

Hannes Reinecke hare at kernel.org
Wed Mar 20 07:40:17 PDT 2024


Implement the 'host_traddr' callback to display the host transport
address for nvmet debugfs.

Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
 drivers/scsi/lpfc/lpfc_nvmet.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index 425328d9c2d8..f927be625966 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -1363,6 +1363,17 @@ lpfc_nvmet_ls_abort(struct nvmet_fc_target_port *targetport,
 		atomic_inc(&lpfc_nvmet->xmt_ls_abort);
 }
 
+static ssize_t
+lpfc_nvmet_host_traddr(void *hosthandle, char *traddr, size_t traddr_size)
+{
+	struct lpfc_nodelist *ndlp = hosthandle;
+
+	return snprintf(traddr, traddr_size,
+			"nn-0x%08llx:pn-0x%08llx",
+			wwn_to_u64(ndlp->nlp_nodename.u.wwn),
+			wwn_to_u64(ndlp->nlp_portname.u.wwn));
+}
+
 static void
 lpfc_nvmet_host_release(void *hosthandle)
 {
@@ -1413,6 +1424,7 @@ static struct nvmet_fc_target_template lpfc_tgttemplate = {
 	.ls_req         = lpfc_nvmet_ls_req,
 	.ls_abort       = lpfc_nvmet_ls_abort,
 	.host_release   = lpfc_nvmet_host_release,
+	.host_traddr    = lpfc_nvmet_host_traddr,
 
 	.max_hw_queues  = 1,
 	.max_sgl_segments = LPFC_NVMET_DEFAULT_SEGS,
-- 
2.35.3




More information about the Linux-nvme mailing list