blob: 07eb6cfa926c266feca3e82e672e781996bbe175 [file] [log] [blame]
Sean Hefty75216632006-11-30 16:53:41 -08001/*
2 * Copyright (c) 2005-2006 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef RDMA_USER_CM_H
34#define RDMA_USER_CM_H
35
36#include <linux/types.h>
37#include <linux/in6.h>
38#include <rdma/ib_user_verbs.h>
39#include <rdma/ib_user_sa.h>
40
Sean Heftyc8f6a362007-02-15 17:00:18 -080041#define RDMA_USER_CM_ABI_VERSION 4
Sean Hefty75216632006-11-30 16:53:41 -080042
43#define RDMA_MAX_PRIVATE_DATA 256
44
45enum {
46 RDMA_USER_CM_CMD_CREATE_ID,
47 RDMA_USER_CM_CMD_DESTROY_ID,
48 RDMA_USER_CM_CMD_BIND_ADDR,
49 RDMA_USER_CM_CMD_RESOLVE_ADDR,
50 RDMA_USER_CM_CMD_RESOLVE_ROUTE,
51 RDMA_USER_CM_CMD_QUERY_ROUTE,
52 RDMA_USER_CM_CMD_CONNECT,
53 RDMA_USER_CM_CMD_LISTEN,
54 RDMA_USER_CM_CMD_ACCEPT,
55 RDMA_USER_CM_CMD_REJECT,
56 RDMA_USER_CM_CMD_DISCONNECT,
57 RDMA_USER_CM_CMD_INIT_QP_ATTR,
58 RDMA_USER_CM_CMD_GET_EVENT,
59 RDMA_USER_CM_CMD_GET_OPTION,
60 RDMA_USER_CM_CMD_SET_OPTION,
Sean Heftyc8f6a362007-02-15 17:00:18 -080061 RDMA_USER_CM_CMD_NOTIFY,
62 RDMA_USER_CM_CMD_JOIN_MCAST,
Sean Hefty88314e42007-11-14 00:29:50 -080063 RDMA_USER_CM_CMD_LEAVE_MCAST,
Sean Heftyee7aed42013-05-29 10:09:25 -070064 RDMA_USER_CM_CMD_MIGRATE_ID,
65 RDMA_USER_CM_CMD_QUERY
Sean Hefty75216632006-11-30 16:53:41 -080066};
67
68/*
69 * command ABI structures.
70 */
71struct rdma_ucm_cmd_hdr {
72 __u32 cmd;
73 __u16 in;
74 __u16 out;
75};
76
77struct rdma_ucm_create_id {
78 __u64 uid;
79 __u64 response;
80 __u16 ps;
Sean Hefty638ef7a2011-06-14 16:31:53 -070081 __u8 qp_type;
82 __u8 reserved[5];
Sean Hefty75216632006-11-30 16:53:41 -080083};
84
85struct rdma_ucm_create_id_resp {
86 __u32 id;
87};
88
89struct rdma_ucm_destroy_id {
90 __u64 response;
91 __u32 id;
92 __u32 reserved;
93};
94
95struct rdma_ucm_destroy_id_resp {
96 __u32 events_reported;
97};
98
99struct rdma_ucm_bind_addr {
100 __u64 response;
101 struct sockaddr_in6 addr;
102 __u32 id;
103};
104
105struct rdma_ucm_resolve_addr {
106 struct sockaddr_in6 src_addr;
107 struct sockaddr_in6 dst_addr;
108 __u32 id;
109 __u32 timeout_ms;
110};
111
112struct rdma_ucm_resolve_route {
113 __u32 id;
114 __u32 timeout_ms;
115};
116
Sean Heftyee7aed42013-05-29 10:09:25 -0700117enum {
Sean Heftyac53b262013-05-29 10:09:27 -0700118 RDMA_USER_CM_QUERY_ADDR,
119 RDMA_USER_CM_QUERY_PATH
Sean Heftyee7aed42013-05-29 10:09:25 -0700120};
121
122struct rdma_ucm_query {
Sean Hefty75216632006-11-30 16:53:41 -0800123 __u64 response;
124 __u32 id;
Sean Heftyee7aed42013-05-29 10:09:25 -0700125 __u32 option;
Sean Hefty75216632006-11-30 16:53:41 -0800126};
127
128struct rdma_ucm_query_route_resp {
129 __u64 node_guid;
130 struct ib_user_path_rec ib_route[2];
131 struct sockaddr_in6 src_addr;
132 struct sockaddr_in6 dst_addr;
133 __u32 num_paths;
134 __u8 port_num;
135 __u8 reserved[3];
136};
137
Sean Heftyee7aed42013-05-29 10:09:25 -0700138struct rdma_ucm_query_addr_resp {
139 __u64 node_guid;
140 __u8 port_num;
141 __u8 reserved;
142 __u16 pkey;
143 __u16 src_size;
144 __u16 dst_size;
145 struct sockaddr_storage src_addr;
146 struct sockaddr_storage dst_addr;
147};
148
Sean Heftyac53b262013-05-29 10:09:27 -0700149struct rdma_ucm_query_path_resp {
150 __u32 num_paths;
151 __u32 reserved;
152 struct ib_path_rec_data path_data[0];
153};
154
Sean Hefty75216632006-11-30 16:53:41 -0800155struct rdma_ucm_conn_param {
156 __u32 qp_num;
Sean Hefty5c438132013-05-29 10:09:23 -0700157 __u32 qkey;
Sean Hefty75216632006-11-30 16:53:41 -0800158 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
159 __u8 private_data_len;
160 __u8 srq;
161 __u8 responder_resources;
162 __u8 initiator_depth;
163 __u8 flow_control;
164 __u8 retry_count;
165 __u8 rnr_retry_count;
166 __u8 valid;
167};
168
169struct rdma_ucm_ud_param {
170 __u32 qp_num;
171 __u32 qkey;
172 struct ib_uverbs_ah_attr ah_attr;
173 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
174 __u8 private_data_len;
175 __u8 reserved[7];
176};
177
178struct rdma_ucm_connect {
179 struct rdma_ucm_conn_param conn_param;
180 __u32 id;
181 __u32 reserved;
182};
183
184struct rdma_ucm_listen {
185 __u32 id;
186 __u32 backlog;
187};
188
189struct rdma_ucm_accept {
190 __u64 uid;
191 struct rdma_ucm_conn_param conn_param;
192 __u32 id;
193 __u32 reserved;
194};
195
196struct rdma_ucm_reject {
197 __u32 id;
198 __u8 private_data_len;
199 __u8 reserved[3];
200 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
201};
202
203struct rdma_ucm_disconnect {
204 __u32 id;
205};
206
207struct rdma_ucm_init_qp_attr {
208 __u64 response;
209 __u32 id;
210 __u32 qp_state;
211};
212
213struct rdma_ucm_notify {
214 __u32 id;
215 __u32 event;
216};
217
Sean Heftyc8f6a362007-02-15 17:00:18 -0800218struct rdma_ucm_join_mcast {
219 __u64 response; /* rdma_ucm_create_id_resp */
220 __u64 uid;
221 struct sockaddr_in6 addr;
222 __u32 id;
223};
224
Sean Hefty75216632006-11-30 16:53:41 -0800225struct rdma_ucm_get_event {
226 __u64 response;
227};
228
229struct rdma_ucm_event_resp {
230 __u64 uid;
231 __u32 id;
232 __u32 event;
233 __u32 status;
234 union {
235 struct rdma_ucm_conn_param conn;
236 struct rdma_ucm_ud_param ud;
237 } param;
238};
239
Sean Hefty7ce86402007-08-08 15:51:13 -0700240/* Option levels */
241enum {
Sean Heftya7ca1f02009-11-16 09:30:33 -0800242 RDMA_OPTION_ID = 0,
243 RDMA_OPTION_IB = 1
Sean Hefty7ce86402007-08-08 15:51:13 -0700244};
245
246/* Option details */
247enum {
Hefty, Seana9bb7912011-05-09 22:06:10 -0700248 RDMA_OPTION_ID_TOS = 0,
249 RDMA_OPTION_ID_REUSEADDR = 1,
Sean Hefty68602122012-06-14 20:31:39 +0000250 RDMA_OPTION_ID_AFONLY = 2,
Hefty, Seana9bb7912011-05-09 22:06:10 -0700251 RDMA_OPTION_IB_PATH = 1
Sean Hefty7ce86402007-08-08 15:51:13 -0700252};
253
254struct rdma_ucm_set_option {
255 __u64 optval;
256 __u32 id;
257 __u32 level;
258 __u32 optname;
259 __u32 optlen;
260};
261
Sean Hefty88314e42007-11-14 00:29:50 -0800262struct rdma_ucm_migrate_id {
263 __u64 response;
264 __u32 id;
265 __u32 fd;
266};
267
268struct rdma_ucm_migrate_resp {
269 __u32 events_reported;
270};
271
Sean Hefty75216632006-11-30 16:53:41 -0800272#endif /* RDMA_USER_CM_H */