blob: 9749c1b34d008e34e353c956bc9ac1f401d92acb [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,
63 RDMA_USER_CM_CMD_LEAVE_MCAST
Sean Hefty75216632006-11-30 16:53:41 -080064};
65
66/*
67 * command ABI structures.
68 */
69struct rdma_ucm_cmd_hdr {
70 __u32 cmd;
71 __u16 in;
72 __u16 out;
73};
74
75struct rdma_ucm_create_id {
76 __u64 uid;
77 __u64 response;
78 __u16 ps;
79 __u8 reserved[6];
80};
81
82struct rdma_ucm_create_id_resp {
83 __u32 id;
84};
85
86struct rdma_ucm_destroy_id {
87 __u64 response;
88 __u32 id;
89 __u32 reserved;
90};
91
92struct rdma_ucm_destroy_id_resp {
93 __u32 events_reported;
94};
95
96struct rdma_ucm_bind_addr {
97 __u64 response;
98 struct sockaddr_in6 addr;
99 __u32 id;
100};
101
102struct rdma_ucm_resolve_addr {
103 struct sockaddr_in6 src_addr;
104 struct sockaddr_in6 dst_addr;
105 __u32 id;
106 __u32 timeout_ms;
107};
108
109struct rdma_ucm_resolve_route {
110 __u32 id;
111 __u32 timeout_ms;
112};
113
114struct rdma_ucm_query_route {
115 __u64 response;
116 __u32 id;
117 __u32 reserved;
118};
119
120struct rdma_ucm_query_route_resp {
121 __u64 node_guid;
122 struct ib_user_path_rec ib_route[2];
123 struct sockaddr_in6 src_addr;
124 struct sockaddr_in6 dst_addr;
125 __u32 num_paths;
126 __u8 port_num;
127 __u8 reserved[3];
128};
129
130struct rdma_ucm_conn_param {
131 __u32 qp_num;
132 __u32 reserved;
133 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
134 __u8 private_data_len;
135 __u8 srq;
136 __u8 responder_resources;
137 __u8 initiator_depth;
138 __u8 flow_control;
139 __u8 retry_count;
140 __u8 rnr_retry_count;
141 __u8 valid;
142};
143
144struct rdma_ucm_ud_param {
145 __u32 qp_num;
146 __u32 qkey;
147 struct ib_uverbs_ah_attr ah_attr;
148 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
149 __u8 private_data_len;
150 __u8 reserved[7];
151};
152
153struct rdma_ucm_connect {
154 struct rdma_ucm_conn_param conn_param;
155 __u32 id;
156 __u32 reserved;
157};
158
159struct rdma_ucm_listen {
160 __u32 id;
161 __u32 backlog;
162};
163
164struct rdma_ucm_accept {
165 __u64 uid;
166 struct rdma_ucm_conn_param conn_param;
167 __u32 id;
168 __u32 reserved;
169};
170
171struct rdma_ucm_reject {
172 __u32 id;
173 __u8 private_data_len;
174 __u8 reserved[3];
175 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
176};
177
178struct rdma_ucm_disconnect {
179 __u32 id;
180};
181
182struct rdma_ucm_init_qp_attr {
183 __u64 response;
184 __u32 id;
185 __u32 qp_state;
186};
187
188struct rdma_ucm_notify {
189 __u32 id;
190 __u32 event;
191};
192
Sean Heftyc8f6a362007-02-15 17:00:18 -0800193struct rdma_ucm_join_mcast {
194 __u64 response; /* rdma_ucm_create_id_resp */
195 __u64 uid;
196 struct sockaddr_in6 addr;
197 __u32 id;
198};
199
Sean Hefty75216632006-11-30 16:53:41 -0800200struct rdma_ucm_get_event {
201 __u64 response;
202};
203
204struct rdma_ucm_event_resp {
205 __u64 uid;
206 __u32 id;
207 __u32 event;
208 __u32 status;
209 union {
210 struct rdma_ucm_conn_param conn;
211 struct rdma_ucm_ud_param ud;
212 } param;
213};
214
Sean Hefty7ce86402007-08-08 15:51:13 -0700215/* Option levels */
216enum {
217 RDMA_OPTION_ID = 0
218};
219
220/* Option details */
221enum {
222 RDMA_OPTION_ID_TOS = 0
223};
224
225struct rdma_ucm_set_option {
226 __u64 optval;
227 __u32 id;
228 __u32 level;
229 __u32 optname;
230 __u32 optlen;
231};
232
Sean Hefty75216632006-11-30 16:53:41 -0800233#endif /* RDMA_USER_CM_H */