1/*
2 * Copyright (c) 2005 Topspin Communications.  All rights reserved.
3 * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
4 * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
5 *
6 * This software is available to you under a choice of one of two
7 * licenses.  You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
11 *
12 *     Redistribution and use in source and binary forms, with or
13 *     without modification, are permitted provided that the following
14 *     conditions are met:
15 *
16 *      - Redistributions of source code must retain the above
17 *        copyright notice, this list of conditions and the following
18 *        disclaimer.
19 *
20 *      - Redistributions in binary form must reproduce the above
21 *        copyright notice, this list of conditions and the following
22 *        disclaimer in the documentation and/or other materials
23 *        provided with the distribution.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
33 */
34
35#ifndef KERN_ABI_H
36#define KERN_ABI_H
37
38#include <infiniband/types.h>
39
40/*
41 * This file must be kept in sync with the kernel's version of
42 * drivers/infiniband/include/ib_user_verbs.h
43 */
44
45/*
46 * The minimum and maximum kernel ABI that we can handle.
47 */
48#define IB_USER_VERBS_MIN_ABI_VERSION	1
49#define IB_USER_VERBS_MAX_ABI_VERSION	6
50
51enum {
52	IB_USER_VERBS_CMD_GET_CONTEXT,
53	IB_USER_VERBS_CMD_QUERY_DEVICE,
54	IB_USER_VERBS_CMD_QUERY_PORT,
55	IB_USER_VERBS_CMD_ALLOC_PD,
56	IB_USER_VERBS_CMD_DEALLOC_PD,
57	IB_USER_VERBS_CMD_CREATE_AH,
58	IB_USER_VERBS_CMD_MODIFY_AH,
59	IB_USER_VERBS_CMD_QUERY_AH,
60	IB_USER_VERBS_CMD_DESTROY_AH,
61	IB_USER_VERBS_CMD_REG_MR,
62	IB_USER_VERBS_CMD_REG_SMR,
63	IB_USER_VERBS_CMD_REREG_MR,
64	IB_USER_VERBS_CMD_QUERY_MR,
65	IB_USER_VERBS_CMD_DEREG_MR,
66	IB_USER_VERBS_CMD_ALLOC_MW,
67	IB_USER_VERBS_CMD_BIND_MW,
68	IB_USER_VERBS_CMD_DEALLOC_MW,
69	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
70	IB_USER_VERBS_CMD_CREATE_CQ,
71	IB_USER_VERBS_CMD_RESIZE_CQ,
72	IB_USER_VERBS_CMD_DESTROY_CQ,
73	IB_USER_VERBS_CMD_POLL_CQ,
74	IB_USER_VERBS_CMD_PEEK_CQ,
75	IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
76	IB_USER_VERBS_CMD_CREATE_QP,
77	IB_USER_VERBS_CMD_QUERY_QP,
78	IB_USER_VERBS_CMD_MODIFY_QP,
79	IB_USER_VERBS_CMD_DESTROY_QP,
80	IB_USER_VERBS_CMD_POST_SEND,
81	IB_USER_VERBS_CMD_POST_RECV,
82	IB_USER_VERBS_CMD_ATTACH_MCAST,
83	IB_USER_VERBS_CMD_DETACH_MCAST,
84	IB_USER_VERBS_CMD_CREATE_SRQ,
85	IB_USER_VERBS_CMD_MODIFY_SRQ,
86	IB_USER_VERBS_CMD_QUERY_SRQ,
87	IB_USER_VERBS_CMD_DESTROY_SRQ,
88	IB_USER_VERBS_CMD_POST_SRQ_RECV,
89	IB_USER_VERBS_CMD_CREATE_XRC_SRQ,
90	IB_USER_VERBS_CMD_OPEN_XRC_DOMAIN,
91	IB_USER_VERBS_CMD_CLOSE_XRC_DOMAIN,
92	IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP,
93	IB_USER_VERBS_CMD_MODIFY_XRC_RCV_QP,
94	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP,
95	IB_USER_VERBS_CMD_REG_XRC_RCV_QP,
96	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP,
97};
98
99/*
100 * Make sure that all structs defined in this file remain laid out so
101 * that they pack the same way on 32-bit and 64-bit architectures (to
102 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
103 * Specifically:
104 *  - Do not use pointer types -- pass pointers in __u64 instead.
105 *  - Make sure that any structure larger than 4 bytes is padded to a
106 *    multiple of 8 bytes.  Otherwise the structure size will be
107 *    different between 32-bit and 64-bit architectures.
108 */
109
110struct ibv_kern_async_event {
111	__u64 element;
112	__u32 event_type;
113	__u32 reserved;
114};
115
116struct ibv_comp_event {
117	__u64 cq_handle;
118};
119
120/*
121 * All commands from userspace should start with a __u32 command field
122 * followed by __u16 in_words and out_words fields (which give the
123 * length of the command block and response buffer if any in 32-bit
124 * words).  The kernel driver will read these fields first and read
125 * the rest of the command struct based on these value.
126 */
127
128struct ibv_query_params {
129	__u32 command;
130	__u16 in_words;
131	__u16 out_words;
132	__u64 response;
133};
134
135struct ibv_query_params_resp {
136	__u32 num_cq_events;
137};
138
139struct ibv_get_context {
140	__u32 command;
141	__u16 in_words;
142	__u16 out_words;
143	__u64 response;
144	__u64 driver_data[0];
145};
146
147struct ibv_get_context_resp {
148	__u32 async_fd;
149	__u32 num_comp_vectors;
150};
151
152struct ibv_query_device {
153	__u32 command;
154	__u16 in_words;
155	__u16 out_words;
156	__u64 response;
157	__u64 driver_data[0];
158};
159
160struct ibv_query_device_resp {
161	__u64 fw_ver;
162	__u64 node_guid;
163	__u64 sys_image_guid;
164	__u64 max_mr_size;
165	__u64 page_size_cap;
166	__u32 vendor_id;
167	__u32 vendor_part_id;
168	__u32 hw_ver;
169	__u32 max_qp;
170	__u32 max_qp_wr;
171	__u32 device_cap_flags;
172	__u32 max_sge;
173	__u32 max_sge_rd;
174	__u32 max_cq;
175	__u32 max_cqe;
176	__u32 max_mr;
177	__u32 max_pd;
178	__u32 max_qp_rd_atom;
179	__u32 max_ee_rd_atom;
180	__u32 max_res_rd_atom;
181	__u32 max_qp_init_rd_atom;
182	__u32 max_ee_init_rd_atom;
183	__u32 atomic_cap;
184	__u32 max_ee;
185	__u32 max_rdd;
186	__u32 max_mw;
187	__u32 max_raw_ipv6_qp;
188	__u32 max_raw_ethy_qp;
189	__u32 max_mcast_grp;
190	__u32 max_mcast_qp_attach;
191	__u32 max_total_mcast_qp_attach;
192	__u32 max_ah;
193	__u32 max_fmr;
194	__u32 max_map_per_fmr;
195	__u32 max_srq;
196	__u32 max_srq_wr;
197	__u32 max_srq_sge;
198	__u16 max_pkeys;
199	__u8  local_ca_ack_delay;
200	__u8  phys_port_cnt;
201	__u8  reserved[4];
202};
203
204struct ibv_query_port {
205	__u32 command;
206	__u16 in_words;
207	__u16 out_words;
208	__u64 response;
209	__u8  port_num;
210	__u8  reserved[7];
211	__u64 driver_data[0];
212};
213
214struct ibv_query_port_resp {
215	__u32 port_cap_flags;
216	__u32 max_msg_sz;
217	__u32 bad_pkey_cntr;
218	__u32 qkey_viol_cntr;
219	__u32 gid_tbl_len;
220	__u16 pkey_tbl_len;
221	__u16 lid;
222	__u16 sm_lid;
223	__u8  state;
224	__u8  max_mtu;
225	__u8  active_mtu;
226	__u8  lmc;
227	__u8  max_vl_num;
228	__u8  sm_sl;
229	__u8  subnet_timeout;
230	__u8  init_type_reply;
231	__u8  active_width;
232	__u8  active_speed;
233	__u8  phys_state;
234	__u8  link_layer;
235	__u8  reserved[2];
236};
237
238struct ibv_alloc_pd {
239	__u32 command;
240	__u16 in_words;
241	__u16 out_words;
242	__u64 response;
243	__u64 driver_data[0];
244};
245
246struct ibv_alloc_pd_resp {
247	__u32 pd_handle;
248};
249
250struct ibv_dealloc_pd {
251	__u32 command;
252	__u16 in_words;
253	__u16 out_words;
254	__u32 pd_handle;
255};
256
257struct ibv_reg_mr {
258	__u32 command;
259	__u16 in_words;
260	__u16 out_words;
261	__u64 response;
262	__u64 start;
263	__u64 length;
264	__u64 hca_va;
265	__u32 pd_handle;
266	__u32 access_flags;
267	__u64 driver_data[0];
268};
269
270struct ibv_reg_mr_resp {
271	__u32 mr_handle;
272	__u32 lkey;
273	__u32 rkey;
274};
275
276struct ibv_dereg_mr {
277	__u32 command;
278	__u16 in_words;
279	__u16 out_words;
280	__u32 mr_handle;
281};
282
283struct ibv_create_comp_channel {
284	__u32 command;
285	__u16 in_words;
286	__u16 out_words;
287	__u64 response;
288};
289
290struct ibv_create_comp_channel_resp {
291	__u32 fd;
292};
293
294struct ibv_create_cq {
295	__u32 command;
296	__u16 in_words;
297	__u16 out_words;
298	__u64 response;
299	__u64 user_handle;
300	__u32 cqe;
301	__u32 comp_vector;
302	__s32 comp_channel;
303	__u32 reserved;
304	__u64 driver_data[0];
305};
306
307struct ibv_create_cq_resp {
308	__u32 cq_handle;
309	__u32 cqe;
310};
311
312struct ibv_kern_wc {
313	__u64  wr_id;
314	__u32  status;
315	__u32  opcode;
316	__u32  vendor_err;
317	__u32  byte_len;
318	__u32  imm_data;
319	__u32  qp_num;
320	__u32  src_qp;
321	__u32  wc_flags;
322	__u16  pkey_index;
323	__u16  slid;
324	__u8   sl;
325	__u8   dlid_path_bits;
326	__u8   port_num;
327	__u8   reserved;
328};
329
330struct ibv_poll_cq {
331	__u32 command;
332	__u16 in_words;
333	__u16 out_words;
334	__u64 response;
335	__u32 cq_handle;
336	__u32 ne;
337};
338
339struct ibv_poll_cq_resp {
340	__u32 count;
341	__u32 reserved;
342	struct ibv_kern_wc wc[0];
343};
344
345struct ibv_req_notify_cq {
346	__u32 command;
347	__u16 in_words;
348	__u16 out_words;
349	__u32 cq_handle;
350	__u32 solicited;
351};
352
353struct ibv_resize_cq {
354	__u32 command;
355	__u16 in_words;
356	__u16 out_words;
357	__u64 response;
358	__u32 cq_handle;
359	__u32 cqe;
360	__u64 driver_data[0];
361};
362
363struct ibv_resize_cq_resp {
364	__u32 cqe;
365	__u32 reserved;
366	__u64 driver_data[0];
367};
368
369struct ibv_destroy_cq {
370	__u32 command;
371	__u16 in_words;
372	__u16 out_words;
373	__u64 response;
374	__u32 cq_handle;
375	__u32 reserved;
376};
377
378struct ibv_destroy_cq_resp {
379	__u32 comp_events_reported;
380	__u32 async_events_reported;
381};
382
383struct ibv_kern_global_route {
384	__u8  dgid[16];
385	__u32 flow_label;
386	__u8  sgid_index;
387	__u8  hop_limit;
388	__u8  traffic_class;
389	__u8  reserved;
390};
391
392struct ibv_kern_ah_attr {
393	struct ibv_kern_global_route grh;
394	__u16 dlid;
395	__u8  sl;
396	__u8  src_path_bits;
397	__u8  static_rate;
398	__u8  is_global;
399	__u8  port_num;
400	__u8  reserved;
401};
402
403struct ibv_kern_qp_attr {
404	__u32	qp_attr_mask;
405	__u32	qp_state;
406	__u32	cur_qp_state;
407	__u32	path_mtu;
408	__u32	path_mig_state;
409	__u32	qkey;
410	__u32	rq_psn;
411	__u32	sq_psn;
412	__u32	dest_qp_num;
413	__u32	qp_access_flags;
414
415	struct ibv_kern_ah_attr ah_attr;
416	struct ibv_kern_ah_attr alt_ah_attr;
417
418	/* ib_qp_cap */
419	__u32	max_send_wr;
420	__u32	max_recv_wr;
421	__u32	max_send_sge;
422	__u32	max_recv_sge;
423	__u32	max_inline_data;
424
425	__u16	pkey_index;
426	__u16	alt_pkey_index;
427	__u8	en_sqd_async_notify;
428	__u8	sq_draining;
429	__u8	max_rd_atomic;
430	__u8	max_dest_rd_atomic;
431	__u8	min_rnr_timer;
432	__u8	port_num;
433	__u8	timeout;
434	__u8	retry_cnt;
435	__u8	rnr_retry;
436	__u8	alt_port_num;
437	__u8	alt_timeout;
438	__u8	reserved[5];
439};
440
441struct ibv_create_qp {
442	__u32 command;
443	__u16 in_words;
444	__u16 out_words;
445	__u64 response;
446	__u64 user_handle;
447	__u32 pd_handle;
448	__u32 send_cq_handle;
449	__u32 recv_cq_handle;
450	__u32 srq_handle;
451	__u32 max_send_wr;
452	__u32 max_recv_wr;
453	__u32 max_send_sge;
454	__u32 max_recv_sge;
455	__u32 max_inline_data;
456	__u8  sq_sig_all;
457	__u8  qp_type;
458	__u8  is_srq;
459	__u8  reserved;
460	__u64 driver_data[0];
461};
462
463struct ibv_create_qp_resp {
464	__u32 qp_handle;
465	__u32 qpn;
466	__u32 max_send_wr;
467	__u32 max_recv_wr;
468	__u32 max_send_sge;
469	__u32 max_recv_sge;
470	__u32 max_inline_data;
471	__u32 reserved;
472};
473
474struct ibv_qp_dest {
475	__u8  dgid[16];
476	__u32 flow_label;
477	__u16 dlid;
478	__u16 reserved;
479	__u8  sgid_index;
480	__u8  hop_limit;
481	__u8  traffic_class;
482	__u8  sl;
483	__u8  src_path_bits;
484	__u8  static_rate;
485	__u8  is_global;
486	__u8  port_num;
487};
488
489struct ibv_query_qp {
490	__u32 command;
491	__u16 in_words;
492	__u16 out_words;
493	__u64 response;
494	__u32 qp_handle;
495	__u32 attr_mask;
496	__u64 driver_data[0];
497};
498
499struct ibv_query_qp_resp {
500	struct ibv_qp_dest dest;
501	struct ibv_qp_dest alt_dest;
502	__u32 max_send_wr;
503	__u32 max_recv_wr;
504	__u32 max_send_sge;
505	__u32 max_recv_sge;
506	__u32 max_inline_data;
507	__u32 qkey;
508	__u32 rq_psn;
509	__u32 sq_psn;
510	__u32 dest_qp_num;
511	__u32 qp_access_flags;
512	__u16 pkey_index;
513	__u16 alt_pkey_index;
514	__u8  qp_state;
515	__u8  cur_qp_state;
516	__u8  path_mtu;
517	__u8  path_mig_state;
518	__u8  sq_draining;
519	__u8  max_rd_atomic;
520	__u8  max_dest_rd_atomic;
521	__u8  min_rnr_timer;
522	__u8  port_num;
523	__u8  timeout;
524	__u8  retry_cnt;
525	__u8  rnr_retry;
526	__u8  alt_port_num;
527	__u8  alt_timeout;
528	__u8  sq_sig_all;
529	__u8  reserved[5];
530	__u64 driver_data[0];
531};
532
533struct ibv_modify_qp {
534	__u32 command;
535	__u16 in_words;
536	__u16 out_words;
537	struct ibv_qp_dest dest;
538	struct ibv_qp_dest alt_dest;
539	__u32 qp_handle;
540	__u32 attr_mask;
541	__u32 qkey;
542	__u32 rq_psn;
543	__u32 sq_psn;
544	__u32 dest_qp_num;
545	__u32 qp_access_flags;
546	__u16 pkey_index;
547	__u16 alt_pkey_index;
548	__u8  qp_state;
549	__u8  cur_qp_state;
550	__u8  path_mtu;
551	__u8  path_mig_state;
552	__u8  en_sqd_async_notify;
553	__u8  max_rd_atomic;
554	__u8  max_dest_rd_atomic;
555	__u8  min_rnr_timer;
556	__u8  port_num;
557	__u8  timeout;
558	__u8  retry_cnt;
559	__u8  rnr_retry;
560	__u8  alt_port_num;
561	__u8  alt_timeout;
562	__u8  reserved[2];
563	__u64 driver_data[0];
564};
565
566struct ibv_destroy_qp {
567	__u32 command;
568	__u16 in_words;
569	__u16 out_words;
570	__u64 response;
571	__u32 qp_handle;
572	__u32 reserved;
573};
574
575struct ibv_destroy_qp_resp {
576	__u32 events_reported;
577};
578
579struct ibv_create_xrc_rcv_qp {
580	__u32 command;
581	__u16 in_words;
582	__u16 out_words;
583	__u64 response;
584	__u64 user_handle;
585	__u32 xrc_domain_handle;
586	__u32 max_send_wr;
587	__u32 max_recv_wr;
588	__u32 max_send_sge;
589	__u32 max_recv_sge;
590	__u32 max_inline_data;
591	__u8  sq_sig_all;
592	__u8  qp_type;
593	__u8  reserved[6];
594	__u64 driver_data[0];
595};
596
597struct ibv_create_xrc_rcv_qp_resp {
598	__u32 qpn;
599	__u32 reserved;
600};
601
602struct ibv_modify_xrc_rcv_qp {
603	__u32 command;
604	__u16 in_words;
605	__u16 out_words;
606	__u32 xrc_domain_handle;
607	__u32 qp_num;
608	struct ibv_qp_dest dest;
609	struct ibv_qp_dest alt_dest;
610	__u32 attr_mask;
611	__u32 qkey;
612	__u32 rq_psn;
613	__u32 sq_psn;
614	__u32 dest_qp_num;
615	__u32 qp_access_flags;
616	__u16 pkey_index;
617	__u16 alt_pkey_index;
618	__u8  qp_state;
619	__u8  cur_qp_state;
620	__u8  path_mtu;
621	__u8  path_mig_state;
622	__u8  en_sqd_async_notify;
623	__u8  max_rd_atomic;
624	__u8  max_dest_rd_atomic;
625	__u8  min_rnr_timer;
626	__u8  port_num;
627	__u8  timeout;
628	__u8  retry_cnt;
629	__u8  rnr_retry;
630	__u8  alt_port_num;
631	__u8  alt_timeout;
632	__u8  reserved[6];
633	__u64 driver_data[0];
634};
635
636struct ibv_query_xrc_rcv_qp {
637	__u32 command;
638	__u16 in_words;
639	__u16 out_words;
640	__u64 response;
641	__u32 xrc_domain_handle;
642	__u32 qp_num;
643	__u32 attr_mask;
644	__u32 reserved;
645	__u64 driver_data[0];
646};
647
648struct ibv_reg_xrc_rcv_qp {
649	__u32 command;
650	__u16 in_words;
651	__u16 out_words;
652	__u32 xrc_domain_handle;
653	__u32 qp_num;
654	__u64 driver_data[0];
655};
656
657struct ibv_unreg_xrc_rcv_qp {
658	__u32 command;
659	__u16 in_words;
660	__u16 out_words;
661	__u32 xrc_domain_handle;
662	__u32 qp_num;
663	__u64 driver_data[0];
664};
665
666struct ibv_kern_send_wr {
667	__u64 wr_id;
668	__u32 num_sge;
669	__u32 opcode;
670	__u32 send_flags;
671	__u32 imm_data;
672	union {
673		struct {
674			__u64 remote_addr;
675			__u32 rkey;
676			__u32 reserved;
677		} rdma;
678		struct {
679			__u64 remote_addr;
680			__u64 compare_add;
681			__u64 swap;
682			__u32 rkey;
683			__u32 reserved;
684		} atomic;
685		struct {
686			__u32 ah;
687			__u32 remote_qpn;
688			__u32 remote_qkey;
689			__u32 reserved;
690		} ud;
691	} wr;
692};
693
694struct ibv_post_send {
695	__u32 command;
696	__u16 in_words;
697	__u16 out_words;
698	__u64 response;
699	__u32 qp_handle;
700	__u32 wr_count;
701	__u32 sge_count;
702	__u32 wqe_size;
703	struct ibv_kern_send_wr send_wr[0];
704};
705
706struct ibv_post_send_resp {
707	__u32 bad_wr;
708};
709
710struct ibv_kern_recv_wr {
711	__u64 wr_id;
712	__u32 num_sge;
713	__u32 reserved;
714};
715
716struct ibv_post_recv {
717	__u32 command;
718	__u16 in_words;
719	__u16 out_words;
720	__u64 response;
721	__u32 qp_handle;
722	__u32 wr_count;
723	__u32 sge_count;
724	__u32 wqe_size;
725	struct ibv_kern_recv_wr recv_wr[0];
726};
727
728struct ibv_post_recv_resp {
729	__u32 bad_wr;
730};
731
732struct ibv_post_srq_recv {
733	__u32 command;
734	__u16 in_words;
735	__u16 out_words;
736	__u64 response;
737	__u32 srq_handle;
738	__u32 wr_count;
739	__u32 sge_count;
740	__u32 wqe_size;
741	struct ibv_kern_recv_wr recv_wr[0];
742};
743
744struct ibv_post_srq_recv_resp {
745	__u32 bad_wr;
746};
747
748struct ibv_create_ah {
749	__u32 command;
750	__u16 in_words;
751	__u16 out_words;
752	__u64 response;
753	__u64 user_handle;
754	__u32 pd_handle;
755	__u32 reserved;
756	struct ibv_kern_ah_attr attr;
757};
758
759struct ibv_create_ah_resp {
760	__u32 handle;
761};
762
763struct ibv_destroy_ah {
764	__u32 command;
765	__u16 in_words;
766	__u16 out_words;
767	__u32 ah_handle;
768};
769
770struct ibv_attach_mcast {
771	__u32 command;
772	__u16 in_words;
773	__u16 out_words;
774	__u8  gid[16];
775	__u32 qp_handle;
776	__u16 mlid;
777	__u16 reserved;
778	__u64 driver_data[0];
779};
780
781struct ibv_detach_mcast {
782	__u32 command;
783	__u16 in_words;
784	__u16 out_words;
785	__u8  gid[16];
786	__u32 qp_handle;
787	__u16 mlid;
788	__u16 reserved;
789	__u64 driver_data[0];
790};
791
792struct ibv_create_srq {
793	__u32 command;
794	__u16 in_words;
795	__u16 out_words;
796	__u64 response;
797	__u64 user_handle;
798	__u32 pd_handle;
799	__u32 max_wr;
800	__u32 max_sge;
801	__u32 srq_limit;
802	__u64 driver_data[0];
803};
804
805struct ibv_create_xrc_srq {
806	__u32 command;
807	__u16 in_words;
808	__u16 out_words;
809	__u64 response;
810	__u64 user_handle;
811	__u32 pd_handle;
812	__u32 max_wr;
813	__u32 max_sge;
814	__u32 srq_limit;
815	__u32 xrcd_handle;
816	__u32 xrc_cq;
817	__u64 driver_data[0];
818};
819
820struct ibv_create_srq_resp {
821	__u32 srq_handle;
822	__u32 max_wr;
823	__u32 max_sge;
824	__u32 reserved;
825};
826
827struct ibv_modify_srq {
828	__u32 command;
829	__u16 in_words;
830	__u16 out_words;
831	__u32 srq_handle;
832	__u32 attr_mask;
833	__u32 max_wr;
834	__u32 srq_limit;
835	__u64 driver_data[0];
836};
837
838struct ibv_query_srq {
839	__u32 command;
840	__u16 in_words;
841	__u16 out_words;
842	__u64 response;
843	__u32 srq_handle;
844	__u32 reserved;
845	__u64 driver_data[0];
846};
847
848struct ibv_query_srq_resp {
849	__u32 max_wr;
850	__u32 max_sge;
851	__u32 srq_limit;
852	__u32 reserved;
853};
854
855struct ibv_destroy_srq {
856	__u32 command;
857	__u16 in_words;
858	__u16 out_words;
859	__u64 response;
860	__u32 srq_handle;
861	__u32 reserved;
862};
863
864struct ibv_destroy_srq_resp {
865	__u32 events_reported;
866};
867
868struct ibv_open_xrc_domain {
869	__u32 command;
870	__u16 in_words;
871	__u16 out_words;
872	__u64 response;
873	__u32 fd;
874	__u32 oflags;
875	__u64 driver_data[0];
876};
877
878struct ibv_open_xrc_domain_resp {
879	__u32 xrcd_handle;
880};
881
882struct ibv_close_xrc_domain {
883	__u32 command;
884	__u16 in_words;
885	__u16 out_words;
886	__u64 response;
887	__u32 xrcd_handle;
888	__u32 reserved;
889	__u64 driver_data[0];
890};
891
892/*
893 * Compatibility with older ABI versions
894 */
895
896enum {
897	IB_USER_VERBS_CMD_QUERY_PARAMS_V2,
898	IB_USER_VERBS_CMD_GET_CONTEXT_V2,
899	IB_USER_VERBS_CMD_QUERY_DEVICE_V2,
900	IB_USER_VERBS_CMD_QUERY_PORT_V2,
901	IB_USER_VERBS_CMD_QUERY_GID_V2,
902	IB_USER_VERBS_CMD_QUERY_PKEY_V2,
903	IB_USER_VERBS_CMD_ALLOC_PD_V2,
904	IB_USER_VERBS_CMD_DEALLOC_PD_V2,
905	IB_USER_VERBS_CMD_CREATE_AH_V2,
906	IB_USER_VERBS_CMD_MODIFY_AH_V2,
907	IB_USER_VERBS_CMD_QUERY_AH_V2,
908	IB_USER_VERBS_CMD_DESTROY_AH_V2,
909	IB_USER_VERBS_CMD_REG_MR_V2,
910	IB_USER_VERBS_CMD_REG_SMR_V2,
911	IB_USER_VERBS_CMD_REREG_MR_V2,
912	IB_USER_VERBS_CMD_QUERY_MR_V2,
913	IB_USER_VERBS_CMD_DEREG_MR_V2,
914	IB_USER_VERBS_CMD_ALLOC_MW_V2,
915	IB_USER_VERBS_CMD_BIND_MW_V2,
916	IB_USER_VERBS_CMD_DEALLOC_MW_V2,
917	IB_USER_VERBS_CMD_CREATE_CQ_V2,
918	IB_USER_VERBS_CMD_RESIZE_CQ_V2,
919	IB_USER_VERBS_CMD_DESTROY_CQ_V2,
920	IB_USER_VERBS_CMD_POLL_CQ_V2,
921	IB_USER_VERBS_CMD_PEEK_CQ_V2,
922	IB_USER_VERBS_CMD_REQ_NOTIFY_CQ_V2,
923	IB_USER_VERBS_CMD_CREATE_QP_V2,
924	IB_USER_VERBS_CMD_QUERY_QP_V2,
925	IB_USER_VERBS_CMD_MODIFY_QP_V2,
926	IB_USER_VERBS_CMD_DESTROY_QP_V2,
927	IB_USER_VERBS_CMD_POST_SEND_V2,
928	IB_USER_VERBS_CMD_POST_RECV_V2,
929	IB_USER_VERBS_CMD_ATTACH_MCAST_V2,
930	IB_USER_VERBS_CMD_DETACH_MCAST_V2,
931	IB_USER_VERBS_CMD_CREATE_SRQ_V2,
932	IB_USER_VERBS_CMD_MODIFY_SRQ_V2,
933	IB_USER_VERBS_CMD_QUERY_SRQ_V2,
934	IB_USER_VERBS_CMD_DESTROY_SRQ_V2,
935	IB_USER_VERBS_CMD_POST_SRQ_RECV_V2,
936	/*
937	 * Set commands that didn't exist to -1 so our compile-time
938	 * trick opcodes in IBV_INIT_CMD() doesn't break.
939	 */
940	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL_V2 = -1,
941	IB_USER_VERBS_CMD_CREATE_XRC_SRQ_V2 = -1,
942	IB_USER_VERBS_CMD_OPEN_XRC_DOMAIN_V2 = -1,
943	IB_USER_VERBS_CMD_CLOSE_XRC_DOMAIN_V2 = -1,
944	IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP_V2 = -1,
945	IB_USER_VERBS_CMD_MODIFY_XRC_RCV_QP_V2 = -1,
946	IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP_V2 = -1,
947	IB_USER_VERBS_CMD_REG_XRC_RCV_QP_V2 = -1,
948	IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP_V2 = -1,
949};
950
951struct ibv_destroy_cq_v1 {
952	__u32 command;
953	__u16 in_words;
954	__u16 out_words;
955	__u32 cq_handle;
956};
957
958struct ibv_destroy_qp_v1 {
959	__u32 command;
960	__u16 in_words;
961	__u16 out_words;
962	__u32 qp_handle;
963};
964
965struct ibv_destroy_srq_v1 {
966	__u32 command;
967	__u16 in_words;
968	__u16 out_words;
969	__u32 srq_handle;
970};
971
972struct ibv_get_context_v2 {
973	__u32 command;
974	__u16 in_words;
975	__u16 out_words;
976	__u64 response;
977	__u64 cq_fd_tab;
978	__u64 driver_data[0];
979};
980
981struct ibv_create_cq_v2 {
982	__u32 command;
983	__u16 in_words;
984	__u16 out_words;
985	__u64 response;
986	__u64 user_handle;
987	__u32 cqe;
988	__u32 event_handler;
989	__u64 driver_data[0];
990};
991
992struct ibv_modify_srq_v3 {
993	__u32 command;
994	__u16 in_words;
995	__u16 out_words;
996	__u32 srq_handle;
997	__u32 attr_mask;
998	__u32 max_wr;
999	__u32 max_sge;
1000	__u32 srq_limit;
1001	__u32 reserved;
1002	__u64 driver_data[0];
1003};
1004
1005struct ibv_create_qp_resp_v3 {
1006	__u32 qp_handle;
1007	__u32 qpn;
1008};
1009
1010struct ibv_create_qp_resp_v4 {
1011	__u32 qp_handle;
1012	__u32 qpn;
1013	__u32 max_send_wr;
1014	__u32 max_recv_wr;
1015	__u32 max_send_sge;
1016	__u32 max_recv_sge;
1017	__u32 max_inline_data;
1018};
1019
1020struct ibv_create_srq_resp_v5 {
1021	__u32 srq_handle;
1022};
1023
1024#endif /* KERN_ABI_H */
1025