[PATCH 1/4] nvme-fabrics: add discovery controller type
Martin Belanger
nitram_67 at hotmail.com
Tue Jan 25 06:59:53 PST 2022
From: Martin Belanger <martin.belanger at dell.com>
TP8010 introduces the Central Discovery Controller (CDC). To
differentiate between a CDC and a DDC (Direct DC), the identify
response now carries a DCTYPE (Discovery Controller Type) field.
Signed-off-by: Martin Belanger <martin.belanger at dell.com>
---
drivers/nvme/host/core.c | 3 +++
drivers/nvme/host/nvme.h | 2 ++
include/linux/nvme.h | 10 +++++++++-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4fc794d9c2f4..cd34b92e8e9d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2978,6 +2978,7 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
ctrl->kas = le16_to_cpu(id->kas);
ctrl->max_namespaces = le32_to_cpu(id->mnan);
ctrl->ctratt = le32_to_cpu(id->ctratt);
+ ctrl->dctype = id->dctype;
if (id->rtd3e) {
/* us -> s */
@@ -3335,6 +3336,7 @@ nvme_show_int_function(numa_node);
nvme_show_int_function(queue_count);
nvme_show_int_function(sqsize);
nvme_show_int_function(kato);
+nvme_show_int_function(dctype);
static ssize_t nvme_sysfs_delete(struct device *dev,
struct device_attribute *attr, const char *buf,
@@ -3533,6 +3535,7 @@ static struct attribute *nvme_dev_attrs[] = {
&dev_attr_reconnect_delay.attr,
&dev_attr_fast_io_fail_tmo.attr,
&dev_attr_kato.attr,
+ &dev_attr_dctype.attr,
NULL
};
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index fe224016418e..f8b60f7346fd 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -349,6 +349,8 @@ struct nvme_ctrl {
unsigned long discard_page_busy;
struct nvme_fault_inject fault_inject;
+
+ enum nvme_dctype dctype;
};
enum nvme_iopolicy {
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 855dd9b3e84b..82567d493c51 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -240,6 +240,12 @@ enum nvme_ctrl_attr {
NVME_CTRL_ATTR_TBKAS = (1 << 6),
};
+enum nvme_dctype {
+ NVME_DCTYPE_NOT_REPORTED = 0,
+ NVME_DCTYPE_DDC = 1,
+ NVME_DCTYPE_CDC = 2,
+};
+
struct nvme_id_ctrl {
__le16 vid;
__le16 ssvid;
@@ -320,7 +326,9 @@ struct nvme_id_ctrl {
__le16 icdoff;
__u8 ctrattr;
__u8 msdbd;
- __u8 rsvd1804[244];
+ __le16 ofcs;
+ __u8 dctype;
+ __u8 rsvd1807[241];
struct nvme_id_power_state psd[32];
__u8 vs[1024];
};
--
2.34.1
More information about the Linux-nvme
mailing list