0001
0002
0003
0004
0005 #ifndef DEF_RDMA_IB_SYSFS_H
0006 #define DEF_RDMA_IB_SYSFS_H
0007
0008 #include <linux/sysfs.h>
0009
0010 struct ib_device;
0011
0012 struct ib_port_attribute {
0013 struct attribute attr;
0014 ssize_t (*show)(struct ib_device *ibdev, u32 port_num,
0015 struct ib_port_attribute *attr, char *buf);
0016 ssize_t (*store)(struct ib_device *ibdev, u32 port_num,
0017 struct ib_port_attribute *attr, const char *buf,
0018 size_t count);
0019 };
0020
0021 #define IB_PORT_ATTR_RW(_name) \
0022 struct ib_port_attribute ib_port_attr_##_name = __ATTR_RW(_name)
0023
0024 #define IB_PORT_ATTR_ADMIN_RW(_name) \
0025 struct ib_port_attribute ib_port_attr_##_name = \
0026 __ATTR_RW_MODE(_name, 0600)
0027
0028 #define IB_PORT_ATTR_RO(_name) \
0029 struct ib_port_attribute ib_port_attr_##_name = __ATTR_RO(_name)
0030
0031 #define IB_PORT_ATTR_WO(_name) \
0032 struct ib_port_attribute ib_port_attr_##_name = __ATTR_WO(_name)
0033
0034 struct ib_device *ib_port_sysfs_get_ibdev_kobj(struct kobject *kobj,
0035 u32 *port_num);
0036
0037 #endif