Deleted Added
full compact
uverbs.h (219820) uverbs.h (278886)
1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
4 * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
5 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
6 * Copyright (c) 2005 PathScale, Inc. All rights reserved.
7 *
8 * This software is available to you under a choice of one of two

--- 27 unchanged lines hidden (view full) ---

36
37#ifndef UVERBS_H
38#define UVERBS_H
39
40#include <linux/kref.h>
41#include <linux/idr.h>
42#include <linux/mutex.h>
43#include <linux/completion.h>
1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
4 * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
5 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
6 * Copyright (c) 2005 PathScale, Inc. All rights reserved.
7 *
8 * This software is available to you under a choice of one of two

--- 27 unchanged lines hidden (view full) ---

36
37#ifndef UVERBS_H
38#define UVERBS_H
39
40#include <linux/kref.h>
41#include <linux/idr.h>
42#include <linux/mutex.h>
43#include <linux/completion.h>
44#include <linux/cdev.h>
45#include <linux/rbtree.h>
44
45#include <rdma/ib_verbs.h>
46
47#include <rdma/ib_verbs.h>
48#include <rdma/ib_verbs_exp.h>
46#include <rdma/ib_umem.h>
47#include <rdma/ib_user_verbs.h>
49#include <rdma/ib_umem.h>
50#include <rdma/ib_user_verbs.h>
51#include <rdma/ib_user_verbs_exp.h>
48
49/*
50 * Our lifetime rules for these structs are the following:
51 *
52 * struct ib_uverbs_device: One reference is held by the module and
53 * released in ib_uverbs_remove_one(). Another reference is taken by
54 * ib_uverbs_open() each time the character special file is opened,
55 * and released in ib_uverbs_release_file() when the file is released.

--- 8 unchanged lines hidden (view full) ---

64 * another reference is held by the corresponding main context file
65 * and released when that file is closed. For completion event files,
66 * a reference is taken when a CQ is created that uses the file, and
67 * released when the CQ is destroyed.
68 */
69
70struct ib_uverbs_device {
71 struct kref ref;
52
53/*
54 * Our lifetime rules for these structs are the following:
55 *
56 * struct ib_uverbs_device: One reference is held by the module and
57 * released in ib_uverbs_remove_one(). Another reference is taken by
58 * ib_uverbs_open() each time the character special file is opened,
59 * and released in ib_uverbs_release_file() when the file is released.

--- 8 unchanged lines hidden (view full) ---

68 * another reference is held by the corresponding main context file
69 * and released when that file is closed. For completion event files,
70 * a reference is taken when a CQ is created that uses the file, and
71 * released when the CQ is destroyed.
72 */
73
74struct ib_uverbs_device {
75 struct kref ref;
76 int num_comp_vectors;
72 struct completion comp;
77 struct completion comp;
73 int devnum;
74 struct cdev *cdev;
75 struct device *dev;
76 struct ib_device *ib_dev;
78 struct device *dev;
79 struct ib_device *ib_dev;
77 int num_comp_vectors;
80 int devnum;
81 struct cdev cdev;
82 struct rb_root xrcd_tree;
83 struct mutex xrcd_tree_mutex;
78};
79
80struct ib_uverbs_event_file {
81 struct kref ref;
82 struct file *filp;
84};
85
86struct ib_uverbs_event_file {
87 struct kref ref;
88 struct file *filp;
89 int is_async;
83 struct ib_uverbs_file *uverbs_file;
84 spinlock_t lock;
90 struct ib_uverbs_file *uverbs_file;
91 spinlock_t lock;
92 int is_closed;
85 wait_queue_head_t poll_wait;
86 struct fasync_struct *async_queue;
87 struct list_head event_list;
93 wait_queue_head_t poll_wait;
94 struct fasync_struct *async_queue;
95 struct list_head event_list;
88 int is_async;
89 int is_closed;
90};
91
92struct ib_uverbs_file {
93 struct kref ref;
94 struct mutex mutex;
95 struct ib_uverbs_device *device;
96 struct ib_ucontext *ucontext;
97 struct ib_event_handler event_handler;

--- 17 unchanged lines hidden (view full) ---

115};
116
117struct ib_uevent_object {
118 struct ib_uobject uobject;
119 struct list_head event_list;
120 u32 events_reported;
121};
122
96};
97
98struct ib_uverbs_file {
99 struct kref ref;
100 struct mutex mutex;
101 struct ib_uverbs_device *device;
102 struct ib_ucontext *ucontext;
103 struct ib_event_handler event_handler;

--- 17 unchanged lines hidden (view full) ---

121};
122
123struct ib_uevent_object {
124 struct ib_uobject uobject;
125 struct list_head event_list;
126 u32 events_reported;
127};
128
129struct ib_uxrcd_object {
130 struct ib_uobject uobject;
131 atomic_t refcnt;
132};
133
134struct ib_usrq_object {
135 struct ib_uevent_object uevent;
136 struct ib_uxrcd_object *uxrcd;
137};
138
123struct ib_uqp_object {
124 struct ib_uevent_object uevent;
125 struct list_head mcast_list;
139struct ib_uqp_object {
140 struct ib_uevent_object uevent;
141 struct list_head mcast_list;
142 struct ib_uxrcd_object *uxrcd;
126};
127
128struct ib_ucq_object {
129 struct ib_uobject uobject;
130 struct ib_uverbs_file *uverbs_file;
131 struct list_head comp_list;
132 struct list_head async_list;
133 u32 comp_events_reported;
134 u32 async_events_reported;
135};
136
143};
144
145struct ib_ucq_object {
146 struct ib_uobject uobject;
147 struct ib_uverbs_file *uverbs_file;
148 struct list_head comp_list;
149 struct list_head async_list;
150 u32 comp_events_reported;
151 u32 async_events_reported;
152};
153
137struct ib_uxrcd_object {
154struct ib_udct_object {
138 struct ib_uobject uobject;
155 struct ib_uobject uobject;
139 struct list_head xrc_reg_qp_list;
140};
141
142extern spinlock_t ib_uverbs_idr_lock;
143extern struct idr ib_uverbs_pd_idr;
144extern struct idr ib_uverbs_mr_idr;
145extern struct idr ib_uverbs_mw_idr;
146extern struct idr ib_uverbs_ah_idr;
147extern struct idr ib_uverbs_cq_idr;
148extern struct idr ib_uverbs_qp_idr;
149extern struct idr ib_uverbs_srq_idr;
156};
157
158extern spinlock_t ib_uverbs_idr_lock;
159extern struct idr ib_uverbs_pd_idr;
160extern struct idr ib_uverbs_mr_idr;
161extern struct idr ib_uverbs_mw_idr;
162extern struct idr ib_uverbs_ah_idr;
163extern struct idr ib_uverbs_cq_idr;
164extern struct idr ib_uverbs_qp_idr;
165extern struct idr ib_uverbs_srq_idr;
150extern struct idr ib_uverbs_xrc_domain_idr;
166extern struct idr ib_uverbs_xrcd_idr;
167extern struct idr ib_uverbs_rule_idr;
168extern struct idr ib_uverbs_dct_idr;
151
152void idr_remove_uobj(struct idr *idp, struct ib_uobject *uobj);
153
154struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
169
170void idr_remove_uobj(struct idr *idp, struct ib_uobject *uobj);
171
172struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
155 int is_async, int *fd);
173 int is_async);
156struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd);
157
158void ib_uverbs_release_ucq(struct ib_uverbs_file *file,
159 struct ib_uverbs_event_file *ev_file,
160 struct ib_ucq_object *uobj);
161void ib_uverbs_release_uevent(struct ib_uverbs_file *file,
162 struct ib_uevent_object *uobj);
163
164void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context);
165void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr);
166void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr);
167void ib_uverbs_srq_event_handler(struct ib_event *event, void *context_ptr);
168void ib_uverbs_event_handler(struct ib_event_handler *handler,
169 struct ib_event *event);
174struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd);
175
176void ib_uverbs_release_ucq(struct ib_uverbs_file *file,
177 struct ib_uverbs_event_file *ev_file,
178 struct ib_ucq_object *uobj);
179void ib_uverbs_release_uevent(struct ib_uverbs_file *file,
180 struct ib_uevent_object *uobj);
181
182void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context);
183void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr);
184void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr);
185void ib_uverbs_srq_event_handler(struct ib_event *event, void *context_ptr);
186void ib_uverbs_event_handler(struct ib_event_handler *handler,
187 struct ib_event *event);
170void ib_uverbs_xrc_rcv_qp_event_handler(struct ib_event *event,
171 void *context_ptr);
172void ib_uverbs_dealloc_xrcd(struct ib_device *ib_dev,
173 struct ib_xrcd *xrcd);
174int ib_uverbs_cleanup_xrc_rcv_qp(struct ib_uverbs_file *file,
175 struct ib_xrcd *xrcd, u32 qp_num);
188void ib_uverbs_dealloc_xrcd(struct ib_uverbs_device *dev, struct ib_xrcd *xrcd);
176
189
190struct ib_uverbs_flow_spec {
191 union {
192 union {
193 struct ib_uverbs_flow_spec_hdr hdr;
194 struct {
195 __u32 type;
196 __u16 size;
197 __u16 reserved;
198 };
199 };
200 struct ib_uverbs_flow_spec_eth eth;
201 struct ib_uverbs_flow_spec_ib ib;
202 struct ib_uverbs_flow_spec_ipv4 ipv4;
203 struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
204 };
205};
206
177#define IB_UVERBS_DECLARE_CMD(name) \
178 ssize_t ib_uverbs_##name(struct ib_uverbs_file *file, \
179 const char __user *buf, int in_len, \
180 int out_len)
181
182IB_UVERBS_DECLARE_CMD(get_context);
183IB_UVERBS_DECLARE_CMD(query_device);
184IB_UVERBS_DECLARE_CMD(query_port);
185IB_UVERBS_DECLARE_CMD(alloc_pd);
186IB_UVERBS_DECLARE_CMD(dealloc_pd);
187IB_UVERBS_DECLARE_CMD(reg_mr);
188IB_UVERBS_DECLARE_CMD(dereg_mr);
207#define IB_UVERBS_DECLARE_CMD(name) \
208 ssize_t ib_uverbs_##name(struct ib_uverbs_file *file, \
209 const char __user *buf, int in_len, \
210 int out_len)
211
212IB_UVERBS_DECLARE_CMD(get_context);
213IB_UVERBS_DECLARE_CMD(query_device);
214IB_UVERBS_DECLARE_CMD(query_port);
215IB_UVERBS_DECLARE_CMD(alloc_pd);
216IB_UVERBS_DECLARE_CMD(dealloc_pd);
217IB_UVERBS_DECLARE_CMD(reg_mr);
218IB_UVERBS_DECLARE_CMD(dereg_mr);
219IB_UVERBS_DECLARE_CMD(alloc_mw);
220IB_UVERBS_DECLARE_CMD(dealloc_mw);
189IB_UVERBS_DECLARE_CMD(create_comp_channel);
190IB_UVERBS_DECLARE_CMD(create_cq);
191IB_UVERBS_DECLARE_CMD(resize_cq);
192IB_UVERBS_DECLARE_CMD(poll_cq);
193IB_UVERBS_DECLARE_CMD(req_notify_cq);
194IB_UVERBS_DECLARE_CMD(destroy_cq);
195IB_UVERBS_DECLARE_CMD(create_qp);
221IB_UVERBS_DECLARE_CMD(create_comp_channel);
222IB_UVERBS_DECLARE_CMD(create_cq);
223IB_UVERBS_DECLARE_CMD(resize_cq);
224IB_UVERBS_DECLARE_CMD(poll_cq);
225IB_UVERBS_DECLARE_CMD(req_notify_cq);
226IB_UVERBS_DECLARE_CMD(destroy_cq);
227IB_UVERBS_DECLARE_CMD(create_qp);
228IB_UVERBS_DECLARE_CMD(open_qp);
196IB_UVERBS_DECLARE_CMD(query_qp);
197IB_UVERBS_DECLARE_CMD(modify_qp);
198IB_UVERBS_DECLARE_CMD(destroy_qp);
199IB_UVERBS_DECLARE_CMD(post_send);
200IB_UVERBS_DECLARE_CMD(post_recv);
201IB_UVERBS_DECLARE_CMD(post_srq_recv);
202IB_UVERBS_DECLARE_CMD(create_ah);
203IB_UVERBS_DECLARE_CMD(destroy_ah);
204IB_UVERBS_DECLARE_CMD(attach_mcast);
205IB_UVERBS_DECLARE_CMD(detach_mcast);
206IB_UVERBS_DECLARE_CMD(create_srq);
207IB_UVERBS_DECLARE_CMD(modify_srq);
208IB_UVERBS_DECLARE_CMD(query_srq);
209IB_UVERBS_DECLARE_CMD(destroy_srq);
229IB_UVERBS_DECLARE_CMD(query_qp);
230IB_UVERBS_DECLARE_CMD(modify_qp);
231IB_UVERBS_DECLARE_CMD(destroy_qp);
232IB_UVERBS_DECLARE_CMD(post_send);
233IB_UVERBS_DECLARE_CMD(post_recv);
234IB_UVERBS_DECLARE_CMD(post_srq_recv);
235IB_UVERBS_DECLARE_CMD(create_ah);
236IB_UVERBS_DECLARE_CMD(destroy_ah);
237IB_UVERBS_DECLARE_CMD(attach_mcast);
238IB_UVERBS_DECLARE_CMD(detach_mcast);
239IB_UVERBS_DECLARE_CMD(create_srq);
240IB_UVERBS_DECLARE_CMD(modify_srq);
241IB_UVERBS_DECLARE_CMD(query_srq);
242IB_UVERBS_DECLARE_CMD(destroy_srq);
210IB_UVERBS_DECLARE_CMD(create_xrc_srq);
211IB_UVERBS_DECLARE_CMD(open_xrc_domain);
212IB_UVERBS_DECLARE_CMD(close_xrc_domain);
213IB_UVERBS_DECLARE_CMD(create_xrc_rcv_qp);
214IB_UVERBS_DECLARE_CMD(modify_xrc_rcv_qp);
215IB_UVERBS_DECLARE_CMD(query_xrc_rcv_qp);
216IB_UVERBS_DECLARE_CMD(reg_xrc_rcv_qp);
217IB_UVERBS_DECLARE_CMD(unreg_xrc_rcv_qp);
243IB_UVERBS_DECLARE_CMD(create_xsrq);
244IB_UVERBS_DECLARE_CMD(open_xrcd);
245IB_UVERBS_DECLARE_CMD(close_xrcd);
218
246
247#define IB_UVERBS_DECLARE_EX_CMD(name) \
248 int ib_uverbs_ex_##name(struct ib_uverbs_file *file,\
249 struct ib_udata *ucore, \
250 struct ib_udata *uhw)
219
251
252#define IB_UVERBS_DECLARE_EXP_CMD(name) \
253 ssize_t ib_uverbs_exp_##name(struct ib_uverbs_file *file, \
254 struct ib_udata *ucore, \
255 struct ib_udata *uhw)
256
257IB_UVERBS_DECLARE_EX_CMD(create_flow);
258IB_UVERBS_DECLARE_EX_CMD(destroy_flow);
259
260IB_UVERBS_DECLARE_EXP_CMD(create_qp);
261IB_UVERBS_DECLARE_EXP_CMD(modify_cq);
262IB_UVERBS_DECLARE_EXP_CMD(modify_qp);
263IB_UVERBS_DECLARE_EXP_CMD(create_cq);
264IB_UVERBS_DECLARE_EXP_CMD(query_device);
265IB_UVERBS_DECLARE_EXP_CMD(create_dct);
266IB_UVERBS_DECLARE_EXP_CMD(destroy_dct);
267IB_UVERBS_DECLARE_EXP_CMD(query_dct);
268
220#endif /* UVERBS_H */
269#endif /* UVERBS_H */