aboutsummaryrefslogtreecommitdiff
path: root/sys/ofed/include/rdma/ib_peer_mem.h
blob: b2a8a4a3f246eeb47dd6e10aeac0a8d1b02a672a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#if !defined(IB_PEER_MEM_H)
#define IB_PEER_MEM_H

#include <rdma/peer_mem.h>


struct invalidation_ctx;
struct ib_ucontext;

struct ib_peer_memory_statistics {
	unsigned long num_alloc_mrs;
	unsigned long num_dealloc_mrs;
	unsigned long num_reg_pages;
	unsigned long num_dereg_pages;
	unsigned long num_free_callbacks;
};

struct ib_peer_memory_client {
	const struct peer_memory_client *peer_mem;

	struct list_head	core_peer_list;
	struct list_head    core_ticket_list;
	unsigned long last_ticket;
#ifdef __FreeBSD__
	int holdcount;
	int needwakeup;
	struct cv peer_cv;
#else
	struct srcu_struct peer_srcu;
#endif
	struct mutex lock;
	struct kobject *kobj;
	struct attribute_group peer_mem_attr_group;
	struct ib_peer_memory_statistics stats;
};

struct core_ticket {
	unsigned long key;
	void *context;
	struct list_head   ticket_list;
};

struct ib_peer_memory_client *ib_get_peer_client(struct ib_ucontext *context, unsigned long addr,
						  size_t size, void **peer_client_context,
						  int *srcu_key);

void ib_put_peer_client(struct ib_peer_memory_client *ib_peer_client,
				void *peer_client_context,
				int srcu_key);

unsigned long ib_peer_insert_context(struct ib_peer_memory_client *ib_peer_client,
				void *context);
int ib_peer_remove_context(struct ib_peer_memory_client *ib_peer_client,
				unsigned long key);
struct core_ticket *ib_peer_search_context(struct ib_peer_memory_client *ib_peer_client,
						unsigned long key);
#endif