aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_sysfs.c')
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c60
1 files changed, 31 insertions, 29 deletions
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 2e85c6c49e7d..2809d789b55c 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -26,9 +26,9 @@ static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO, \
26ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, status, "0x%08x\n", 26ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, status, "0x%08x\n",
27 atomic_read(&adapter->status)); 27 atomic_read(&adapter->status));
28ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, peer_wwnn, "0x%016llx\n", 28ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, peer_wwnn, "0x%016llx\n",
29 adapter->peer_wwnn); 29 (unsigned long long) adapter->peer_wwnn);
30ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, peer_wwpn, "0x%016llx\n", 30ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, peer_wwpn, "0x%016llx\n",
31 adapter->peer_wwpn); 31 (unsigned long long) adapter->peer_wwpn);
32ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, peer_d_id, "0x%06x\n", 32ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, peer_d_id, "0x%06x\n",
33 adapter->peer_d_id); 33 adapter->peer_d_id);
34ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, card_version, "0x%04x\n", 34ZFCP_DEFINE_ATTR(zfcp_adapter, adapter, card_version, "0x%04x\n",
@@ -135,8 +135,9 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
135{ 135{
136 struct zfcp_adapter *adapter = dev_get_drvdata(dev); 136 struct zfcp_adapter *adapter = dev_get_drvdata(dev);
137 struct zfcp_port *port; 137 struct zfcp_port *port;
138 wwn_t wwpn; 138 u64 wwpn;
139 int retval = 0; 139 int retval = 0;
140 LIST_HEAD(port_remove_lh);
140 141
141 down(&zfcp_data.config_sema); 142 down(&zfcp_data.config_sema);
142 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_REMOVE) { 143 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_REMOVE) {
@@ -144,7 +145,7 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
144 goto out; 145 goto out;
145 } 146 }
146 147
147 if (strict_strtoull(buf, 0, &wwpn)) { 148 if (strict_strtoull(buf, 0, (unsigned long long *) &wwpn)) {
148 retval = -EINVAL; 149 retval = -EINVAL;
149 goto out; 150 goto out;
150 } 151 }
@@ -154,7 +155,7 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
154 if (port && (atomic_read(&port->refcount) == 0)) { 155 if (port && (atomic_read(&port->refcount) == 0)) {
155 zfcp_port_get(port); 156 zfcp_port_get(port);
156 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status); 157 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status);
157 list_move(&port->list, &adapter->port_remove_lh); 158 list_move(&port->list, &port_remove_lh);
158 } else 159 } else
159 port = NULL; 160 port = NULL;
160 write_unlock_irq(&zfcp_data.config_lock); 161 write_unlock_irq(&zfcp_data.config_lock);
@@ -200,7 +201,7 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
200{ 201{
201 struct zfcp_port *port = dev_get_drvdata(dev); 202 struct zfcp_port *port = dev_get_drvdata(dev);
202 struct zfcp_unit *unit; 203 struct zfcp_unit *unit;
203 fcp_lun_t fcp_lun; 204 u64 fcp_lun;
204 int retval = -EINVAL; 205 int retval = -EINVAL;
205 206
206 down(&zfcp_data.config_sema); 207 down(&zfcp_data.config_sema);
@@ -209,7 +210,7 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
209 goto out; 210 goto out;
210 } 211 }
211 212
212 if (strict_strtoull(buf, 0, &fcp_lun)) 213 if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
213 goto out; 214 goto out;
214 215
215 unit = zfcp_unit_enqueue(port, fcp_lun); 216 unit = zfcp_unit_enqueue(port, fcp_lun);
@@ -233,8 +234,9 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
233{ 234{
234 struct zfcp_port *port = dev_get_drvdata(dev); 235 struct zfcp_port *port = dev_get_drvdata(dev);
235 struct zfcp_unit *unit; 236 struct zfcp_unit *unit;
236 fcp_lun_t fcp_lun; 237 u64 fcp_lun;
237 int retval = 0; 238 int retval = 0;
239 LIST_HEAD(unit_remove_lh);
238 240
239 down(&zfcp_data.config_sema); 241 down(&zfcp_data.config_sema);
240 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_REMOVE) { 242 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_REMOVE) {
@@ -242,7 +244,7 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
242 goto out; 244 goto out;
243 } 245 }
244 246
245 if (strict_strtoull(buf, 0, &fcp_lun)) { 247 if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun)) {
246 retval = -EINVAL; 248 retval = -EINVAL;
247 goto out; 249 goto out;
248 } 250 }
@@ -252,7 +254,7 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
252 if (unit && (atomic_read(&unit->refcount) == 0)) { 254 if (unit && (atomic_read(&unit->refcount) == 0)) {
253 zfcp_unit_get(unit); 255 zfcp_unit_get(unit);
254 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); 256 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status);
255 list_move(&unit->list, &port->unit_remove_lh); 257 list_move(&unit->list, &unit_remove_lh);
256 } else 258 } else
257 unit = NULL; 259 unit = NULL;
258 260
@@ -273,22 +275,7 @@ out:
273} 275}
274static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store); 276static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store);
275 277
276static struct attribute *zfcp_port_ns_attrs[] = { 278static struct attribute *zfcp_port_attrs[] = {
277 &dev_attr_port_failed.attr,
278 &dev_attr_port_in_recovery.attr,
279 &dev_attr_port_status.attr,
280 &dev_attr_port_access_denied.attr,
281 NULL
282};
283
284/**
285 * zfcp_sysfs_ns_port_attrs - sysfs attributes for nameserver
286 */
287struct attribute_group zfcp_sysfs_ns_port_attrs = {
288 .attrs = zfcp_port_ns_attrs,
289};
290
291static struct attribute *zfcp_port_no_ns_attrs[] = {
292 &dev_attr_unit_add.attr, 279 &dev_attr_unit_add.attr,
293 &dev_attr_unit_remove.attr, 280 &dev_attr_unit_remove.attr,
294 &dev_attr_port_failed.attr, 281 &dev_attr_port_failed.attr,
@@ -302,7 +289,7 @@ static struct attribute *zfcp_port_no_ns_attrs[] = {
302 * zfcp_sysfs_port_attrs - sysfs attributes for all other ports 289 * zfcp_sysfs_port_attrs - sysfs attributes for all other ports
303 */ 290 */
304struct attribute_group zfcp_sysfs_port_attrs = { 291struct attribute_group zfcp_sysfs_port_attrs = {
305 .attrs = zfcp_port_no_ns_attrs, 292 .attrs = zfcp_port_attrs,
306}; 293};
307 294
308static struct attribute *zfcp_unit_attrs[] = { 295static struct attribute *zfcp_unit_attrs[] = {
@@ -395,8 +382,10 @@ static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL);
395 382
396ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n", 383ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n",
397 unit->port->adapter->ccw_device->dev.bus_id); 384 unit->port->adapter->ccw_device->dev.bus_id);
398ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n", unit->port->wwpn); 385ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n",
399ZFCP_DEFINE_SCSI_ATTR(fcp_lun, "0x%016llx\n", unit->fcp_lun); 386 (unsigned long long) unit->port->wwpn);
387ZFCP_DEFINE_SCSI_ATTR(fcp_lun, "0x%016llx\n",
388 (unsigned long long) unit->fcp_lun);
400 389
401struct device_attribute *zfcp_sysfs_sdev_attrs[] = { 390struct device_attribute *zfcp_sysfs_sdev_attrs[] = {
402 &dev_attr_fcp_lun, 391 &dev_attr_fcp_lun,
@@ -487,10 +476,23 @@ ZFCP_SHOST_ATTR(megabytes, "%llu %llu\n",
487ZFCP_SHOST_ATTR(seconds_active, "%llu\n", 476ZFCP_SHOST_ATTR(seconds_active, "%llu\n",
488 (unsigned long long) stat_info.seconds_act); 477 (unsigned long long) stat_info.seconds_act);
489 478
479static ssize_t zfcp_sysfs_adapter_q_full_show(struct device *dev,
480 struct device_attribute *attr,
481 char *buf)
482{
483 struct Scsi_Host *scsi_host = class_to_shost(dev);
484 struct zfcp_adapter *adapter =
485 (struct zfcp_adapter *) scsi_host->hostdata[0];
486
487 return sprintf(buf, "%d\n", atomic_read(&adapter->qdio_outb_full));
488}
489static DEVICE_ATTR(queue_full, S_IRUGO, zfcp_sysfs_adapter_q_full_show, NULL);
490
490struct device_attribute *zfcp_sysfs_shost_attrs[] = { 491struct device_attribute *zfcp_sysfs_shost_attrs[] = {
491 &dev_attr_utilization, 492 &dev_attr_utilization,
492 &dev_attr_requests, 493 &dev_attr_requests,
493 &dev_attr_megabytes, 494 &dev_attr_megabytes,
494 &dev_attr_seconds_active, 495 &dev_attr_seconds_active,
496 &dev_attr_queue_full,
495 NULL 497 NULL
496}; 498};