Page MenuHomeFreeBSD

D44713.id137179.diff
No OneTemporary

D44713.id137179.diff

diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile
--- a/rescue/rescue/Makefile
+++ b/rescue/rescue/Makefile
@@ -135,6 +135,9 @@
# CRUNCH_PROGS+= devd
CRUNCH_LIBS+= -l80211 -lalias -lcam -lncursesw -ldevstat -lipsec -llzma
+.if ${MK_NVME} != "no"
+CRUNCH_LIBS_camcontrol+= ${LIBNVMF}
+.endif
.if ${MK_ZFS} != "no"
CRUNCH_LIBS+= -lavl -lpthread -luutil -lumem -ltpool -lspl -lrt
CRUNCH_LIBS_zfs+= ${LIBBE} \
diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile
--- a/sbin/camcontrol/Makefile
+++ b/sbin/camcontrol/Makefile
@@ -16,7 +16,7 @@
SRCS+= zone.c
.if ${MK_NVME} != "no"
.PATH: ${SRCTOP}/sbin/nvmecontrol
-CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol -DWITH_NVME
+CFLAGS+= -I${SRCTOP}/lib/libnvmf -I${SRCTOP}/sbin/nvmecontrol -DWITH_NVME
SRCS+= identify_ext.c
SRCS+= nc_util.c
.PATH: ${SRCTOP}/sys/dev/nvme
@@ -27,6 +27,9 @@
WARNS?= 3
.endif
LIBADD= cam sbuf util
+.if ${MK_NVME} != "no"
+LIBADD+= nvmf
+.endif
MAN= camcontrol.8
.include <bsd.prog.mk>
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -61,6 +61,7 @@
#include <camlib.h>
#include "camcontrol.h"
#ifdef WITH_NVME
+#include <libnvmf.h>
#include "nvmecontrol_ext.h"
#endif
@@ -5412,19 +5413,33 @@
}
#ifdef WITH_NVME
if (cts->protocol == PROTO_NVME) {
- struct ccb_trans_settings_nvme *nvmex =
- &cts->xport_specific.nvme;
+ struct ccb_trans_settings_nvme *nvme =
+ &cts->proto_specific.nvme;
- if (nvmex->valid & CTS_NVME_VALID_SPEC) {
+ if (nvme->valid & CTS_NVME_VALID_SPEC) {
fprintf(stdout, "%sNVMe Spec: %d.%d\n", pathstr,
- NVME_MAJOR(nvmex->spec),
- NVME_MINOR(nvmex->spec));
+ NVME_MAJOR(nvme->spec),
+ NVME_MINOR(nvme->spec));
}
- if (nvmex->valid & CTS_NVME_VALID_LINK) {
+ }
+ if (cts->transport == XPORT_NVME) {
+ struct ccb_trans_settings_nvme *nvme =
+ &cts->xport_specific.nvme;
+
+ if (nvme->valid & CTS_NVME_VALID_LINK) {
fprintf(stdout, "%sPCIe lanes: %d (%d max)\n", pathstr,
- nvmex->lanes, nvmex->max_lanes);
+ nvme->lanes, nvme->max_lanes);
fprintf(stdout, "%sPCIe Generation: %d (%d max)\n", pathstr,
- nvmex->speed, nvmex->max_speed);
+ nvme->speed, nvme->max_speed);
+ }
+ }
+ if (cts->transport == XPORT_NVMF) {
+ struct ccb_trans_settings_nvmf *nvmf =
+ &cts->xport_specific.nvmf;
+
+ if (nvmf->valid & CTS_NVMF_VALID_TRTYPE) {
+ fprintf(stdout, "%sTransport: %s\n", pathstr,
+ nvmf_transport_type(nvmf->trtype));
}
}
#endif
diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h
--- a/sys/cam/cam_ccb.h
+++ b/sys/cam/cam_ccb.h
@@ -297,9 +297,10 @@
XPORT_SRP, /* SCSI RDMA Protocol */
XPORT_NVME, /* NVMe over PCIe */
XPORT_MMCSD, /* MMC, SD, SDIO card */
+ XPORT_NVMF, /* NVMe over Fabrics */
} cam_xport;
-#define XPORT_IS_NVME(t) ((t) == XPORT_NVME)
+#define XPORT_IS_NVME(t) ((t) == XPORT_NVME || (t) == XPORT_NVMF)
#define XPORT_IS_ATA(t) ((t) == XPORT_ATA || (t) == XPORT_SATA)
#define XPORT_IS_SCSI(t) ((t) != XPORT_UNKNOWN && \
(t) != XPORT_UNSPECIFIED && \
@@ -653,6 +654,12 @@
_Static_assert(sizeof(struct ccb_pathinq_settings_nvme) == 64,
"ccb_pathinq_settings_nvme too big");
+struct ccb_pathinq_settings_nvmf {
+ uint32_t nsid; /* Namespace ID for this path */
+ uint8_t trtype;
+ char dev_name[NVME_DEV_NAME_LEN]; /* nvme controller dev name for this device */
+};
+
#define PATHINQ_SETTINGS_SIZE 128
struct ccb_pathinq {
@@ -684,6 +691,7 @@
struct ccb_pathinq_settings_fc fc;
struct ccb_pathinq_settings_sas sas;
struct ccb_pathinq_settings_nvme nvme;
+ struct ccb_pathinq_settings_nvmf nvmf;
char ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE];
} xport_specific;
u_int maxio; /* Max supported I/O size, in bytes. */
@@ -1050,6 +1058,13 @@
uint8_t max_speed; /* PCIe generation for each lane */
};
+struct ccb_trans_settings_nvmf
+{
+ u_int valid; /* Which fields to honor */
+#define CTS_NVMF_VALID_TRTYPE 0x01
+ uint8_t trtype;
+};
+
#include <cam/mmc/mmc_bus.h>
struct ccb_trans_settings_mmc {
struct mmc_ios ios;
@@ -1122,6 +1137,7 @@
struct ccb_trans_settings_pata ata;
struct ccb_trans_settings_sata sata;
struct ccb_trans_settings_nvme nvme;
+ struct ccb_trans_settings_nvmf nvmf;
} xport_specific;
};
diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c
--- a/sys/cam/nvme/nvme_xpt.c
+++ b/sys/cam/nvme/nvme_xpt.c
@@ -175,6 +175,7 @@
CAM_XPT_XPORT(nvme_xport_ ## x);
NVME_XPT_XPORT(nvme, NVME);
+NVME_XPT_XPORT(nvmf, NVMF);
#undef NVME_XPT_XPORT

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 1, 9:17 AM (5 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34552175
Default Alt Text
D44713.id137179.diff (4 KB)

Event Timeline