Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Copyright (c) 2019 Mellanox Technologies. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #ifndef _RDMA_COUNTER_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #define _RDMA_COUNTER_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/pid_namespace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <rdma/restrack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <rdma/rdma_netlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct ib_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct ib_qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct auto_mode_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	int qp_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct rdma_counter_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	enum rdma_nl_counter_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	enum rdma_nl_counter_mask mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	struct auto_mode_param param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct rdma_port_counter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	struct rdma_counter_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	struct rdma_hw_stats *hstats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	unsigned int num_counters;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct rdma_counter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	struct rdma_restrack_entry	res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	struct ib_device		*device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	uint32_t			id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	struct kref			kref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	struct rdma_counter_mode	mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	struct mutex			lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	struct rdma_hw_stats		*stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	u8				port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void rdma_counter_init(struct ib_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void rdma_counter_release(struct ib_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int rdma_counter_set_auto_mode(struct ib_device *dev, u8 port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 			       bool on, enum rdma_nl_counter_mask mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int rdma_counter_bind_qp_auto(struct ib_qp *qp, u8 port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int rdma_counter_unbind_qp(struct ib_qp *qp, bool force);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) int rdma_counter_query_stats(struct rdma_counter *counter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) u64 rdma_counter_get_hwstat_value(struct ib_device *dev, u8 port, u32 index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int rdma_counter_bind_qpn(struct ib_device *dev, u8 port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 			  u32 qp_num, u32 counter_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int rdma_counter_bind_qpn_alloc(struct ib_device *dev, u8 port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 				u32 qp_num, u32 *counter_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) int rdma_counter_unbind_qpn(struct ib_device *dev, u8 port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 			    u32 qp_num, u32 counter_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int rdma_counter_get_mode(struct ib_device *dev, u8 port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 			  enum rdma_nl_counter_mode *mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 			  enum rdma_nl_counter_mask *mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #endif /* _RDMA_COUNTER_H_ */