Thread (14 messages) 14 messages, 3 authors, 2021-08-13

Re: [PATCH v5 9/9] libahci: Introduce ncq_prio_supported sysfs sttribute

From: Niklas Cassel <hidden>
Date: 2021-08-13 13:56:20
Also in: linux-block

On Wed, Aug 11, 2021 at 11:30:52PM +0000, Damien Le Moal wrote:
On 2021/08/12 4:07, Niklas Cassel wrote:
quoted
On Tue, Aug 10, 2021 at 02:49:39PM +0900, Damien Le Moal wrote:
quoted
Currently, the only way a user can determine if a SATA device supports
NCQ priority is to try to enable the use of this feature using the
ncq_prio_enable sysfs device attribute. If enabling the feature fails,
it is because the device does not support NCQ priority. Otherwise, the
feature is enabled and indicates that the device supports NCQ priority.

Improve this odd interface by introducing the read-only
ncq_prio_supported sysfs device attribute to indicate if a SATA device
supports NCQ priority. The value of this attribute reflects if the
device flag ATA_DFLAG_NCQ_PRIO is set or cleared.

Signed-off-by: Damien Le Moal <redacted>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libahci.c     |  1 +
 drivers/ata/libata-sata.c | 24 ++++++++++++++++++++++++
 include/linux/libata.h    |  1 +
 3 files changed, 26 insertions(+)
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index fec2e9754aed..5b3fa2cbe722 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -125,6 +125,7 @@ EXPORT_SYMBOL_GPL(ahci_shost_attrs);
 struct device_attribute *ahci_sdev_attrs[] = {
 	&dev_attr_sw_activity,
 	&dev_attr_unload_heads,
+	&dev_attr_ncq_prio_supported,
Hello Damien,

I do not fully understand if NCQ is only supported for AHCI controllers,
or if vanilla SATA controllers (without AHCI) can support it as well
(since NCQ is part of the ATA Command Set - 5).

However, I do think that you might have missed adding the
dev_attr_ncq_prio_supported
attribute for the ata_ncq_sdev_attrs struct in libata-sata.c

(The ata_ncq_sdev_attrs struct already has the dev_attr_ncq_prio_enable
attribute, so it makes sense that it should have the new supported
attribute as well.)
Good catch. I indeed forgot that one. Will add it.
When respinning this patch, we should document this new attribute in:
Documentation/ABI/testing/sysfs-block-device
as well. (ncq_prio_enable is already documented there.)

Kind regards,
Niklas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help