Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21921
b: refs/heads/master
c: c5bcbbb
h: refs/heads/master
i:
  21919: 51358f9
v: v3
  • Loading branch information
Roland Dreier committed Mar 20, 2006
1 parent 83516a5 commit a68019c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2fa5e2ebbe2d81f741ba7bed9e07dc38cc734625
refs/heads/master: c5bcbbb9fe00128d500c2f473d5ddc8d8c2c53a7
30 changes: 29 additions & 1 deletion trunk/drivers/infiniband/core/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,42 @@ static ssize_t show_node_guid(struct class_device *cdev, char *buf)
be16_to_cpu(((__be16 *) &dev->node_guid)[3]));
}

static ssize_t show_node_desc(struct class_device *cdev, char *buf)
{
struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);

return sprintf(buf, "%.64s\n", dev->node_desc);
}

static ssize_t set_node_desc(struct class_device *cdev, const char *buf,
size_t count)
{
struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
struct ib_device_modify desc = {};
int ret;

if (!dev->modify_device)
return -EIO;

memcpy(desc.node_desc, buf, min_t(int, count, 64));
ret = ib_modify_device(dev, IB_DEVICE_MODIFY_NODE_DESC, &desc);
if (ret)
return ret;

return count;
}

static CLASS_DEVICE_ATTR(node_type, S_IRUGO, show_node_type, NULL);
static CLASS_DEVICE_ATTR(sys_image_guid, S_IRUGO, show_sys_image_guid, NULL);
static CLASS_DEVICE_ATTR(node_guid, S_IRUGO, show_node_guid, NULL);
static CLASS_DEVICE_ATTR(node_desc, S_IRUGO | S_IWUSR, show_node_desc,
set_node_desc);

static struct class_device_attribute *ib_class_attributes[] = {
&class_device_attr_node_type,
&class_device_attr_sys_image_guid,
&class_device_attr_node_guid
&class_device_attr_node_guid,
&class_device_attr_node_desc
};

static struct class ib_class = {
Expand Down
5 changes: 4 additions & 1 deletion trunk/include/rdma/ib_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,13 @@ struct ib_port_attr {
};

enum ib_device_modify_flags {
IB_DEVICE_MODIFY_SYS_IMAGE_GUID = 1
IB_DEVICE_MODIFY_SYS_IMAGE_GUID = 1 << 0,
IB_DEVICE_MODIFY_NODE_DESC = 1 << 1
};

struct ib_device_modify {
u64 sys_image_guid;
char node_desc[64];
};

enum ib_port_modify_flags {
Expand Down Expand Up @@ -951,6 +953,7 @@ struct ib_device {
u64 uverbs_cmd_mask;
int uverbs_abi_ver;

char node_desc[64];
__be64 node_guid;
u8 node_type;
u8 phys_port_cnt;
Expand Down

0 comments on commit a68019c

Please sign in to comment.