Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 2023 03:38:31 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: af296130eadb - main - nvme_xpt: Tidy nvme_announce_periph for fabrics support.
Message-ID:  <202306270338.35R3cVo0034558@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=af296130eadbad541d57717719d87bec43353e18

commit af296130eadbad541d57717719d87bec43353e18
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-06-27 03:37:43 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-06-27 03:37:43 +0000

    nvme_xpt: Tidy nvme_announce_periph for fabrics support.
    
    - Read the version from cts.protocol_version.
    
    - Only check xport_specific.nvme for PCI-e info for XPORT_NVME.
    
    Reviewed by:    chuck, imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D40618
---
 sys/cam/nvme/nvme_xpt.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c
index 0575c5220c0b..f1bcd581a096 100644
--- a/sys/cam/nvme/nvme_xpt.c
+++ b/sys/cam/nvme/nvme_xpt.c
@@ -802,19 +802,22 @@ nvme_announce_periph(struct cam_periph *periph)
 	xpt_action((union ccb*)&cts);
 	if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
 		return;
-	nvmex = &cts.xport_specific.nvme;
 
 	/* Ask the SIM for its base transfer speed */
 	xpt_path_inq(&cpi, periph->path);
 	sbuf_new(&sb, buffer, sizeof(buffer), SBUF_FIXEDLEN);
 	sbuf_printf(&sb, "%s%d: nvme version %d.%d",
 	    periph->periph_name, periph->unit_number,
-	    NVME_MAJOR(nvmex->spec),
-	    NVME_MINOR(nvmex->spec));
-	if (nvmex->valid & CTS_NVME_VALID_LINK)
-		sbuf_printf(&sb, " x%d (max x%d) lanes PCIe Gen%d (max Gen%d) link",
-		    nvmex->lanes, nvmex->max_lanes,
-		    nvmex->speed, nvmex->max_speed);
+	    NVME_MAJOR(cts.protocol_version),
+	    NVME_MINOR(cts.protocol_version));
+	if (cts.transport == XPORT_NVME) {
+		nvmex = &cts.proto_specific.nvme;
+		if (nvmex->valid & CTS_NVME_VALID_LINK)
+			sbuf_printf(&sb,
+			    " x%d (max x%d) lanes PCIe Gen%d (max Gen%d) link",
+			    nvmex->lanes, nvmex->max_lanes,
+			    nvmex->speed, nvmex->max_speed);
+	}
 	sbuf_printf(&sb, "\n");
 	sbuf_finish(&sb);
 	sbuf_putbuf(&sb);



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