1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (c) 2021 Mellanox Technologies Ltd. All rights reserved.
5 #ifndef DEF_RDMA_IB_SYSFS_H
6 #define DEF_RDMA_IB_SYSFS_H
8 #include <linux/sysfs.h>
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
,
21 #define IB_PORT_ATTR_RW(_name) \
22 struct ib_port_attribute ib_port_attr_##_name = __ATTR_RW(_name)
24 #define IB_PORT_ATTR_ADMIN_RW(_name) \
25 struct ib_port_attribute ib_port_attr_##_name = \
26 __ATTR_RW_MODE(_name, 0600)
28 #define IB_PORT_ATTR_RO(_name) \
29 struct ib_port_attribute ib_port_attr_##_name = __ATTR_RO(_name)
31 #define IB_PORT_ATTR_WO(_name) \
32 struct ib_port_attribute ib_port_attr_##_name = __ATTR_WO(_name)
34 struct ib_device
*ib_port_sysfs_get_ibdev_kobj(struct kobject
*kobj
,