diff options
author | Christoph Hellwig <hch@lst.de> | 2005-09-19 15:59:42 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-10-28 15:57:58 -0400 |
commit | c3ee74c4e91017169c7f1fa74a57ba8502ec49c3 (patch) | |
tree | 44e429eab97f84511ecd1fb7f2e7568c4e5beecc /drivers/scsi | |
parent | d25cf1ced9d446dcd3fd399e15b518fea936f3ed (diff) |
[SCSI] scsi_transport_sas: support link error attributes
For now supporting the ->get_linkerrors method is mandatory. I'll
probably be beaten to implement the .show_foo variables and different
types of attributes soon..
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 1d145d2f9a38..63445f90097e 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | #define SAS_HOST_ATTRS 0 | 36 | #define SAS_HOST_ATTRS 0 |
37 | #define SAS_PORT_ATTRS 11 | 37 | #define SAS_PORT_ATTRS 15 |
38 | #define SAS_RPORT_ATTRS 5 | 38 | #define SAS_RPORT_ATTRS 5 |
39 | 39 | ||
40 | struct sas_internal { | 40 | struct sas_internal { |
@@ -257,6 +257,26 @@ show_sas_phy_##field(struct class_device *cdev, char *buf) \ | |||
257 | sas_phy_show_linkspeed(field) \ | 257 | sas_phy_show_linkspeed(field) \ |
258 | static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) | 258 | static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) |
259 | 259 | ||
260 | #define sas_phy_show_linkerror(field) \ | ||
261 | static ssize_t \ | ||
262 | show_sas_phy_##field(struct class_device *cdev, char *buf) \ | ||
263 | { \ | ||
264 | struct sas_phy *phy = transport_class_to_phy(cdev); \ | ||
265 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ | ||
266 | struct sas_internal *i = to_sas_internal(shost->transportt); \ | ||
267 | int error; \ | ||
268 | \ | ||
269 | error = i->f->get_linkerrors(phy); \ | ||
270 | if (error) \ | ||
271 | return error; \ | ||
272 | return snprintf(buf, 20, "%u\n", phy->field); \ | ||
273 | } | ||
274 | |||
275 | #define sas_phy_linkerror_attr(field) \ | ||
276 | sas_phy_show_linkerror(field) \ | ||
277 | static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) | ||
278 | |||
279 | |||
260 | static ssize_t | 280 | static ssize_t |
261 | show_sas_device_type(struct class_device *cdev, char *buf) | 281 | show_sas_device_type(struct class_device *cdev, char *buf) |
262 | { | 282 | { |
@@ -282,6 +302,10 @@ sas_phy_linkspeed_attr(minimum_linkrate_hw); | |||
282 | sas_phy_linkspeed_attr(minimum_linkrate); | 302 | sas_phy_linkspeed_attr(minimum_linkrate); |
283 | sas_phy_linkspeed_attr(maximum_linkrate_hw); | 303 | sas_phy_linkspeed_attr(maximum_linkrate_hw); |
284 | sas_phy_linkspeed_attr(maximum_linkrate); | 304 | sas_phy_linkspeed_attr(maximum_linkrate); |
305 | sas_phy_linkerror_attr(invalid_dword_count); | ||
306 | sas_phy_linkerror_attr(running_disparity_error_count); | ||
307 | sas_phy_linkerror_attr(loss_of_dword_sync_count); | ||
308 | sas_phy_linkerror_attr(phy_reset_problem_count); | ||
285 | 309 | ||
286 | 310 | ||
287 | static DECLARE_TRANSPORT_CLASS(sas_phy_class, | 311 | static DECLARE_TRANSPORT_CLASS(sas_phy_class, |
@@ -749,6 +773,11 @@ sas_attach_transport(struct sas_function_template *ft) | |||
749 | SETUP_PORT_ATTRIBUTE(minimum_linkrate); | 773 | SETUP_PORT_ATTRIBUTE(minimum_linkrate); |
750 | SETUP_PORT_ATTRIBUTE(maximum_linkrate_hw); | 774 | SETUP_PORT_ATTRIBUTE(maximum_linkrate_hw); |
751 | SETUP_PORT_ATTRIBUTE(maximum_linkrate); | 775 | SETUP_PORT_ATTRIBUTE(maximum_linkrate); |
776 | |||
777 | SETUP_PORT_ATTRIBUTE(invalid_dword_count); | ||
778 | SETUP_PORT_ATTRIBUTE(running_disparity_error_count); | ||
779 | SETUP_PORT_ATTRIBUTE(loss_of_dword_sync_count); | ||
780 | SETUP_PORT_ATTRIBUTE(phy_reset_problem_count); | ||
752 | i->phy_attrs[count] = NULL; | 781 | i->phy_attrs[count] = NULL; |
753 | 782 | ||
754 | count = 0; | 783 | count = 0; |