提交 90a2508d 编写于 作者: E Ed Cashin 提交者: Linus Torvalds

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: NEd Cashin <ecashin@coraid.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 aa304fde
...@@ -98,6 +98,14 @@ static ssize_t aoedisk_show_fwver(struct device *dev, ...@@ -98,6 +98,14 @@ static ssize_t aoedisk_show_fwver(struct device *dev,
return snprintf(page, PAGE_SIZE, "0x%04x\n", (unsigned int) d->fw_ver); return snprintf(page, PAGE_SIZE, "0x%04x\n", (unsigned int) d->fw_ver);
} }
static ssize_t aoedisk_show_payload(struct device *dev,
struct device_attribute *attr, char *page)
{
struct gendisk *disk = dev_to_disk(dev);
struct aoedev *d = disk->private_data;
return snprintf(page, PAGE_SIZE, "%lu\n", d->maxbcnt);
}
static DEVICE_ATTR(state, S_IRUGO, aoedisk_show_state, NULL); static DEVICE_ATTR(state, S_IRUGO, aoedisk_show_state, NULL);
static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL); static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL);
...@@ -106,12 +114,14 @@ static struct device_attribute dev_attr_firmware_version = { ...@@ -106,12 +114,14 @@ static struct device_attribute dev_attr_firmware_version = {
.attr = { .name = "firmware-version", .mode = S_IRUGO }, .attr = { .name = "firmware-version", .mode = S_IRUGO },
.show = aoedisk_show_fwver, .show = aoedisk_show_fwver,
}; };
static DEVICE_ATTR(payload, S_IRUGO, aoedisk_show_payload, NULL);
static struct attribute *aoe_attrs[] = { static struct attribute *aoe_attrs[] = {
&dev_attr_state.attr, &dev_attr_state.attr,
&dev_attr_mac.attr, &dev_attr_mac.attr,
&dev_attr_netif.attr, &dev_attr_netif.attr,
&dev_attr_firmware_version.attr, &dev_attr_firmware_version.attr,
&dev_attr_payload.attr,
NULL, NULL,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册