Skip to contentSkip to conversation

nvme: Add ctrl attributes for queue_count and sqsize

PATCH In review James Smart 3 participants 4 messages Sep 26, 2019 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvme: Add ctrl attributes for queue_count and sqsize

Current controller interrogation requires a lot of guesswork on how many io queues were created and what the io sq size is. The numbers are dependent upon core/fabric defaults, connect arguments, and target responses.

Add sysfs attributes for queue_count and sqsize.

---
v2:
Updated is_visible to not show sqsize attribute on pcie controllers

---
 drivers/nvme/host/core.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/nvme/host/core.c +6 -0
index e0e2dcbfd05e..d3c85c6d9230 100644
@@ -3040,6 +3040,8 @@ static DEVICE_ATTR(field, S_IRUGO, field##_show, NULL);
 
 nvme_show_int_function(cntlid);
 nvme_show_int_function(numa_node);
+nvme_show_int_function(queue_count);
+nvme_show_int_function(sqsize);
 
 static ssize_t nvme_sysfs_delete(struct device *dev,
 				struct device_attribute *attr, const char *buf,
@@ -3120,6 +3122,8 @@ static struct attribute *nvme_dev_attrs[] = {
 	&dev_attr_address.attr,
 	&dev_attr_state.attr,
 	&dev_attr_numa_node.attr,
+	&dev_attr_queue_count.attr,
+	&dev_attr_sqsize.attr,
 	NULL
 };
 
@@ -3133,6 +3137,8 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
 		return 0;
 	if (a == &dev_attr_address.attr && !ctrl->ops->get_address)
 		return 0;
+	if (!strncmp(ctrl->ops->name, "pcie", 4) && a == &dev_attr_sqsize.attr)
+		return 0;
 
 	return a->mode;
 }
Signature · 7 lines
2.13.7


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
maintainer
#2 lore raw
Quoted 5 lines · Sagi Grimberg
Quoted 3 lines

v2:
Updated is_visible to not show sqsize attribute on pcie controllers

Why? isn't sqsize assigned for pci controllers as well?

I only noticed this comment in the 'struct nvme_ctrl' definition:

        /* Fabrics only */
        u16 sqsize;

But since it's been questioned, I see pcie does indeed set this field, and the code comment was the only source of confusion. So sure, the original patch is fine in that sense.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#3 lore raw
In reply to James Smart
Quoted 54 lines · James Smart

Current controller interrogation requires a lot of guesswork on how many io queues were created and what the io sq size is. The numbers are dependent upon core/fabric defaults, connect arguments, and target responses.

Add sysfs attributes for queue_count and sqsize.

---
v2:
Updated is_visible to not show sqsize attribute on pcie controllers
---
drivers/nvme/host/core.c | 6 ++++++

1 file changed, 6 insertions(+)
drivers/nvme/host/core.c +6 -0
index e0e2dcbfd05e..d3c85c6d9230 100644
@@ -3040,6 +3040,8 @@ static DEVICE_ATTR(field, S_IRUGO, field##_show, NULL);
 
 nvme_show_int_function(cntlid);
 nvme_show_int_function(numa_node);
+nvme_show_int_function(queue_count);
+nvme_show_int_function(sqsize);
 
 static ssize_t nvme_sysfs_delete(struct device *dev,
 				struct device_attribute *attr, const char *buf,
@@ -3120,6 +3122,8 @@ static struct attribute *nvme_dev_attrs[] = {
 	&dev_attr_address.attr,
 	&dev_attr_state.attr,
 	&dev_attr_numa_node.attr,
+	&dev_attr_queue_count.attr,
+	&dev_attr_sqsize.attr,
 	NULL
 };
 
@@ -3133,6 +3137,8 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
 		return 0;
 	if (a == &dev_attr_address.attr && !ctrl->ops->get_address)
 		return 0;
+	if (!strncmp(ctrl->ops->name, "pcie", 4) && a == &dev_attr_sqsize.attr)
+		return 0;
 
 	return a->mode;
 }
Signature · 1 line
2.13.7

Ok scratch the v2 - original patch was fine.

Thanks

— james

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme