Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rdma_cm.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 Voltaire Inc. All rights reserved.
3  * Copyright (c) 2005 Intel Corporation. All rights reserved.
4  *
5  * This software is available to you under a choice of one of two
6  * licenses. You may choose to be licensed under the terms of the GNU
7  * General Public License (GPL) Version 2, available from the file
8  * COPYING in the main directory of this source tree, or the
9  * OpenIB.org BSD license below:
10  *
11  * Redistribution and use in source and binary forms, with or
12  * without modification, are permitted provided that the following
13  * conditions are met:
14  *
15  * - Redistributions of source code must retain the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer.
18  *
19  * - Redistributions in binary form must reproduce the above
20  * copyright notice, this list of conditions and the following
21  * disclaimer in the documentation and/or other materials
22  * provided with the distribution.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31  * SOFTWARE.
32  */
33 
34 #if !defined(RDMA_CM_H)
35 #define RDMA_CM_H
36 
37 #include <linux/socket.h>
38 #include <linux/in6.h>
39 #include <rdma/ib_addr.h>
40 #include <rdma/ib_sa.h>
41 
42 /*
43  * Upon receiving a device removal event, users must destroy the associated
44  * RDMA identifier and release all resources allocated with the device.
45  */
63 };
64 
66  RDMA_PS_SDP = 0x0001,
67  RDMA_PS_IPOIB = 0x0002,
68  RDMA_PS_IB = 0x013F,
69  RDMA_PS_TCP = 0x0106,
70  RDMA_PS_UDP = 0x0111,
71 };
72 
73 struct rdma_addr {
77 };
78 
79 struct rdma_route {
80  struct rdma_addr addr;
82  int num_paths;
83 };
84 
86  const void *private_data;
91  u8 retry_count; /* ignored when accepting */
93  /* Fields below ignored if a QP is created on the rdma_cm_id. */
96 };
97 
98 struct rdma_ud_param {
99  const void *private_data;
104 };
105 
108  int status;
109  union {
112  } param;
113 };
114 
127 };
128 
129 struct rdma_cm_id;
130 
139  struct rdma_cm_event *event);
140 
141 struct rdma_cm_id {
142  struct ib_device *device;
143  void *context;
144  struct ib_qp *qp;
150 };
151 
162  void *context, enum rdma_port_space ps,
163  enum ib_qp_type qp_type);
164 
173 void rdma_destroy_id(struct rdma_cm_id *id);
174 
186 int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr);
187 
198 int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
199  struct sockaddr *dst_addr, int timeout_ms);
200 
209 int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms);
210 
218 int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
219  struct ib_qp_init_attr *qp_init_attr);
220 
228 void rdma_destroy_qp(struct rdma_cm_id *id);
229 
249 int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
250  int *qp_attr_mask);
251 
264 int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
265 
273 int rdma_listen(struct rdma_cm_id *id, int backlog);
274 
290 int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
291 
305 int rdma_notify(struct rdma_cm_id *id, enum ib_event_type event);
306 
310 int rdma_reject(struct rdma_cm_id *id, const void *private_data,
311  u8 private_data_len);
312 
317 int rdma_disconnect(struct rdma_cm_id *id);
318 
327 int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,
328  void *context);
329 
334 void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr);
335 
348 void rdma_set_service_type(struct rdma_cm_id *id, int tos);
349 
358 int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse);
359 
368 int rdma_set_afonly(struct rdma_cm_id *id, int afonly);
369 
370 #endif /* RDMA_CM_H */