Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
iw_cm.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
3  * Copyright (c) 2005 Open Grid Computing, Inc. 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 #ifndef IW_CM_H
34 #define IW_CM_H
35 
36 #include <linux/in.h>
37 #include <rdma/ib_cm.h>
38 
39 struct iw_cm_id;
40 
42  IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */
43  IW_CM_EVENT_CONNECT_REPLY, /* reply from active connect request */
44  IW_CM_EVENT_ESTABLISHED, /* passive side accept successful */
45  IW_CM_EVENT_DISCONNECT, /* orderly shutdown */
46  IW_CM_EVENT_CLOSE /* close complete */
47 };
48 
49 struct iw_cm_event {
51  int status;
54  void *private_data;
59 };
60 
68 typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id,
69  struct iw_cm_event *event);
70 
79 typedef int (*iw_event_handler)(struct iw_cm_id *cm_id,
80  struct iw_cm_event *event);
81 
82 struct iw_cm_id {
83  iw_cm_handler cm_handler; /* client callback function */
84  void *context; /* client cb context */
85  struct ib_device *device;
88  void *provider_data; /* provider private data */
89  iw_event_handler event_handler; /* cb for provider
90  events */
91  /* Used by provider to add and remove refs on IW cm_id */
92  void (*add_ref)(struct iw_cm_id *);
93  void (*rem_ref)(struct iw_cm_id *);
94 };
95 
97  const void *private_data;
102 };
103 
104 struct iw_cm_verbs {
105  void (*add_ref)(struct ib_qp *qp);
106 
107  void (*rem_ref)(struct ib_qp *qp);
108 
109  struct ib_qp * (*get_qp)(struct ib_device *device,
110  int qpn);
111 
112  int (*connect)(struct iw_cm_id *cm_id,
113  struct iw_cm_conn_param *conn_param);
114 
115  int (*accept)(struct iw_cm_id *cm_id,
116  struct iw_cm_conn_param *conn_param);
117 
118  int (*reject)(struct iw_cm_id *cm_id,
119  const void *pdata, u8 pdata_len);
120 
121  int (*create_listen)(struct iw_cm_id *cm_id,
122  int backlog);
123 
124  int (*destroy_listen)(struct iw_cm_id *cm_id);
125 };
126 
135 struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
137 
146 void iw_destroy_cm_id(struct iw_cm_id *cm_id);
147 
159 void iw_cm_unbind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp);
160 
167 struct ib_qp *iw_cm_get_qp(struct ib_device *device, int qpn);
168 
180 int iw_cm_listen(struct iw_cm_id *cm_id, int backlog);
181 
196 int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
197 
210 int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data,
211  u8 private_data_len);
212 
225 int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
226 
237 int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt);
238 
248 int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr,
249  int *qp_attr_mask);
250 
251 #endif /* IW_CM_H */