git: 7e771c225d9c - stable/14 - nvmecontrol: Display additional Fabrics-related fields for cdata

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 27 Aug 2024 01:06:33 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=7e771c225d9c34e5d57faad99829c0bba41ee897

commit 7e771c225d9c34e5d57faad99829c0bba41ee897
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-03-23 00:25:07 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-08-26 18:31:02 +0000

    nvmecontrol: Display additional Fabrics-related fields for cdata
    
    Some of these fields are specific to Fabrics controllers (such as the
    size of capsules) while other fields are shared with PCI-e
    controllers, but are more relevant for Fabrics controllers (such as
    KeepAlive timer properties).
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D44449
    
    (cherry picked from commit acbc176c3dfdfebd047507dc7d843f8cc10984a8)
---
 sbin/nvmecontrol/identify_ext.c | 51 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c
index cc30ba0d6349..1082433d697e 100644
--- a/sbin/nvmecontrol/identify_ext.c
+++ b/sbin/nvmecontrol/identify_ext.c
@@ -139,6 +139,36 @@ nvme_print_controller(struct nvme_controller_data *cdata)
 	printf("Version:                     %d.%d.%d\n",
 	    (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff,
 	    cdata->ver & 0xff);
+	printf("Traffic Based Keep Alive:    %sSupported\n",
+	    NVMEV(NVME_CTRLR_DATA_CTRATT_TBKAS, cdata->ctratt) ? "" : "Not ");
+	printf("Controller Type:             ");
+	switch (cdata->cntrltype) {
+	case 0:
+		printf("Not Reported\n");
+		break;
+	case 1:
+		printf("I/O Controller\n");
+		break;
+	case 2:
+		printf("Discovery Controller\n");
+		break;
+	case 3:
+		printf("Administrative Controller\n");
+		break;
+	default:
+		printf("%d (Reserved)\n", cdata->cntrltype);
+		break;
+	}
+	printf("Keep Alive Timer             ");
+	if (cdata->kas == 0)
+		printf("Not Supported\n");
+	else
+		printf("%u ms granularity\n", cdata->kas * 100);
+	printf("Maximum Outstanding Commands ");
+	if (cdata->maxcmd == 0)
+		printf("Not Specified\n");
+	else
+		printf("%u\n", cdata->maxcmd);
 	printf("\n");
 
 	printf("Admin Command Set Attributes\n");
@@ -249,4 +279,25 @@ nvme_print_controller(struct nvme_controller_data *cdata)
 
 	if (cdata->ver >= 0x010201)
 		printf("\nNVM Subsystem Name:          %.256s\n", cdata->subnqn);
+
+	if (cdata->ioccsz != 0) {
+		printf("\n");
+		printf("Fabrics Attributes\n");
+		printf("==================\n");
+		printf("I/O Command Capsule Size:    %d bytes\n",
+		    cdata->ioccsz * 16);
+		printf("I/O Response Capsule Size:   %d bytes\n",
+		    cdata->iorcsz * 16);
+		printf("In Capsule Data Offset:      %d bytes\n",
+		    cdata->icdoff * 16);
+		printf("Controller Model:            %s\n",
+		    (cdata->fcatt & 1) == 0 ? "Dynamic" : "Static");
+		printf("Max SGL Descriptors:         ");
+		if (cdata->msdbd == 0)
+			printf("Unlimited\n");
+		else
+			printf("%d\n", cdata->msdbd);
+		printf("Disconnect of I/O Queues:    %sSupported\n",
+		    (cdata->ofcs & 1) == 1 ? "" : "Not ");
+	}
 }