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,
85219820Sjeff	IB_USER_VERBS_CMD_CREATE_XRC_SRQ,
86219820Sjeff	IB_USER_VERBS_CMD_OPEN_XRC_DOMAIN,
87219820Sjeff	IB_USER_VERBS_CMD_CLOSE_XRC_DOMAIN,
88219820Sjeff	IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP,
89219820Sjeff	IB_USER_VERBS_CMD_MODIFY_XRC_RCV_QP,
90219820Sjeff	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP,
91219820Sjeff	IB_USER_VERBS_CMD_REG_XRC_RCV_QP,
92219820Sjeff	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP,
93219820Sjeff};
94219820Sjeff
95219820Sjeff/*
96219820Sjeff * Make sure that all structs defined in this file remain laid out so
97219820Sjeff * that they pack the same way on 32-bit and 64-bit architectures (to
98219820Sjeff * avoid incompatibility between 32-bit userspace and 64-bit kernels).
99219820Sjeff * Specifically:
100219820Sjeff *  - Do not use pointer types -- pass pointers in __u64 instead.
101219820Sjeff *  - Make sure that any structure larger than 4 bytes is padded to a
102219820Sjeff *    multiple of 8 bytes.  Otherwise the structure size will be
103219820Sjeff *    different between 32-bit and 64-bit architectures.
104219820Sjeff */
105219820Sjeff
106219820Sjeffstruct ib_uverbs_async_event_desc {
107219820Sjeff	__u64 element;
108219820Sjeff	__u32 event_type;	/* enum ib_event_type */
109219820Sjeff	__u32 reserved;
110219820Sjeff};
111219820Sjeff
112219820Sjeffstruct ib_uverbs_comp_event_desc {
113219820Sjeff	__u64 cq_handle;
114219820Sjeff};
115219820Sjeff
116219820Sjeff/*
117219820Sjeff * All commands from userspace should start with a __u32 command field
118219820Sjeff * followed by __u16 in_words and out_words fields (which give the
119219820Sjeff * length of the command block and response buffer if any in 32-bit
120219820Sjeff * words).  The kernel driver will read these fields first and read
121219820Sjeff * the rest of the command struct based on these value.
122219820Sjeff */
123219820Sjeff
124219820Sjeffstruct ib_uverbs_cmd_hdr {
125219820Sjeff	__u32 command;
126219820Sjeff	__u16 in_words;
127219820Sjeff	__u16 out_words;
128219820Sjeff};
129219820Sjeff
130219820Sjeffstruct ib_uverbs_get_context {
131219820Sjeff	__u64 response;
132219820Sjeff	__u64 driver_data[0];
133219820Sjeff};
134219820Sjeff
135219820Sjeffstruct ib_uverbs_get_context_resp {
136219820Sjeff	__u32 async_fd;
137219820Sjeff	__u32 num_comp_vectors;
138219820Sjeff};
139219820Sjeff
140219820Sjeffstruct ib_uverbs_query_device {
141219820Sjeff	__u64 response;
142219820Sjeff	__u64 driver_data[0];
143219820Sjeff};
144219820Sjeff
145219820Sjeffstruct ib_uverbs_query_device_resp {
146219820Sjeff	__u64 fw_ver;
147219820Sjeff	__be64 node_guid;
148219820Sjeff	__be64 sys_image_guid;
149219820Sjeff	__u64 max_mr_size;
150219820Sjeff	__u64 page_size_cap;
151219820Sjeff	__u32 vendor_id;
152219820Sjeff	__u32 vendor_part_id;
153219820Sjeff	__u32 hw_ver;
154219820Sjeff	__u32 max_qp;
155219820Sjeff	__u32 max_qp_wr;
156219820Sjeff	__u32 device_cap_flags;
157219820Sjeff	__u32 max_sge;
158219820Sjeff	__u32 max_sge_rd;
159219820Sjeff	__u32 max_cq;
160219820Sjeff	__u32 max_cqe;
161219820Sjeff	__u32 max_mr;
162219820Sjeff	__u32 max_pd;
163219820Sjeff	__u32 max_qp_rd_atom;
164219820Sjeff	__u32 max_ee_rd_atom;
165219820Sjeff	__u32 max_res_rd_atom;
166219820Sjeff	__u32 max_qp_init_rd_atom;
167219820Sjeff	__u32 max_ee_init_rd_atom;
168219820Sjeff	__u32 atomic_cap;
169219820Sjeff	__u32 max_ee;
170219820Sjeff	__u32 max_rdd;
171219820Sjeff	__u32 max_mw;
172219820Sjeff	__u32 max_raw_ipv6_qp;
173219820Sjeff	__u32 max_raw_ethy_qp;
174219820Sjeff	__u32 max_mcast_grp;
175219820Sjeff	__u32 max_mcast_qp_attach;
176219820Sjeff	__u32 max_total_mcast_qp_attach;
177219820Sjeff	__u32 max_ah;
178219820Sjeff	__u32 max_fmr;
179219820Sjeff	__u32 max_map_per_fmr;
180219820Sjeff	__u32 max_srq;
181219820Sjeff	__u32 max_srq_wr;
182219820Sjeff	__u32 max_srq_sge;
183219820Sjeff	__u16 max_pkeys;
184219820Sjeff	__u8  local_ca_ack_delay;
185219820Sjeff	__u8  phys_port_cnt;
186219820Sjeff	__u8  reserved[4];
187219820Sjeff};
188219820Sjeff
189219820Sjeffstruct ib_uverbs_query_port {
190219820Sjeff	__u64 response;
191219820Sjeff	__u8  port_num;
192219820Sjeff	__u8  reserved[7];
193219820Sjeff	__u64 driver_data[0];
194219820Sjeff};
195219820Sjeff
196219820Sjeffstruct ib_uverbs_query_port_resp {
197219820Sjeff	__u32 port_cap_flags;
198219820Sjeff	__u32 max_msg_sz;
199219820Sjeff	__u32 bad_pkey_cntr;
200219820Sjeff	__u32 qkey_viol_cntr;
201219820Sjeff	__u32 gid_tbl_len;
202219820Sjeff	__u16 pkey_tbl_len;
203219820Sjeff	__u16 lid;
204219820Sjeff	__u16 sm_lid;
205219820Sjeff	__u8  state;
206219820Sjeff	__u8  max_mtu;
207219820Sjeff	__u8  active_mtu;
208219820Sjeff	__u8  lmc;
209219820Sjeff	__u8  max_vl_num;
210219820Sjeff	__u8  sm_sl;
211219820Sjeff	__u8  subnet_timeout;
212219820Sjeff	__u8  init_type_reply;
213219820Sjeff	__u8  active_width;
214219820Sjeff	__u8  active_speed;
215219820Sjeff	__u8  phys_state;
216219820Sjeff	__u8  link_layer;
217219820Sjeff	__u8  reserved[2];
218219820Sjeff};
219219820Sjeff
220219820Sjeffstruct ib_uverbs_alloc_pd {
221219820Sjeff	__u64 response;
222219820Sjeff	__u64 driver_data[0];
223219820Sjeff};
224219820Sjeff
225219820Sjeffstruct ib_uverbs_alloc_pd_resp {
226219820Sjeff	__u32 pd_handle;
227219820Sjeff};
228219820Sjeff
229219820Sjeffstruct ib_uverbs_dealloc_pd {
230219820Sjeff	__u32 pd_handle;
231219820Sjeff};
232219820Sjeff
233219820Sjeffstruct ib_uverbs_reg_mr {
234219820Sjeff	__u64 response;
235219820Sjeff	__u64 start;
236219820Sjeff	__u64 length;
237219820Sjeff	__u64 hca_va;
238219820Sjeff	__u32 pd_handle;
239219820Sjeff	__u32 access_flags;
240219820Sjeff	__u64 driver_data[0];
241219820Sjeff};
242219820Sjeff
243219820Sjeffstruct ib_uverbs_reg_mr_resp {
244219820Sjeff	__u32 mr_handle;
245219820Sjeff	__u32 lkey;
246219820Sjeff	__u32 rkey;
247219820Sjeff};
248219820Sjeff
249219820Sjeffstruct ib_uverbs_dereg_mr {
250219820Sjeff	__u32 mr_handle;
251219820Sjeff};
252219820Sjeff
253219820Sjeffstruct ib_uverbs_create_comp_channel {
254219820Sjeff	__u64 response;
255219820Sjeff};
256219820Sjeff
257219820Sjeffstruct ib_uverbs_create_comp_channel_resp {
258219820Sjeff	__u32 fd;
259219820Sjeff};
260219820Sjeff
261219820Sjeffstruct ib_uverbs_create_cq {
262219820Sjeff	__u64 response;
263219820Sjeff	__u64 user_handle;
264219820Sjeff	__u32 cqe;
265219820Sjeff	__u32 comp_vector;
266219820Sjeff	__s32 comp_channel;
267219820Sjeff	__u32 reserved;
268219820Sjeff	__u64 driver_data[0];
269219820Sjeff};
270219820Sjeff
271219820Sjeffstruct ib_uverbs_create_cq_resp {
272219820Sjeff	__u32 cq_handle;
273219820Sjeff	__u32 cqe;
274219820Sjeff};
275219820Sjeff
276219820Sjeffstruct ib_uverbs_resize_cq {
277219820Sjeff	__u64 response;
278219820Sjeff	__u32 cq_handle;
279219820Sjeff	__u32 cqe;
280219820Sjeff	__u64 driver_data[0];
281219820Sjeff};
282219820Sjeff
283219820Sjeffstruct ib_uverbs_resize_cq_resp {
284219820Sjeff	__u32 cqe;
285219820Sjeff	__u32 reserved;
286219820Sjeff	__u64 driver_data[0];
287219820Sjeff};
288219820Sjeff
289219820Sjeffstruct ib_uverbs_poll_cq {
290219820Sjeff	__u64 response;
291219820Sjeff	__u32 cq_handle;
292219820Sjeff	__u32 ne;
293219820Sjeff};
294219820Sjeff
295219820Sjeffstruct ib_uverbs_wc {
296219820Sjeff	__u64 wr_id;
297219820Sjeff	__u32 status;
298219820Sjeff	__u32 opcode;
299219820Sjeff	__u32 vendor_err;
300219820Sjeff	__u32 byte_len;
301219820Sjeff	union {
302219820Sjeff		__u32 imm_data;
303219820Sjeff		__u32 invalidate_rkey;
304219820Sjeff	} ex;
305219820Sjeff	__u32 qp_num;
306219820Sjeff	__u32 src_qp;
307219820Sjeff	__u32 wc_flags;
308219820Sjeff	__u16 pkey_index;
309219820Sjeff	__u16 slid;
310219820Sjeff	__u8 sl;
311219820Sjeff	__u8 dlid_path_bits;
312219820Sjeff	__u8 port_num;
313219820Sjeff	__u8 reserved;
314219820Sjeff};
315219820Sjeff
316219820Sjeffstruct ib_uverbs_poll_cq_resp {
317219820Sjeff	__u32 count;
318219820Sjeff	__u32 reserved;
319219820Sjeff	struct ib_uverbs_wc wc[0];
320219820Sjeff};
321219820Sjeff
322219820Sjeffstruct ib_uverbs_req_notify_cq {
323219820Sjeff	__u32 cq_handle;
324219820Sjeff	__u32 solicited_only;
325219820Sjeff};
326219820Sjeff
327219820Sjeffstruct ib_uverbs_destroy_cq {
328219820Sjeff	__u64 response;
329219820Sjeff	__u32 cq_handle;
330219820Sjeff	__u32 reserved;
331219820Sjeff};
332219820Sjeff
333219820Sjeffstruct ib_uverbs_destroy_cq_resp {
334219820Sjeff	__u32 comp_events_reported;
335219820Sjeff	__u32 async_events_reported;
336219820Sjeff};
337219820Sjeff
338219820Sjeffstruct ib_uverbs_global_route {
339219820Sjeff	__u8  dgid[16];
340219820Sjeff	__u32 flow_label;
341219820Sjeff	__u8  sgid_index;
342219820Sjeff	__u8  hop_limit;
343219820Sjeff	__u8  traffic_class;
344219820Sjeff	__u8  reserved;
345219820Sjeff};
346219820Sjeff
347219820Sjeffstruct ib_uverbs_ah_attr {
348219820Sjeff	struct ib_uverbs_global_route grh;
349219820Sjeff	__u16 dlid;
350219820Sjeff	__u8  sl;
351219820Sjeff	__u8  src_path_bits;
352219820Sjeff	__u8  static_rate;
353219820Sjeff	__u8  is_global;
354219820Sjeff	__u8  port_num;
355219820Sjeff	__u8  reserved;
356219820Sjeff};
357219820Sjeff
358219820Sjeffstruct ib_uverbs_qp_attr {
359219820Sjeff	__u32	qp_attr_mask;
360219820Sjeff	__u32	qp_state;
361219820Sjeff	__u32	cur_qp_state;
362219820Sjeff	__u32	path_mtu;
363219820Sjeff	__u32	path_mig_state;
364219820Sjeff	__u32	qkey;
365219820Sjeff	__u32	rq_psn;
366219820Sjeff	__u32	sq_psn;
367219820Sjeff	__u32	dest_qp_num;
368219820Sjeff	__u32	qp_access_flags;
369219820Sjeff
370219820Sjeff	struct ib_uverbs_ah_attr ah_attr;
371219820Sjeff	struct ib_uverbs_ah_attr alt_ah_attr;
372219820Sjeff
373219820Sjeff	/* ib_qp_cap */
374219820Sjeff	__u32	max_send_wr;
375219820Sjeff	__u32	max_recv_wr;
376219820Sjeff	__u32	max_send_sge;
377219820Sjeff	__u32	max_recv_sge;
378219820Sjeff	__u32	max_inline_data;
379219820Sjeff
380219820Sjeff	__u16	pkey_index;
381219820Sjeff	__u16	alt_pkey_index;
382219820Sjeff	__u8	en_sqd_async_notify;
383219820Sjeff	__u8	sq_draining;
384219820Sjeff	__u8	max_rd_atomic;
385219820Sjeff	__u8	max_dest_rd_atomic;
386219820Sjeff	__u8	min_rnr_timer;
387219820Sjeff	__u8	port_num;
388219820Sjeff	__u8	timeout;
389219820Sjeff	__u8	retry_cnt;
390219820Sjeff	__u8	rnr_retry;
391219820Sjeff	__u8	alt_port_num;
392219820Sjeff	__u8	alt_timeout;
393219820Sjeff	__u8	reserved[5];
394219820Sjeff};
395219820Sjeff
396219820Sjeffstruct ib_uverbs_create_qp {
397219820Sjeff	__u64 response;
398219820Sjeff	__u64 user_handle;
399219820Sjeff	__u32 pd_handle;
400219820Sjeff	__u32 send_cq_handle;
401219820Sjeff	__u32 recv_cq_handle;
402219820Sjeff	__u32 srq_handle;
403219820Sjeff	__u32 max_send_wr;
404219820Sjeff	__u32 max_recv_wr;
405219820Sjeff	__u32 max_send_sge;
406219820Sjeff	__u32 max_recv_sge;
407219820Sjeff	__u32 max_inline_data;
408219820Sjeff	__u8  sq_sig_all;
409219820Sjeff	__u8  qp_type;
410219820Sjeff	__u8  is_srq;
411219820Sjeff	__u8  reserved;
412219820Sjeff	__u64 driver_data[0];
413219820Sjeff};
414219820Sjeff
415219820Sjeffstruct ib_uverbs_create_qp_resp {
416219820Sjeff	__u32 qp_handle;
417219820Sjeff	__u32 qpn;
418219820Sjeff	__u32 max_send_wr;
419219820Sjeff	__u32 max_recv_wr;
420219820Sjeff	__u32 max_send_sge;
421219820Sjeff	__u32 max_recv_sge;
422219820Sjeff	__u32 max_inline_data;
423219820Sjeff	__u32 reserved;
424219820Sjeff};
425219820Sjeff
426219820Sjeff/*
427219820Sjeff * This struct needs to remain a multiple of 8 bytes to keep the
428219820Sjeff * alignment of the modify QP parameters.
429219820Sjeff */
430219820Sjeffstruct ib_uverbs_qp_dest {
431219820Sjeff	__u8  dgid[16];
432219820Sjeff	__u32 flow_label;
433219820Sjeff	__u16 dlid;
434219820Sjeff	__u16 reserved;
435219820Sjeff	__u8  sgid_index;
436219820Sjeff	__u8  hop_limit;
437219820Sjeff	__u8  traffic_class;
438219820Sjeff	__u8  sl;
439219820Sjeff	__u8  src_path_bits;
440219820Sjeff	__u8  static_rate;
441219820Sjeff	__u8  is_global;
442219820Sjeff	__u8  port_num;
443219820Sjeff};
444219820Sjeff
445219820Sjeffstruct ib_uverbs_query_qp {
446219820Sjeff	__u64 response;
447219820Sjeff	__u32 qp_handle;
448219820Sjeff	__u32 attr_mask;
449219820Sjeff	__u64 driver_data[0];
450219820Sjeff};
451219820Sjeff
452219820Sjeffstruct ib_uverbs_query_qp_resp {
453219820Sjeff	struct ib_uverbs_qp_dest dest;
454219820Sjeff	struct ib_uverbs_qp_dest alt_dest;
455219820Sjeff	__u32 max_send_wr;
456219820Sjeff	__u32 max_recv_wr;
457219820Sjeff	__u32 max_send_sge;
458219820Sjeff	__u32 max_recv_sge;
459219820Sjeff	__u32 max_inline_data;
460219820Sjeff	__u32 qkey;
461219820Sjeff	__u32 rq_psn;
462219820Sjeff	__u32 sq_psn;
463219820Sjeff	__u32 dest_qp_num;
464219820Sjeff	__u32 qp_access_flags;
465219820Sjeff	__u16 pkey_index;
466219820Sjeff	__u16 alt_pkey_index;
467219820Sjeff	__u8  qp_state;
468219820Sjeff	__u8  cur_qp_state;
469219820Sjeff	__u8  path_mtu;
470219820Sjeff	__u8  path_mig_state;
471219820Sjeff	__u8  sq_draining;
472219820Sjeff	__u8  max_rd_atomic;
473219820Sjeff	__u8  max_dest_rd_atomic;
474219820Sjeff	__u8  min_rnr_timer;
475219820Sjeff	__u8  port_num;
476219820Sjeff	__u8  timeout;
477219820Sjeff	__u8  retry_cnt;
478219820Sjeff	__u8  rnr_retry;
479219820Sjeff	__u8  alt_port_num;
480219820Sjeff	__u8  alt_timeout;
481219820Sjeff	__u8  sq_sig_all;
482219820Sjeff	__u8  reserved[5];
483219820Sjeff	__u64 driver_data[0];
484219820Sjeff};
485219820Sjeff
486219820Sjeffstruct ib_uverbs_modify_qp {
487219820Sjeff	struct ib_uverbs_qp_dest dest;
488219820Sjeff	struct ib_uverbs_qp_dest alt_dest;
489219820Sjeff	__u32 qp_handle;
490219820Sjeff	__u32 attr_mask;
491219820Sjeff	__u32 qkey;
492219820Sjeff	__u32 rq_psn;
493219820Sjeff	__u32 sq_psn;
494219820Sjeff	__u32 dest_qp_num;
495219820Sjeff	__u32 qp_access_flags;
496219820Sjeff	__u16 pkey_index;
497219820Sjeff	__u16 alt_pkey_index;
498219820Sjeff	__u8  qp_state;
499219820Sjeff	__u8  cur_qp_state;
500219820Sjeff	__u8  path_mtu;
501219820Sjeff	__u8  path_mig_state;
502219820Sjeff	__u8  en_sqd_async_notify;
503219820Sjeff	__u8  max_rd_atomic;
504219820Sjeff	__u8  max_dest_rd_atomic;
505219820Sjeff	__u8  min_rnr_timer;
506219820Sjeff	__u8  port_num;
507219820Sjeff	__u8  timeout;
508219820Sjeff	__u8  retry_cnt;
509219820Sjeff	__u8  rnr_retry;
510219820Sjeff	__u8  alt_port_num;
511219820Sjeff	__u8  alt_timeout;
512219820Sjeff	__u8  reserved[2];
513219820Sjeff	__u64 driver_data[0];
514219820Sjeff};
515219820Sjeff
516219820Sjeffstruct ib_uverbs_modify_qp_resp {
517219820Sjeff};
518219820Sjeff
519219820Sjeffstruct ib_uverbs_destroy_qp {
520219820Sjeff	__u64 response;
521219820Sjeff	__u32 qp_handle;
522219820Sjeff	__u32 reserved;
523219820Sjeff};
524219820Sjeff
525219820Sjeffstruct ib_uverbs_destroy_qp_resp {
526219820Sjeff	__u32 events_reported;
527219820Sjeff};
528219820Sjeff
529219820Sjeff/*
530219820Sjeff * The ib_uverbs_sge structure isn't used anywhere, since we assume
531219820Sjeff * the ib_sge structure is packed the same way on 32-bit and 64-bit
532219820Sjeff * architectures in both kernel and user space.  It's just here to
533219820Sjeff * document the ABI.
534219820Sjeff */
535219820Sjeffstruct ib_uverbs_sge {
536219820Sjeff	__u64 addr;
537219820Sjeff	__u32 length;
538219820Sjeff	__u32 lkey;
539219820Sjeff};
540219820Sjeff
541219820Sjeffstruct ib_uverbs_send_wr {
542219820Sjeff	__u64 wr_id;
543219820Sjeff	__u32 num_sge;
544219820Sjeff	__u32 opcode;
545219820Sjeff	__u32 send_flags;
546219820Sjeff	union {
547219820Sjeff		__u32 imm_data;
548219820Sjeff		__u32 invalidate_rkey;
549219820Sjeff	} ex;
550219820Sjeff	union {
551219820Sjeff		struct {
552219820Sjeff			__u64 remote_addr;
553219820Sjeff			__u32 rkey;
554219820Sjeff			__u32 reserved;
555219820Sjeff		} rdma;
556219820Sjeff		struct {
557219820Sjeff			__u64 remote_addr;
558219820Sjeff			__u64 compare_add;
559219820Sjeff			__u64 swap;
560219820Sjeff			__u32 rkey;
561219820Sjeff			__u32 reserved;
562219820Sjeff		} atomic;
563219820Sjeff		struct {
564219820Sjeff			__u32 ah;
565219820Sjeff			__u32 remote_qpn;
566219820Sjeff			__u32 remote_qkey;
567219820Sjeff			__u32 reserved;
568219820Sjeff		} ud;
569219820Sjeff	} wr;
570219820Sjeff};
571219820Sjeff
572219820Sjeffstruct ib_uverbs_post_send {
573219820Sjeff	__u64 response;
574219820Sjeff	__u32 qp_handle;
575219820Sjeff	__u32 wr_count;
576219820Sjeff	__u32 sge_count;
577219820Sjeff	__u32 wqe_size;
578219820Sjeff	struct ib_uverbs_send_wr send_wr[0];
579219820Sjeff};
580219820Sjeff
581219820Sjeffstruct ib_uverbs_post_send_resp {
582219820Sjeff	__u32 bad_wr;
583219820Sjeff};
584219820Sjeff
585219820Sjeffstruct ib_uverbs_recv_wr {
586219820Sjeff	__u64 wr_id;
587219820Sjeff	__u32 num_sge;
588219820Sjeff	__u32 reserved;
589219820Sjeff};
590219820Sjeff
591219820Sjeffstruct ib_uverbs_post_recv {
592219820Sjeff	__u64 response;
593219820Sjeff	__u32 qp_handle;
594219820Sjeff	__u32 wr_count;
595219820Sjeff	__u32 sge_count;
596219820Sjeff	__u32 wqe_size;
597219820Sjeff	struct ib_uverbs_recv_wr recv_wr[0];
598219820Sjeff};
599219820Sjeff
600219820Sjeffstruct ib_uverbs_post_recv_resp {
601219820Sjeff	__u32 bad_wr;
602219820Sjeff};
603219820Sjeff
604219820Sjeffstruct ib_uverbs_post_srq_recv {
605219820Sjeff	__u64 response;
606219820Sjeff	__u32 srq_handle;
607219820Sjeff	__u32 wr_count;
608219820Sjeff	__u32 sge_count;
609219820Sjeff	__u32 wqe_size;
610219820Sjeff	struct ib_uverbs_recv_wr recv[0];
611219820Sjeff};
612219820Sjeff
613219820Sjeffstruct ib_uverbs_post_srq_recv_resp {
614219820Sjeff	__u32 bad_wr;
615219820Sjeff};
616219820Sjeff
617219820Sjeffstruct ib_uverbs_create_ah {
618219820Sjeff	__u64 response;
619219820Sjeff	__u64 user_handle;
620219820Sjeff	__u32 pd_handle;
621219820Sjeff	__u32 reserved;
622219820Sjeff	struct ib_uverbs_ah_attr attr;
623219820Sjeff};
624219820Sjeff
625219820Sjeffstruct ib_uverbs_create_ah_resp {
626219820Sjeff	__u32 ah_handle;
627219820Sjeff};
628219820Sjeff
629219820Sjeffstruct ib_uverbs_destroy_ah {
630219820Sjeff	__u32 ah_handle;
631219820Sjeff};
632219820Sjeff
633219820Sjeffstruct ib_uverbs_attach_mcast {
634219820Sjeff	__u8  gid[16];
635219820Sjeff	__u32 qp_handle;
636219820Sjeff	__u16 mlid;
637219820Sjeff	__u16 reserved;
638219820Sjeff	__u64 driver_data[0];
639219820Sjeff};
640219820Sjeff
641219820Sjeffstruct ib_uverbs_detach_mcast {
642219820Sjeff	__u8  gid[16];
643219820Sjeff	__u32 qp_handle;
644219820Sjeff	__u16 mlid;
645219820Sjeff	__u16 reserved;
646219820Sjeff	__u64 driver_data[0];
647219820Sjeff};
648219820Sjeff
649219820Sjeffstruct ib_uverbs_create_srq {
650219820Sjeff	__u64 response;
651219820Sjeff	__u64 user_handle;
652219820Sjeff	__u32 pd_handle;
653219820Sjeff	__u32 max_wr;
654219820Sjeff	__u32 max_sge;
655219820Sjeff	__u32 srq_limit;
656219820Sjeff	__u64 driver_data[0];
657219820Sjeff};
658219820Sjeff
659219820Sjeffstruct ib_uverbs_create_xrc_srq {
660219820Sjeff	__u64 response;
661219820Sjeff	__u64 user_handle;
662219820Sjeff	__u32 pd_handle;
663219820Sjeff	__u32 max_wr;
664219820Sjeff	__u32 max_sge;
665219820Sjeff	__u32 srq_limit;
666219820Sjeff	__u32 xrcd_handle;
667219820Sjeff	__u32 xrc_cq;
668219820Sjeff	__u64 driver_data[0];
669219820Sjeff};
670219820Sjeff
671219820Sjeffstruct ib_uverbs_create_srq_resp {
672219820Sjeff	__u32 srq_handle;
673219820Sjeff	__u32 max_wr;
674219820Sjeff	__u32 max_sge;
675219820Sjeff	__u32 reserved;
676219820Sjeff};
677219820Sjeff
678219820Sjeffstruct ib_uverbs_modify_srq {
679219820Sjeff	__u32 srq_handle;
680219820Sjeff	__u32 attr_mask;
681219820Sjeff	__u32 max_wr;
682219820Sjeff	__u32 srq_limit;
683219820Sjeff	__u64 driver_data[0];
684219820Sjeff};
685219820Sjeff
686219820Sjeffstruct ib_uverbs_query_srq {
687219820Sjeff	__u64 response;
688219820Sjeff	__u32 srq_handle;
689219820Sjeff	__u32 reserved;
690219820Sjeff	__u64 driver_data[0];
691219820Sjeff};
692219820Sjeff
693219820Sjeffstruct ib_uverbs_query_srq_resp {
694219820Sjeff	__u32 max_wr;
695219820Sjeff	__u32 max_sge;
696219820Sjeff	__u32 srq_limit;
697219820Sjeff	__u32 reserved;
698219820Sjeff};
699219820Sjeff
700219820Sjeffstruct ib_uverbs_destroy_srq {
701219820Sjeff	__u64 response;
702219820Sjeff	__u32 srq_handle;
703219820Sjeff	__u32 reserved;
704219820Sjeff};
705219820Sjeff
706219820Sjeffstruct ib_uverbs_destroy_srq_resp {
707219820Sjeff	__u32 events_reported;
708219820Sjeff};
709219820Sjeff
710219820Sjeffstruct ib_uverbs_open_xrc_domain {
711219820Sjeff	__u64 response;
712219820Sjeff	__u32 fd;
713219820Sjeff	__u32 oflags;
714219820Sjeff	__u64 driver_data[0];
715219820Sjeff};
716219820Sjeff
717219820Sjeffstruct ib_uverbs_open_xrc_domain_resp {
718219820Sjeff	__u32 xrcd_handle;
719219820Sjeff};
720219820Sjeff
721219820Sjeffstruct ib_uverbs_close_xrc_domain {
722219820Sjeff	__u64 response;
723219820Sjeff	__u32 xrcd_handle;
724219820Sjeff	__u32 reserved;
725219820Sjeff	__u64 driver_data[0];
726219820Sjeff};
727219820Sjeff
728219820Sjeffstruct ib_uverbs_create_xrc_rcv_qp {
729219820Sjeff	__u64 response;
730219820Sjeff	__u64 user_handle;
731219820Sjeff	__u32 xrc_domain_handle;
732219820Sjeff	__u32 max_send_wr;
733219820Sjeff	__u32 max_recv_wr;
734219820Sjeff	__u32 max_send_sge;
735219820Sjeff	__u32 max_recv_sge;
736219820Sjeff	__u32 max_inline_data;
737219820Sjeff	__u8  sq_sig_all;
738219820Sjeff	__u8  qp_type;
739219820Sjeff	__u8  reserved[6];
740219820Sjeff	__u64 driver_data[0];
741219820Sjeff};
742219820Sjeff
743219820Sjeffstruct ib_uverbs_create_xrc_rcv_qp_resp {
744219820Sjeff	__u32 qpn;
745219820Sjeff	__u32 reserved;
746219820Sjeff};
747219820Sjeff
748219820Sjeffstruct ib_uverbs_modify_xrc_rcv_qp {
749219820Sjeff	__u32 xrc_domain_handle;
750219820Sjeff	__u32 qp_num;
751219820Sjeff	struct ib_uverbs_qp_dest dest;
752219820Sjeff	struct ib_uverbs_qp_dest alt_dest;
753219820Sjeff	__u32 attr_mask;
754219820Sjeff	__u32 qkey;
755219820Sjeff	__u32 rq_psn;
756219820Sjeff	__u32 sq_psn;
757219820Sjeff	__u32 dest_qp_num;
758219820Sjeff	__u32 qp_access_flags;
759219820Sjeff	__u16 pkey_index;
760219820Sjeff	__u16 alt_pkey_index;
761219820Sjeff	__u8  qp_state;
762219820Sjeff	__u8  cur_qp_state;
763219820Sjeff	__u8  path_mtu;
764219820Sjeff	__u8  path_mig_state;
765219820Sjeff	__u8  en_sqd_async_notify;
766219820Sjeff	__u8  max_rd_atomic;
767219820Sjeff	__u8  max_dest_rd_atomic;
768219820Sjeff	__u8  min_rnr_timer;
769219820Sjeff	__u8  port_num;
770219820Sjeff	__u8  timeout;
771219820Sjeff	__u8  retry_cnt;
772219820Sjeff	__u8  rnr_retry;
773219820Sjeff	__u8  alt_port_num;
774219820Sjeff	__u8  alt_timeout;
775219820Sjeff	__u8  reserved[6];
776219820Sjeff	__u64 driver_data[0];
777219820Sjeff};
778219820Sjeff
779219820Sjeffstruct ib_uverbs_query_xrc_rcv_qp {
780219820Sjeff	__u64 response;
781219820Sjeff	__u32 xrc_domain_handle;
782219820Sjeff	__u32 qp_num;
783219820Sjeff	__u32 attr_mask;
784219820Sjeff	__u32 reserved;
785219820Sjeff	__u64 driver_data[0];
786219820Sjeff};
787219820Sjeff
788219820Sjeffstruct ib_uverbs_reg_xrc_rcv_qp {
789219820Sjeff	__u32 xrc_domain_handle;
790219820Sjeff	__u32 qp_num;
791219820Sjeff	__u64 driver_data[0];
792219820Sjeff};
793219820Sjeff
794219820Sjeffstruct ib_uverbs_unreg_xrc_rcv_qp {
795219820Sjeff	__u32 xrc_domain_handle;
796219820Sjeff	__u32 qp_num;
797219820Sjeff	__u64 driver_data[0];
798219820Sjeff};
799219820Sjeff
800219820Sjeff
801219820Sjeff#endif /* IB_USER_VERBS_H */
802