Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/include/rdma/rdma_counter.h
26278 views
1
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2
/*
3
* Copyright (c) 2019 Mellanox Technologies. All rights reserved.
4
*/
5
6
#ifndef _RDMA_COUNTER_H_
7
#define _RDMA_COUNTER_H_
8
9
#include <linux/mutex.h>
10
#include <linux/pid_namespace.h>
11
12
#include <rdma/restrack.h>
13
#include <rdma/rdma_netlink.h>
14
15
struct ib_device;
16
struct ib_qp;
17
18
struct auto_mode_param {
19
int qp_type;
20
};
21
22
struct rdma_counter_mode {
23
enum rdma_nl_counter_mode mode;
24
enum rdma_nl_counter_mask mask;
25
struct auto_mode_param param;
26
bool bind_opcnt;
27
};
28
29
struct rdma_port_counter {
30
struct rdma_counter_mode mode;
31
struct rdma_hw_stats *hstats;
32
unsigned int num_counters;
33
struct mutex lock;
34
};
35
36
struct rdma_counter {
37
struct rdma_restrack_entry res;
38
struct ib_device *device;
39
uint32_t id;
40
struct kref kref;
41
struct rdma_counter_mode mode;
42
struct mutex lock;
43
struct rdma_hw_stats *stats;
44
u32 port;
45
};
46
47
void rdma_counter_init(struct ib_device *dev);
48
void rdma_counter_release(struct ib_device *dev);
49
int rdma_counter_set_auto_mode(struct ib_device *dev, u32 port,
50
enum rdma_nl_counter_mask mask,
51
bool bind_opcnt,
52
struct netlink_ext_ack *extack);
53
int rdma_counter_bind_qp_auto(struct ib_qp *qp, u32 port);
54
int rdma_counter_unbind_qp(struct ib_qp *qp, u32 port, bool force);
55
56
int rdma_counter_query_stats(struct rdma_counter *counter);
57
u64 rdma_counter_get_hwstat_value(struct ib_device *dev, u32 port, u32 index);
58
int rdma_counter_bind_qpn(struct ib_device *dev, u32 port,
59
u32 qp_num, u32 counter_id);
60
int rdma_counter_bind_qpn_alloc(struct ib_device *dev, u32 port,
61
u32 qp_num, u32 *counter_id);
62
int rdma_counter_unbind_qpn(struct ib_device *dev, u32 port,
63
u32 qp_num, u32 counter_id);
64
int rdma_counter_get_mode(struct ib_device *dev, u32 port,
65
enum rdma_nl_counter_mode *mode,
66
enum rdma_nl_counter_mask *mask,
67
bool *opcnt);
68
69
int rdma_counter_modify(struct ib_device *dev, u32 port,
70
unsigned int index, bool enable);
71
#endif /* _RDMA_COUNTER_H_ */
72
73