Commit 4758fd91 authored by Damien Le Moal's avatar Damien Le Moal Committed by Martin K. Petersen

scsi: mpt3sas: Introduce sas_ncq_prio_supported sysfs sttribute

Similarly to AHCI, introduce the device sysfs attribute
sas_ncq_prio_supported to advertise if a SATA device supports the NCQ
priority feature. Without this new attribute, the user can only discover if
a SATA device supports NCQ priority by trying to enable the feature use
with the sas_ncq_prio_enable sysfs device attribute, which fails when the
device does not support high prioity commands.

Link: https://lore.kernel.org/r/20210807041859.579409-11-damien.lemoal@wdc.comReviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent cdc17676
......@@ -3919,6 +3919,24 @@ sas_device_handle_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(sas_device_handle);
/**
* sas_ncq_prio_supported_show - Indicate if device supports NCQ priority
* @dev: pointer to embedded device
* @attr: sas_ncq_prio_supported attribute descriptor
* @buf: the buffer returned
*
* A sysfs 'read-only' sdev attribute, only works with SATA
*/
static ssize_t
sas_ncq_prio_supported_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct scsi_device *sdev = to_scsi_device(dev);
return sysfs_emit(buf, "%d\n", scsih_ncq_prio_supp(sdev));
}
static DEVICE_ATTR_RO(sas_ncq_prio_supported);
/**
* sas_ncq_prio_enable_show - send prioritized io commands to device
* @dev: pointer to embedded device
......@@ -3961,6 +3979,7 @@ static DEVICE_ATTR_RW(sas_ncq_prio_enable);
struct device_attribute *mpt3sas_dev_attrs[] = {
&dev_attr_sas_address,
&dev_attr_sas_device_handle,
&dev_attr_sas_ncq_prio_supported,
&dev_attr_sas_ncq_prio_enable,
NULL,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment