1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34#ifndef RDMA_USER_CM_H
35#define RDMA_USER_CM_H
36
37#include <linux/types.h>
38#include <linux/socket.h>
39#include <linux/in6.h>
40#include <rdma/ib_user_verbs.h>
41#include <rdma/ib_user_sa.h>
42
43#define RDMA_USER_CM_ABI_VERSION 4
44
45#define RDMA_MAX_PRIVATE_DATA 256
46
47enum {
48 RDMA_USER_CM_CMD_CREATE_ID,
49 RDMA_USER_CM_CMD_DESTROY_ID,
50 RDMA_USER_CM_CMD_BIND_IP,
51 RDMA_USER_CM_CMD_RESOLVE_IP,
52 RDMA_USER_CM_CMD_RESOLVE_ROUTE,
53 RDMA_USER_CM_CMD_QUERY_ROUTE,
54 RDMA_USER_CM_CMD_CONNECT,
55 RDMA_USER_CM_CMD_LISTEN,
56 RDMA_USER_CM_CMD_ACCEPT,
57 RDMA_USER_CM_CMD_REJECT,
58 RDMA_USER_CM_CMD_DISCONNECT,
59 RDMA_USER_CM_CMD_INIT_QP_ATTR,
60 RDMA_USER_CM_CMD_GET_EVENT,
61 RDMA_USER_CM_CMD_GET_OPTION,
62 RDMA_USER_CM_CMD_SET_OPTION,
63 RDMA_USER_CM_CMD_NOTIFY,
64 RDMA_USER_CM_CMD_JOIN_IP_MCAST,
65 RDMA_USER_CM_CMD_LEAVE_MCAST,
66 RDMA_USER_CM_CMD_MIGRATE_ID,
67 RDMA_USER_CM_CMD_QUERY,
68 RDMA_USER_CM_CMD_BIND,
69 RDMA_USER_CM_CMD_RESOLVE_ADDR,
70 RDMA_USER_CM_CMD_JOIN_MCAST
71};
72
73
74enum rdma_ucm_port_space {
75 RDMA_PS_IPOIB = 0x0002,
76 RDMA_PS_IB = 0x013F,
77 RDMA_PS_TCP = 0x0106,
78 RDMA_PS_UDP = 0x0111,
79};
80
81
82
83
84struct rdma_ucm_cmd_hdr {
85 __u32 cmd;
86 __u16 in;
87 __u16 out;
88};
89
90struct rdma_ucm_create_id {
91 __aligned_u64 uid;
92 __aligned_u64 response;
93 __u16 ps;
94 __u8 qp_type;
95 __u8 reserved[5];
96};
97
98struct rdma_ucm_create_id_resp {
99 __u32 id;
100};
101
102struct rdma_ucm_destroy_id {
103 __aligned_u64 response;
104 __u32 id;
105 __u32 reserved;
106};
107
108struct rdma_ucm_destroy_id_resp {
109 __u32 events_reported;
110};
111
112struct rdma_ucm_bind_ip {
113 __aligned_u64 response;
114 struct sockaddr_in6 addr;
115 __u32 id;
116};
117
118struct rdma_ucm_bind {
119 __u32 id;
120 __u16 addr_size;
121 __u16 reserved;
122 struct __kernel_sockaddr_storage addr;
123};
124
125struct rdma_ucm_resolve_ip {
126 struct sockaddr_in6 src_addr;
127 struct sockaddr_in6 dst_addr;
128 __u32 id;
129 __u32 timeout_ms;
130};
131
132struct rdma_ucm_resolve_addr {
133 __u32 id;
134 __u32 timeout_ms;
135 __u16 src_size;
136 __u16 dst_size;
137 __u32 reserved;
138 struct __kernel_sockaddr_storage src_addr;
139 struct __kernel_sockaddr_storage dst_addr;
140};
141
142struct rdma_ucm_resolve_route {
143 __u32 id;
144 __u32 timeout_ms;
145};
146
147enum {
148 RDMA_USER_CM_QUERY_ADDR,
149 RDMA_USER_CM_QUERY_PATH,
150 RDMA_USER_CM_QUERY_GID
151};
152
153struct rdma_ucm_query {
154 __aligned_u64 response;
155 __u32 id;
156 __u32 option;
157};
158
159struct rdma_ucm_query_route_resp {
160 __aligned_u64 node_guid;
161 struct ib_user_path_rec ib_route[2];
162 struct sockaddr_in6 src_addr;
163 struct sockaddr_in6 dst_addr;
164 __u32 num_paths;
165 __u8 port_num;
166 __u8 reserved[3];
167};
168
169struct rdma_ucm_query_addr_resp {
170 __aligned_u64 node_guid;
171 __u8 port_num;
172 __u8 reserved;
173 __u16 pkey;
174 __u16 src_size;
175 __u16 dst_size;
176 struct __kernel_sockaddr_storage src_addr;
177 struct __kernel_sockaddr_storage dst_addr;
178};
179
180struct rdma_ucm_query_path_resp {
181 __u32 num_paths;
182 __u32 reserved;
183 struct ib_path_rec_data path_data[0];
184};
185
186struct rdma_ucm_conn_param {
187 __u32 qp_num;
188 __u32 qkey;
189 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
190 __u8 private_data_len;
191 __u8 srq;
192 __u8 responder_resources;
193 __u8 initiator_depth;
194 __u8 flow_control;
195 __u8 retry_count;
196 __u8 rnr_retry_count;
197 __u8 valid;
198};
199
200struct rdma_ucm_ud_param {
201 __u32 qp_num;
202 __u32 qkey;
203 struct ib_uverbs_ah_attr ah_attr;
204 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
205 __u8 private_data_len;
206 __u8 reserved[7];
207};
208
209struct rdma_ucm_connect {
210 struct rdma_ucm_conn_param conn_param;
211 __u32 id;
212 __u32 reserved;
213};
214
215struct rdma_ucm_listen {
216 __u32 id;
217 __u32 backlog;
218};
219
220struct rdma_ucm_accept {
221 __aligned_u64 uid;
222 struct rdma_ucm_conn_param conn_param;
223 __u32 id;
224 __u32 reserved;
225};
226
227struct rdma_ucm_reject {
228 __u32 id;
229 __u8 private_data_len;
230 __u8 reserved[3];
231 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
232};
233
234struct rdma_ucm_disconnect {
235 __u32 id;
236};
237
238struct rdma_ucm_init_qp_attr {
239 __aligned_u64 response;
240 __u32 id;
241 __u32 qp_state;
242};
243
244struct rdma_ucm_notify {
245 __u32 id;
246 __u32 event;
247};
248
249struct rdma_ucm_join_ip_mcast {
250 __aligned_u64 response;
251 __aligned_u64 uid;
252 struct sockaddr_in6 addr;
253 __u32 id;
254};
255
256
257enum {
258 RDMA_MC_JOIN_FLAG_FULLMEMBER,
259 RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER,
260 RDMA_MC_JOIN_FLAG_RESERVED,
261};
262
263struct rdma_ucm_join_mcast {
264 __aligned_u64 response;
265 __aligned_u64 uid;
266 __u32 id;
267 __u16 addr_size;
268 __u16 join_flags;
269 struct __kernel_sockaddr_storage addr;
270};
271
272struct rdma_ucm_get_event {
273 __aligned_u64 response;
274};
275
276struct rdma_ucm_event_resp {
277 __aligned_u64 uid;
278 __u32 id;
279 __u32 event;
280 __u32 status;
281
282
283
284
285 union {
286 struct rdma_ucm_conn_param conn;
287 struct rdma_ucm_ud_param ud;
288 } param;
289 __u32 reserved;
290};
291
292
293enum {
294 RDMA_OPTION_ID = 0,
295 RDMA_OPTION_IB = 1
296};
297
298
299enum {
300 RDMA_OPTION_ID_TOS = 0,
301 RDMA_OPTION_ID_REUSEADDR = 1,
302 RDMA_OPTION_ID_AFONLY = 2,
303 RDMA_OPTION_ID_ACK_TIMEOUT = 3
304};
305
306enum {
307 RDMA_OPTION_IB_PATH = 1
308};
309
310struct rdma_ucm_set_option {
311 __aligned_u64 optval;
312 __u32 id;
313 __u32 level;
314 __u32 optname;
315 __u32 optlen;
316};
317
318struct rdma_ucm_migrate_id {
319 __aligned_u64 response;
320 __u32 id;
321 __u32 fd;
322};
323
324struct rdma_ucm_migrate_resp {
325 __u32 events_reported;
326};
327
328#endif
329