diff options
| author | Jason Yan <[email protected]> | 2017-12-08 09:42:06 +0000 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2018-01-09 02:59:28 +0000 |
| commit | 8eea9dd84e450e5262643823691108f2a208a2ac (patch) | |
| tree | 955ffe8a05c8ef84e5c5cdf491cc7bd6922808af /drivers/scsi/libsas/sas_init.c | |
| parent | scsi: libsas: shut down the PHY if events reached the threshold (diff) | |
| download | kernel-8eea9dd84e450e5262643823691108f2a208a2ac.tar.gz kernel-8eea9dd84e450e5262643823691108f2a208a2ac.zip | |
scsi: libsas: make the event threshold configurable
Add a sysfs attr that LLDD can configure it for every host. We made an
example in hisi_sas. Other LLDDs using libsas can implement it if they
want.
Suggested-by: Hannes Reinecke <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
CC: John Garry <[email protected]>
CC: Johannes Thumshirn <[email protected]>
CC: Ewan Milne <[email protected]>
CC: Christoph Hellwig <[email protected]>
CC: Tomas Henzl <[email protected]>
CC: Dan Williams <[email protected]>
Acked-by: John Garry <[email protected]> #for hisi_sas part
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'drivers/scsi/libsas/sas_init.c')
| -rw-r--r-- | drivers/scsi/libsas/sas_init.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 22bfc025ae81..afd928bf903e 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c @@ -538,6 +538,37 @@ static struct sas_function_template sft = { .smp_handler = sas_smp_handler, }; +static inline ssize_t phy_event_threshold_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); + + return scnprintf(buf, PAGE_SIZE, "%u\n", sha->event_thres); +} + +static inline ssize_t phy_event_threshold_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); + + sha->event_thres = simple_strtol(buf, NULL, 10); + + /* threshold cannot be set too small */ + if (sha->event_thres < 32) + sha->event_thres = 32; + + return count; +} + +DEVICE_ATTR(phy_event_threshold, + S_IRUGO|S_IWUSR, + phy_event_threshold_show, + phy_event_threshold_store); +EXPORT_SYMBOL_GPL(dev_attr_phy_event_threshold); + struct scsi_transport_template * sas_domain_attach_transport(struct sas_domain_function_template *dft) { |
