1219820Sjeff/*
2219820Sjeff * Copyright (c) 2005 Topspin Communications.  All rights reserved.
3219820Sjeff * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
4219820Sjeff * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
5219820Sjeff * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
6219820Sjeff *
7219820Sjeff * This software is available to you under a choice of one of two
8219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
9219820Sjeff * General Public License (GPL) Version 2, available from the file
10219820Sjeff * COPYING in the main directory of this source tree, or the
11219820Sjeff * OpenIB.org BSD license below:
12219820Sjeff *
13219820Sjeff *     Redistribution and use in source and binary forms, with or
14219820Sjeff *     without modification, are permitted provided that the following
15219820Sjeff *     conditions are met:
16219820Sjeff *
17219820Sjeff *      - Redistributions of source code must retain the above
18219820Sjeff *        copyright notice, this list of conditions and the following
19219820Sjeff *        disclaimer.
20219820Sjeff *
21219820Sjeff *      - Redistributions in binary form must reproduce the above
22219820Sjeff *        copyright notice, this list of conditions and the following
23219820Sjeff *        disclaimer in the documentation and/or other materials
24219820Sjeff *        provided with the distribution.
25219820Sjeff *
26219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33219820Sjeff * SOFTWARE.
34219820Sjeff */
35219820Sjeff
36219820Sjeff#ifndef IB_USER_VERBS_H
37219820Sjeff#define IB_USER_VERBS_H
38219820Sjeff
39219820Sjeff#include <linux/types.h>
40219820Sjeff
41219820Sjeff/*
42219820Sjeff * Increment this value if any changes that break userspace ABI
43219820Sjeff * compatibility are made.
44219820Sjeff */
45219820Sjeff#define IB_USER_VERBS_ABI_VERSION	6
46219820Sjeff
47219820Sjeffenum {
48219820Sjeff	IB_USER_VERBS_CMD_GET_CONTEXT,
49219820Sjeff	IB_USER_VERBS_CMD_QUERY_DEVICE,
50219820Sjeff	IB_USER_VERBS_CMD_QUERY_PORT,
51219820Sjeff	IB_USER_VERBS_CMD_ALLOC_PD,
52219820Sjeff	IB_USER_VERBS_CMD_DEALLOC_PD,
53219820Sjeff	IB_USER_VERBS_CMD_CREATE_AH,
54219820Sjeff	IB_USER_VERBS_CMD_MODIFY_AH,
55219820Sjeff	IB_USER_VERBS_CMD_QUERY_AH,
56219820Sjeff	IB_USER_VERBS_CMD_DESTROY_AH,
57219820Sjeff	IB_USER_VERBS_CMD_REG_MR,
58219820Sjeff	IB_USER_VERBS_CMD_REG_SMR,
59219820Sjeff	IB_USER_VERBS_CMD_REREG_MR,
60219820Sjeff	IB_USER_VERBS_CMD_QUERY_MR,
61219820Sjeff	IB_USER_VERBS_CMD_DEREG_MR,
62219820Sjeff	IB_USER_VERBS_CMD_ALLOC_MW,
63219820Sjeff	IB_USER_VERBS_CMD_BIND_MW,
64219820Sjeff	IB_USER_VERBS_CMD_DEALLOC_MW,
65219820Sjeff	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
66219820Sjeff	IB_USER_VERBS_CMD_CREATE_CQ,
67219820Sjeff	IB_USER_VERBS_CMD_RESIZE_CQ,
68219820Sjeff	IB_USER_VERBS_CMD_DESTROY_CQ,
69219820Sjeff	IB_USER_VERBS_CMD_POLL_CQ,
70219820Sjeff	IB_USER_VERBS_CMD_PEEK_CQ,
71219820Sjeff	IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
72219820Sjeff	IB_USER_VERBS_CMD_CREATE_QP,
73219820Sjeff	IB_USER_VERBS_CMD_QUERY_QP,
74219820Sjeff	IB_USER_VERBS_CMD_MODIFY_QP,
75219820Sjeff	IB_USER_VERBS_CMD_DESTROY_QP,
76219820Sjeff	IB_USER_VERBS_CMD_POST_SEND,
77219820Sjeff	IB_USER_VERBS_CMD_POST_RECV,
78219820Sjeff	IB_USER_VERBS_CMD_ATTACH_MCAST,
79219820Sjeff	IB_USER_VERBS_CMD_DETACH_MCAST,
80219820Sjeff	IB_USER_VERBS_CMD_CREATE_SRQ,
81219820Sjeff	IB_USER_VERBS_CMD_MODIFY_SRQ,
82219820Sjeff	IB_USER_VERBS_CMD_QUERY_SRQ,
83219820Sjeff	IB_USER_VERBS_CMD_DESTROY_SRQ,
84219820Sjeff	IB_USER_VERBS_CMD_POST_SRQ_RECV,
85255932Salfred	IB_USER_VERBS_CMD_OPEN_XRCD,
86255932Salfred	IB_USER_VERBS_CMD_CLOSE_XRCD,
87255932Salfred	IB_USER_VERBS_CMD_CREATE_XSRQ,
88255932Salfred	IB_USER_VERBS_CMD_OPEN_QP,
89255932Salfred	IB_USER_VERBS_CMD_ATTACH_FLOW,
90255932Salfred	IB_USER_VERBS_CMD_DETACH_FLOW,
91219820Sjeff	IB_USER_VERBS_CMD_CREATE_XRC_SRQ,
92219820Sjeff	IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP,
93219820Sjeff	IB_USER_VERBS_CMD_MODIFY_XRC_RCV_QP,
94219820Sjeff	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP,
95219820Sjeff	IB_USER_VERBS_CMD_REG_XRC_RCV_QP,
96219820Sjeff	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP,
97219820Sjeff};
98219820Sjeff
99219820Sjeff/*
100219820Sjeff * Make sure that all structs defined in this file remain laid out so
101219820Sjeff * that they pack the same way on 32-bit and 64-bit architectures (to
102219820Sjeff * avoid incompatibility between 32-bit userspace and 64-bit kernels).
103219820Sjeff * Specifically:
104219820Sjeff *  - Do not use pointer types -- pass pointers in __u64 instead.
105219820Sjeff *  - Make sure that any structure larger than 4 bytes is padded to a
106219820Sjeff *    multiple of 8 bytes.  Otherwise the structure size will be
107219820Sjeff *    different between 32-bit and 64-bit architectures.
108219820Sjeff */
109219820Sjeff
110219820Sjeffstruct ib_uverbs_async_event_desc {
111219820Sjeff	__u64 element;
112219820Sjeff	__u32 event_type;	/* enum ib_event_type */
113219820Sjeff	__u32 reserved;
114219820Sjeff};
115219820Sjeff
116219820Sjeffstruct ib_uverbs_comp_event_desc {
117219820Sjeff	__u64 cq_handle;
118219820Sjeff};
119219820Sjeff
120219820Sjeff/*
121219820Sjeff * All commands from userspace should start with a __u32 command field
122219820Sjeff * followed by __u16 in_words and out_words fields (which give the
123219820Sjeff * length of the command block and response buffer if any in 32-bit
124219820Sjeff * words).  The kernel driver will read these fields first and read
125219820Sjeff * the rest of the command struct based on these value.
126219820Sjeff */
127219820Sjeff
128219820Sjeffstruct ib_uverbs_cmd_hdr {
129219820Sjeff	__u32 command;
130219820Sjeff	__u16 in_words;
131219820Sjeff	__u16 out_words;
132219820Sjeff};
133219820Sjeff
134219820Sjeffstruct ib_uverbs_get_context {
135219820Sjeff	__u64 response;
136219820Sjeff	__u64 driver_data[0];
137219820Sjeff};
138219820Sjeff
139219820Sjeffstruct ib_uverbs_get_context_resp {
140219820Sjeff	__u32 async_fd;
141219820Sjeff	__u32 num_comp_vectors;
142219820Sjeff};
143219820Sjeff
144219820Sjeffstruct ib_uverbs_query_device {
145219820Sjeff	__u64 response;
146219820Sjeff	__u64 driver_data[0];
147219820Sjeff};
148219820Sjeff
149219820Sjeffstruct ib_uverbs_query_device_resp {
150219820Sjeff	__u64 fw_ver;
151219820Sjeff	__be64 node_guid;
152219820Sjeff	__be64 sys_image_guid;
153219820Sjeff	__u64 max_mr_size;
154219820Sjeff	__u64 page_size_cap;
155219820Sjeff	__u32 vendor_id;
156219820Sjeff	__u32 vendor_part_id;
157219820Sjeff	__u32 hw_ver;
158219820Sjeff	__u32 max_qp;
159219820Sjeff	__u32 max_qp_wr;
160219820Sjeff	__u32 device_cap_flags;
161219820Sjeff	__u32 max_sge;
162219820Sjeff	__u32 max_sge_rd;
163219820Sjeff	__u32 max_cq;
164219820Sjeff	__u32 max_cqe;
165219820Sjeff	__u32 max_mr;
166219820Sjeff	__u32 max_pd;
167219820Sjeff	__u32 max_qp_rd_atom;
168219820Sjeff	__u32 max_ee_rd_atom;
169219820Sjeff	__u32 max_res_rd_atom;
170219820Sjeff	__u32 max_qp_init_rd_atom;
171219820Sjeff	__u32 max_ee_init_rd_atom;
172219820Sjeff	__u32 atomic_cap;
173219820Sjeff	__u32 max_ee;
174219820Sjeff	__u32 max_rdd;
175219820Sjeff	__u32 max_mw;
176219820Sjeff	__u32 max_raw_ipv6_qp;
177219820Sjeff	__u32 max_raw_ethy_qp;
178219820Sjeff	__u32 max_mcast_grp;
179219820Sjeff	__u32 max_mcast_qp_attach;
180219820Sjeff	__u32 max_total_mcast_qp_attach;
181219820Sjeff	__u32 max_ah;
182219820Sjeff	__u32 max_fmr;
183219820Sjeff	__u32 max_map_per_fmr;
184219820Sjeff	__u32 max_srq;
185219820Sjeff	__u32 max_srq_wr;
186219820Sjeff	__u32 max_srq_sge;
187219820Sjeff	__u16 max_pkeys;
188219820Sjeff	__u8  local_ca_ack_delay;
189219820Sjeff	__u8  phys_port_cnt;
190219820Sjeff	__u8  reserved[4];
191219820Sjeff};
192219820Sjeff
193219820Sjeffstruct ib_uverbs_query_port {
194219820Sjeff	__u64 response;
195219820Sjeff	__u8  port_num;
196219820Sjeff	__u8  reserved[7];
197219820Sjeff	__u64 driver_data[0];
198219820Sjeff};
199219820Sjeff
200219820Sjeffstruct ib_uverbs_query_port_resp {
201219820Sjeff	__u32 port_cap_flags;
202219820Sjeff	__u32 max_msg_sz;
203219820Sjeff	__u32 bad_pkey_cntr;
204219820Sjeff	__u32 qkey_viol_cntr;
205219820Sjeff	__u32 gid_tbl_len;
206219820Sjeff	__u16 pkey_tbl_len;
207219820Sjeff	__u16 lid;
208219820Sjeff	__u16 sm_lid;
209219820Sjeff	__u8  state;
210219820Sjeff	__u8  max_mtu;
211219820Sjeff	__u8  active_mtu;
212219820Sjeff	__u8  lmc;
213219820Sjeff	__u8  max_vl_num;
214219820Sjeff	__u8  sm_sl;
215219820Sjeff	__u8  subnet_timeout;
216219820Sjeff	__u8  init_type_reply;
217219820Sjeff	__u8  active_width;
218219820Sjeff	__u8  active_speed;
219219820Sjeff	__u8  phys_state;
220219820Sjeff	__u8  link_layer;
221219820Sjeff	__u8  reserved[2];
222219820Sjeff};
223219820Sjeff
224219820Sjeffstruct ib_uverbs_alloc_pd {
225219820Sjeff	__u64 response;
226219820Sjeff	__u64 driver_data[0];
227219820Sjeff};
228219820Sjeff
229219820Sjeffstruct ib_uverbs_alloc_pd_resp {
230219820Sjeff	__u32 pd_handle;
231219820Sjeff};
232219820Sjeff
233219820Sjeffstruct ib_uverbs_dealloc_pd {
234219820Sjeff	__u32 pd_handle;
235219820Sjeff};
236219820Sjeff
237255932Salfredstruct ib_uverbs_open_xrcd {
238255932Salfred	__u64 response;
239255932Salfred	__u32 fd;
240255932Salfred	__u32 oflags;
241255932Salfred	__u64 driver_data[0];
242255932Salfred};
243255932Salfred
244255932Salfredstruct ib_uverbs_open_xrcd_resp {
245255932Salfred	__u32 xrcd_handle;
246255932Salfred};
247255932Salfred
248255932Salfredstruct ib_uverbs_close_xrcd {
249255932Salfred	__u32 xrcd_handle;
250255932Salfred};
251255932Salfred
252219820Sjeffstruct ib_uverbs_reg_mr {
253219820Sjeff	__u64 response;
254219820Sjeff	__u64 start;
255219820Sjeff	__u64 length;
256219820Sjeff	__u64 hca_va;
257219820Sjeff	__u32 pd_handle;
258219820Sjeff	__u32 access_flags;
259219820Sjeff	__u64 driver_data[0];
260219820Sjeff};
261219820Sjeff
262219820Sjeffstruct ib_uverbs_reg_mr_resp {
263219820Sjeff	__u32 mr_handle;
264219820Sjeff	__u32 lkey;
265219820Sjeff	__u32 rkey;
266219820Sjeff};
267219820Sjeff
268219820Sjeffstruct ib_uverbs_dereg_mr {
269219820Sjeff	__u32 mr_handle;
270219820Sjeff};
271219820Sjeff
272219820Sjeffstruct ib_uverbs_create_comp_channel {
273219820Sjeff	__u64 response;
274219820Sjeff};
275219820Sjeff
276219820Sjeffstruct ib_uverbs_create_comp_channel_resp {
277219820Sjeff	__u32 fd;
278219820Sjeff};
279219820Sjeff
280219820Sjeffstruct ib_uverbs_create_cq {
281219820Sjeff	__u64 response;
282219820Sjeff	__u64 user_handle;
283219820Sjeff	__u32 cqe;
284219820Sjeff	__u32 comp_vector;
285219820Sjeff	__s32 comp_channel;
286219820Sjeff	__u32 reserved;
287219820Sjeff	__u64 driver_data[0];
288219820Sjeff};
289219820Sjeff
290219820Sjeffstruct ib_uverbs_create_cq_resp {
291219820Sjeff	__u32 cq_handle;
292219820Sjeff	__u32 cqe;
293219820Sjeff};
294219820Sjeff
295219820Sjeffstruct ib_uverbs_resize_cq {
296219820Sjeff	__u64 response;
297219820Sjeff	__u32 cq_handle;
298219820Sjeff	__u32 cqe;
299219820Sjeff	__u64 driver_data[0];
300219820Sjeff};
301219820Sjeff
302219820Sjeffstruct ib_uverbs_resize_cq_resp {
303219820Sjeff	__u32 cqe;
304219820Sjeff	__u32 reserved;
305219820Sjeff	__u64 driver_data[0];
306219820Sjeff};
307219820Sjeff
308219820Sjeffstruct ib_uverbs_poll_cq {
309219820Sjeff	__u64 response;
310219820Sjeff	__u32 cq_handle;
311219820Sjeff	__u32 ne;
312219820Sjeff};
313219820Sjeff
314219820Sjeffstruct ib_uverbs_wc {
315219820Sjeff	__u64 wr_id;
316219820Sjeff	__u32 status;
317219820Sjeff	__u32 opcode;
318219820Sjeff	__u32 vendor_err;
319219820Sjeff	__u32 byte_len;
320219820Sjeff	union {
321219820Sjeff		__u32 imm_data;
322219820Sjeff		__u32 invalidate_rkey;
323219820Sjeff	} ex;
324219820Sjeff	__u32 qp_num;
325219820Sjeff	__u32 src_qp;
326219820Sjeff	__u32 wc_flags;
327219820Sjeff	__u16 pkey_index;
328219820Sjeff	__u16 slid;
329219820Sjeff	__u8 sl;
330219820Sjeff	__u8 dlid_path_bits;
331219820Sjeff	__u8 port_num;
332219820Sjeff	__u8 reserved;
333219820Sjeff};
334219820Sjeff
335219820Sjeffstruct ib_uverbs_poll_cq_resp {
336219820Sjeff	__u32 count;
337219820Sjeff	__u32 reserved;
338219820Sjeff	struct ib_uverbs_wc wc[0];
339219820Sjeff};
340219820Sjeff
341219820Sjeffstruct ib_uverbs_req_notify_cq {
342219820Sjeff	__u32 cq_handle;
343219820Sjeff	__u32 solicited_only;
344219820Sjeff};
345219820Sjeff
346219820Sjeffstruct ib_uverbs_destroy_cq {
347219820Sjeff	__u64 response;
348219820Sjeff	__u32 cq_handle;
349219820Sjeff	__u32 reserved;
350219820Sjeff};
351219820Sjeff
352219820Sjeffstruct ib_uverbs_destroy_cq_resp {
353219820Sjeff	__u32 comp_events_reported;
354219820Sjeff	__u32 async_events_reported;
355219820Sjeff};
356219820Sjeff
357219820Sjeffstruct ib_uverbs_global_route {
358219820Sjeff	__u8  dgid[16];
359219820Sjeff	__u32 flow_label;
360219820Sjeff	__u8  sgid_index;
361219820Sjeff	__u8  hop_limit;
362219820Sjeff	__u8  traffic_class;
363219820Sjeff	__u8  reserved;
364219820Sjeff};
365219820Sjeff
366219820Sjeffstruct ib_uverbs_ah_attr {
367219820Sjeff	struct ib_uverbs_global_route grh;
368219820Sjeff	__u16 dlid;
369219820Sjeff	__u8  sl;
370219820Sjeff	__u8  src_path_bits;
371219820Sjeff	__u8  static_rate;
372219820Sjeff	__u8  is_global;
373219820Sjeff	__u8  port_num;
374219820Sjeff	__u8  reserved;
375219820Sjeff};
376219820Sjeff
377219820Sjeffstruct ib_uverbs_qp_attr {
378219820Sjeff	__u32	qp_attr_mask;
379219820Sjeff	__u32	qp_state;
380219820Sjeff	__u32	cur_qp_state;
381219820Sjeff	__u32	path_mtu;
382219820Sjeff	__u32	path_mig_state;
383219820Sjeff	__u32	qkey;
384219820Sjeff	__u32	rq_psn;
385219820Sjeff	__u32	sq_psn;
386219820Sjeff	__u32	dest_qp_num;
387219820Sjeff	__u32	qp_access_flags;
388219820Sjeff
389219820Sjeff	struct ib_uverbs_ah_attr ah_attr;
390219820Sjeff	struct ib_uverbs_ah_attr alt_ah_attr;
391219820Sjeff
392219820Sjeff	/* ib_qp_cap */
393219820Sjeff	__u32	max_send_wr;
394219820Sjeff	__u32	max_recv_wr;
395219820Sjeff	__u32	max_send_sge;
396219820Sjeff	__u32	max_recv_sge;
397219820Sjeff	__u32	max_inline_data;
398219820Sjeff
399219820Sjeff	__u16	pkey_index;
400219820Sjeff	__u16	alt_pkey_index;
401219820Sjeff	__u8	en_sqd_async_notify;
402219820Sjeff	__u8	sq_draining;
403219820Sjeff	__u8	max_rd_atomic;
404219820Sjeff	__u8	max_dest_rd_atomic;
405219820Sjeff	__u8	min_rnr_timer;
406219820Sjeff	__u8	port_num;
407219820Sjeff	__u8	timeout;
408219820Sjeff	__u8	retry_cnt;
409219820Sjeff	__u8	rnr_retry;
410219820Sjeff	__u8	alt_port_num;
411219820Sjeff	__u8	alt_timeout;
412219820Sjeff	__u8	reserved[5];
413219820Sjeff};
414219820Sjeff
415219820Sjeffstruct ib_uverbs_create_qp {
416219820Sjeff	__u64 response;
417219820Sjeff	__u64 user_handle;
418219820Sjeff	__u32 pd_handle;
419219820Sjeff	__u32 send_cq_handle;
420219820Sjeff	__u32 recv_cq_handle;
421219820Sjeff	__u32 srq_handle;
422219820Sjeff	__u32 max_send_wr;
423219820Sjeff	__u32 max_recv_wr;
424219820Sjeff	__u32 max_send_sge;
425219820Sjeff	__u32 max_recv_sge;
426219820Sjeff	__u32 max_inline_data;
427219820Sjeff	__u8  sq_sig_all;
428219820Sjeff	__u8  qp_type;
429219820Sjeff	__u8  is_srq;
430219820Sjeff	__u8  reserved;
431219820Sjeff	__u64 driver_data[0];
432219820Sjeff};
433219820Sjeff
434255932Salfredstruct ib_uverbs_open_qp {
435255932Salfred	__u64 response;
436255932Salfred	__u64 user_handle;
437255932Salfred	__u32 pd_handle;
438255932Salfred	__u32 qpn;
439255932Salfred	__u8  qp_type;
440255932Salfred	__u8  reserved[7];
441255932Salfred	__u64 driver_data[0];
442255932Salfred};
443255932Salfred
444255932Salfred/* also used for open response */
445219820Sjeffstruct ib_uverbs_create_qp_resp {
446219820Sjeff	__u32 qp_handle;
447219820Sjeff	__u32 qpn;
448219820Sjeff	__u32 max_send_wr;
449219820Sjeff	__u32 max_recv_wr;
450219820Sjeff	__u32 max_send_sge;
451219820Sjeff	__u32 max_recv_sge;
452219820Sjeff	__u32 max_inline_data;
453219820Sjeff	__u32 reserved;
454219820Sjeff};
455219820Sjeff
456219820Sjeff/*
457219820Sjeff * This struct needs to remain a multiple of 8 bytes to keep the
458219820Sjeff * alignment of the modify QP parameters.
459219820Sjeff */
460219820Sjeffstruct ib_uverbs_qp_dest {
461219820Sjeff	__u8  dgid[16];
462219820Sjeff	__u32 flow_label;
463219820Sjeff	__u16 dlid;
464219820Sjeff	__u16 reserved;
465219820Sjeff	__u8  sgid_index;
466219820Sjeff	__u8  hop_limit;
467219820Sjeff	__u8  traffic_class;
468219820Sjeff	__u8  sl;
469219820Sjeff	__u8  src_path_bits;
470219820Sjeff	__u8  static_rate;
471219820Sjeff	__u8  is_global;
472219820Sjeff	__u8  port_num;
473219820Sjeff};
474219820Sjeff
475219820Sjeffstruct ib_uverbs_query_qp {
476219820Sjeff	__u64 response;
477219820Sjeff	__u32 qp_handle;
478219820Sjeff	__u32 attr_mask;
479219820Sjeff	__u64 driver_data[0];
480219820Sjeff};
481219820Sjeff
482219820Sjeffstruct ib_uverbs_query_qp_resp {
483219820Sjeff	struct ib_uverbs_qp_dest dest;
484219820Sjeff	struct ib_uverbs_qp_dest alt_dest;
485219820Sjeff	__u32 max_send_wr;
486219820Sjeff	__u32 max_recv_wr;
487219820Sjeff	__u32 max_send_sge;
488219820Sjeff	__u32 max_recv_sge;
489219820Sjeff	__u32 max_inline_data;
490219820Sjeff	__u32 qkey;
491219820Sjeff	__u32 rq_psn;
492219820Sjeff	__u32 sq_psn;
493219820Sjeff	__u32 dest_qp_num;
494219820Sjeff	__u32 qp_access_flags;
495219820Sjeff	__u16 pkey_index;
496219820Sjeff	__u16 alt_pkey_index;
497219820Sjeff	__u8  qp_state;
498219820Sjeff	__u8  cur_qp_state;
499219820Sjeff	__u8  path_mtu;
500219820Sjeff	__u8  path_mig_state;
501219820Sjeff	__u8  sq_draining;
502219820Sjeff	__u8  max_rd_atomic;
503219820Sjeff	__u8  max_dest_rd_atomic;
504219820Sjeff	__u8  min_rnr_timer;
505219820Sjeff	__u8  port_num;
506219820Sjeff	__u8  timeout;
507219820Sjeff	__u8  retry_cnt;
508219820Sjeff	__u8  rnr_retry;
509219820Sjeff	__u8  alt_port_num;
510219820Sjeff	__u8  alt_timeout;
511219820Sjeff	__u8  sq_sig_all;
512219820Sjeff	__u8  reserved[5];
513219820Sjeff	__u64 driver_data[0];
514219820Sjeff};
515219820Sjeff
516219820Sjeffstruct ib_uverbs_modify_qp {
517219820Sjeff	struct ib_uverbs_qp_dest dest;
518219820Sjeff	struct ib_uverbs_qp_dest alt_dest;
519219820Sjeff	__u32 qp_handle;
520219820Sjeff	__u32 attr_mask;
521219820Sjeff	__u32 qkey;
522219820Sjeff	__u32 rq_psn;
523219820Sjeff	__u32 sq_psn;
524219820Sjeff	__u32 dest_qp_num;
525219820Sjeff	__u32 qp_access_flags;
526219820Sjeff	__u16 pkey_index;
527219820Sjeff	__u16 alt_pkey_index;
528219820Sjeff	__u8  qp_state;
529219820Sjeff	__u8  cur_qp_state;
530219820Sjeff	__u8  path_mtu;
531219820Sjeff	__u8  path_mig_state;
532219820Sjeff	__u8  en_sqd_async_notify;
533219820Sjeff	__u8  max_rd_atomic;
534219820Sjeff	__u8  max_dest_rd_atomic;
535219820Sjeff	__u8  min_rnr_timer;
536219820Sjeff	__u8  port_num;
537219820Sjeff	__u8  timeout;
538219820Sjeff	__u8  retry_cnt;
539219820Sjeff	__u8  rnr_retry;
540219820Sjeff	__u8  alt_port_num;
541219820Sjeff	__u8  alt_timeout;
542219820Sjeff	__u8  reserved[2];
543219820Sjeff	__u64 driver_data[0];
544219820Sjeff};
545219820Sjeff
546219820Sjeffstruct ib_uverbs_modify_qp_resp {
547219820Sjeff};
548219820Sjeff
549219820Sjeffstruct ib_uverbs_destroy_qp {
550219820Sjeff	__u64 response;
551219820Sjeff	__u32 qp_handle;
552219820Sjeff	__u32 reserved;
553219820Sjeff};
554219820Sjeff
555219820Sjeffstruct ib_uverbs_destroy_qp_resp {
556219820Sjeff	__u32 events_reported;
557219820Sjeff};
558219820Sjeff
559219820Sjeff/*
560219820Sjeff * The ib_uverbs_sge structure isn't used anywhere, since we assume
561219820Sjeff * the ib_sge structure is packed the same way on 32-bit and 64-bit
562219820Sjeff * architectures in both kernel and user space.  It's just here to
563219820Sjeff * document the ABI.
564219820Sjeff */
565219820Sjeffstruct ib_uverbs_sge {
566219820Sjeff	__u64 addr;
567219820Sjeff	__u32 length;
568219820Sjeff	__u32 lkey;
569219820Sjeff};
570219820Sjeff
571219820Sjeffstruct ib_uverbs_send_wr {
572219820Sjeff	__u64 wr_id;
573219820Sjeff	__u32 num_sge;
574219820Sjeff	__u32 opcode;
575219820Sjeff	__u32 send_flags;
576219820Sjeff	union {
577219820Sjeff		__u32 imm_data;
578219820Sjeff		__u32 invalidate_rkey;
579219820Sjeff	} ex;
580219820Sjeff	union {
581219820Sjeff		struct {
582219820Sjeff			__u64 remote_addr;
583219820Sjeff			__u32 rkey;
584219820Sjeff			__u32 reserved;
585219820Sjeff		} rdma;
586219820Sjeff		struct {
587219820Sjeff			__u64 remote_addr;
588219820Sjeff			__u64 compare_add;
589219820Sjeff			__u64 swap;
590219820Sjeff			__u32 rkey;
591219820Sjeff			__u32 reserved;
592219820Sjeff		} atomic;
593219820Sjeff		struct {
594219820Sjeff			__u32 ah;
595219820Sjeff			__u32 remote_qpn;
596219820Sjeff			__u32 remote_qkey;
597219820Sjeff			__u32 reserved;
598219820Sjeff		} ud;
599219820Sjeff	} wr;
600219820Sjeff};
601219820Sjeff
602255932Salfredstruct ibv_uverbs_flow_spec {
603255932Salfred	__u32  type;
604255932Salfred	__be32 src_ip;
605255932Salfred	__be32 dst_ip;
606255932Salfred	__be16 src_port;
607255932Salfred	__be16 dst_port;
608255932Salfred	__u8   l4_protocol;
609255932Salfred	__u8   block_mc_loopback;
610255932Salfred};
611255932Salfred
612219820Sjeffstruct ib_uverbs_post_send {
613219820Sjeff	__u64 response;
614219820Sjeff	__u32 qp_handle;
615219820Sjeff	__u32 wr_count;
616219820Sjeff	__u32 sge_count;
617219820Sjeff	__u32 wqe_size;
618219820Sjeff	struct ib_uverbs_send_wr send_wr[0];
619219820Sjeff};
620219820Sjeff
621219820Sjeffstruct ib_uverbs_post_send_resp {
622219820Sjeff	__u32 bad_wr;
623219820Sjeff};
624219820Sjeff
625219820Sjeffstruct ib_uverbs_recv_wr {
626219820Sjeff	__u64 wr_id;
627219820Sjeff	__u32 num_sge;
628219820Sjeff	__u32 reserved;
629219820Sjeff};
630219820Sjeff
631219820Sjeffstruct ib_uverbs_post_recv {
632219820Sjeff	__u64 response;
633219820Sjeff	__u32 qp_handle;
634219820Sjeff	__u32 wr_count;
635219820Sjeff	__u32 sge_count;
636219820Sjeff	__u32 wqe_size;
637219820Sjeff	struct ib_uverbs_recv_wr recv_wr[0];
638219820Sjeff};
639219820Sjeff
640219820Sjeffstruct ib_uverbs_post_recv_resp {
641219820Sjeff	__u32 bad_wr;
642219820Sjeff};
643219820Sjeff
644219820Sjeffstruct ib_uverbs_post_srq_recv {
645219820Sjeff	__u64 response;
646219820Sjeff	__u32 srq_handle;
647219820Sjeff	__u32 wr_count;
648219820Sjeff	__u32 sge_count;
649219820Sjeff	__u32 wqe_size;
650219820Sjeff	struct ib_uverbs_recv_wr recv[0];
651219820Sjeff};
652219820Sjeff
653219820Sjeffstruct ib_uverbs_post_srq_recv_resp {
654219820Sjeff	__u32 bad_wr;
655219820Sjeff};
656219820Sjeff
657219820Sjeffstruct ib_uverbs_create_ah {
658219820Sjeff	__u64 response;
659219820Sjeff	__u64 user_handle;
660219820Sjeff	__u32 pd_handle;
661219820Sjeff	__u32 reserved;
662219820Sjeff	struct ib_uverbs_ah_attr attr;
663219820Sjeff};
664219820Sjeff
665219820Sjeffstruct ib_uverbs_create_ah_resp {
666219820Sjeff	__u32 ah_handle;
667219820Sjeff};
668219820Sjeff
669219820Sjeffstruct ib_uverbs_destroy_ah {
670219820Sjeff	__u32 ah_handle;
671219820Sjeff};
672219820Sjeff
673219820Sjeffstruct ib_uverbs_attach_mcast {
674219820Sjeff	__u8  gid[16];
675219820Sjeff	__u32 qp_handle;
676219820Sjeff	__u16 mlid;
677219820Sjeff	__u16 reserved;
678219820Sjeff	__u64 driver_data[0];
679219820Sjeff};
680219820Sjeff
681219820Sjeffstruct ib_uverbs_detach_mcast {
682219820Sjeff	__u8  gid[16];
683219820Sjeff	__u32 qp_handle;
684219820Sjeff	__u16 mlid;
685219820Sjeff	__u16 reserved;
686219820Sjeff	__u64 driver_data[0];
687219820Sjeff};
688219820Sjeff
689255932Salfredstruct ibv_kern_flow_spec {
690255932Salfred	__u32  type;
691255932Salfred	__u32  reserved1;
692255932Salfred	union {
693255932Salfred		struct {
694255932Salfred			__be16 ethertype;
695255932Salfred			__be16 vlan;
696255932Salfred			__u8 vlan_present;
697255932Salfred			__u8  mac[6];
698255932Salfred			__u8  port;
699255932Salfred		} eth;
700255932Salfred		struct {
701255932Salfred			__be32 qpn;
702255932Salfred		} ib_uc;
703255932Salfred		struct {
704255932Salfred			__u8  mgid[16];
705255932Salfred		} ib_mc;
706255932Salfred	} l2_id;
707255932Salfred	__be32 src_ip;
708255932Salfred	__be32 dst_ip;
709255932Salfred	__be16 src_port;
710255932Salfred	__be16 dst_port;
711255932Salfred	__u8   l4_protocol;
712255932Salfred	__u8   block_mc_loopback;
713255932Salfred	__u8   reserved[2];
714255932Salfred};
715255932Salfred
716255932Salfredstruct ib_uverbs_attach_flow {
717255932Salfred	__u32 qp_handle;
718255932Salfred	__u32 priority;
719255932Salfred	struct ibv_kern_flow_spec spec;
720255932Salfred};
721255932Salfred
722255932Salfredstruct ib_uverbs_detach_flow {
723255932Salfred	__u32 qp_handle;
724255932Salfred	__u32 priority;
725255932Salfred	struct ibv_kern_flow_spec spec;
726255932Salfred};
727255932Salfred
728219820Sjeffstruct ib_uverbs_create_srq {
729219820Sjeff	__u64 response;
730219820Sjeff	__u64 user_handle;
731219820Sjeff	__u32 pd_handle;
732219820Sjeff	__u32 max_wr;
733219820Sjeff	__u32 max_sge;
734219820Sjeff	__u32 srq_limit;
735219820Sjeff	__u64 driver_data[0];
736219820Sjeff};
737219820Sjeff
738255932Salfredstruct ib_uverbs_create_xsrq {
739219820Sjeff	__u64 response;
740219820Sjeff	__u64 user_handle;
741255932Salfred	__u32 srq_type;
742219820Sjeff	__u32 pd_handle;
743219820Sjeff	__u32 max_wr;
744219820Sjeff	__u32 max_sge;
745219820Sjeff	__u32 srq_limit;
746255932Salfred	__u32 reserved;
747219820Sjeff	__u32 xrcd_handle;
748255932Salfred	__u32 cq_handle;
749219820Sjeff	__u64 driver_data[0];
750219820Sjeff};
751219820Sjeff
752219820Sjeffstruct ib_uverbs_create_srq_resp {
753219820Sjeff	__u32 srq_handle;
754219820Sjeff	__u32 max_wr;
755219820Sjeff	__u32 max_sge;
756255932Salfred	__u32 srqn;
757219820Sjeff};
758219820Sjeff
759219820Sjeffstruct ib_uverbs_modify_srq {
760219820Sjeff	__u32 srq_handle;
761219820Sjeff	__u32 attr_mask;
762219820Sjeff	__u32 max_wr;
763219820Sjeff	__u32 srq_limit;
764219820Sjeff	__u64 driver_data[0];
765219820Sjeff};
766219820Sjeff
767219820Sjeffstruct ib_uverbs_query_srq {
768219820Sjeff	__u64 response;
769219820Sjeff	__u32 srq_handle;
770219820Sjeff	__u32 reserved;
771219820Sjeff	__u64 driver_data[0];
772219820Sjeff};
773219820Sjeff
774219820Sjeffstruct ib_uverbs_query_srq_resp {
775219820Sjeff	__u32 max_wr;
776219820Sjeff	__u32 max_sge;
777219820Sjeff	__u32 srq_limit;
778219820Sjeff	__u32 reserved;
779219820Sjeff};
780219820Sjeff
781219820Sjeffstruct ib_uverbs_destroy_srq {
782219820Sjeff	__u64 response;
783219820Sjeff	__u32 srq_handle;
784219820Sjeff	__u32 reserved;
785219820Sjeff};
786219820Sjeff
787219820Sjeffstruct ib_uverbs_destroy_srq_resp {
788219820Sjeff	__u32 events_reported;
789219820Sjeff};
790219820Sjeff
791219820Sjeffstruct ib_uverbs_open_xrc_domain {
792219820Sjeff	__u64 response;
793219820Sjeff	__u32 fd;
794219820Sjeff	__u32 oflags;
795219820Sjeff	__u64 driver_data[0];
796219820Sjeff};
797219820Sjeff
798219820Sjeffstruct ib_uverbs_open_xrc_domain_resp {
799219820Sjeff	__u32 xrcd_handle;
800219820Sjeff};
801219820Sjeff
802219820Sjeffstruct ib_uverbs_close_xrc_domain {
803219820Sjeff	__u64 response;
804219820Sjeff	__u32 xrcd_handle;
805219820Sjeff	__u32 reserved;
806219820Sjeff	__u64 driver_data[0];
807219820Sjeff};
808219820Sjeff
809219820Sjeffstruct ib_uverbs_create_xrc_rcv_qp {
810219820Sjeff	__u64 response;
811219820Sjeff	__u64 user_handle;
812219820Sjeff	__u32 xrc_domain_handle;
813219820Sjeff	__u32 max_send_wr;
814219820Sjeff	__u32 max_recv_wr;
815219820Sjeff	__u32 max_send_sge;
816219820Sjeff	__u32 max_recv_sge;
817219820Sjeff	__u32 max_inline_data;
818219820Sjeff	__u8  sq_sig_all;
819219820Sjeff	__u8  qp_type;
820219820Sjeff	__u8  reserved[6];
821219820Sjeff	__u64 driver_data[0];
822219820Sjeff};
823219820Sjeff
824219820Sjeffstruct ib_uverbs_create_xrc_rcv_qp_resp {
825219820Sjeff	__u32 qpn;
826219820Sjeff	__u32 reserved;
827219820Sjeff};
828219820Sjeff
829219820Sjeffstruct ib_uverbs_modify_xrc_rcv_qp {
830219820Sjeff	__u32 xrc_domain_handle;
831219820Sjeff	__u32 qp_num;
832219820Sjeff	struct ib_uverbs_qp_dest dest;
833219820Sjeff	struct ib_uverbs_qp_dest alt_dest;
834219820Sjeff	__u32 attr_mask;
835219820Sjeff	__u32 qkey;
836219820Sjeff	__u32 rq_psn;
837219820Sjeff	__u32 sq_psn;
838219820Sjeff	__u32 dest_qp_num;
839219820Sjeff	__u32 qp_access_flags;
840219820Sjeff	__u16 pkey_index;
841219820Sjeff	__u16 alt_pkey_index;
842219820Sjeff	__u8  qp_state;
843219820Sjeff	__u8  cur_qp_state;
844219820Sjeff	__u8  path_mtu;
845219820Sjeff	__u8  path_mig_state;
846219820Sjeff	__u8  en_sqd_async_notify;
847219820Sjeff	__u8  max_rd_atomic;
848219820Sjeff	__u8  max_dest_rd_atomic;
849219820Sjeff	__u8  min_rnr_timer;
850219820Sjeff	__u8  port_num;
851219820Sjeff	__u8  timeout;
852219820Sjeff	__u8  retry_cnt;
853219820Sjeff	__u8  rnr_retry;
854219820Sjeff	__u8  alt_port_num;
855219820Sjeff	__u8  alt_timeout;
856219820Sjeff	__u8  reserved[6];
857219820Sjeff	__u64 driver_data[0];
858219820Sjeff};
859219820Sjeff
860219820Sjeffstruct ib_uverbs_query_xrc_rcv_qp {
861219820Sjeff	__u64 response;
862219820Sjeff	__u32 xrc_domain_handle;
863219820Sjeff	__u32 qp_num;
864219820Sjeff	__u32 attr_mask;
865219820Sjeff	__u32 reserved;
866219820Sjeff	__u64 driver_data[0];
867219820Sjeff};
868219820Sjeff
869219820Sjeffstruct ib_uverbs_reg_xrc_rcv_qp {
870219820Sjeff	__u32 xrc_domain_handle;
871219820Sjeff	__u32 qp_num;
872219820Sjeff	__u64 driver_data[0];
873219820Sjeff};
874219820Sjeff
875219820Sjeffstruct ib_uverbs_unreg_xrc_rcv_qp {
876219820Sjeff	__u32 xrc_domain_handle;
877219820Sjeff	__u32 qp_num;
878219820Sjeff	__u64 driver_data[0];
879219820Sjeff};
880219820Sjeff
881219820Sjeff
882219820Sjeff#endif /* IB_USER_VERBS_H */
883