aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEd Cashin <ecashin@coraid.com>2012-12-17 19:03:34 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 20:15:23 -0500
commit90a2508d01845afbb3118615ce44d689cbb0e943 (patch)
treef0ccbdc043fbb192b7a17ca3ffc0667b7ab31111 /drivers
parentaa304fdefa568d63c862df7abe55d39811845c7c (diff)
aoe: "payload" sysfs file exports per-AoE-command data transfer size
The userland aoetools package includes an "aoe-stat" command that can display a "payload size" column when the aoe driver exports this information. Users can quickly see what amount of user data is transferred inside each AoE command on the network, network headers excluded. Signed-off-by: Ed Cashin <ecashin@coraid.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/aoe/aoeblk.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index d5aa3b8c9f3..56736cd5f3f 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -98,6 +98,14 @@ static ssize_t aoedisk_show_fwver(struct device *dev,
98 98
99 return snprintf(page, PAGE_SIZE, "0x%04x\n", (unsigned int) d->fw_ver); 99 return snprintf(page, PAGE_SIZE, "0x%04x\n", (unsigned int) d->fw_ver);
100} 100}
101static ssize_t aoedisk_show_payload(struct device *dev,
102 struct device_attribute *attr, char *page)
103{
104 struct gendisk *disk = dev_to_disk(dev);
105 struct aoedev *d = disk->private_data;
106
107 return snprintf(page, PAGE_SIZE, "%lu\n", d->maxbcnt);
108}
101 109
102static DEVICE_ATTR(state, S_IRUGO, aoedisk_show_state, NULL); 110static DEVICE_ATTR(state, S_IRUGO, aoedisk_show_state, NULL);
103static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL); 111static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL);
@@ -106,12 +114,14 @@ static struct device_attribute dev_attr_firmware_version = {
106 .attr = { .name = "firmware-version", .mode = S_IRUGO }, 114 .attr = { .name = "firmware-version", .mode = S_IRUGO },
107 .show = aoedisk_show_fwver, 115 .show = aoedisk_show_fwver,
108}; 116};
117static DEVICE_ATTR(payload, S_IRUGO, aoedisk_show_payload, NULL);
109 118
110static struct attribute *aoe_attrs[] = { 119static struct attribute *aoe_attrs[] = {
111 &dev_attr_state.attr, 120 &dev_attr_state.attr,
112 &dev_attr_mac.attr, 121 &dev_attr_mac.attr,
113 &dev_attr_netif.attr, 122 &dev_attr_netif.attr,
114 &dev_attr_firmware_version.attr, 123 &dev_attr_firmware_version.attr,
124 &dev_attr_payload.attr,
115 NULL, 125 NULL,
116}; 126};
117 127