Linux Audio

Check our new training course

Loading...
v3.1
  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 * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
  6 *
  7 * This software is available to you under a choice of one of two
  8 * licenses.  You may choose to be licensed under the terms of the GNU
  9 * General Public License (GPL) Version 2, available from the file
 10 * COPYING in the main directory of this source tree, or the
 11 * OpenIB.org BSD license below:
 12 *
 13 *     Redistribution and use in source and binary forms, with or
 14 *     without modification, are permitted provided that the following
 15 *     conditions are met:
 16 *
 17 *      - Redistributions of source code must retain the above
 18 *        copyright notice, this list of conditions and the following
 19 *        disclaimer.
 20 *
 21 *      - Redistributions in binary form must reproduce the above
 22 *        copyright notice, this list of conditions and the following
 23 *        disclaimer in the documentation and/or other materials
 24 *        provided with the distribution.
 25 *
 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 33 * SOFTWARE.
 34 */
 35
 36#ifndef IB_USER_VERBS_H
 37#define IB_USER_VERBS_H
 38
 39#include <linux/types.h>
 40
 41/*
 42 * Increment this value if any changes that break userspace ABI
 43 * compatibility are made.
 44 */
 45#define IB_USER_VERBS_ABI_VERSION	6
 46
 47enum {
 48	IB_USER_VERBS_CMD_GET_CONTEXT,
 49	IB_USER_VERBS_CMD_QUERY_DEVICE,
 50	IB_USER_VERBS_CMD_QUERY_PORT,
 51	IB_USER_VERBS_CMD_ALLOC_PD,
 52	IB_USER_VERBS_CMD_DEALLOC_PD,
 53	IB_USER_VERBS_CMD_CREATE_AH,
 54	IB_USER_VERBS_CMD_MODIFY_AH,
 55	IB_USER_VERBS_CMD_QUERY_AH,
 56	IB_USER_VERBS_CMD_DESTROY_AH,
 57	IB_USER_VERBS_CMD_REG_MR,
 58	IB_USER_VERBS_CMD_REG_SMR,
 59	IB_USER_VERBS_CMD_REREG_MR,
 60	IB_USER_VERBS_CMD_QUERY_MR,
 61	IB_USER_VERBS_CMD_DEREG_MR,
 62	IB_USER_VERBS_CMD_ALLOC_MW,
 63	IB_USER_VERBS_CMD_BIND_MW,
 64	IB_USER_VERBS_CMD_DEALLOC_MW,
 65	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
 66	IB_USER_VERBS_CMD_CREATE_CQ,
 67	IB_USER_VERBS_CMD_RESIZE_CQ,
 68	IB_USER_VERBS_CMD_DESTROY_CQ,
 69	IB_USER_VERBS_CMD_POLL_CQ,
 70	IB_USER_VERBS_CMD_PEEK_CQ,
 71	IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
 72	IB_USER_VERBS_CMD_CREATE_QP,
 73	IB_USER_VERBS_CMD_QUERY_QP,
 74	IB_USER_VERBS_CMD_MODIFY_QP,
 75	IB_USER_VERBS_CMD_DESTROY_QP,
 76	IB_USER_VERBS_CMD_POST_SEND,
 77	IB_USER_VERBS_CMD_POST_RECV,
 78	IB_USER_VERBS_CMD_ATTACH_MCAST,
 79	IB_USER_VERBS_CMD_DETACH_MCAST,
 80	IB_USER_VERBS_CMD_CREATE_SRQ,
 81	IB_USER_VERBS_CMD_MODIFY_SRQ,
 82	IB_USER_VERBS_CMD_QUERY_SRQ,
 83	IB_USER_VERBS_CMD_DESTROY_SRQ,
 84	IB_USER_VERBS_CMD_POST_SRQ_RECV
 
 
 
 
 85};
 86
 87/*
 88 * Make sure that all structs defined in this file remain laid out so
 89 * that they pack the same way on 32-bit and 64-bit architectures (to
 90 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
 91 * Specifically:
 92 *  - Do not use pointer types -- pass pointers in __u64 instead.
 93 *  - Make sure that any structure larger than 4 bytes is padded to a
 94 *    multiple of 8 bytes.  Otherwise the structure size will be
 95 *    different between 32-bit and 64-bit architectures.
 96 */
 97
 98struct ib_uverbs_async_event_desc {
 99	__u64 element;
100	__u32 event_type;	/* enum ib_event_type */
101	__u32 reserved;
102};
103
104struct ib_uverbs_comp_event_desc {
105	__u64 cq_handle;
106};
107
108/*
109 * All commands from userspace should start with a __u32 command field
110 * followed by __u16 in_words and out_words fields (which give the
111 * length of the command block and response buffer if any in 32-bit
112 * words).  The kernel driver will read these fields first and read
113 * the rest of the command struct based on these value.
114 */
115
116struct ib_uverbs_cmd_hdr {
117	__u32 command;
118	__u16 in_words;
119	__u16 out_words;
120};
121
122struct ib_uverbs_get_context {
123	__u64 response;
124	__u64 driver_data[0];
125};
126
127struct ib_uverbs_get_context_resp {
128	__u32 async_fd;
129	__u32 num_comp_vectors;
130};
131
132struct ib_uverbs_query_device {
133	__u64 response;
134	__u64 driver_data[0];
135};
136
137struct ib_uverbs_query_device_resp {
138	__u64 fw_ver;
139	__be64 node_guid;
140	__be64 sys_image_guid;
141	__u64 max_mr_size;
142	__u64 page_size_cap;
143	__u32 vendor_id;
144	__u32 vendor_part_id;
145	__u32 hw_ver;
146	__u32 max_qp;
147	__u32 max_qp_wr;
148	__u32 device_cap_flags;
149	__u32 max_sge;
150	__u32 max_sge_rd;
151	__u32 max_cq;
152	__u32 max_cqe;
153	__u32 max_mr;
154	__u32 max_pd;
155	__u32 max_qp_rd_atom;
156	__u32 max_ee_rd_atom;
157	__u32 max_res_rd_atom;
158	__u32 max_qp_init_rd_atom;
159	__u32 max_ee_init_rd_atom;
160	__u32 atomic_cap;
161	__u32 max_ee;
162	__u32 max_rdd;
163	__u32 max_mw;
164	__u32 max_raw_ipv6_qp;
165	__u32 max_raw_ethy_qp;
166	__u32 max_mcast_grp;
167	__u32 max_mcast_qp_attach;
168	__u32 max_total_mcast_qp_attach;
169	__u32 max_ah;
170	__u32 max_fmr;
171	__u32 max_map_per_fmr;
172	__u32 max_srq;
173	__u32 max_srq_wr;
174	__u32 max_srq_sge;
175	__u16 max_pkeys;
176	__u8  local_ca_ack_delay;
177	__u8  phys_port_cnt;
178	__u8  reserved[4];
179};
180
181struct ib_uverbs_query_port {
182	__u64 response;
183	__u8  port_num;
184	__u8  reserved[7];
185	__u64 driver_data[0];
186};
187
188struct ib_uverbs_query_port_resp {
189	__u32 port_cap_flags;
190	__u32 max_msg_sz;
191	__u32 bad_pkey_cntr;
192	__u32 qkey_viol_cntr;
193	__u32 gid_tbl_len;
194	__u16 pkey_tbl_len;
195	__u16 lid;
196	__u16 sm_lid;
197	__u8  state;
198	__u8  max_mtu;
199	__u8  active_mtu;
200	__u8  lmc;
201	__u8  max_vl_num;
202	__u8  sm_sl;
203	__u8  subnet_timeout;
204	__u8  init_type_reply;
205	__u8  active_width;
206	__u8  active_speed;
207	__u8  phys_state;
208	__u8  link_layer;
209	__u8  reserved[2];
210};
211
212struct ib_uverbs_alloc_pd {
213	__u64 response;
214	__u64 driver_data[0];
215};
216
217struct ib_uverbs_alloc_pd_resp {
218	__u32 pd_handle;
219};
220
221struct ib_uverbs_dealloc_pd {
222	__u32 pd_handle;
223};
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225struct ib_uverbs_reg_mr {
226	__u64 response;
227	__u64 start;
228	__u64 length;
229	__u64 hca_va;
230	__u32 pd_handle;
231	__u32 access_flags;
232	__u64 driver_data[0];
233};
234
235struct ib_uverbs_reg_mr_resp {
236	__u32 mr_handle;
237	__u32 lkey;
238	__u32 rkey;
239};
240
241struct ib_uverbs_dereg_mr {
242	__u32 mr_handle;
243};
244
245struct ib_uverbs_create_comp_channel {
246	__u64 response;
247};
248
249struct ib_uverbs_create_comp_channel_resp {
250	__u32 fd;
251};
252
253struct ib_uverbs_create_cq {
254	__u64 response;
255	__u64 user_handle;
256	__u32 cqe;
257	__u32 comp_vector;
258	__s32 comp_channel;
259	__u32 reserved;
260	__u64 driver_data[0];
261};
262
263struct ib_uverbs_create_cq_resp {
264	__u32 cq_handle;
265	__u32 cqe;
266};
267
268struct ib_uverbs_resize_cq {
269	__u64 response;
270	__u32 cq_handle;
271	__u32 cqe;
272	__u64 driver_data[0];
273};
274
275struct ib_uverbs_resize_cq_resp {
276	__u32 cqe;
277	__u32 reserved;
278	__u64 driver_data[0];
279};
280
281struct ib_uverbs_poll_cq {
282	__u64 response;
283	__u32 cq_handle;
284	__u32 ne;
285};
286
287struct ib_uverbs_wc {
288	__u64 wr_id;
289	__u32 status;
290	__u32 opcode;
291	__u32 vendor_err;
292	__u32 byte_len;
293	union {
294		__u32 imm_data;
295		__u32 invalidate_rkey;
296	} ex;
297	__u32 qp_num;
298	__u32 src_qp;
299	__u32 wc_flags;
300	__u16 pkey_index;
301	__u16 slid;
302	__u8 sl;
303	__u8 dlid_path_bits;
304	__u8 port_num;
305	__u8 reserved;
306};
307
308struct ib_uverbs_poll_cq_resp {
309	__u32 count;
310	__u32 reserved;
311	struct ib_uverbs_wc wc[0];
312};
313
314struct ib_uverbs_req_notify_cq {
315	__u32 cq_handle;
316	__u32 solicited_only;
317};
318
319struct ib_uverbs_destroy_cq {
320	__u64 response;
321	__u32 cq_handle;
322	__u32 reserved;
323};
324
325struct ib_uverbs_destroy_cq_resp {
326	__u32 comp_events_reported;
327	__u32 async_events_reported;
328};
329
330struct ib_uverbs_global_route {
331	__u8  dgid[16];
332	__u32 flow_label;
333	__u8  sgid_index;
334	__u8  hop_limit;
335	__u8  traffic_class;
336	__u8  reserved;
337};
338
339struct ib_uverbs_ah_attr {
340	struct ib_uverbs_global_route grh;
341	__u16 dlid;
342	__u8  sl;
343	__u8  src_path_bits;
344	__u8  static_rate;
345	__u8  is_global;
346	__u8  port_num;
347	__u8  reserved;
348};
349
350struct ib_uverbs_qp_attr {
351	__u32	qp_attr_mask;
352	__u32	qp_state;
353	__u32	cur_qp_state;
354	__u32	path_mtu;
355	__u32	path_mig_state;
356	__u32	qkey;
357	__u32	rq_psn;
358	__u32	sq_psn;
359	__u32	dest_qp_num;
360	__u32	qp_access_flags;
361
362	struct ib_uverbs_ah_attr ah_attr;
363	struct ib_uverbs_ah_attr alt_ah_attr;
364
365	/* ib_qp_cap */
366	__u32	max_send_wr;
367	__u32	max_recv_wr;
368	__u32	max_send_sge;
369	__u32	max_recv_sge;
370	__u32	max_inline_data;
371
372	__u16	pkey_index;
373	__u16	alt_pkey_index;
374	__u8	en_sqd_async_notify;
375	__u8	sq_draining;
376	__u8	max_rd_atomic;
377	__u8	max_dest_rd_atomic;
378	__u8	min_rnr_timer;
379	__u8	port_num;
380	__u8	timeout;
381	__u8	retry_cnt;
382	__u8	rnr_retry;
383	__u8	alt_port_num;
384	__u8	alt_timeout;
385	__u8	reserved[5];
386};
387
388struct ib_uverbs_create_qp {
389	__u64 response;
390	__u64 user_handle;
391	__u32 pd_handle;
392	__u32 send_cq_handle;
393	__u32 recv_cq_handle;
394	__u32 srq_handle;
395	__u32 max_send_wr;
396	__u32 max_recv_wr;
397	__u32 max_send_sge;
398	__u32 max_recv_sge;
399	__u32 max_inline_data;
400	__u8  sq_sig_all;
401	__u8  qp_type;
402	__u8  is_srq;
403	__u8  reserved;
404	__u64 driver_data[0];
405};
406
 
 
 
 
 
 
 
 
 
 
 
407struct ib_uverbs_create_qp_resp {
408	__u32 qp_handle;
409	__u32 qpn;
410	__u32 max_send_wr;
411	__u32 max_recv_wr;
412	__u32 max_send_sge;
413	__u32 max_recv_sge;
414	__u32 max_inline_data;
415	__u32 reserved;
416};
417
418/*
419 * This struct needs to remain a multiple of 8 bytes to keep the
420 * alignment of the modify QP parameters.
421 */
422struct ib_uverbs_qp_dest {
423	__u8  dgid[16];
424	__u32 flow_label;
425	__u16 dlid;
426	__u16 reserved;
427	__u8  sgid_index;
428	__u8  hop_limit;
429	__u8  traffic_class;
430	__u8  sl;
431	__u8  src_path_bits;
432	__u8  static_rate;
433	__u8  is_global;
434	__u8  port_num;
435};
436
437struct ib_uverbs_query_qp {
438	__u64 response;
439	__u32 qp_handle;
440	__u32 attr_mask;
441	__u64 driver_data[0];
442};
443
444struct ib_uverbs_query_qp_resp {
445	struct ib_uverbs_qp_dest dest;
446	struct ib_uverbs_qp_dest alt_dest;
447	__u32 max_send_wr;
448	__u32 max_recv_wr;
449	__u32 max_send_sge;
450	__u32 max_recv_sge;
451	__u32 max_inline_data;
452	__u32 qkey;
453	__u32 rq_psn;
454	__u32 sq_psn;
455	__u32 dest_qp_num;
456	__u32 qp_access_flags;
457	__u16 pkey_index;
458	__u16 alt_pkey_index;
459	__u8  qp_state;
460	__u8  cur_qp_state;
461	__u8  path_mtu;
462	__u8  path_mig_state;
463	__u8  sq_draining;
464	__u8  max_rd_atomic;
465	__u8  max_dest_rd_atomic;
466	__u8  min_rnr_timer;
467	__u8  port_num;
468	__u8  timeout;
469	__u8  retry_cnt;
470	__u8  rnr_retry;
471	__u8  alt_port_num;
472	__u8  alt_timeout;
473	__u8  sq_sig_all;
474	__u8  reserved[5];
475	__u64 driver_data[0];
476};
477
478struct ib_uverbs_modify_qp {
479	struct ib_uverbs_qp_dest dest;
480	struct ib_uverbs_qp_dest alt_dest;
481	__u32 qp_handle;
482	__u32 attr_mask;
483	__u32 qkey;
484	__u32 rq_psn;
485	__u32 sq_psn;
486	__u32 dest_qp_num;
487	__u32 qp_access_flags;
488	__u16 pkey_index;
489	__u16 alt_pkey_index;
490	__u8  qp_state;
491	__u8  cur_qp_state;
492	__u8  path_mtu;
493	__u8  path_mig_state;
494	__u8  en_sqd_async_notify;
495	__u8  max_rd_atomic;
496	__u8  max_dest_rd_atomic;
497	__u8  min_rnr_timer;
498	__u8  port_num;
499	__u8  timeout;
500	__u8  retry_cnt;
501	__u8  rnr_retry;
502	__u8  alt_port_num;
503	__u8  alt_timeout;
504	__u8  reserved[2];
505	__u64 driver_data[0];
506};
507
508struct ib_uverbs_modify_qp_resp {
509};
510
511struct ib_uverbs_destroy_qp {
512	__u64 response;
513	__u32 qp_handle;
514	__u32 reserved;
515};
516
517struct ib_uverbs_destroy_qp_resp {
518	__u32 events_reported;
519};
520
521/*
522 * The ib_uverbs_sge structure isn't used anywhere, since we assume
523 * the ib_sge structure is packed the same way on 32-bit and 64-bit
524 * architectures in both kernel and user space.  It's just here to
525 * document the ABI.
526 */
527struct ib_uverbs_sge {
528	__u64 addr;
529	__u32 length;
530	__u32 lkey;
531};
532
533struct ib_uverbs_send_wr {
534	__u64 wr_id;
535	__u32 num_sge;
536	__u32 opcode;
537	__u32 send_flags;
538	union {
539		__u32 imm_data;
540		__u32 invalidate_rkey;
541	} ex;
542	union {
543		struct {
544			__u64 remote_addr;
545			__u32 rkey;
546			__u32 reserved;
547		} rdma;
548		struct {
549			__u64 remote_addr;
550			__u64 compare_add;
551			__u64 swap;
552			__u32 rkey;
553			__u32 reserved;
554		} atomic;
555		struct {
556			__u32 ah;
557			__u32 remote_qpn;
558			__u32 remote_qkey;
559			__u32 reserved;
560		} ud;
561	} wr;
562};
563
564struct ib_uverbs_post_send {
565	__u64 response;
566	__u32 qp_handle;
567	__u32 wr_count;
568	__u32 sge_count;
569	__u32 wqe_size;
570	struct ib_uverbs_send_wr send_wr[0];
571};
572
573struct ib_uverbs_post_send_resp {
574	__u32 bad_wr;
575};
576
577struct ib_uverbs_recv_wr {
578	__u64 wr_id;
579	__u32 num_sge;
580	__u32 reserved;
581};
582
583struct ib_uverbs_post_recv {
584	__u64 response;
585	__u32 qp_handle;
586	__u32 wr_count;
587	__u32 sge_count;
588	__u32 wqe_size;
589	struct ib_uverbs_recv_wr recv_wr[0];
590};
591
592struct ib_uverbs_post_recv_resp {
593	__u32 bad_wr;
594};
595
596struct ib_uverbs_post_srq_recv {
597	__u64 response;
598	__u32 srq_handle;
599	__u32 wr_count;
600	__u32 sge_count;
601	__u32 wqe_size;
602	struct ib_uverbs_recv_wr recv[0];
603};
604
605struct ib_uverbs_post_srq_recv_resp {
606	__u32 bad_wr;
607};
608
609struct ib_uverbs_create_ah {
610	__u64 response;
611	__u64 user_handle;
612	__u32 pd_handle;
613	__u32 reserved;
614	struct ib_uverbs_ah_attr attr;
615};
616
617struct ib_uverbs_create_ah_resp {
618	__u32 ah_handle;
619};
620
621struct ib_uverbs_destroy_ah {
622	__u32 ah_handle;
623};
624
625struct ib_uverbs_attach_mcast {
626	__u8  gid[16];
627	__u32 qp_handle;
628	__u16 mlid;
629	__u16 reserved;
630	__u64 driver_data[0];
631};
632
633struct ib_uverbs_detach_mcast {
634	__u8  gid[16];
635	__u32 qp_handle;
636	__u16 mlid;
637	__u16 reserved;
638	__u64 driver_data[0];
639};
640
641struct ib_uverbs_create_srq {
642	__u64 response;
643	__u64 user_handle;
644	__u32 pd_handle;
645	__u32 max_wr;
646	__u32 max_sge;
647	__u32 srq_limit;
648	__u64 driver_data[0];
649};
650
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651struct ib_uverbs_create_srq_resp {
652	__u32 srq_handle;
653	__u32 max_wr;
654	__u32 max_sge;
655	__u32 reserved;
656};
657
658struct ib_uverbs_modify_srq {
659	__u32 srq_handle;
660	__u32 attr_mask;
661	__u32 max_wr;
662	__u32 srq_limit;
663	__u64 driver_data[0];
664};
665
666struct ib_uverbs_query_srq {
667	__u64 response;
668	__u32 srq_handle;
669	__u32 reserved;
670	__u64 driver_data[0];
671};
672
673struct ib_uverbs_query_srq_resp {
674	__u32 max_wr;
675	__u32 max_sge;
676	__u32 srq_limit;
677	__u32 reserved;
678};
679
680struct ib_uverbs_destroy_srq {
681	__u64 response;
682	__u32 srq_handle;
683	__u32 reserved;
684};
685
686struct ib_uverbs_destroy_srq_resp {
687	__u32 events_reported;
688};
689
690#endif /* IB_USER_VERBS_H */
v3.5.6
  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 * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
  6 *
  7 * This software is available to you under a choice of one of two
  8 * licenses.  You may choose to be licensed under the terms of the GNU
  9 * General Public License (GPL) Version 2, available from the file
 10 * COPYING in the main directory of this source tree, or the
 11 * OpenIB.org BSD license below:
 12 *
 13 *     Redistribution and use in source and binary forms, with or
 14 *     without modification, are permitted provided that the following
 15 *     conditions are met:
 16 *
 17 *      - Redistributions of source code must retain the above
 18 *        copyright notice, this list of conditions and the following
 19 *        disclaimer.
 20 *
 21 *      - Redistributions in binary form must reproduce the above
 22 *        copyright notice, this list of conditions and the following
 23 *        disclaimer in the documentation and/or other materials
 24 *        provided with the distribution.
 25 *
 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 33 * SOFTWARE.
 34 */
 35
 36#ifndef IB_USER_VERBS_H
 37#define IB_USER_VERBS_H
 38
 39#include <linux/types.h>
 40
 41/*
 42 * Increment this value if any changes that break userspace ABI
 43 * compatibility are made.
 44 */
 45#define IB_USER_VERBS_ABI_VERSION	6
 46
 47enum {
 48	IB_USER_VERBS_CMD_GET_CONTEXT,
 49	IB_USER_VERBS_CMD_QUERY_DEVICE,
 50	IB_USER_VERBS_CMD_QUERY_PORT,
 51	IB_USER_VERBS_CMD_ALLOC_PD,
 52	IB_USER_VERBS_CMD_DEALLOC_PD,
 53	IB_USER_VERBS_CMD_CREATE_AH,
 54	IB_USER_VERBS_CMD_MODIFY_AH,
 55	IB_USER_VERBS_CMD_QUERY_AH,
 56	IB_USER_VERBS_CMD_DESTROY_AH,
 57	IB_USER_VERBS_CMD_REG_MR,
 58	IB_USER_VERBS_CMD_REG_SMR,
 59	IB_USER_VERBS_CMD_REREG_MR,
 60	IB_USER_VERBS_CMD_QUERY_MR,
 61	IB_USER_VERBS_CMD_DEREG_MR,
 62	IB_USER_VERBS_CMD_ALLOC_MW,
 63	IB_USER_VERBS_CMD_BIND_MW,
 64	IB_USER_VERBS_CMD_DEALLOC_MW,
 65	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
 66	IB_USER_VERBS_CMD_CREATE_CQ,
 67	IB_USER_VERBS_CMD_RESIZE_CQ,
 68	IB_USER_VERBS_CMD_DESTROY_CQ,
 69	IB_USER_VERBS_CMD_POLL_CQ,
 70	IB_USER_VERBS_CMD_PEEK_CQ,
 71	IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
 72	IB_USER_VERBS_CMD_CREATE_QP,
 73	IB_USER_VERBS_CMD_QUERY_QP,
 74	IB_USER_VERBS_CMD_MODIFY_QP,
 75	IB_USER_VERBS_CMD_DESTROY_QP,
 76	IB_USER_VERBS_CMD_POST_SEND,
 77	IB_USER_VERBS_CMD_POST_RECV,
 78	IB_USER_VERBS_CMD_ATTACH_MCAST,
 79	IB_USER_VERBS_CMD_DETACH_MCAST,
 80	IB_USER_VERBS_CMD_CREATE_SRQ,
 81	IB_USER_VERBS_CMD_MODIFY_SRQ,
 82	IB_USER_VERBS_CMD_QUERY_SRQ,
 83	IB_USER_VERBS_CMD_DESTROY_SRQ,
 84	IB_USER_VERBS_CMD_POST_SRQ_RECV,
 85	IB_USER_VERBS_CMD_OPEN_XRCD,
 86	IB_USER_VERBS_CMD_CLOSE_XRCD,
 87	IB_USER_VERBS_CMD_CREATE_XSRQ,
 88	IB_USER_VERBS_CMD_OPEN_QP
 89};
 90
 91/*
 92 * Make sure that all structs defined in this file remain laid out so
 93 * that they pack the same way on 32-bit and 64-bit architectures (to
 94 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
 95 * Specifically:
 96 *  - Do not use pointer types -- pass pointers in __u64 instead.
 97 *  - Make sure that any structure larger than 4 bytes is padded to a
 98 *    multiple of 8 bytes.  Otherwise the structure size will be
 99 *    different between 32-bit and 64-bit architectures.
100 */
101
102struct ib_uverbs_async_event_desc {
103	__u64 element;
104	__u32 event_type;	/* enum ib_event_type */
105	__u32 reserved;
106};
107
108struct ib_uverbs_comp_event_desc {
109	__u64 cq_handle;
110};
111
112/*
113 * All commands from userspace should start with a __u32 command field
114 * followed by __u16 in_words and out_words fields (which give the
115 * length of the command block and response buffer if any in 32-bit
116 * words).  The kernel driver will read these fields first and read
117 * the rest of the command struct based on these value.
118 */
119
120struct ib_uverbs_cmd_hdr {
121	__u32 command;
122	__u16 in_words;
123	__u16 out_words;
124};
125
126struct ib_uverbs_get_context {
127	__u64 response;
128	__u64 driver_data[0];
129};
130
131struct ib_uverbs_get_context_resp {
132	__u32 async_fd;
133	__u32 num_comp_vectors;
134};
135
136struct ib_uverbs_query_device {
137	__u64 response;
138	__u64 driver_data[0];
139};
140
141struct ib_uverbs_query_device_resp {
142	__u64 fw_ver;
143	__be64 node_guid;
144	__be64 sys_image_guid;
145	__u64 max_mr_size;
146	__u64 page_size_cap;
147	__u32 vendor_id;
148	__u32 vendor_part_id;
149	__u32 hw_ver;
150	__u32 max_qp;
151	__u32 max_qp_wr;
152	__u32 device_cap_flags;
153	__u32 max_sge;
154	__u32 max_sge_rd;
155	__u32 max_cq;
156	__u32 max_cqe;
157	__u32 max_mr;
158	__u32 max_pd;
159	__u32 max_qp_rd_atom;
160	__u32 max_ee_rd_atom;
161	__u32 max_res_rd_atom;
162	__u32 max_qp_init_rd_atom;
163	__u32 max_ee_init_rd_atom;
164	__u32 atomic_cap;
165	__u32 max_ee;
166	__u32 max_rdd;
167	__u32 max_mw;
168	__u32 max_raw_ipv6_qp;
169	__u32 max_raw_ethy_qp;
170	__u32 max_mcast_grp;
171	__u32 max_mcast_qp_attach;
172	__u32 max_total_mcast_qp_attach;
173	__u32 max_ah;
174	__u32 max_fmr;
175	__u32 max_map_per_fmr;
176	__u32 max_srq;
177	__u32 max_srq_wr;
178	__u32 max_srq_sge;
179	__u16 max_pkeys;
180	__u8  local_ca_ack_delay;
181	__u8  phys_port_cnt;
182	__u8  reserved[4];
183};
184
185struct ib_uverbs_query_port {
186	__u64 response;
187	__u8  port_num;
188	__u8  reserved[7];
189	__u64 driver_data[0];
190};
191
192struct ib_uverbs_query_port_resp {
193	__u32 port_cap_flags;
194	__u32 max_msg_sz;
195	__u32 bad_pkey_cntr;
196	__u32 qkey_viol_cntr;
197	__u32 gid_tbl_len;
198	__u16 pkey_tbl_len;
199	__u16 lid;
200	__u16 sm_lid;
201	__u8  state;
202	__u8  max_mtu;
203	__u8  active_mtu;
204	__u8  lmc;
205	__u8  max_vl_num;
206	__u8  sm_sl;
207	__u8  subnet_timeout;
208	__u8  init_type_reply;
209	__u8  active_width;
210	__u8  active_speed;
211	__u8  phys_state;
212	__u8  link_layer;
213	__u8  reserved[2];
214};
215
216struct ib_uverbs_alloc_pd {
217	__u64 response;
218	__u64 driver_data[0];
219};
220
221struct ib_uverbs_alloc_pd_resp {
222	__u32 pd_handle;
223};
224
225struct ib_uverbs_dealloc_pd {
226	__u32 pd_handle;
227};
228
229struct ib_uverbs_open_xrcd {
230	__u64 response;
231	__u32 fd;
232	__u32 oflags;
233	__u64 driver_data[0];
234};
235
236struct ib_uverbs_open_xrcd_resp {
237	__u32 xrcd_handle;
238};
239
240struct ib_uverbs_close_xrcd {
241	__u32 xrcd_handle;
242};
243
244struct ib_uverbs_reg_mr {
245	__u64 response;
246	__u64 start;
247	__u64 length;
248	__u64 hca_va;
249	__u32 pd_handle;
250	__u32 access_flags;
251	__u64 driver_data[0];
252};
253
254struct ib_uverbs_reg_mr_resp {
255	__u32 mr_handle;
256	__u32 lkey;
257	__u32 rkey;
258};
259
260struct ib_uverbs_dereg_mr {
261	__u32 mr_handle;
262};
263
264struct ib_uverbs_create_comp_channel {
265	__u64 response;
266};
267
268struct ib_uverbs_create_comp_channel_resp {
269	__u32 fd;
270};
271
272struct ib_uverbs_create_cq {
273	__u64 response;
274	__u64 user_handle;
275	__u32 cqe;
276	__u32 comp_vector;
277	__s32 comp_channel;
278	__u32 reserved;
279	__u64 driver_data[0];
280};
281
282struct ib_uverbs_create_cq_resp {
283	__u32 cq_handle;
284	__u32 cqe;
285};
286
287struct ib_uverbs_resize_cq {
288	__u64 response;
289	__u32 cq_handle;
290	__u32 cqe;
291	__u64 driver_data[0];
292};
293
294struct ib_uverbs_resize_cq_resp {
295	__u32 cqe;
296	__u32 reserved;
297	__u64 driver_data[0];
298};
299
300struct ib_uverbs_poll_cq {
301	__u64 response;
302	__u32 cq_handle;
303	__u32 ne;
304};
305
306struct ib_uverbs_wc {
307	__u64 wr_id;
308	__u32 status;
309	__u32 opcode;
310	__u32 vendor_err;
311	__u32 byte_len;
312	union {
313		__u32 imm_data;
314		__u32 invalidate_rkey;
315	} ex;
316	__u32 qp_num;
317	__u32 src_qp;
318	__u32 wc_flags;
319	__u16 pkey_index;
320	__u16 slid;
321	__u8 sl;
322	__u8 dlid_path_bits;
323	__u8 port_num;
324	__u8 reserved;
325};
326
327struct ib_uverbs_poll_cq_resp {
328	__u32 count;
329	__u32 reserved;
330	struct ib_uverbs_wc wc[0];
331};
332
333struct ib_uverbs_req_notify_cq {
334	__u32 cq_handle;
335	__u32 solicited_only;
336};
337
338struct ib_uverbs_destroy_cq {
339	__u64 response;
340	__u32 cq_handle;
341	__u32 reserved;
342};
343
344struct ib_uverbs_destroy_cq_resp {
345	__u32 comp_events_reported;
346	__u32 async_events_reported;
347};
348
349struct ib_uverbs_global_route {
350	__u8  dgid[16];
351	__u32 flow_label;
352	__u8  sgid_index;
353	__u8  hop_limit;
354	__u8  traffic_class;
355	__u8  reserved;
356};
357
358struct ib_uverbs_ah_attr {
359	struct ib_uverbs_global_route grh;
360	__u16 dlid;
361	__u8  sl;
362	__u8  src_path_bits;
363	__u8  static_rate;
364	__u8  is_global;
365	__u8  port_num;
366	__u8  reserved;
367};
368
369struct ib_uverbs_qp_attr {
370	__u32	qp_attr_mask;
371	__u32	qp_state;
372	__u32	cur_qp_state;
373	__u32	path_mtu;
374	__u32	path_mig_state;
375	__u32	qkey;
376	__u32	rq_psn;
377	__u32	sq_psn;
378	__u32	dest_qp_num;
379	__u32	qp_access_flags;
380
381	struct ib_uverbs_ah_attr ah_attr;
382	struct ib_uverbs_ah_attr alt_ah_attr;
383
384	/* ib_qp_cap */
385	__u32	max_send_wr;
386	__u32	max_recv_wr;
387	__u32	max_send_sge;
388	__u32	max_recv_sge;
389	__u32	max_inline_data;
390
391	__u16	pkey_index;
392	__u16	alt_pkey_index;
393	__u8	en_sqd_async_notify;
394	__u8	sq_draining;
395	__u8	max_rd_atomic;
396	__u8	max_dest_rd_atomic;
397	__u8	min_rnr_timer;
398	__u8	port_num;
399	__u8	timeout;
400	__u8	retry_cnt;
401	__u8	rnr_retry;
402	__u8	alt_port_num;
403	__u8	alt_timeout;
404	__u8	reserved[5];
405};
406
407struct ib_uverbs_create_qp {
408	__u64 response;
409	__u64 user_handle;
410	__u32 pd_handle;
411	__u32 send_cq_handle;
412	__u32 recv_cq_handle;
413	__u32 srq_handle;
414	__u32 max_send_wr;
415	__u32 max_recv_wr;
416	__u32 max_send_sge;
417	__u32 max_recv_sge;
418	__u32 max_inline_data;
419	__u8  sq_sig_all;
420	__u8  qp_type;
421	__u8  is_srq;
422	__u8  reserved;
423	__u64 driver_data[0];
424};
425
426struct ib_uverbs_open_qp {
427	__u64 response;
428	__u64 user_handle;
429	__u32 pd_handle;
430	__u32 qpn;
431	__u8  qp_type;
432	__u8  reserved[7];
433	__u64 driver_data[0];
434};
435
436/* also used for open response */
437struct ib_uverbs_create_qp_resp {
438	__u32 qp_handle;
439	__u32 qpn;
440	__u32 max_send_wr;
441	__u32 max_recv_wr;
442	__u32 max_send_sge;
443	__u32 max_recv_sge;
444	__u32 max_inline_data;
445	__u32 reserved;
446};
447
448/*
449 * This struct needs to remain a multiple of 8 bytes to keep the
450 * alignment of the modify QP parameters.
451 */
452struct ib_uverbs_qp_dest {
453	__u8  dgid[16];
454	__u32 flow_label;
455	__u16 dlid;
456	__u16 reserved;
457	__u8  sgid_index;
458	__u8  hop_limit;
459	__u8  traffic_class;
460	__u8  sl;
461	__u8  src_path_bits;
462	__u8  static_rate;
463	__u8  is_global;
464	__u8  port_num;
465};
466
467struct ib_uverbs_query_qp {
468	__u64 response;
469	__u32 qp_handle;
470	__u32 attr_mask;
471	__u64 driver_data[0];
472};
473
474struct ib_uverbs_query_qp_resp {
475	struct ib_uverbs_qp_dest dest;
476	struct ib_uverbs_qp_dest alt_dest;
477	__u32 max_send_wr;
478	__u32 max_recv_wr;
479	__u32 max_send_sge;
480	__u32 max_recv_sge;
481	__u32 max_inline_data;
482	__u32 qkey;
483	__u32 rq_psn;
484	__u32 sq_psn;
485	__u32 dest_qp_num;
486	__u32 qp_access_flags;
487	__u16 pkey_index;
488	__u16 alt_pkey_index;
489	__u8  qp_state;
490	__u8  cur_qp_state;
491	__u8  path_mtu;
492	__u8  path_mig_state;
493	__u8  sq_draining;
494	__u8  max_rd_atomic;
495	__u8  max_dest_rd_atomic;
496	__u8  min_rnr_timer;
497	__u8  port_num;
498	__u8  timeout;
499	__u8  retry_cnt;
500	__u8  rnr_retry;
501	__u8  alt_port_num;
502	__u8  alt_timeout;
503	__u8  sq_sig_all;
504	__u8  reserved[5];
505	__u64 driver_data[0];
506};
507
508struct ib_uverbs_modify_qp {
509	struct ib_uverbs_qp_dest dest;
510	struct ib_uverbs_qp_dest alt_dest;
511	__u32 qp_handle;
512	__u32 attr_mask;
513	__u32 qkey;
514	__u32 rq_psn;
515	__u32 sq_psn;
516	__u32 dest_qp_num;
517	__u32 qp_access_flags;
518	__u16 pkey_index;
519	__u16 alt_pkey_index;
520	__u8  qp_state;
521	__u8  cur_qp_state;
522	__u8  path_mtu;
523	__u8  path_mig_state;
524	__u8  en_sqd_async_notify;
525	__u8  max_rd_atomic;
526	__u8  max_dest_rd_atomic;
527	__u8  min_rnr_timer;
528	__u8  port_num;
529	__u8  timeout;
530	__u8  retry_cnt;
531	__u8  rnr_retry;
532	__u8  alt_port_num;
533	__u8  alt_timeout;
534	__u8  reserved[2];
535	__u64 driver_data[0];
536};
537
538struct ib_uverbs_modify_qp_resp {
539};
540
541struct ib_uverbs_destroy_qp {
542	__u64 response;
543	__u32 qp_handle;
544	__u32 reserved;
545};
546
547struct ib_uverbs_destroy_qp_resp {
548	__u32 events_reported;
549};
550
551/*
552 * The ib_uverbs_sge structure isn't used anywhere, since we assume
553 * the ib_sge structure is packed the same way on 32-bit and 64-bit
554 * architectures in both kernel and user space.  It's just here to
555 * document the ABI.
556 */
557struct ib_uverbs_sge {
558	__u64 addr;
559	__u32 length;
560	__u32 lkey;
561};
562
563struct ib_uverbs_send_wr {
564	__u64 wr_id;
565	__u32 num_sge;
566	__u32 opcode;
567	__u32 send_flags;
568	union {
569		__u32 imm_data;
570		__u32 invalidate_rkey;
571	} ex;
572	union {
573		struct {
574			__u64 remote_addr;
575			__u32 rkey;
576			__u32 reserved;
577		} rdma;
578		struct {
579			__u64 remote_addr;
580			__u64 compare_add;
581			__u64 swap;
582			__u32 rkey;
583			__u32 reserved;
584		} atomic;
585		struct {
586			__u32 ah;
587			__u32 remote_qpn;
588			__u32 remote_qkey;
589			__u32 reserved;
590		} ud;
591	} wr;
592};
593
594struct ib_uverbs_post_send {
595	__u64 response;
596	__u32 qp_handle;
597	__u32 wr_count;
598	__u32 sge_count;
599	__u32 wqe_size;
600	struct ib_uverbs_send_wr send_wr[0];
601};
602
603struct ib_uverbs_post_send_resp {
604	__u32 bad_wr;
605};
606
607struct ib_uverbs_recv_wr {
608	__u64 wr_id;
609	__u32 num_sge;
610	__u32 reserved;
611};
612
613struct ib_uverbs_post_recv {
614	__u64 response;
615	__u32 qp_handle;
616	__u32 wr_count;
617	__u32 sge_count;
618	__u32 wqe_size;
619	struct ib_uverbs_recv_wr recv_wr[0];
620};
621
622struct ib_uverbs_post_recv_resp {
623	__u32 bad_wr;
624};
625
626struct ib_uverbs_post_srq_recv {
627	__u64 response;
628	__u32 srq_handle;
629	__u32 wr_count;
630	__u32 sge_count;
631	__u32 wqe_size;
632	struct ib_uverbs_recv_wr recv[0];
633};
634
635struct ib_uverbs_post_srq_recv_resp {
636	__u32 bad_wr;
637};
638
639struct ib_uverbs_create_ah {
640	__u64 response;
641	__u64 user_handle;
642	__u32 pd_handle;
643	__u32 reserved;
644	struct ib_uverbs_ah_attr attr;
645};
646
647struct ib_uverbs_create_ah_resp {
648	__u32 ah_handle;
649};
650
651struct ib_uverbs_destroy_ah {
652	__u32 ah_handle;
653};
654
655struct ib_uverbs_attach_mcast {
656	__u8  gid[16];
657	__u32 qp_handle;
658	__u16 mlid;
659	__u16 reserved;
660	__u64 driver_data[0];
661};
662
663struct ib_uverbs_detach_mcast {
664	__u8  gid[16];
665	__u32 qp_handle;
666	__u16 mlid;
667	__u16 reserved;
668	__u64 driver_data[0];
669};
670
671struct ib_uverbs_create_srq {
672	__u64 response;
673	__u64 user_handle;
674	__u32 pd_handle;
675	__u32 max_wr;
676	__u32 max_sge;
677	__u32 srq_limit;
678	__u64 driver_data[0];
679};
680
681struct ib_uverbs_create_xsrq {
682	__u64 response;
683	__u64 user_handle;
684	__u32 srq_type;
685	__u32 pd_handle;
686	__u32 max_wr;
687	__u32 max_sge;
688	__u32 srq_limit;
689	__u32 reserved;
690	__u32 xrcd_handle;
691	__u32 cq_handle;
692	__u64 driver_data[0];
693};
694
695struct ib_uverbs_create_srq_resp {
696	__u32 srq_handle;
697	__u32 max_wr;
698	__u32 max_sge;
699	__u32 srqn;
700};
701
702struct ib_uverbs_modify_srq {
703	__u32 srq_handle;
704	__u32 attr_mask;
705	__u32 max_wr;
706	__u32 srq_limit;
707	__u64 driver_data[0];
708};
709
710struct ib_uverbs_query_srq {
711	__u64 response;
712	__u32 srq_handle;
713	__u32 reserved;
714	__u64 driver_data[0];
715};
716
717struct ib_uverbs_query_srq_resp {
718	__u32 max_wr;
719	__u32 max_sge;
720	__u32 srq_limit;
721	__u32 reserved;
722};
723
724struct ib_uverbs_destroy_srq {
725	__u64 response;
726	__u32 srq_handle;
727	__u32 reserved;
728};
729
730struct ib_uverbs_destroy_srq_resp {
731	__u32 events_reported;
732};
733
734#endif /* IB_USER_VERBS_H */