162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2021 Mellanox Technologies Ltd. All rights reserved. 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci#ifndef DEF_RDMA_IB_SYSFS_H 662306a36Sopenharmony_ci#define DEF_RDMA_IB_SYSFS_H 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include <linux/sysfs.h> 962306a36Sopenharmony_ci 1062306a36Sopenharmony_cistruct ib_device; 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_cistruct ib_port_attribute { 1362306a36Sopenharmony_ci struct attribute attr; 1462306a36Sopenharmony_ci ssize_t (*show)(struct ib_device *ibdev, u32 port_num, 1562306a36Sopenharmony_ci struct ib_port_attribute *attr, char *buf); 1662306a36Sopenharmony_ci ssize_t (*store)(struct ib_device *ibdev, u32 port_num, 1762306a36Sopenharmony_ci struct ib_port_attribute *attr, const char *buf, 1862306a36Sopenharmony_ci size_t count); 1962306a36Sopenharmony_ci}; 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#define IB_PORT_ATTR_RW(_name) \ 2262306a36Sopenharmony_ci struct ib_port_attribute ib_port_attr_##_name = __ATTR_RW(_name) 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define IB_PORT_ATTR_ADMIN_RW(_name) \ 2562306a36Sopenharmony_ci struct ib_port_attribute ib_port_attr_##_name = \ 2662306a36Sopenharmony_ci __ATTR_RW_MODE(_name, 0600) 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#define IB_PORT_ATTR_RO(_name) \ 2962306a36Sopenharmony_ci struct ib_port_attribute ib_port_attr_##_name = __ATTR_RO(_name) 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#define IB_PORT_ATTR_WO(_name) \ 3262306a36Sopenharmony_ci struct ib_port_attribute ib_port_attr_##_name = __ATTR_WO(_name) 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_cistruct ib_device *ib_port_sysfs_get_ibdev_kobj(struct kobject *kobj, 3562306a36Sopenharmony_ci u32 *port_num); 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#endif 38