Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jan 2025 20:49:42 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 858280e60f05 - main - nvmecontrol devlist: Annotate connected Fabrics hosts
Message-ID:  <202501312049.50VKngLA063431@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=858280e60f0505a2fcf26920ef0b8c9e20cd2d49

commit 858280e60f0505a2fcf26920ef0b8c9e20cd2d49
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-01-31 20:49:11 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-01-31 20:49:11 +0000

    nvmecontrol devlist: Annotate connected Fabrics hosts
    
    If a Fabrics host is connected, use the discovery log entry from the
    reconnect parameters to output the transport type and address.
    
    Reviewed by:    chuck
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D48731
---
 sbin/nvmecontrol/devlist.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/sbin/nvmecontrol/devlist.c b/sbin/nvmecontrol/devlist.c
index 31445a2ef920..7bf6bc6f097c 100644
--- a/sbin/nvmecontrol/devlist.c
+++ b/sbin/nvmecontrol/devlist.c
@@ -152,7 +152,23 @@ print_controller_info(const char *name, int fd)
 
 	nvme_strvis(mn, cdata.mn, sizeof(mn), NVME_MODEL_NUMBER_LENGTH);
 	printf("%6s: %s", name, mn);
-	if (!connected) {
+	if (connected) {
+		const struct nvme_discovery_log_entry *dle;
+		size_t len;
+
+		nvlist_destroy(nvl);
+		if (nvmf_reconnect_params(fd, &nvl) == 0) {
+			dle = nvlist_get_binary(nvl, "dle", &len);
+			if (len == sizeof(*dle)) {
+				printf(" (connected via %s %.*s:%.*s)",
+				    nvmf_transport_type(dle->trtype),
+				    (int)sizeof(dle->traddr), dle->traddr,
+				    (int)sizeof(dle->trsvcid), dle->trsvcid);
+			}
+		} else {
+			nvl = NULL;
+		}
+	} else {
 		if (now.tv_sec == 0)
 			clock_gettime(CLOCK_REALTIME, &now);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501312049.50VKngLA063431>