ib_user_verbs.h revision 255932
1141524Swpaul/*
2141524Swpaul * Copyright (c) 2005 Topspin Communications.  All rights reserved.
3141524Swpaul * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
4141524Swpaul * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
5141524Swpaul * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
6141524Swpaul *
7141524Swpaul * This software is available to you under a choice of one of two
8141524Swpaul * licenses.  You may choose to be licensed under the terms of the GNU
9141524Swpaul * General Public License (GPL) Version 2, available from the file
10141524Swpaul * COPYING in the main directory of this source tree, or the
11141524Swpaul * OpenIB.org BSD license below:
12141524Swpaul *
13141524Swpaul *     Redistribution and use in source and binary forms, with or
14141524Swpaul *     without modification, are permitted provided that the following
15141524Swpaul *     conditions are met:
16141524Swpaul *
17141524Swpaul *      - Redistributions of source code must retain the above
18141524Swpaul *        copyright notice, this list of conditions and the following
19141524Swpaul *        disclaimer.
20141524Swpaul *
21141524Swpaul *      - Redistributions in binary form must reproduce the above
22141524Swpaul *        copyright notice, this list of conditions and the following
23141524Swpaul *        disclaimer in the documentation and/or other materials
24141524Swpaul *        provided with the distribution.
25141524Swpaul *
26141524Swpaul * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27141524Swpaul * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28141524Swpaul * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29141524Swpaul * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30141524Swpaul * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31141524Swpaul * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32141524Swpaul * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33141524Swpaul * SOFTWARE.
34141524Swpaul */
35141524Swpaul
36141524Swpaul#ifndef IB_USER_VERBS_H
37141524Swpaul#define IB_USER_VERBS_H
38141524Swpaul
39141524Swpaul#include <linux/types.h>
40141524Swpaul
41141524Swpaul/*
42141524Swpaul * Increment this value if any changes that break userspace ABI
43141524Swpaul * compatibility are made.
44141524Swpaul */
45141524Swpaul#define IB_USER_VERBS_ABI_VERSION	6
46141524Swpaul
47141524Swpaulenum {
48141524Swpaul	IB_USER_VERBS_CMD_GET_CONTEXT,
49144888Swpaul	IB_USER_VERBS_CMD_QUERY_DEVICE,
50144888Swpaul	IB_USER_VERBS_CMD_QUERY_PORT,
51144888Swpaul	IB_USER_VERBS_CMD_ALLOC_PD,
52141524Swpaul	IB_USER_VERBS_CMD_DEALLOC_PD,
53141524Swpaul	IB_USER_VERBS_CMD_CREATE_AH,
54141524Swpaul	IB_USER_VERBS_CMD_MODIFY_AH,
55145205Swpaul	IB_USER_VERBS_CMD_QUERY_AH,
56145205Swpaul	IB_USER_VERBS_CMD_DESTROY_AH,
57145205Swpaul	IB_USER_VERBS_CMD_REG_MR,
58145205Swpaul	IB_USER_VERBS_CMD_REG_SMR,
59189488Sweongyo	IB_USER_VERBS_CMD_REREG_MR,
60186507Sweongyo	IB_USER_VERBS_CMD_QUERY_MR,
61141524Swpaul	IB_USER_VERBS_CMD_DEREG_MR,
62141524Swpaul	IB_USER_VERBS_CMD_ALLOC_MW,
63141524Swpaul	IB_USER_VERBS_CMD_BIND_MW,
64141524Swpaul	IB_USER_VERBS_CMD_DEALLOC_MW,
65141524Swpaul	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
66141524Swpaul	IB_USER_VERBS_CMD_CREATE_CQ,
67142399Swpaul	IB_USER_VERBS_CMD_RESIZE_CQ,
68141524Swpaul	IB_USER_VERBS_CMD_DESTROY_CQ,
69151977Swpaul	IB_USER_VERBS_CMD_POLL_CQ,
70141524Swpaul	IB_USER_VERBS_CMD_PEEK_CQ,
71141524Swpaul	IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
72141524Swpaul	IB_USER_VERBS_CMD_CREATE_QP,
73141524Swpaul	IB_USER_VERBS_CMD_QUERY_QP,
74141524Swpaul	IB_USER_VERBS_CMD_MODIFY_QP,
75144888Swpaul	IB_USER_VERBS_CMD_DESTROY_QP,
76144888Swpaul	IB_USER_VERBS_CMD_POST_SEND,
77144888Swpaul	IB_USER_VERBS_CMD_POST_RECV,
78141524Swpaul	IB_USER_VERBS_CMD_ATTACH_MCAST,
79144888Swpaul	IB_USER_VERBS_CMD_DETACH_MCAST,
80144888Swpaul	IB_USER_VERBS_CMD_CREATE_SRQ,
81144888Swpaul	IB_USER_VERBS_CMD_MODIFY_SRQ,
82144888Swpaul	IB_USER_VERBS_CMD_QUERY_SRQ,
83144888Swpaul	IB_USER_VERBS_CMD_DESTROY_SRQ,
84144888Swpaul	IB_USER_VERBS_CMD_POST_SRQ_RECV,
85144888Swpaul	IB_USER_VERBS_CMD_OPEN_XRCD,
86144888Swpaul	IB_USER_VERBS_CMD_CLOSE_XRCD,
87144888Swpaul	IB_USER_VERBS_CMD_CREATE_XSRQ,
88144888Swpaul	IB_USER_VERBS_CMD_OPEN_QP,
89144888Swpaul	IB_USER_VERBS_CMD_ATTACH_FLOW,
90141524Swpaul	IB_USER_VERBS_CMD_DETACH_FLOW,
91141524Swpaul	IB_USER_VERBS_CMD_CREATE_XRC_SRQ,
92141524Swpaul	IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP,
93141524Swpaul	IB_USER_VERBS_CMD_MODIFY_XRC_RCV_QP,
94141524Swpaul	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP,
95141524Swpaul	IB_USER_VERBS_CMD_REG_XRC_RCV_QP,
96141524Swpaul	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP,
97189488Sweongyo};
98141524Swpaul
99141524Swpaul/*
100141524Swpaul * Make sure that all structs defined in this file remain laid out so
101141524Swpaul * that they pack the same way on 32-bit and 64-bit architectures (to
102141524Swpaul * avoid incompatibility between 32-bit userspace and 64-bit kernels).
103141524Swpaul * Specifically:
104141524Swpaul *  - Do not use pointer types -- pass pointers in __u64 instead.
105141524Swpaul *  - Make sure that any structure larger than 4 bytes is padded to a
106141524Swpaul *    multiple of 8 bytes.  Otherwise the structure size will be
107141524Swpaul *    different between 32-bit and 64-bit architectures.
108141524Swpaul */
109141524Swpaul
110141524Swpaulstruct ib_uverbs_async_event_desc {
111141524Swpaul	__u64 element;
112144888Swpaul	__u32 event_type;	/* enum ib_event_type */
113144888Swpaul	__u32 reserved;
114144888Swpaul};
115144888Swpaul
116144888Swpaulstruct ib_uverbs_comp_event_desc {
117144888Swpaul	__u64 cq_handle;
118144888Swpaul};
119144888Swpaul
120144888Swpaul/*
121144888Swpaul * All commands from userspace should start with a __u32 command field
122144888Swpaul * followed by __u16 in_words and out_words fields (which give the
123144888Swpaul * length of the command block and response buffer if any in 32-bit
124144888Swpaul * words).  The kernel driver will read these fields first and read
125144888Swpaul * the rest of the command struct based on these value.
126198786Srpaulo */
127141524Swpaul
128141524Swpaulstruct ib_uverbs_cmd_hdr {
129141524Swpaul	__u32 command;
130141524Swpaul	__u16 in_words;
131141524Swpaul	__u16 out_words;
132141524Swpaul};
133141524Swpaul
134141524Swpaulstruct ib_uverbs_get_context {
135141524Swpaul	__u64 response;
136141524Swpaul	__u64 driver_data[0];
137141524Swpaul};
138141524Swpaul
139141524Swpaulstruct ib_uverbs_get_context_resp {
140141524Swpaul	__u32 async_fd;
141141524Swpaul	__u32 num_comp_vectors;
142151207Swpaul};
143151207Swpaul
144141524Swpaulstruct ib_uverbs_query_device {
145141524Swpaul	__u64 response;
146144888Swpaul	__u64 driver_data[0];
147144888Swpaul};
148144888Swpaul
149144888Swpaulstruct ib_uverbs_query_device_resp {
150144888Swpaul	__u64 fw_ver;
151198786Srpaulo	__be64 node_guid;
152141524Swpaul	__be64 sys_image_guid;
153141524Swpaul	__u64 max_mr_size;
154141524Swpaul	__u64 page_size_cap;
155141524Swpaul	__u32 vendor_id;
156141524Swpaul	__u32 vendor_part_id;
157141524Swpaul	__u32 hw_ver;
158141524Swpaul	__u32 max_qp;
159141524Swpaul	__u32 max_qp_wr;
160142399Swpaul	__u32 device_cap_flags;
161141524Swpaul	__u32 max_sge;
162142399Swpaul	__u32 max_sge_rd;
163141524Swpaul	__u32 max_cq;
164141524Swpaul	__u32 max_cqe;
165142399Swpaul	__u32 max_mr;
166151207Swpaul	__u32 max_pd;
167141524Swpaul	__u32 max_qp_rd_atom;
168144888Swpaul	__u32 max_ee_rd_atom;
169144888Swpaul	__u32 max_res_rd_atom;
170142399Swpaul	__u32 max_qp_init_rd_atom;
171142399Swpaul	__u32 max_ee_init_rd_atom;
172142399Swpaul	__u32 atomic_cap;
173151207Swpaul	__u32 max_ee;
174151207Swpaul	__u32 max_rdd;
175198786Srpaulo	__u32 max_mw;
176142399Swpaul	__u32 max_raw_ipv6_qp;
177142399Swpaul	__u32 max_raw_ethy_qp;
178141524Swpaul	__u32 max_mcast_grp;
179141524Swpaul	__u32 max_mcast_qp_attach;
180142399Swpaul	__u32 max_total_mcast_qp_attach;
181144888Swpaul	__u32 max_ah;
182144888Swpaul	__u32 max_fmr;
183141524Swpaul	__u32 max_map_per_fmr;
184144888Swpaul	__u32 max_srq;
185144888Swpaul	__u32 max_srq_wr;
186198786Srpaulo	__u32 max_srq_sge;
187141524Swpaul	__u16 max_pkeys;
188141524Swpaul	__u8  local_ca_ack_delay;
189141524Swpaul	__u8  phys_port_cnt;
190141524Swpaul	__u8  reserved[4];
191142399Swpaul};
192151207Swpaul
193142399Swpaulstruct ib_uverbs_query_port {
194198786Srpaulo	__u64 response;
195141524Swpaul	__u8  port_num;
196141524Swpaul	__u8  reserved[7];
197145485Swpaul	__u64 driver_data[0];
198145485Swpaul};
199145485Swpaul
200145485Swpaulstruct ib_uverbs_query_port_resp {
201145485Swpaul	__u32 port_cap_flags;
202145485Swpaul	__u32 max_msg_sz;
203145485Swpaul	__u32 bad_pkey_cntr;
204145485Swpaul	__u32 qkey_viol_cntr;
205145485Swpaul	__u32 gid_tbl_len;
206145485Swpaul	__u16 pkey_tbl_len;
207145485Swpaul	__u16 lid;
208145485Swpaul	__u16 sm_lid;
209146016Swpaul	__u8  state;
210145485Swpaul	__u8  max_mtu;
211145485Swpaul	__u8  active_mtu;
212198786Srpaulo	__u8  lmc;
213145485Swpaul	__u8  max_vl_num;
214145485Swpaul	__u8  sm_sl;
215145485Swpaul	__u8  subnet_timeout;
216145485Swpaul	__u8  init_type_reply;
217198786Srpaulo	__u8  active_width;
218145485Swpaul	__u8  active_speed;
219145485Swpaul	__u8  phys_state;
220141524Swpaul	__u8  link_layer;
221141524Swpaul	__u8  reserved[2];
222141524Swpaul};
223141524Swpaul
224141524Swpaulstruct ib_uverbs_alloc_pd {
225141524Swpaul	__u64 response;
226141524Swpaul	__u64 driver_data[0];
227141524Swpaul};
228141524Swpaul
229141524Swpaulstruct ib_uverbs_alloc_pd_resp {
230141524Swpaul	__u32 pd_handle;
231145485Swpaul};
232141524Swpaul
233145485Swpaulstruct ib_uverbs_dealloc_pd {
234145485Swpaul	__u32 pd_handle;
235151207Swpaul};
236141524Swpaul
237145485Swpaulstruct ib_uverbs_open_xrcd {
238145485Swpaul	__u64 response;
239145485Swpaul	__u32 fd;
240145485Swpaul	__u32 oflags;
241145485Swpaul	__u64 driver_data[0];
242145485Swpaul};
243145485Swpaul
244145485Swpaulstruct ib_uverbs_open_xrcd_resp {
245145485Swpaul	__u32 xrcd_handle;
246145485Swpaul};
247145485Swpaul
248141524Swpaulstruct ib_uverbs_close_xrcd {
249145485Swpaul	__u32 xrcd_handle;
250145485Swpaul};
251145485Swpaul
252145485Swpaulstruct ib_uverbs_reg_mr {
253145485Swpaul	__u64 response;
254145485Swpaul	__u64 start;
255145485Swpaul	__u64 length;
256145485Swpaul	__u64 hca_va;
257145485Swpaul	__u32 pd_handle;
258145485Swpaul	__u32 access_flags;
259145485Swpaul	__u64 driver_data[0];
260145485Swpaul};
261145485Swpaul
262145485Swpaulstruct ib_uverbs_reg_mr_resp {
263145485Swpaul	__u32 mr_handle;
264145485Swpaul	__u32 lkey;
265145485Swpaul	__u32 rkey;
266145485Swpaul};
267145485Swpaul
268145485Swpaulstruct ib_uverbs_dereg_mr {
269145485Swpaul	__u32 mr_handle;
270145485Swpaul};
271145485Swpaul
272151207Swpaulstruct ib_uverbs_create_comp_channel {
273145485Swpaul	__u64 response;
274145485Swpaul};
275145485Swpaul
276145485Swpaulstruct ib_uverbs_create_comp_channel_resp {
277141524Swpaul	__u32 fd;
278141524Swpaul};
279141524Swpaul
280141524Swpaulstruct ib_uverbs_create_cq {
281141524Swpaul	__u64 response;
282141524Swpaul	__u64 user_handle;
283141524Swpaul	__u32 cqe;
284141524Swpaul	__u32 comp_vector;
285151207Swpaul	__s32 comp_channel;
286198786Srpaulo	__u32 reserved;
287151207Swpaul	__u64 driver_data[0];
288189488Sweongyo};
289141524Swpaul
290141524Swpaulstruct ib_uverbs_create_cq_resp {
291141524Swpaul	__u32 cq_handle;
292151207Swpaul	__u32 cqe;
293151207Swpaul};
294141982Swpaul
295141524Swpaulstruct ib_uverbs_resize_cq {
296141524Swpaul	__u64 response;
297141524Swpaul	__u32 cq_handle;
298141524Swpaul	__u32 cqe;
299141524Swpaul	__u64 driver_data[0];
300141524Swpaul};
301151207Swpaul
302141524Swpaulstruct ib_uverbs_resize_cq_resp {
303141524Swpaul	__u32 cqe;
304141524Swpaul	__u32 reserved;
305141524Swpaul	__u64 driver_data[0];
306141524Swpaul};
307141524Swpaul
308141524Swpaulstruct ib_uverbs_poll_cq {
309198786Srpaulo	__u64 response;
310141524Swpaul	__u32 cq_handle;
311141524Swpaul	__u32 ne;
312146015Swpaul};
313146015Swpaul
314215708Sbschmidtstruct ib_uverbs_wc {
315215708Sbschmidt	__u64 wr_id;
316215708Sbschmidt	__u32 status;
317215708Sbschmidt	__u32 opcode;
318215708Sbschmidt	__u32 vendor_err;
319215708Sbschmidt	__u32 byte_len;
320215708Sbschmidt	union {
321215708Sbschmidt		__u32 imm_data;
322215708Sbschmidt		__u32 invalidate_rkey;
323215708Sbschmidt	} ex;
324215708Sbschmidt	__u32 qp_num;
325215708Sbschmidt	__u32 src_qp;
326215708Sbschmidt	__u32 wc_flags;
327215708Sbschmidt	__u16 pkey_index;
328215708Sbschmidt	__u16 slid;
329215708Sbschmidt	__u8 sl;
330215708Sbschmidt	__u8 dlid_path_bits;
331215708Sbschmidt	__u8 port_num;
332141524Swpaul	__u8 reserved;
333141524Swpaul};
334141524Swpaul
335141524Swpaulstruct ib_uverbs_poll_cq_resp {
336141524Swpaul	__u32 count;
337141524Swpaul	__u32 reserved;
338145485Swpaul	struct ib_uverbs_wc wc[0];
339141524Swpaul};
340141524Swpaul
341141524Swpaulstruct ib_uverbs_req_notify_cq {
342145485Swpaul	__u32 cq_handle;
343145485Swpaul	__u32 solicited_only;
344145485Swpaul};
345141524Swpaul
346141524Swpaulstruct ib_uverbs_destroy_cq {
347141524Swpaul	__u64 response;
348141524Swpaul	__u32 cq_handle;
349141524Swpaul	__u32 reserved;
350142931Swpaul};
351141524Swpaul
352146015Swpaulstruct ib_uverbs_destroy_cq_resp {
353151207Swpaul	__u32 comp_events_reported;
354141524Swpaul	__u32 async_events_reported;
355141524Swpaul};
356141524Swpaul
357141524Swpaulstruct ib_uverbs_global_route {
358141524Swpaul	__u8  dgid[16];
359141524Swpaul	__u32 flow_label;
360146015Swpaul	__u8  sgid_index;
361189488Sweongyo	__u8  hop_limit;
362146015Swpaul	__u8  traffic_class;
363146015Swpaul	__u8  reserved;
364141524Swpaul};
365141524Swpaul
366198786Srpaulostruct ib_uverbs_ah_attr {
367141524Swpaul	struct ib_uverbs_global_route grh;
368141524Swpaul	__u16 dlid;
369141524Swpaul	__u8  sl;
370198786Srpaulo	__u8  src_path_bits;
371141524Swpaul	__u8  static_rate;
372186507Sweongyo	__u8  is_global;
373186507Sweongyo	__u8  port_num;
374186507Sweongyo	__u8  reserved;
375198786Srpaulo};
376186507Sweongyo
377141524Swpaulstruct ib_uverbs_qp_attr {
378141524Swpaul	__u32	qp_attr_mask;
379141524Swpaul	__u32	qp_state;
380141524Swpaul	__u32	cur_qp_state;
381198786Srpaulo	__u32	path_mtu;
382141524Swpaul	__u32	path_mig_state;
383141524Swpaul	__u32	qkey;
384215708Sbschmidt	__u32	rq_psn;
385215708Sbschmidt	__u32	sq_psn;
386215708Sbschmidt	__u32	dest_qp_num;
387215708Sbschmidt	__u32	qp_access_flags;
388141524Swpaul
389141524Swpaul	struct ib_uverbs_ah_attr ah_attr;
390142399Swpaul	struct ib_uverbs_ah_attr alt_ah_attr;
391198786Srpaulo
392141524Swpaul	/* ib_qp_cap */
393141524Swpaul	__u32	max_send_wr;
394146015Swpaul	__u32	max_recv_wr;
395146015Swpaul	__u32	max_send_sge;
396146015Swpaul	__u32	max_recv_sge;
397146015Swpaul	__u32	max_inline_data;
398141524Swpaul
399141524Swpaul	__u16	pkey_index;
400141524Swpaul	__u16	alt_pkey_index;
401141524Swpaul	__u8	en_sqd_async_notify;
402141524Swpaul	__u8	sq_draining;
403141524Swpaul	__u8	max_rd_atomic;
404141524Swpaul	__u8	max_dest_rd_atomic;
405144888Swpaul	__u8	min_rnr_timer;
406141524Swpaul	__u8	port_num;
407141524Swpaul	__u8	timeout;
408141524Swpaul	__u8	retry_cnt;
409142931Swpaul	__u8	rnr_retry;
410142931Swpaul	__u8	alt_port_num;
411141524Swpaul	__u8	alt_timeout;
412141524Swpaul	__u8	reserved[5];
413141524Swpaul};
414189488Sweongyo
415141524Swpaulstruct ib_uverbs_create_qp {
416141524Swpaul	__u64 response;
417142931Swpaul	__u64 user_handle;
418141524Swpaul	__u32 pd_handle;
419141524Swpaul	__u32 send_cq_handle;
420142931Swpaul	__u32 recv_cq_handle;
421141524Swpaul	__u32 srq_handle;
422142931Swpaul	__u32 max_send_wr;
423198786Srpaulo	__u32 max_recv_wr;
424141524Swpaul	__u32 max_send_sge;
425141524Swpaul	__u32 max_recv_sge;
426151207Swpaul	__u32 max_inline_data;
427141524Swpaul	__u8  sq_sig_all;
428142931Swpaul	__u8  qp_type;
429142931Swpaul	__u8  is_srq;
430141524Swpaul	__u8  reserved;
431151207Swpaul	__u64 driver_data[0];
432151207Swpaul};
433151207Swpaul
434151207Swpaulstruct ib_uverbs_open_qp {
435198786Srpaulo	__u64 response;
436151207Swpaul	__u64 user_handle;
437141524Swpaul	__u32 pd_handle;
438142931Swpaul	__u32 qpn;
439145485Swpaul	__u8  qp_type;
440145485Swpaul	__u8  reserved[7];
441145485Swpaul	__u64 driver_data[0];
442141524Swpaul};
443141524Swpaul
444141524Swpaul/* also used for open response */
445142931Swpaulstruct ib_uverbs_create_qp_resp {
446141524Swpaul	__u32 qp_handle;
447141524Swpaul	__u32 qpn;
448151207Swpaul	__u32 max_send_wr;
449142931Swpaul	__u32 max_recv_wr;
450141524Swpaul	__u32 max_send_sge;
451198786Srpaulo	__u32 max_recv_sge;
452141524Swpaul	__u32 max_inline_data;
453141524Swpaul	__u32 reserved;
454141524Swpaul};
455141524Swpaul
456141524Swpaul/*
457141524Swpaul * This struct needs to remain a multiple of 8 bytes to keep the
458141524Swpaul * alignment of the modify QP parameters.
459141524Swpaul */
460141524Swpaulstruct ib_uverbs_qp_dest {
461141524Swpaul	__u8  dgid[16];
462141524Swpaul	__u32 flow_label;
463141524Swpaul	__u16 dlid;
464141524Swpaul	__u16 reserved;
465141524Swpaul	__u8  sgid_index;
466141524Swpaul	__u8  hop_limit;
467141524Swpaul	__u8  traffic_class;
468141524Swpaul	__u8  sl;
469141524Swpaul	__u8  src_path_bits;
470141524Swpaul	__u8  static_rate;
471141524Swpaul	__u8  is_global;
472141524Swpaul	__u8  port_num;
473141524Swpaul};
474141524Swpaul
475141524Swpaulstruct ib_uverbs_query_qp {
476141524Swpaul	__u64 response;
477141524Swpaul	__u32 qp_handle;
478141524Swpaul	__u32 attr_mask;
479141524Swpaul	__u64 driver_data[0];
480141524Swpaul};
481141524Swpaul
482141524Swpaulstruct ib_uverbs_query_qp_resp {
483141524Swpaul	struct ib_uverbs_qp_dest dest;
484141524Swpaul	struct ib_uverbs_qp_dest alt_dest;
485141524Swpaul	__u32 max_send_wr;
486141524Swpaul	__u32 max_recv_wr;
487141524Swpaul	__u32 max_send_sge;
488198786Srpaulo	__u32 max_recv_sge;
489141524Swpaul	__u32 max_inline_data;
490141524Swpaul	__u32 qkey;
491141524Swpaul	__u32 rq_psn;
492141524Swpaul	__u32 sq_psn;
493141524Swpaul	__u32 dest_qp_num;
494141524Swpaul	__u32 qp_access_flags;
495141524Swpaul	__u16 pkey_index;
496141524Swpaul	__u16 alt_pkey_index;
497141524Swpaul	__u8  qp_state;
498141524Swpaul	__u8  cur_qp_state;
499141524Swpaul	__u8  path_mtu;
500141524Swpaul	__u8  path_mig_state;
501141524Swpaul	__u8  sq_draining;
502141524Swpaul	__u8  max_rd_atomic;
503141524Swpaul	__u8  max_dest_rd_atomic;
504141524Swpaul	__u8  min_rnr_timer;
505141524Swpaul	__u8  port_num;
506141524Swpaul	__u8  timeout;
507141524Swpaul	__u8  retry_cnt;
508141524Swpaul	__u8  rnr_retry;
509141524Swpaul	__u8  alt_port_num;
510141524Swpaul	__u8  alt_timeout;
511141524Swpaul	__u8  sq_sig_all;
512141524Swpaul	__u8  reserved[5];
513141524Swpaul	__u64 driver_data[0];
514141524Swpaul};
515141524Swpaul
516141524Swpaulstruct ib_uverbs_modify_qp {
517141524Swpaul	struct ib_uverbs_qp_dest dest;
518141524Swpaul	struct ib_uverbs_qp_dest alt_dest;
519141524Swpaul	__u32 qp_handle;
520141524Swpaul	__u32 attr_mask;
521141524Swpaul	__u32 qkey;
522141524Swpaul	__u32 rq_psn;
523145485Swpaul	__u32 sq_psn;
524145485Swpaul	__u32 dest_qp_num;
525145485Swpaul	__u32 qp_access_flags;
526198786Srpaulo	__u16 pkey_index;
527145485Swpaul	__u16 alt_pkey_index;
528145485Swpaul	__u8  qp_state;
529141524Swpaul	__u8  cur_qp_state;
530141524Swpaul	__u8  path_mtu;
531141524Swpaul	__u8  path_mig_state;
532198786Srpaulo	__u8  en_sqd_async_notify;
533141524Swpaul	__u8  max_rd_atomic;
534141524Swpaul	__u8  max_dest_rd_atomic;
535141524Swpaul	__u8  min_rnr_timer;
536141524Swpaul	__u8  port_num;
537141524Swpaul	__u8  timeout;
538141524Swpaul	__u8  retry_cnt;
539141524Swpaul	__u8  rnr_retry;
540141524Swpaul	__u8  alt_port_num;
541141524Swpaul	__u8  alt_timeout;
542141524Swpaul	__u8  reserved[2];
543141524Swpaul	__u64 driver_data[0];
544141524Swpaul};
545141524Swpaul
546151207Swpaulstruct ib_uverbs_modify_qp_resp {
547141524Swpaul};
548144888Swpaul
549141524Swpaulstruct ib_uverbs_destroy_qp {
550141524Swpaul	__u64 response;
551141524Swpaul	__u32 qp_handle;
552151207Swpaul	__u32 reserved;
553151207Swpaul};
554192036Sbrueffer
555192036Sbruefferstruct ib_uverbs_destroy_qp_resp {
556198786Srpaulo	__u32 events_reported;
557192036Sbrueffer};
558141524Swpaul
559144888Swpaul/*
560144888Swpaul * The ib_uverbs_sge structure isn't used anywhere, since we assume
561144888Swpaul * the ib_sge structure is packed the same way on 32-bit and 64-bit
562144888Swpaul * architectures in both kernel and user space.  It's just here to
563144888Swpaul * document the ABI.
564144888Swpaul */
565141524Swpaulstruct ib_uverbs_sge {
566141524Swpaul	__u64 addr;
567141524Swpaul	__u32 length;
568141524Swpaul	__u32 lkey;
569189488Sweongyo};
570141524Swpaul
571141524Swpaulstruct ib_uverbs_send_wr {
572141524Swpaul	__u64 wr_id;
573198786Srpaulo	__u32 num_sge;
574141524Swpaul	__u32 opcode;
575141963Swpaul	__u32 send_flags;
576141963Swpaul	union {
577141963Swpaul		__u32 imm_data;
578141963Swpaul		__u32 invalidate_rkey;
579141963Swpaul	} ex;
580141963Swpaul	union {
581141963Swpaul		struct {
582141963Swpaul			__u64 remote_addr;
583144888Swpaul			__u32 rkey;
584141963Swpaul			__u32 reserved;
585141963Swpaul		} rdma;
586144888Swpaul		struct {
587144888Swpaul			__u64 remote_addr;
588141963Swpaul			__u64 compare_add;
589141963Swpaul			__u64 swap;
590141963Swpaul			__u32 rkey;
591141963Swpaul			__u32 reserved;
592141963Swpaul		} atomic;
593141963Swpaul		struct {
594141963Swpaul			__u32 ah;
595141963Swpaul			__u32 remote_qpn;
596141963Swpaul			__u32 remote_qkey;
597141963Swpaul			__u32 reserved;
598141963Swpaul		} ud;
599141963Swpaul	} wr;
600141963Swpaul};
601198786Srpaulo
602141963Swpaulstruct ibv_uverbs_flow_spec {
603141963Swpaul	__u32  type;
604141963Swpaul	__be32 src_ip;
605141963Swpaul	__be32 dst_ip;
606141963Swpaul	__be16 src_port;
607141963Swpaul	__be16 dst_port;
608141963Swpaul	__u8   l4_protocol;
609141963Swpaul	__u8   block_mc_loopback;
610141963Swpaul};
611141963Swpaul
612141963Swpaulstruct ib_uverbs_post_send {
613144888Swpaul	__u64 response;
614198786Srpaulo	__u32 qp_handle;
615141963Swpaul	__u32 wr_count;
616144888Swpaul	__u32 sge_count;
617141963Swpaul	__u32 wqe_size;
618144888Swpaul	struct ib_uverbs_send_wr send_wr[0];
619144888Swpaul};
620144888Swpaul
621144888Swpaulstruct ib_uverbs_post_send_resp {
622144888Swpaul	__u32 bad_wr;
623144888Swpaul};
624144888Swpaul
625144888Swpaulstruct ib_uverbs_recv_wr {
626144888Swpaul	__u64 wr_id;
627144888Swpaul	__u32 num_sge;
628144888Swpaul	__u32 reserved;
629144888Swpaul};
630144888Swpaul
631144888Swpaulstruct ib_uverbs_post_recv {
632144888Swpaul	__u64 response;
633144888Swpaul	__u32 qp_handle;
634144888Swpaul	__u32 wr_count;
635144888Swpaul	__u32 sge_count;
636144888Swpaul	__u32 wqe_size;
637144888Swpaul	struct ib_uverbs_recv_wr recv_wr[0];
638144888Swpaul};
639144888Swpaul
640144888Swpaulstruct ib_uverbs_post_recv_resp {
641144888Swpaul	__u32 bad_wr;
642144888Swpaul};
643144888Swpaul
644144888Swpaulstruct ib_uverbs_post_srq_recv {
645144888Swpaul	__u64 response;
646144888Swpaul	__u32 srq_handle;
647145205Swpaul	__u32 wr_count;
648145205Swpaul	__u32 sge_count;
649145205Swpaul	__u32 wqe_size;
650145205Swpaul	struct ib_uverbs_recv_wr recv[0];
651145205Swpaul};
652145205Swpaul
653145205Swpaulstruct ib_uverbs_post_srq_recv_resp {
654145205Swpaul	__u32 bad_wr;
655145205Swpaul};
656145205Swpaul
657145205Swpaulstruct ib_uverbs_create_ah {
658145205Swpaul	__u64 response;
659145205Swpaul	__u64 user_handle;
660144888Swpaul	__u32 pd_handle;
661144888Swpaul	__u32 reserved;
662144888Swpaul	struct ib_uverbs_ah_attr attr;
663144888Swpaul};
664144888Swpaul
665144888Swpaulstruct ib_uverbs_create_ah_resp {
666144888Swpaul	__u32 ah_handle;
667144888Swpaul};
668144888Swpaul
669144888Swpaulstruct ib_uverbs_destroy_ah {
670144888Swpaul	__u32 ah_handle;
671144888Swpaul};
672144888Swpaul
673144888Swpaulstruct ib_uverbs_attach_mcast {
674144888Swpaul	__u8  gid[16];
675144888Swpaul	__u32 qp_handle;
676144888Swpaul	__u16 mlid;
677144888Swpaul	__u16 reserved;
678144888Swpaul	__u64 driver_data[0];
679144888Swpaul};
680144888Swpaul
681144888Swpaulstruct ib_uverbs_detach_mcast {
682144888Swpaul	__u8  gid[16];
683144888Swpaul	__u32 qp_handle;
684144888Swpaul	__u16 mlid;
685144888Swpaul	__u16 reserved;
686144888Swpaul	__u64 driver_data[0];
687144888Swpaul};
688144888Swpaul
689144888Swpaulstruct ibv_kern_flow_spec {
690144888Swpaul	__u32  type;
691144888Swpaul	__u32  reserved1;
692144888Swpaul	union {
693144888Swpaul		struct {
694144888Swpaul			__be16 ethertype;
695144888Swpaul			__be16 vlan;
696146428Swpaul			__u8 vlan_present;
697146428Swpaul			__u8  mac[6];
698146428Swpaul			__u8  port;
699146428Swpaul		} eth;
700146428Swpaul		struct {
701146428Swpaul			__be32 qpn;
702146428Swpaul		} ib_uc;
703146428Swpaul		struct {
704146428Swpaul			__u8  mgid[16];
705146428Swpaul		} ib_mc;
706151207Swpaul	} l2_id;
707146428Swpaul	__be32 src_ip;
708146428Swpaul	__be32 dst_ip;
709146428Swpaul	__be16 src_port;
710151977Swpaul	__be16 dst_port;
711144888Swpaul	__u8   l4_protocol;
712144888Swpaul	__u8   block_mc_loopback;
713151977Swpaul	__u8   reserved[2];
714144888Swpaul};
715151977Swpaul
716144888Swpaulstruct ib_uverbs_attach_flow {
717144888Swpaul	__u32 qp_handle;
718144888Swpaul	__u32 priority;
719144888Swpaul	struct ibv_kern_flow_spec spec;
720144888Swpaul};
721144888Swpaul
722144888Swpaulstruct ib_uverbs_detach_flow {
723144888Swpaul	__u32 qp_handle;
724144888Swpaul	__u32 priority;
725144888Swpaul	struct ibv_kern_flow_spec spec;
726144888Swpaul};
727144888Swpaul
728144888Swpaulstruct ib_uverbs_create_srq {
729144888Swpaul	__u64 response;
730144888Swpaul	__u64 user_handle;
731151977Swpaul	__u32 pd_handle;
732144888Swpaul	__u32 max_wr;
733144888Swpaul	__u32 max_sge;
734151977Swpaul	__u32 srq_limit;
735151977Swpaul	__u64 driver_data[0];
736144888Swpaul};
737144888Swpaul
738144888Swpaulstruct ib_uverbs_create_xsrq {
739144888Swpaul	__u64 response;
740144888Swpaul	__u64 user_handle;
741145485Swpaul	__u32 srq_type;
742144888Swpaul	__u32 pd_handle;
743144888Swpaul	__u32 max_wr;
744144888Swpaul	__u32 max_sge;
745144888Swpaul	__u32 srq_limit;
746144888Swpaul	__u32 reserved;
747144888Swpaul	__u32 xrcd_handle;
748144888Swpaul	__u32 cq_handle;
749189488Sweongyo	__u64 driver_data[0];
750189488Sweongyo};
751189488Sweongyo
752189488Sweongyostruct ib_uverbs_create_srq_resp {
753144888Swpaul	__u32 srq_handle;
754144888Swpaul	__u32 max_wr;
755144888Swpaul	__u32 max_sge;
756189488Sweongyo	__u32 srqn;
757189488Sweongyo};
758144888Swpaul
759144888Swpaulstruct ib_uverbs_modify_srq {
760189488Sweongyo	__u32 srq_handle;
761189488Sweongyo	__u32 attr_mask;
762144888Swpaul	__u32 max_wr;
763189488Sweongyo	__u32 srq_limit;
764144888Swpaul	__u64 driver_data[0];
765189488Sweongyo};
766189488Sweongyo
767189488Sweongyostruct ib_uverbs_query_srq {
768189488Sweongyo	__u64 response;
769144888Swpaul	__u32 srq_handle;
770189488Sweongyo	__u32 reserved;
771144888Swpaul	__u64 driver_data[0];
772189488Sweongyo};
773189488Sweongyo
774198786Srpaulostruct ib_uverbs_query_srq_resp {
775144888Swpaul	__u32 max_wr;
776189488Sweongyo	__u32 max_sge;
777144888Swpaul	__u32 srq_limit;
778144888Swpaul	__u32 reserved;
779144888Swpaul};
780189488Sweongyo
781144888Swpaulstruct ib_uverbs_destroy_srq {
782144888Swpaul	__u64 response;
783189488Sweongyo	__u32 srq_handle;
784144888Swpaul	__u32 reserved;
785144888Swpaul};
786144888Swpaul
787144888Swpaulstruct ib_uverbs_destroy_srq_resp {
788144888Swpaul	__u32 events_reported;
789144888Swpaul};
790144888Swpaul
791144888Swpaulstruct ib_uverbs_open_xrc_domain {
792189488Sweongyo	__u64 response;
793144888Swpaul	__u32 fd;
794198786Srpaulo	__u32 oflags;
795144888Swpaul	__u64 driver_data[0];
796144888Swpaul};
797189488Sweongyo
798189488Sweongyostruct ib_uverbs_open_xrc_domain_resp {
799189488Sweongyo	__u32 xrcd_handle;
800189488Sweongyo};
801144888Swpaul
802144888Swpaulstruct ib_uverbs_close_xrc_domain {
803144888Swpaul	__u64 response;
804189488Sweongyo	__u32 xrcd_handle;
805189488Sweongyo	__u32 reserved;
806144888Swpaul	__u64 driver_data[0];
807144888Swpaul};
808189488Sweongyo
809189488Sweongyostruct ib_uverbs_create_xrc_rcv_qp {
810144888Swpaul	__u64 response;
811189488Sweongyo	__u64 user_handle;
812144888Swpaul	__u32 xrc_domain_handle;
813189488Sweongyo	__u32 max_send_wr;
814189488Sweongyo	__u32 max_recv_wr;
815189488Sweongyo	__u32 max_send_sge;
816189488Sweongyo	__u32 max_recv_sge;
817144888Swpaul	__u32 max_inline_data;
818189488Sweongyo	__u8  sq_sig_all;
819144888Swpaul	__u8  qp_type;
820189488Sweongyo	__u8  reserved[6];
821189488Sweongyo	__u64 driver_data[0];
822198786Srpaulo};
823144888Swpaul
824189488Sweongyostruct ib_uverbs_create_xrc_rcv_qp_resp {
825144888Swpaul	__u32 qpn;
826144888Swpaul	__u32 reserved;
827144888Swpaul};
828189488Sweongyo
829144888Swpaulstruct ib_uverbs_modify_xrc_rcv_qp {
830144888Swpaul	__u32 xrc_domain_handle;
831189488Sweongyo	__u32 qp_num;
832144888Swpaul	struct ib_uverbs_qp_dest dest;
833144888Swpaul	struct ib_uverbs_qp_dest alt_dest;
834144888Swpaul	__u32 attr_mask;
835144888Swpaul	__u32 qkey;
836189488Sweongyo	__u32 rq_psn;
837144888Swpaul	__u32 sq_psn;
838198786Srpaulo	__u32 dest_qp_num;
839144888Swpaul	__u32 qp_access_flags;
840144888Swpaul	__u16 pkey_index;
841189488Sweongyo	__u16 alt_pkey_index;
842189488Sweongyo	__u8  qp_state;
843189488Sweongyo	__u8  cur_qp_state;
844144888Swpaul	__u8  path_mtu;
845144888Swpaul	__u8  path_mig_state;
846144888Swpaul	__u8  en_sqd_async_notify;
847189488Sweongyo	__u8  max_rd_atomic;
848189488Sweongyo	__u8  max_dest_rd_atomic;
849144888Swpaul	__u8  min_rnr_timer;
850189488Sweongyo	__u8  port_num;
851189488Sweongyo	__u8  timeout;
852189488Sweongyo	__u8  retry_cnt;
853144888Swpaul	__u8  rnr_retry;
854189488Sweongyo	__u8  alt_port_num;
855189488Sweongyo	__u8  alt_timeout;
856189488Sweongyo	__u8  reserved[6];
857144888Swpaul	__u64 driver_data[0];
858189488Sweongyo};
859144888Swpaul
860189488Sweongyostruct ib_uverbs_query_xrc_rcv_qp {
861189488Sweongyo	__u64 response;
862198786Srpaulo	__u32 xrc_domain_handle;
863144888Swpaul	__u32 qp_num;
864189488Sweongyo	__u32 attr_mask;
865144888Swpaul	__u32 reserved;
866189488Sweongyo	__u64 driver_data[0];
867144888Swpaul};
868189488Sweongyo
869144888Swpaulstruct ib_uverbs_reg_xrc_rcv_qp {
870144888Swpaul	__u32 xrc_domain_handle;
871189488Sweongyo	__u32 qp_num;
872144888Swpaul	__u64 driver_data[0];
873189488Sweongyo};
874144888Swpaul
875198786Srpaulostruct ib_uverbs_unreg_xrc_rcv_qp {
876144888Swpaul	__u32 xrc_domain_handle;
877144888Swpaul	__u32 qp_num;
878141963Swpaul	__u64 driver_data[0];
879144888Swpaul};
880189488Sweongyo
881189488Sweongyo
882144888Swpaul#endif /* IB_USER_VERBS_H */
883144888Swpaul