The branch main has been updated by jhb:

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

commit 858280e60f0505a2fcf26920ef0b8c9e20cd2d49
Author:     John Baldwin <j...@freebsd.org>
AuthorDate: 2025-01-31 20:49:11 +0000
Commit:     John Baldwin <j...@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);
 

Reply via email to