Print this page
5072 all rdma cm events should be in the enum
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/ib/clients/of/rdma/rdma_cm.h
+++ new/usr/src/uts/common/sys/ib/clients/of/rdma/rdma_cm.h
1 1 /*
2 2 * This file contains definitions used in OFED defined user/kernel
3 3 * interfaces. These are imported from the OFED header rdma_cm.h. Oracle
4 4 * elects to have and use the contents of rdma_cm.h under and governed
5 5 * by the OpenIB.org BSD license (see below for details). However,
6 6 * the following notice accompanied the original version of this file:
7 7 */
8 8
9 9 /*
10 10 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
11 11 * Copyright (c) 2005 Intel Corporation. All rights reserved.
12 12 *
13 13 * This Software is licensed under one of the following licenses:
14 14 *
15 15 * 1) under the terms of the "Common Public License 1.0" a copy of which is
16 16 * available from the Open Source Initiative, see
17 17 * http://www.opensource.org/licenses/cpl.php.
18 18 *
19 19 * 2) under the terms of the "The BSD License" a copy of which is
20 20 * available from the Open Source Initiative, see
21 21 * http://www.opensource.org/licenses/bsd-license.php.
22 22 *
23 23 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
24 24 * copy of which is available from the Open Source Initiative, see
25 25 * http://www.opensource.org/licenses/gpl-license.php.
26 26 *
27 27 * Licensee has the right to choose one of the above licenses.
28 28 *
29 29 * Redistributions of source code must retain the above copyright
30 30 * notice and one of the license notices.
31 31 *
32 32 * Redistributions in binary form must reproduce both the above copyright
33 33 * notice, one of the license notices in the documentation
34 34 * and/or other materials provided with the distribution.
35 35 *
36 36 */
37 37
38 38 #ifndef _SYS_IB_CLIENTS_OF_RDMA_RDMA_CM_H
39 39 #define _SYS_IB_CLIENTS_OF_RDMA_RDMA_CM_H
40 40
41 41 #ifdef __cplusplus
42 42 extern "C" {
43 43 #endif
44 44
45 45 #include <sys/socket.h>
46 46
47 47 /*
48 48 * Upon receiving a device removal event, users must destroy the associated
49 49 * RDMA identifier and release all resources allocated with the device.
50 50 */
51 51 enum rdma_cm_event_type {
52 52 RDMA_CM_EVENT_ADDR_RESOLVED,
53 53 RDMA_CM_EVENT_ADDR_ERROR,
54 54 RDMA_CM_EVENT_ROUTE_RESOLVED,
↓ open down ↓ |
54 lines elided |
↑ open up ↑ |
55 55 RDMA_CM_EVENT_ROUTE_ERROR,
56 56 RDMA_CM_EVENT_CONNECT_REQUEST,
57 57 RDMA_CM_EVENT_CONNECT_RESPONSE,
58 58 RDMA_CM_EVENT_CONNECT_ERROR,
59 59 RDMA_CM_EVENT_UNREACHABLE,
60 60 RDMA_CM_EVENT_REJECTED,
61 61 RDMA_CM_EVENT_ESTABLISHED,
62 62 RDMA_CM_EVENT_DISCONNECTED,
63 63 RDMA_CM_EVENT_DEVICE_REMOVAL,
64 64 RDMA_CM_EVENT_MULTICAST_JOIN,
65 - RDMA_CM_EVENT_MULTICAST_ERROR
65 + RDMA_CM_EVENT_MULTICAST_ERROR,
66 + RDMA_CM_EVENT_ADDR_CHANGE
66 67 };
67 68
68 69 enum rdma_port_space {
69 70 RDMA_PS_SDP = 0x0001,
70 71 RDMA_PS_IPOIB = 0x0002,
71 72 RDMA_PS_TCP = 0x0106,
72 73 RDMA_PS_UDP = 0x0111,
73 74 RDMA_PS_SCTP = 0x0183
74 75 };
75 76
76 77 struct rdma_addr {
77 78 struct sockaddr src_addr;
78 79 uint8_t src_pad[sizeof (struct sockaddr_in6) -
79 80 sizeof (struct sockaddr)];
80 81 struct sockaddr dst_addr;
81 82 uint8_t dst_pad[sizeof (struct sockaddr_in6) -
82 83 sizeof (struct sockaddr)];
83 84 struct rdma_dev_addr dev_addr;
84 85 };
85 86
86 87 struct rdma_route {
87 88 struct rdma_addr addr;
88 89 struct ib_sa_path_rec *path_rec;
89 90 int num_paths;
90 91 };
91 92
92 93 struct rdma_conn_param {
93 94 const void *private_data;
94 95 uint8_t private_data_len;
95 96 uint8_t responder_resources;
96 97 uint8_t initiator_depth;
97 98 uint8_t flow_control;
98 99 uint8_t retry_count; /* ignored when accepting */
99 100 uint8_t rnr_retry_count;
100 101 /* Fields below ignored if a QP is created on the rdma_cm_id. */
101 102 uint8_t srq;
102 103 uint32_t qp_num;
103 104 };
104 105
105 106 struct rdma_ud_param {
106 107 const void *private_data;
107 108 uint8_t private_data_len;
108 109 struct ib_ah_attr ah_attr;
109 110 uint32_t qp_num;
110 111 uint32_t qkey;
111 112 };
112 113
113 114 struct rdma_cm_event {
114 115 enum rdma_cm_event_type event;
115 116 int status;
116 117 union {
117 118 struct rdma_conn_param conn;
118 119 struct rdma_ud_param ud;
119 120 } param;
120 121 };
121 122
122 123 struct rdma_cm_id;
123 124
124 125 /*
125 126 * rdma_cm_event_handler - Callback used to report user events.
126 127 *
127 128 * Notes: Users may not call rdma_destroy_id from this callback to destroy
128 129 * the passed in id, or a corresponding listen id. Returning a
129 130 * non-zero value from the callback will destroy the passed in id.
130 131 */
131 132 typedef int (*rdma_cm_event_handler)(struct rdma_cm_id *id,
132 133 struct rdma_cm_event *event);
133 134
134 135 struct rdma_cm_id {
135 136 struct ib_device *device;
136 137 void *context;
137 138 struct ib_qp *qp;
138 139 rdma_cm_event_handler event_handler;
139 140 struct rdma_route route;
140 141 enum rdma_port_space ps;
141 142 uint8_t port_num;
142 143 };
143 144
144 145 /*
145 146 * rdma_create_id - Create an RDMA identifier.
146 147 *
147 148 * @event_handler: User callback invoked to report events associated with the
148 149 * returned rdma_id.
149 150 * @context: User specified context associated with the id.
150 151 * @ps: RDMA port space.
151 152 */
152 153 struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
153 154 void *context, enum rdma_port_space ps);
154 155
155 156 /*
156 157 * rdma_map_id2clnthdl -
157 158 * Maps RDMA identifier with IBTF and / or ROF client handles. Either
158 159 * of the handles can be NULL, but both should not be NULL. This API
159 160 * is called just after calling rdma_create_id() on the passive side.
160 161 *
161 162 * rdma_map_id2qphdl -
162 163 * This is used to map RDMA-CM ID to IBTF or ROF client handle and
163 164 * the QP handle. This is called by the passive side just after
164 165 * rdma_create_id() and on the active side just before rdma_accept()
165 166 * in the CONNECTION_REQUEST event handler.
166 167 */
167 168 void rdma_map_id2clnthdl(struct rdma_cm_id *id, void *ib_client_hdl,
168 169 void *iw_client_hdl);
169 170 void rdma_map_id2qphdl(struct rdma_cm_id *id, void *qp_hdl);
170 171
171 172 /*
172 173 * rdma_destroy_id - Destroys an RDMA identifier.
173 174 *
174 175 * @id: RDMA identifier.
175 176 *
176 177 * Note: calling this function has the effect of canceling in-flight
177 178 * asynchronous operations associated with the id.
178 179 */
179 180 void rdma_destroy_id(struct rdma_cm_id *id);
180 181
181 182 /*
182 183 * rdma_bind_addr - Bind an RDMA identifier to a source address and
183 184 * associated RDMA device, if needed.
184 185 *
185 186 * @id: RDMA identifier.
186 187 * @addr: Local address information. Wildcard values are permitted.
187 188 *
188 189 * This associates a source address with the RDMA identifier before calling
189 190 * rdma_listen. If a specific local address is given, the RDMA identifier will
190 191 * be bound to a local RDMA device.
191 192 */
192 193 int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr);
193 194
194 195 /*
195 196 * rdma_resolve_addr - Resolve destination and optional source addresses
196 197 * from IP addresses to an RDMA address. If successful, the specified
197 198 * rdma_cm_id will be bound to a local device.
198 199 *
199 200 * @id: RDMA identifier.
200 201 * @src_addr: Source address information. This parameter may be NULL.
201 202 * @dst_addr: Destination address information.
202 203 * @timeout_ms: Time to wait for resolution to complete.
203 204 */
204 205 int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
205 206 struct sockaddr *dst_addr, int timeout_ms);
206 207
207 208 /*
208 209 * rdma_resolve_route - Resolve the RDMA address bound to the RDMA identifier
209 210 * into route information needed to establish a connection.
210 211 *
211 212 * This is called on the client side of a connection.
212 213 * Users must have first called rdma_resolve_addr to resolve a dst_addr
213 214 * into an RDMA address before calling this routine.
214 215 */
215 216 int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms);
216 217
217 218
218 219 /*
219 220 * rdma_init_qp_attr - Initializes the QP attributes for use in transitioning
220 221 * to a specified QP state.
221 222 * @id: Communication identifier associated with the QP attributes to
222 223 * initialize.
223 224 * @qp_attr: On input, specifies the desired QP state. On output, the
224 225 * mandatory and desired optional attributes will be set in order to
225 226 * modify the QP to the specified state.
226 227 * @qp_attr_mask: The QP attribute mask that may be used to transition the
227 228 * QP to the specified state.
228 229 *
229 230 * Users must set the @qp_attr->qp_state to the desired QP state. This call
230 231 * will set all required attributes for the given transition, along with
231 232 * known optional attributes. Users may override the attributes returned from
232 233 * this call before calling ib_modify_qp.
233 234 *
234 235 * Users that wish to have their QP automatically transitioned through its
235 236 * states can associate a QP with the rdma_cm_id by calling rdma_create_qp().
236 237 */
237 238 int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
238 239 int *qp_attr_mask);
239 240 /*
240 241 * rdma_connect - Initiate an active connection request.
241 242 * @id: Connection identifier to connect.
242 243 * @conn_param: Connection information used for connected QPs.
243 244 *
244 245 * Users must have resolved a route for the rdma_cm_id to connect with
245 246 * by having called rdma_resolve_route before calling this routine.
246 247 *
247 248 * This call will either connect to a remote QP or obtain remote QP
248 249 * information for unconnected rdma_cm_id's. The actual operation is
249 250 * based on the rdma_cm_id's port space.
250 251 */
251 252 int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
252 253
253 254 /*
254 255 * rdma_listen - This function is called by the passive side to
255 256 * listen for incoming connection requests.
256 257 *
257 258 * Users must have bound the rdma_cm_id to a local address by calling
258 259 * rdma_bind_addr before calling this routine.
259 260 */
260 261 int rdma_listen(struct rdma_cm_id *id, int backlog);
261 262
262 263 /*
263 264 * rdma_accept - Called to accept a connection request or response.
264 265 * @id: Connection identifier associated with the request.
265 266 * @conn_param: Information needed to establish the connection. This must be
266 267 * provided if accepting a connection request. If accepting a connection
267 268 * response, this parameter must be NULL.
268 269 *
269 270 * Typically, this routine is only called by the listener to accept a connection
270 271 * request. It must also be called on the active side of a connection if the
271 272 * user is performing their own QP transitions.
272 273 *
273 274 * In the case of error, a reject message is sent to the remote side and the
274 275 * state of the qp associated with the id is modified to error, such that any
275 276 * previously posted receive buffers would be flushed.
276 277 */
277 278 int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
278 279
279 280 /*
280 281 * rdma_notify - Notifies the RDMA CM of an asynchronous event that has
281 282 * occurred on the connection.
282 283 * @id: Connection identifier to transition to established.
283 284 * @event: Asynchronous event.
284 285 *
285 286 * This routine should be invoked by users to notify the CM of relevant
286 287 * communication events. Events that should be reported to the CM and
287 288 * when to report them are:
288 289 *
289 290 * IB_EVENT_COMM_EST - Used when a message is received on a connected
290 291 * QP before an RTU has been received.
291 292 */
292 293 int rdma_notify(struct rdma_cm_id *id, enum ib_event_type event);
293 294
294 295 /*
295 296 * rdma_reject - Called to reject a connection request or response.
296 297 */
297 298 int rdma_reject(struct rdma_cm_id *id, const void *private_data,
298 299 uint8_t private_data_len);
299 300
300 301 /*
301 302 * rdma_disconnect - This function disconnects the associated QP and
302 303 * transitions it into the error state.
303 304 */
304 305 int rdma_disconnect(struct rdma_cm_id *id);
305 306
306 307 /*
307 308 * rdma_join_multicast - Join the multicast group specified by the given
308 309 * address.
309 310 * @id: Communication identifier associated with the request.
310 311 * @addr: Multicast address identifying the group to join.
311 312 * @context: User-defined context associated with the join request, returned
312 313 * to the user through the private_data pointer in multicast events.
313 314 */
314 315 int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,
315 316 void *context);
316 317
317 318 /*
318 319 * rdma_leave_multicast - Leave the multicast group specified by the given
319 320 * address.
320 321 */
321 322 void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr);
322 323
323 324 /*
324 325 * rdma_set_service_type - Set the type of service associated with a
325 326 * connection identifier.
326 327 * @id: Communication identifier to associated with service type.
327 328 * @tos: Type of service.
328 329 *
329 330 * The type of service is interpretted as a differentiated service
330 331 * field (RFC 2474). The service type should be specified before
331 332 * performing route resolution, as existing communication on the
332 333 * connection identifier may be unaffected. The type of service
333 334 * requested may not be supported by the network to all destinations.
334 335 */
335 336 void rdma_set_service_type(struct rdma_cm_id *id, int tos);
336 337
337 338
338 339 /*
339 340 * rdma_create_qp - Allocate a QP and associate it with the specified RDMA
340 341 * identifier.
341 342 *
342 343 * QPs allocated to an rdma_cm_id will automatically be transitioned by the CMA
343 344 * through their states.
344 345 */
345 346 int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
346 347 struct ib_qp_init_attr *qp_init_attr);
347 348
348 349 /*
349 350 * rdma_destroy_qp - Deallocate the QP associated with the specified RDMA
350 351 * identifier.
351 352 *
352 353 * Users must destroy any QP associated with an RDMA identifier before
353 354 * destroying the RDMA ID.
354 355 */
355 356 void rdma_destroy_qp(struct rdma_cm_id *id);
356 357
357 358 #ifdef __cplusplus
358 359 }
359 360 #endif
360 361 #endif /* _SYS_IB_CLIENTS_OF_RDMA_RDMA_CM_H */
↓ open down ↓ |
285 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX