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_EXP_H
37#define IB_USER_VERBS_EXP_H
38
39#include <rdma/ib_user_verbs.h>
40
41enum {
42	IB_USER_VERBS_EXP_CMD_FIRST = 64
43};
44
45enum {
46	IB_USER_VERBS_EXP_CMD_CREATE_QP,
47	IB_USER_VERBS_EXP_CMD_MODIFY_CQ,
48	IB_USER_VERBS_EXP_CMD_MODIFY_QP,
49	IB_USER_VERBS_EXP_CMD_CREATE_CQ,
50	IB_USER_VERBS_EXP_CMD_QUERY_DEVICE,
51	IB_USER_VERBS_EXP_CMD_CREATE_DCT,
52	IB_USER_VERBS_EXP_CMD_DESTROY_DCT,
53	IB_USER_VERBS_EXP_CMD_QUERY_DCT,
54};
55
56/*
57 * Make sure that all structs defined in this file remain laid out so
58 * that they pack the same way on 32-bit and 64-bit architectures (to
59 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
60 * Specifically:
61 *  - Do not use pointer types -- pass pointers in __u64 instead.
62 *  - Make sure that any structure larger than 4 bytes is padded to a
63 *    multiple of 8 bytes.  Otherwise the structure size will be
64 *    different between 32-bit and 64-bit architectures.
65 */
66
67enum ib_uverbs_exp_create_qp_comp_mask {
68	IB_UVERBS_EXP_CREATE_QP_CAP_FLAGS          = (1ULL << 0),
69	IB_UVERBS_EXP_CREATE_QP_INL_RECV           = (1ULL << 1),
70	IB_UVERBS_EXP_CREATE_QP_QPG                = (1ULL << 2)
71};
72
73struct ib_uverbs_qpg_init_attrib {
74	__u32 tss_child_count;
75	__u32 rss_child_count;
76};
77
78struct ib_uverbs_qpg {
79	__u32 qpg_type;
80	union {
81		struct {
82			__u32 parent_handle;
83			__u32 reserved;
84		};
85		struct ib_uverbs_qpg_init_attrib parent_attrib;
86	};
87	__u32 reserved2;
88};
89
90struct ib_uverbs_exp_create_qp {
91	__u64 comp_mask;
92	__u64 user_handle;
93	__u32 pd_handle;
94	__u32 send_cq_handle;
95	__u32 recv_cq_handle;
96	__u32 srq_handle;
97	__u32 max_send_wr;
98	__u32 max_recv_wr;
99	__u32 max_send_sge;
100	__u32 max_recv_sge;
101	__u32 max_inline_data;
102	__u8  sq_sig_all;
103	__u8  qp_type;
104	__u8  is_srq;
105	__u8  reserved;
106	__u64 qp_cap_flags;
107	__u32 max_inl_recv;
108	__u32 reserved1;
109	struct ib_uverbs_qpg qpg;
110	__u64 driver_data[0];
111};
112
113enum ib_uverbs_exp_create_qp_resp_comp_mask {
114	IB_UVERBS_EXP_CREATE_QP_RESP_INL_RECV	= (1ULL << 0),
115};
116
117struct ib_uverbs_exp_create_qp_resp {
118	__u64 comp_mask;
119	__u32 qp_handle;
120	__u32 qpn;
121	__u32 max_send_wr;
122	__u32 max_recv_wr;
123	__u32 max_send_sge;
124	__u32 max_recv_sge;
125	__u32 max_inline_data;
126	__u32 max_inl_recv;
127};
128
129struct ib_uverbs_create_dct {
130	__u64	comp_mask;
131	__u64	user_handle;
132	__u32	pd_handle;
133	__u32	cq_handle;
134	__u32	srq_handle;
135	__u32	access_flags;
136	__u32	flow_label;
137	__u64	dc_key;
138	__u8	min_rnr_timer;
139	__u8	tclass;
140	__u8	port;
141	__u8	pkey_index;
142	__u8	gid_index;
143	__u8	hop_limit;
144	__u8	mtu;
145	__u8	rsvd;
146	__u32	create_flags;
147	__u64	driver_data[0];
148};
149
150struct ib_uverbs_create_dct_resp {
151	__u32 dct_handle;
152	__u32 dctn;
153};
154
155struct ib_uverbs_destroy_dct {
156	__u64 comp_mask;
157	__u64 user_handle;
158};
159
160struct ib_uverbs_destroy_dct_resp {
161	__u64	reserved;
162};
163
164struct ib_uverbs_query_dct {
165	__u64	comp_mask;
166	__u64	dct_handle;
167	__u64	driver_data[0];
168};
169
170struct ib_uverbs_query_dct_resp {
171	__u64	dc_key;
172	__u32	access_flags;
173	__u32	flow_label;
174	__u32	key_violations;
175	__u8	port;
176	__u8	min_rnr_timer;
177	__u8	tclass;
178	__u8	mtu;
179	__u8	pkey_index;
180	__u8	gid_index;
181	__u8	hop_limit;
182	__u8	state;
183	__u32	rsvd;
184	__u64	driver_data[0];
185};
186
187struct ib_uverbs_exp_query_device {
188	__u64 comp_mask;
189	__u64 driver_data[0];
190};
191
192struct ib_uverbs_exp_query_device_resp {
193	__u64					comp_mask;
194	struct ib_uverbs_query_device_resp	base;
195	__u64					timestamp_mask;
196	__u64					hca_core_clock;
197	__u64					device_cap_flags2;
198	__u32					dc_rd_req;
199	__u32					dc_rd_res;
200	__u32					inline_recv_sz;
201	__u32					max_rss_tbl_sz;
202};
203
204#endif /* IB_USER_VERBS_EXP_H */
205