]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/s390/scsi/zfcp_sysfs.c
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[mirror_ubuntu-artful-kernel.git] / drivers / s390 / scsi / zfcp_sysfs.c
CommitLineData
60221920
SS
1/*
2 * zfcp device driver
3 *
4 * sysfs attributes.
5 *
615f59e0 6 * Copyright IBM Corporation 2008, 2010
60221920
SS
7 */
8
ecf39d42
CS
9#define KMSG_COMPONENT "zfcp"
10#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
11
5a0e3ad6 12#include <linux/slab.h>
60221920
SS
13#include "zfcp_ext.h"
14
15#define ZFCP_DEV_ATTR(_feat, _name, _mode, _show, _store) \
16struct device_attribute dev_attr_##_feat##_##_name = __ATTR(_name, _mode,\
17 _show, _store)
18#define ZFCP_DEFINE_ATTR(_feat_def, _feat, _name, _format, _value) \
19static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev, \
20 struct device_attribute *at,\
21 char *buf) \
22{ \
615f59e0 23 struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \
60221920
SS
24 \
25 return sprintf(buf, _format, _value); \
26} \
27static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO, \
28 zfcp_sysfs_##_feat##_##_name##_show, NULL);
29
de3dc572
SS
30#define ZFCP_DEFINE_A_ATTR(_name, _format, _value) \
31static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, \
32 struct device_attribute *at,\
33 char *buf) \
34{ \
35 struct ccw_device *cdev = to_ccwdev(dev); \
36 struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev); \
37 int i; \
38 \
39 if (!adapter) \
40 return -ENODEV; \
41 \
42 i = sprintf(buf, _format, _value); \
43 zfcp_ccw_adapter_put(adapter); \
44 return i; \
45} \
46static ZFCP_DEV_ATTR(adapter, _name, S_IRUGO, \
47 zfcp_sysfs_adapter_##_name##_show, NULL);
48
49ZFCP_DEFINE_A_ATTR(status, "0x%08x\n", atomic_read(&adapter->status));
50ZFCP_DEFINE_A_ATTR(peer_wwnn, "0x%016llx\n",
51 (unsigned long long) adapter->peer_wwnn);
52ZFCP_DEFINE_A_ATTR(peer_wwpn, "0x%016llx\n",
53 (unsigned long long) adapter->peer_wwpn);
54ZFCP_DEFINE_A_ATTR(peer_d_id, "0x%06x\n", adapter->peer_d_id);
55ZFCP_DEFINE_A_ATTR(card_version, "0x%04x\n", adapter->hydra_version);
56ZFCP_DEFINE_A_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version);
57ZFCP_DEFINE_A_ATTR(hardware_version, "0x%08x\n", adapter->hardware_version);
58ZFCP_DEFINE_A_ATTR(in_recovery, "%d\n", (atomic_read(&adapter->status) &
59 ZFCP_STATUS_COMMON_ERP_INUSE) != 0);
60221920
SS
60
61ZFCP_DEFINE_ATTR(zfcp_port, port, status, "0x%08x\n",
62 atomic_read(&port->status));
63ZFCP_DEFINE_ATTR(zfcp_port, port, in_recovery, "%d\n",
64 (atomic_read(&port->status) &
65 ZFCP_STATUS_COMMON_ERP_INUSE) != 0);
66ZFCP_DEFINE_ATTR(zfcp_port, port, access_denied, "%d\n",
67 (atomic_read(&port->status) &
68 ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
69
70ZFCP_DEFINE_ATTR(zfcp_unit, unit, status, "0x%08x\n",
71 atomic_read(&unit->status));
72ZFCP_DEFINE_ATTR(zfcp_unit, unit, in_recovery, "%d\n",
73 (atomic_read(&unit->status) &
74 ZFCP_STATUS_COMMON_ERP_INUSE) != 0);
75ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_denied, "%d\n",
76 (atomic_read(&unit->status) &
77 ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
78ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_shared, "%d\n",
79 (atomic_read(&unit->status) &
80 ZFCP_STATUS_UNIT_SHARED) != 0);
81ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_readonly, "%d\n",
82 (atomic_read(&unit->status) &
83 ZFCP_STATUS_UNIT_READONLY) != 0);
84
85#define ZFCP_SYSFS_FAILED(_feat_def, _feat, _adapter, _mod_id, _reopen_id) \
86static ssize_t zfcp_sysfs_##_feat##_failed_show(struct device *dev, \
87 struct device_attribute *attr, \
88 char *buf) \
89{ \
615f59e0 90 struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \
60221920
SS
91 \
92 if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED) \
93 return sprintf(buf, "1\n"); \
94 else \
95 return sprintf(buf, "0\n"); \
96} \
97static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \
98 struct device_attribute *attr,\
99 const char *buf, size_t count)\
100{ \
615f59e0 101 struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \
60221920
SS
102 unsigned long val; \
103 int retval = 0; \
104 \
615f59e0 105 if (!(_feat && get_device(&_feat->dev))) \
6b183334 106 return -EBUSY; \
60221920
SS
107 \
108 if (strict_strtoul(buf, 0, &val) || val != 0) { \
109 retval = -EINVAL; \
110 goto out; \
111 } \
112 \
113 zfcp_erp_modify_##_feat##_status(_feat, _mod_id, NULL, \
114 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);\
115 zfcp_erp_##_feat##_reopen(_feat, ZFCP_STATUS_COMMON_ERP_FAILED, \
116 _reopen_id, NULL); \
117 zfcp_erp_wait(_adapter); \
118out: \
615f59e0 119 put_device(&_feat->dev); \
60221920
SS
120 return retval ? retval : (ssize_t) count; \
121} \
122static ZFCP_DEV_ATTR(_feat, failed, S_IWUSR | S_IRUGO, \
123 zfcp_sysfs_##_feat##_failed_show, \
124 zfcp_sysfs_##_feat##_failed_store);
125
5ffd51a5
SS
126ZFCP_SYSFS_FAILED(zfcp_port, port, port->adapter, "sypfai1", "sypfai2");
127ZFCP_SYSFS_FAILED(zfcp_unit, unit, unit->port->adapter, "syufai1", "syufai2");
60221920 128
de3dc572
SS
129static ssize_t zfcp_sysfs_adapter_failed_show(struct device *dev,
130 struct device_attribute *attr,
131 char *buf)
132{
133 struct ccw_device *cdev = to_ccwdev(dev);
134 struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
135 int i;
136
137 if (!adapter)
138 return -ENODEV;
139
140 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
141 i = sprintf(buf, "1\n");
142 else
143 i = sprintf(buf, "0\n");
144
145 zfcp_ccw_adapter_put(adapter);
146 return i;
147}
148
149static ssize_t zfcp_sysfs_adapter_failed_store(struct device *dev,
150 struct device_attribute *attr,
151 const char *buf, size_t count)
152{
153 struct ccw_device *cdev = to_ccwdev(dev);
154 struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
155 unsigned long val;
156 int retval = 0;
157
158 if (!adapter)
159 return -ENODEV;
160
de3dc572
SS
161 if (strict_strtoul(buf, 0, &val) || val != 0) {
162 retval = -EINVAL;
163 goto out;
164 }
165
166 zfcp_erp_modify_adapter_status(adapter, "syafai1", NULL,
167 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
168 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
169 "syafai2", NULL);
170 zfcp_erp_wait(adapter);
171out:
172 zfcp_ccw_adapter_put(adapter);
173 return retval ? retval : (ssize_t) count;
174}
175static ZFCP_DEV_ATTR(adapter, failed, S_IWUSR | S_IRUGO,
176 zfcp_sysfs_adapter_failed_show,
177 zfcp_sysfs_adapter_failed_store);
178
60221920
SS
179static ssize_t zfcp_sysfs_port_rescan_store(struct device *dev,
180 struct device_attribute *attr,
181 const char *buf, size_t count)
182{
de3dc572
SS
183 struct ccw_device *cdev = to_ccwdev(dev);
184 struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
60221920 185
de3dc572
SS
186 if (!adapter)
187 return -ENODEV;
188
9eae07ef
SS
189 /* sync the user-space- with the kernel-invocation of scan_work */
190 queue_work(adapter->work_queue, &adapter->scan_work);
191 flush_work(&adapter->scan_work);
de3dc572 192 zfcp_ccw_adapter_put(adapter);
6b183334 193
9eae07ef 194 return (ssize_t) count;
60221920
SS
195}
196static ZFCP_DEV_ATTR(adapter, port_rescan, S_IWUSR, NULL,
197 zfcp_sysfs_port_rescan_store);
198
199static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
200 struct device_attribute *attr,
201 const char *buf, size_t count)
202{
de3dc572
SS
203 struct ccw_device *cdev = to_ccwdev(dev);
204 struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
60221920 205 struct zfcp_port *port;
7ba58c9c 206 u64 wwpn;
6b183334 207 int retval = -EINVAL;
60221920 208
de3dc572
SS
209 if (!adapter)
210 return -ENODEV;
211
6b183334 212 if (strict_strtoull(buf, 0, (unsigned long long *) &wwpn))
60221920 213 goto out;
60221920 214
60221920 215 port = zfcp_get_port_by_wwpn(adapter, wwpn);
6b183334 216 if (!port)
60221920 217 goto out;
6b183334
SS
218 else
219 retval = 0;
f3450c7b
SS
220
221 write_lock_irq(&adapter->port_list_lock);
222 list_del(&port->list);
223 write_unlock_irq(&adapter->port_list_lock);
224
615f59e0 225 put_device(&port->dev);
f3450c7b 226
5ffd51a5 227 zfcp_erp_port_shutdown(port, 0, "syprs_1", NULL);
615f59e0 228 zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
60221920 229 out:
de3dc572 230 zfcp_ccw_adapter_put(adapter);
60221920
SS
231 return retval ? retval : (ssize_t) count;
232}
233static ZFCP_DEV_ATTR(adapter, port_remove, S_IWUSR, NULL,
234 zfcp_sysfs_port_remove_store);
235
236static struct attribute *zfcp_adapter_attrs[] = {
237 &dev_attr_adapter_failed.attr,
238 &dev_attr_adapter_in_recovery.attr,
239 &dev_attr_adapter_port_remove.attr,
240 &dev_attr_adapter_port_rescan.attr,
241 &dev_attr_adapter_peer_wwnn.attr,
242 &dev_attr_adapter_peer_wwpn.attr,
243 &dev_attr_adapter_peer_d_id.attr,
244 &dev_attr_adapter_card_version.attr,
245 &dev_attr_adapter_lic_version.attr,
246 &dev_attr_adapter_status.attr,
247 &dev_attr_adapter_hardware_version.attr,
248 NULL
249};
250
251struct attribute_group zfcp_sysfs_adapter_attrs = {
252 .attrs = zfcp_adapter_attrs,
253};
254
255static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
256 struct device_attribute *attr,
257 const char *buf, size_t count)
258{
615f59e0 259 struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
60221920 260 struct zfcp_unit *unit;
7ba58c9c 261 u64 fcp_lun;
60221920
SS
262 int retval = -EINVAL;
263
615f59e0 264 if (!(port && get_device(&port->dev)))
6b183334 265 return -EBUSY;
60221920 266
7ba58c9c 267 if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
60221920
SS
268 goto out;
269
270 unit = zfcp_unit_enqueue(port, fcp_lun);
271 if (IS_ERR(unit))
272 goto out;
6b183334
SS
273 else
274 retval = 0;
60221920 275
5ffd51a5 276 zfcp_erp_unit_reopen(unit, 0, "syuas_1", NULL);
60221920 277 zfcp_erp_wait(unit->port->adapter);
9e820afd 278 flush_work(&unit->scsi_work);
60221920 279out:
615f59e0 280 put_device(&port->dev);
60221920
SS
281 return retval ? retval : (ssize_t) count;
282}
283static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store);
284
285static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
286 struct device_attribute *attr,
287 const char *buf, size_t count)
288{
615f59e0 289 struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
60221920 290 struct zfcp_unit *unit;
7ba58c9c 291 u64 fcp_lun;
6b183334 292 int retval = -EINVAL;
60221920 293
615f59e0 294 if (!(port && get_device(&port->dev)))
6b183334 295 return -EBUSY;
60221920 296
6b183334 297 if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
60221920 298 goto out;
60221920 299
60221920 300 unit = zfcp_get_unit_by_lun(port, fcp_lun);
6b183334 301 if (!unit)
60221920 302 goto out;
6b183334
SS
303 else
304 retval = 0;
60221920 305
ecf0c772
SS
306 /* wait for possible timeout during SCSI probe */
307 flush_work(&unit->scsi_work);
308
f3450c7b
SS
309 write_lock_irq(&port->unit_list_lock);
310 list_del(&unit->list);
311 write_unlock_irq(&port->unit_list_lock);
ecf0c772 312
615f59e0 313 put_device(&unit->dev);
ecf0c772 314
f3450c7b 315 zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL);
615f59e0 316 zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
60221920 317out:
615f59e0 318 put_device(&port->dev);
60221920
SS
319 return retval ? retval : (ssize_t) count;
320}
321static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store);
322
5ab944f9 323static struct attribute *zfcp_port_attrs[] = {
60221920
SS
324 &dev_attr_unit_add.attr,
325 &dev_attr_unit_remove.attr,
326 &dev_attr_port_failed.attr,
327 &dev_attr_port_in_recovery.attr,
328 &dev_attr_port_status.attr,
329 &dev_attr_port_access_denied.attr,
330 NULL
331};
332
333/**
334 * zfcp_sysfs_port_attrs - sysfs attributes for all other ports
335 */
336struct attribute_group zfcp_sysfs_port_attrs = {
5ab944f9 337 .attrs = zfcp_port_attrs,
60221920
SS
338};
339
340static struct attribute *zfcp_unit_attrs[] = {
341 &dev_attr_unit_failed.attr,
342 &dev_attr_unit_in_recovery.attr,
343 &dev_attr_unit_status.attr,
344 &dev_attr_unit_access_denied.attr,
345 &dev_attr_unit_access_shared.attr,
346 &dev_attr_unit_access_readonly.attr,
347 NULL
348};
349
350struct attribute_group zfcp_sysfs_unit_attrs = {
351 .attrs = zfcp_unit_attrs,
352};
353
354#define ZFCP_DEFINE_LATENCY_ATTR(_name) \
355static ssize_t \
356zfcp_sysfs_unit_##_name##_latency_show(struct device *dev, \
357 struct device_attribute *attr, \
358 char *buf) { \
359 struct scsi_device *sdev = to_scsi_device(dev); \
360 struct zfcp_unit *unit = sdev->hostdata; \
361 struct zfcp_latencies *lat = &unit->latencies; \
362 struct zfcp_adapter *adapter = unit->port->adapter; \
60221920
SS
363 unsigned long long fsum, fmin, fmax, csum, cmin, cmax, cc; \
364 \
49f0f01c 365 spin_lock_bh(&lat->lock); \
60221920
SS
366 fsum = lat->_name.fabric.sum * adapter->timer_ticks; \
367 fmin = lat->_name.fabric.min * adapter->timer_ticks; \
368 fmax = lat->_name.fabric.max * adapter->timer_ticks; \
369 csum = lat->_name.channel.sum * adapter->timer_ticks; \
370 cmin = lat->_name.channel.min * adapter->timer_ticks; \
371 cmax = lat->_name.channel.max * adapter->timer_ticks; \
372 cc = lat->_name.counter; \
49f0f01c 373 spin_unlock_bh(&lat->lock); \
60221920
SS
374 \
375 do_div(fsum, 1000); \
376 do_div(fmin, 1000); \
377 do_div(fmax, 1000); \
378 do_div(csum, 1000); \
379 do_div(cmin, 1000); \
380 do_div(cmax, 1000); \
381 \
382 return sprintf(buf, "%llu %llu %llu %llu %llu %llu %llu\n", \
383 fmin, fmax, fsum, cmin, cmax, csum, cc); \
384} \
385static ssize_t \
386zfcp_sysfs_unit_##_name##_latency_store(struct device *dev, \
387 struct device_attribute *attr, \
388 const char *buf, size_t count) \
389{ \
390 struct scsi_device *sdev = to_scsi_device(dev); \
391 struct zfcp_unit *unit = sdev->hostdata; \
392 struct zfcp_latencies *lat = &unit->latencies; \
393 unsigned long flags; \
394 \
395 spin_lock_irqsave(&lat->lock, flags); \
396 lat->_name.fabric.sum = 0; \
397 lat->_name.fabric.min = 0xFFFFFFFF; \
398 lat->_name.fabric.max = 0; \
399 lat->_name.channel.sum = 0; \
400 lat->_name.channel.min = 0xFFFFFFFF; \
401 lat->_name.channel.max = 0; \
402 lat->_name.counter = 0; \
403 spin_unlock_irqrestore(&lat->lock, flags); \
404 \
405 return (ssize_t) count; \
406} \
407static DEVICE_ATTR(_name##_latency, S_IWUSR | S_IRUGO, \
408 zfcp_sysfs_unit_##_name##_latency_show, \
409 zfcp_sysfs_unit_##_name##_latency_store);
410
411ZFCP_DEFINE_LATENCY_ATTR(read);
412ZFCP_DEFINE_LATENCY_ATTR(write);
413ZFCP_DEFINE_LATENCY_ATTR(cmd);
414
415#define ZFCP_DEFINE_SCSI_ATTR(_name, _format, _value) \
416static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev, \
417 struct device_attribute *attr,\
418 char *buf) \
419{ \
420 struct scsi_device *sdev = to_scsi_device(dev); \
421 struct zfcp_unit *unit = sdev->hostdata; \
422 \
423 return sprintf(buf, _format, _value); \
424} \
425static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL);
426
427ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n",
b9d3aed7 428 dev_name(&unit->port->adapter->ccw_device->dev));
7ba58c9c
SS
429ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n",
430 (unsigned long long) unit->port->wwpn);
431ZFCP_DEFINE_SCSI_ATTR(fcp_lun, "0x%016llx\n",
432 (unsigned long long) unit->fcp_lun);
60221920
SS
433
434struct device_attribute *zfcp_sysfs_sdev_attrs[] = {
435 &dev_attr_fcp_lun,
436 &dev_attr_wwpn,
437 &dev_attr_hba_id,
438 &dev_attr_read_latency,
439 &dev_attr_write_latency,
440 &dev_attr_cmd_latency,
441 NULL
442};
443
444static ssize_t zfcp_sysfs_adapter_util_show(struct device *dev,
445 struct device_attribute *attr,
446 char *buf)
447{
448 struct Scsi_Host *scsi_host = dev_to_shost(dev);
449 struct fsf_qtcb_bottom_port *qtcb_port;
450 struct zfcp_adapter *adapter;
451 int retval;
452
453 adapter = (struct zfcp_adapter *) scsi_host->hostdata[0];
454 if (!(adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA))
455 return -EOPNOTSUPP;
456
457 qtcb_port = kzalloc(sizeof(struct fsf_qtcb_bottom_port), GFP_KERNEL);
458 if (!qtcb_port)
459 return -ENOMEM;
460
564e1c86 461 retval = zfcp_fsf_exchange_port_data_sync(adapter->qdio, qtcb_port);
60221920
SS
462 if (!retval)
463 retval = sprintf(buf, "%u %u %u\n", qtcb_port->cp_util,
464 qtcb_port->cb_util, qtcb_port->a_util);
465 kfree(qtcb_port);
466 return retval;
467}
468static DEVICE_ATTR(utilization, S_IRUGO, zfcp_sysfs_adapter_util_show, NULL);
469
470static int zfcp_sysfs_adapter_ex_config(struct device *dev,
471 struct fsf_statistics_info *stat_inf)
472{
473 struct Scsi_Host *scsi_host = dev_to_shost(dev);
474 struct fsf_qtcb_bottom_config *qtcb_config;
475 struct zfcp_adapter *adapter;
476 int retval;
477
478 adapter = (struct zfcp_adapter *) scsi_host->hostdata[0];
479 if (!(adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA))
480 return -EOPNOTSUPP;
481
482 qtcb_config = kzalloc(sizeof(struct fsf_qtcb_bottom_config),
483 GFP_KERNEL);
484 if (!qtcb_config)
485 return -ENOMEM;
486
564e1c86 487 retval = zfcp_fsf_exchange_config_data_sync(adapter->qdio, qtcb_config);
60221920
SS
488 if (!retval)
489 *stat_inf = qtcb_config->stat_info;
490
491 kfree(qtcb_config);
492 return retval;
493}
494
495#define ZFCP_SHOST_ATTR(_name, _format, _arg...) \
496static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, \
497 struct device_attribute *attr,\
498 char *buf) \
499{ \
500 struct fsf_statistics_info stat_info; \
501 int retval; \
502 \
503 retval = zfcp_sysfs_adapter_ex_config(dev, &stat_info); \
504 if (retval) \
505 return retval; \
506 \
507 return sprintf(buf, _format, ## _arg); \
508} \
509static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_adapter_##_name##_show, NULL);
510
511ZFCP_SHOST_ATTR(requests, "%llu %llu %llu\n",
512 (unsigned long long) stat_info.input_req,
513 (unsigned long long) stat_info.output_req,
514 (unsigned long long) stat_info.control_req);
515
516ZFCP_SHOST_ATTR(megabytes, "%llu %llu\n",
517 (unsigned long long) stat_info.input_mb,
518 (unsigned long long) stat_info.output_mb);
519
520ZFCP_SHOST_ATTR(seconds_active, "%llu\n",
521 (unsigned long long) stat_info.seconds_act);
522
2450d3e7
SR
523static ssize_t zfcp_sysfs_adapter_q_full_show(struct device *dev,
524 struct device_attribute *attr,
525 char *buf)
526{
527 struct Scsi_Host *scsi_host = class_to_shost(dev);
564e1c86
SS
528 struct zfcp_qdio *qdio =
529 ((struct zfcp_adapter *) scsi_host->hostdata[0])->qdio;
acf7b861
CS
530 u64 util;
531
564e1c86
SS
532 spin_lock_bh(&qdio->stat_lock);
533 util = qdio->req_q_util;
534 spin_unlock_bh(&qdio->stat_lock);
2450d3e7 535
564e1c86 536 return sprintf(buf, "%d %llu\n", atomic_read(&qdio->req_q_full),
acf7b861 537 (unsigned long long)util);
2450d3e7
SR
538}
539static DEVICE_ATTR(queue_full, S_IRUGO, zfcp_sysfs_adapter_q_full_show, NULL);
540
60221920
SS
541struct device_attribute *zfcp_sysfs_shost_attrs[] = {
542 &dev_attr_utilization,
543 &dev_attr_requests,
544 &dev_attr_megabytes,
545 &dev_attr_seconds_active,
2450d3e7 546 &dev_attr_queue_full,
60221920
SS
547 NULL
548};