Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ib_cm.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004, 2005 Intel Corporation. All rights reserved.
3  * Copyright (c) 2004 Topspin Corporation. All rights reserved.
4  * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
5  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
6  *
7  * This software is available to you under a choice of one of two
8  * licenses. You may choose to be licensed under the terms of the GNU
9  * General Public License (GPL) Version 2, available from the file
10  * COPYING in the main directory of this source tree, or the
11  * OpenIB.org BSD license below:
12  *
13  * Redistribution and use in source and binary forms, with or
14  * without modification, are permitted provided that the following
15  * conditions are met:
16  *
17  * - Redistributions of source code must retain the above
18  * copyright notice, this list of conditions and the following
19  * disclaimer.
20  *
21  * - Redistributions in binary form must reproduce the above
22  * copyright notice, this list of conditions and the following
23  * disclaimer in the documentation and/or other materials
24  * provided with the distribution.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33  * SOFTWARE.
34  */
35 #if !defined(IB_CM_H)
36 #define IB_CM_H
37 
38 #include <rdma/ib_mad.h>
39 #include <rdma/ib_sa.h>
40 
41 /* ib_cm and ib_user_cm modules share /sys/class/infiniband_cm */
42 extern struct class cm_class;
43 
61 };
62 
70 };
71 
91 };
92 
109 };
110 
111 struct ib_cm_id;
112 
116 
119 
124 
129  unsigned int flow_control:1;
131  unsigned int retry_count:3;
132  unsigned int rnr_retry_count:3;
133  unsigned int srq:1;
134 };
135 
143  unsigned int target_ack_delay:5;
144  unsigned int failover_accepted:2;
145  unsigned int flow_control:1;
146  unsigned int rnr_retry_count:3;
147  unsigned int srq:1;
148 };
149 
184 };
185 
188  void *ari;
190 };
191 
194 };
195 
198 };
199 
215 };
216 
219  void *apr_info;
221 };
222 
227 };
228 
236 };
237 
242  void *info;
244 };
245 
246 struct ib_cm_event {
248  union {
251  /* No data for RTU received events. */
256  /* No data for DREQ/DREP received events. */
260  } param;
261 
263 };
264 
265 #define CM_REQ_ATTR_ID cpu_to_be16(0x0010)
266 #define CM_MRA_ATTR_ID cpu_to_be16(0x0011)
267 #define CM_REJ_ATTR_ID cpu_to_be16(0x0012)
268 #define CM_REP_ATTR_ID cpu_to_be16(0x0013)
269 #define CM_RTU_ATTR_ID cpu_to_be16(0x0014)
270 #define CM_DREQ_ATTR_ID cpu_to_be16(0x0015)
271 #define CM_DREP_ATTR_ID cpu_to_be16(0x0016)
272 #define CM_SIDR_REQ_ATTR_ID cpu_to_be16(0x0017)
273 #define CM_SIDR_REP_ATTR_ID cpu_to_be16(0x0018)
274 #define CM_LAP_ATTR_ID cpu_to_be16(0x0019)
275 #define CM_APR_ATTR_ID cpu_to_be16(0x001A)
276 
293 typedef int (*ib_cm_handler)(struct ib_cm_id *cm_id,
294  struct ib_cm_event *event);
295 
296 struct ib_cm_id {
298  void *context;
299  struct ib_device *device;
302  enum ib_cm_state state; /* internal CM/debug use */
303  enum ib_cm_lap_state lap_state; /* internal CM/debug use */
306  u32 remote_cm_qpn; /* 1 unless redirected */
307 };
308 
320 struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
322  void *context);
323 
330 void ib_destroy_cm_id(struct ib_cm_id *cm_id);
331 
332 #define IB_SERVICE_ID_AGN_MASK cpu_to_be64(0xFF00000000000000ULL)
333 #define IB_CM_ASSIGN_SERVICE_ID cpu_to_be64(0x0200000000000000ULL)
334 #define IB_CMA_SERVICE_ID cpu_to_be64(0x0000000001000000ULL)
335 #define IB_CMA_SERVICE_ID_MASK cpu_to_be64(0xFFFFFFFFFF000000ULL)
336 #define IB_SDP_SERVICE_ID cpu_to_be64(0x0000000000010000ULL)
337 #define IB_SDP_SERVICE_ID_MASK cpu_to_be64(0xFFFFFFFFFFFF0000ULL)
338 
342 };
343 
360 int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id, __be64 service_mask,
362 
370  const void *private_data;
382 };
383 
391 int ib_send_cm_req(struct ib_cm_id *cm_id,
392  struct ib_cm_req_param *param);
393 
397  const void *private_data;
405 };
406 
415 int ib_send_cm_rep(struct ib_cm_id *cm_id,
416  struct ib_cm_rep_param *param);
417 
426 int ib_send_cm_rtu(struct ib_cm_id *cm_id,
427  const void *private_data,
428  u8 private_data_len);
429 
439 int ib_send_cm_dreq(struct ib_cm_id *cm_id,
440  const void *private_data,
441  u8 private_data_len);
442 
454 int ib_send_cm_drep(struct ib_cm_id *cm_id,
455  const void *private_data,
456  u8 private_data_len);
457 
472 int ib_cm_notify(struct ib_cm_id *cm_id, enum ib_event_type event);
473 
486 int ib_send_cm_rej(struct ib_cm_id *cm_id,
488  void *ari,
489  u8 ari_length,
490  const void *private_data,
491  u8 private_data_len);
492 
493 #define IB_CM_MRA_FLAG_DELAY 0x80 /* Send MRA only after a duplicate msg */
494 
506 int ib_send_cm_mra(struct ib_cm_id *cm_id,
507  u8 service_timeout,
508  const void *private_data,
509  u8 private_data_len);
510 
521 int ib_send_cm_lap(struct ib_cm_id *cm_id,
522  struct ib_sa_path_rec *alternate_path,
523  const void *private_data,
524  u8 private_data_len);
525 
542 int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
543  struct ib_qp_attr *qp_attr,
544  int *qp_attr_mask);
545 
558 int ib_send_cm_apr(struct ib_cm_id *cm_id,
560  void *info,
561  u8 info_length,
562  const void *private_data,
563  u8 private_data_len);
564 
569  const void *private_data;
572 };
573 
581 int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
582  struct ib_cm_sidr_req_param *param);
583 
588  const void *info;
590  const void *private_data;
592 };
593 
601 int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
602  struct ib_cm_sidr_rep_param *param);
603 
604 #endif /* IB_CM_H */