| 1 |
|
| 2 | |
| 3 | * Copyright (c) 2021 Mellanox Technologies Ltd. All rights reserved.
|
| 4 |
|
| 5 | #ifndef DEF_RDMA_IB_SYSFS_H
|
| 6 | #define DEF_RDMA_IB_SYSFS_H
|
| 7 |
|
| 8 | #include <linux/sysfs.h>
|
| 9 |
|
| 10 | struct ib_device;
|
| 11 |
|
| 12 | struct ib_port_attribute {
|
| 13 | struct attribute attr;
|
| 14 | ssize_t (*show)(struct ib_device *ibdev, u32 port_num,
|
| 15 | struct ib_port_attribute *attr, char *buf);
|
| 16 | ssize_t (*store)(struct ib_device *ibdev, u32 port_num,
|
| 17 | struct ib_port_attribute *attr, const char *buf,
|
| 18 | size_t count);
|
| 19 | };
|
| 20 |
|
| 21 | #define IB_PORT_ATTR_RW(_name) \
|
| 22 | struct ib_port_attribute ib_port_attr_##_name = __ATTR_RW(_name)
|
| 23 |
|
| 24 | #define IB_PORT_ATTR_ADMIN_RW(_name) \
|
| 25 | struct ib_port_attribute ib_port_attr_##_name = \
|
| 26 | __ATTR_RW_MODE(_name, 0600)
|
| 27 |
|
| 28 | #define IB_PORT_ATTR_RO(_name) \
|
| 29 | struct ib_port_attribute ib_port_attr_##_name = __ATTR_RO(_name)
|
| 30 |
|
| 31 | #define IB_PORT_ATTR_WO(_name) \
|
| 32 | struct ib_port_attribute ib_port_attr_##_name = __ATTR_WO(_name)
|
| 33 |
|
| 34 | struct ib_device *ib_port_sysfs_get_ibdev_kobj(struct kobject *kobj,
|
| 35 | u32 *port_num);
|
| 36 |
|
| 37 | #endif
|