Skip to content

Commit 858280e

Browse files
committed
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
1 parent ad9dc97 commit 858280e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

sbin/nvmecontrol/devlist.c

+17-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,23 @@ print_controller_info(const char *name, int fd)
152152

153153
nvme_strvis(mn, cdata.mn, sizeof(mn), NVME_MODEL_NUMBER_LENGTH);
154154
printf("%6s: %s", name, mn);
155-
if (!connected) {
155+
if (connected) {
156+
const struct nvme_discovery_log_entry *dle;
157+
size_t len;
158+
159+
nvlist_destroy(nvl);
160+
if (nvmf_reconnect_params(fd, &nvl) == 0) {
161+
dle = nvlist_get_binary(nvl, "dle", &len);
162+
if (len == sizeof(*dle)) {
163+
printf(" (connected via %s %.*s:%.*s)",
164+
nvmf_transport_type(dle->trtype),
165+
(int)sizeof(dle->traddr), dle->traddr,
166+
(int)sizeof(dle->trsvcid), dle->trsvcid);
167+
}
168+
} else {
169+
nvl = NULL;
170+
}
171+
} else {
156172
if (now.tv_sec == 0)
157173
clock_gettime(CLOCK_REALTIME, &now);
158174

0 commit comments

Comments
 (0)