diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-22 18:47:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-22 18:47:06 -0400 |
commit | db392219c5f572610645696e3672f6ea38783a65 (patch) | |
tree | 240878f6367e528840cc4fe92f6b3a251651572f /include | |
parent | 3e2ab46df697048e222cdc046a2fa97149ca32ba (diff) | |
parent | 9cd330d36b32ed48d49561b165842db20bd153cc (diff) |
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband: (65 commits)
IB: Fix typo in kerneldoc for ib_set_client_data()
IPoIB: Add some likely/unlikely annotations in hot path
IPoIB: Remove unused include of vmalloc.h
IPoIB: Rejoin all multicast groups after a port event
IPoIB: Create MCGs with all attributes required by RFC
IB/sa: fix ib_sa_selector names
IB/iser: INFINIBAND_ISER depends on INET
IB/mthca: Simplify calls to mthca_cq_clean()
RDMA/cma: Document rdma_accept() error handling
IB/mthca: Recover from catastrophic errors
RDMA/cma: Document rdma_destroy_id() function
IB/cm: Do not track remote QPN in timewait state
IB/sa: Require SA registration
IPoIB: Refactor completion handling
IB/iser: Do not use FMR for a single dma entry sg
IB/iser: fix some debug prints
IB/iser: make FMR "page size" be 4K and not PAGE_SIZE
IB/iser: Limit the max size of a scsi command
IB/iser: fix a check of SG alignment for RDMA
RDMA/cma: Protect against adding device during destruction
...
Diffstat (limited to 'include')
-rw-r--r-- | include/rdma/ib_addr.h | 17 | ||||
-rw-r--r-- | include/rdma/ib_sa.h | 45 | ||||
-rw-r--r-- | include/rdma/ib_user_verbs.h | 2 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 31 | ||||
-rw-r--r-- | include/rdma/iw_cm.h | 258 | ||||
-rw-r--r-- | include/rdma/rdma_cm.h | 12 |
6 files changed, 349 insertions, 16 deletions
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 0ff67398928d..81b62307621d 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h | |||
@@ -40,7 +40,7 @@ struct rdma_dev_addr { | |||
40 | unsigned char src_dev_addr[MAX_ADDR_LEN]; | 40 | unsigned char src_dev_addr[MAX_ADDR_LEN]; |
41 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; | 41 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; |
42 | unsigned char broadcast[MAX_ADDR_LEN]; | 42 | unsigned char broadcast[MAX_ADDR_LEN]; |
43 | enum ib_node_type dev_type; | 43 | enum rdma_node_type dev_type; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | /** | 46 | /** |
@@ -72,6 +72,9 @@ int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr, | |||
72 | 72 | ||
73 | void rdma_addr_cancel(struct rdma_dev_addr *addr); | 73 | void rdma_addr_cancel(struct rdma_dev_addr *addr); |
74 | 74 | ||
75 | int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, | ||
76 | const unsigned char *dst_dev_addr); | ||
77 | |||
75 | static inline int ip_addr_size(struct sockaddr *addr) | 78 | static inline int ip_addr_size(struct sockaddr *addr) |
76 | { | 79 | { |
77 | return addr->sa_family == AF_INET6 ? | 80 | return addr->sa_family == AF_INET6 ? |
@@ -113,4 +116,16 @@ static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, | |||
113 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); | 116 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); |
114 | } | 117 | } |
115 | 118 | ||
119 | static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr, | ||
120 | union ib_gid *gid) | ||
121 | { | ||
122 | memcpy(gid, dev_addr->src_dev_addr, sizeof *gid); | ||
123 | } | ||
124 | |||
125 | static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr, | ||
126 | union ib_gid *gid) | ||
127 | { | ||
128 | memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid); | ||
129 | } | ||
130 | |||
116 | #endif /* IB_ADDR_H */ | 131 | #endif /* IB_ADDR_H */ |
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index c99e4420fd7e..97715b0c20b6 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. | 2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. |
3 | * Copyright (c) 2005 Voltaire, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Voltaire, Inc. All rights reserved. |
4 | * Copyright (c) 2006 Intel Corporation. All rights reserved. | ||
4 | * | 5 | * |
5 | * This software is available to you under a choice of one of two | 6 | * 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 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -36,8 +37,11 @@ | |||
36 | #ifndef IB_SA_H | 37 | #ifndef IB_SA_H |
37 | #define IB_SA_H | 38 | #define IB_SA_H |
38 | 39 | ||
40 | #include <linux/completion.h> | ||
39 | #include <linux/compiler.h> | 41 | #include <linux/compiler.h> |
40 | 42 | ||
43 | #include <asm/atomic.h> | ||
44 | |||
41 | #include <rdma/ib_verbs.h> | 45 | #include <rdma/ib_verbs.h> |
42 | #include <rdma/ib_mad.h> | 46 | #include <rdma/ib_mad.h> |
43 | 47 | ||
@@ -79,8 +83,8 @@ enum { | |||
79 | }; | 83 | }; |
80 | 84 | ||
81 | enum ib_sa_selector { | 85 | enum ib_sa_selector { |
82 | IB_SA_GTE = 0, | 86 | IB_SA_GT = 0, |
83 | IB_SA_LTE = 1, | 87 | IB_SA_LT = 1, |
84 | IB_SA_EQ = 2, | 88 | IB_SA_EQ = 2, |
85 | /* | 89 | /* |
86 | * The meaning of "best" depends on the attribute: for | 90 | * The meaning of "best" depends on the attribute: for |
@@ -250,11 +254,28 @@ struct ib_sa_service_rec { | |||
250 | u64 data64[2]; | 254 | u64 data64[2]; |
251 | }; | 255 | }; |
252 | 256 | ||
257 | struct ib_sa_client { | ||
258 | atomic_t users; | ||
259 | struct completion comp; | ||
260 | }; | ||
261 | |||
262 | /** | ||
263 | * ib_sa_register_client - Register an SA client. | ||
264 | */ | ||
265 | void ib_sa_register_client(struct ib_sa_client *client); | ||
266 | |||
267 | /** | ||
268 | * ib_sa_unregister_client - Deregister an SA client. | ||
269 | * @client: Client object to deregister. | ||
270 | */ | ||
271 | void ib_sa_unregister_client(struct ib_sa_client *client); | ||
272 | |||
253 | struct ib_sa_query; | 273 | struct ib_sa_query; |
254 | 274 | ||
255 | void ib_sa_cancel_query(int id, struct ib_sa_query *query); | 275 | void ib_sa_cancel_query(int id, struct ib_sa_query *query); |
256 | 276 | ||
257 | int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | 277 | int ib_sa_path_rec_get(struct ib_sa_client *client, |
278 | struct ib_device *device, u8 port_num, | ||
258 | struct ib_sa_path_rec *rec, | 279 | struct ib_sa_path_rec *rec, |
259 | ib_sa_comp_mask comp_mask, | 280 | ib_sa_comp_mask comp_mask, |
260 | int timeout_ms, gfp_t gfp_mask, | 281 | int timeout_ms, gfp_t gfp_mask, |
@@ -264,7 +285,8 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | |||
264 | void *context, | 285 | void *context, |
265 | struct ib_sa_query **query); | 286 | struct ib_sa_query **query); |
266 | 287 | ||
267 | int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | 288 | int ib_sa_mcmember_rec_query(struct ib_sa_client *client, |
289 | struct ib_device *device, u8 port_num, | ||
268 | u8 method, | 290 | u8 method, |
269 | struct ib_sa_mcmember_rec *rec, | 291 | struct ib_sa_mcmember_rec *rec, |
270 | ib_sa_comp_mask comp_mask, | 292 | ib_sa_comp_mask comp_mask, |
@@ -275,7 +297,8 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | |||
275 | void *context, | 297 | void *context, |
276 | struct ib_sa_query **query); | 298 | struct ib_sa_query **query); |
277 | 299 | ||
278 | int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | 300 | int ib_sa_service_rec_query(struct ib_sa_client *client, |
301 | struct ib_device *device, u8 port_num, | ||
279 | u8 method, | 302 | u8 method, |
280 | struct ib_sa_service_rec *rec, | 303 | struct ib_sa_service_rec *rec, |
281 | ib_sa_comp_mask comp_mask, | 304 | ib_sa_comp_mask comp_mask, |
@@ -288,6 +311,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | |||
288 | 311 | ||
289 | /** | 312 | /** |
290 | * ib_sa_mcmember_rec_set - Start an MCMember set query | 313 | * ib_sa_mcmember_rec_set - Start an MCMember set query |
314 | * @client:SA client | ||
291 | * @device:device to send query on | 315 | * @device:device to send query on |
292 | * @port_num: port number to send query on | 316 | * @port_num: port number to send query on |
293 | * @rec:MCMember Record to send in query | 317 | * @rec:MCMember Record to send in query |
@@ -311,7 +335,8 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | |||
311 | * cancel the query. | 335 | * cancel the query. |
312 | */ | 336 | */ |
313 | static inline int | 337 | static inline int |
314 | ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | 338 | ib_sa_mcmember_rec_set(struct ib_sa_client *client, |
339 | struct ib_device *device, u8 port_num, | ||
315 | struct ib_sa_mcmember_rec *rec, | 340 | struct ib_sa_mcmember_rec *rec, |
316 | ib_sa_comp_mask comp_mask, | 341 | ib_sa_comp_mask comp_mask, |
317 | int timeout_ms, gfp_t gfp_mask, | 342 | int timeout_ms, gfp_t gfp_mask, |
@@ -321,7 +346,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
321 | void *context, | 346 | void *context, |
322 | struct ib_sa_query **query) | 347 | struct ib_sa_query **query) |
323 | { | 348 | { |
324 | return ib_sa_mcmember_rec_query(device, port_num, | 349 | return ib_sa_mcmember_rec_query(client, device, port_num, |
325 | IB_MGMT_METHOD_SET, | 350 | IB_MGMT_METHOD_SET, |
326 | rec, comp_mask, | 351 | rec, comp_mask, |
327 | timeout_ms, gfp_mask, callback, | 352 | timeout_ms, gfp_mask, callback, |
@@ -330,6 +355,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
330 | 355 | ||
331 | /** | 356 | /** |
332 | * ib_sa_mcmember_rec_delete - Start an MCMember delete query | 357 | * ib_sa_mcmember_rec_delete - Start an MCMember delete query |
358 | * @client:SA client | ||
333 | * @device:device to send query on | 359 | * @device:device to send query on |
334 | * @port_num: port number to send query on | 360 | * @port_num: port number to send query on |
335 | * @rec:MCMember Record to send in query | 361 | * @rec:MCMember Record to send in query |
@@ -353,7 +379,8 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
353 | * cancel the query. | 379 | * cancel the query. |
354 | */ | 380 | */ |
355 | static inline int | 381 | static inline int |
356 | ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, | 382 | ib_sa_mcmember_rec_delete(struct ib_sa_client *client, |
383 | struct ib_device *device, u8 port_num, | ||
357 | struct ib_sa_mcmember_rec *rec, | 384 | struct ib_sa_mcmember_rec *rec, |
358 | ib_sa_comp_mask comp_mask, | 385 | ib_sa_comp_mask comp_mask, |
359 | int timeout_ms, gfp_t gfp_mask, | 386 | int timeout_ms, gfp_t gfp_mask, |
@@ -363,7 +390,7 @@ ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, | |||
363 | void *context, | 390 | void *context, |
364 | struct ib_sa_query **query) | 391 | struct ib_sa_query **query) |
365 | { | 392 | { |
366 | return ib_sa_mcmember_rec_query(device, port_num, | 393 | return ib_sa_mcmember_rec_query(client, device, port_num, |
367 | IB_SA_METHOD_DELETE, | 394 | IB_SA_METHOD_DELETE, |
368 | rec, comp_mask, | 395 | rec, comp_mask, |
369 | timeout_ms, gfp_mask, callback, | 396 | timeout_ms, gfp_mask, callback, |
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h index 7b5372010f4b..db1b814b62cc 100644 --- a/include/rdma/ib_user_verbs.h +++ b/include/rdma/ib_user_verbs.h | |||
@@ -275,6 +275,8 @@ struct ib_uverbs_resize_cq { | |||
275 | 275 | ||
276 | struct ib_uverbs_resize_cq_resp { | 276 | struct ib_uverbs_resize_cq_resp { |
277 | __u32 cqe; | 277 | __u32 cqe; |
278 | __u32 reserved; | ||
279 | __u64 driver_data[0]; | ||
278 | }; | 280 | }; |
279 | 281 | ||
280 | struct ib_uverbs_poll_cq { | 282 | struct ib_uverbs_poll_cq { |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index ee1f3a355666..8eacc3510993 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -56,12 +56,22 @@ union ib_gid { | |||
56 | } global; | 56 | } global; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | enum ib_node_type { | 59 | enum rdma_node_type { |
60 | IB_NODE_CA = 1, | 60 | /* IB values map to NodeInfo:NodeType. */ |
61 | IB_NODE_SWITCH, | 61 | RDMA_NODE_IB_CA = 1, |
62 | IB_NODE_ROUTER | 62 | RDMA_NODE_IB_SWITCH, |
63 | RDMA_NODE_IB_ROUTER, | ||
64 | RDMA_NODE_RNIC | ||
63 | }; | 65 | }; |
64 | 66 | ||
67 | enum rdma_transport_type { | ||
68 | RDMA_TRANSPORT_IB, | ||
69 | RDMA_TRANSPORT_IWARP | ||
70 | }; | ||
71 | |||
72 | enum rdma_transport_type | ||
73 | rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; | ||
74 | |||
65 | enum ib_device_cap_flags { | 75 | enum ib_device_cap_flags { |
66 | IB_DEVICE_RESIZE_MAX_WR = 1, | 76 | IB_DEVICE_RESIZE_MAX_WR = 1, |
67 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), | 77 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), |
@@ -78,6 +88,9 @@ enum ib_device_cap_flags { | |||
78 | IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), | 88 | IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), |
79 | IB_DEVICE_SRQ_RESIZE = (1<<13), | 89 | IB_DEVICE_SRQ_RESIZE = (1<<13), |
80 | IB_DEVICE_N_NOTIFY_CQ = (1<<14), | 90 | IB_DEVICE_N_NOTIFY_CQ = (1<<14), |
91 | IB_DEVICE_ZERO_STAG = (1<<15), | ||
92 | IB_DEVICE_SEND_W_INV = (1<<16), | ||
93 | IB_DEVICE_MEM_WINDOW = (1<<17) | ||
81 | }; | 94 | }; |
82 | 95 | ||
83 | enum ib_atomic_cap { | 96 | enum ib_atomic_cap { |
@@ -835,6 +848,8 @@ struct ib_cache { | |||
835 | u8 *lmc_cache; | 848 | u8 *lmc_cache; |
836 | }; | 849 | }; |
837 | 850 | ||
851 | struct iw_cm_verbs; | ||
852 | |||
838 | struct ib_device { | 853 | struct ib_device { |
839 | struct device *dma_device; | 854 | struct device *dma_device; |
840 | 855 | ||
@@ -851,6 +866,8 @@ struct ib_device { | |||
851 | 866 | ||
852 | u32 flags; | 867 | u32 flags; |
853 | 868 | ||
869 | struct iw_cm_verbs *iwcm; | ||
870 | |||
854 | int (*query_device)(struct ib_device *device, | 871 | int (*query_device)(struct ib_device *device, |
855 | struct ib_device_attr *device_attr); | 872 | struct ib_device_attr *device_attr); |
856 | int (*query_port)(struct ib_device *device, | 873 | int (*query_port)(struct ib_device *device, |
@@ -888,7 +905,8 @@ struct ib_device { | |||
888 | struct ib_udata *udata); | 905 | struct ib_udata *udata); |
889 | int (*modify_srq)(struct ib_srq *srq, | 906 | int (*modify_srq)(struct ib_srq *srq, |
890 | struct ib_srq_attr *srq_attr, | 907 | struct ib_srq_attr *srq_attr, |
891 | enum ib_srq_attr_mask srq_attr_mask); | 908 | enum ib_srq_attr_mask srq_attr_mask, |
909 | struct ib_udata *udata); | ||
892 | int (*query_srq)(struct ib_srq *srq, | 910 | int (*query_srq)(struct ib_srq *srq, |
893 | struct ib_srq_attr *srq_attr); | 911 | struct ib_srq_attr *srq_attr); |
894 | int (*destroy_srq)(struct ib_srq *srq); | 912 | int (*destroy_srq)(struct ib_srq *srq); |
@@ -900,7 +918,8 @@ struct ib_device { | |||
900 | struct ib_udata *udata); | 918 | struct ib_udata *udata); |
901 | int (*modify_qp)(struct ib_qp *qp, | 919 | int (*modify_qp)(struct ib_qp *qp, |
902 | struct ib_qp_attr *qp_attr, | 920 | struct ib_qp_attr *qp_attr, |
903 | int qp_attr_mask); | 921 | int qp_attr_mask, |
922 | struct ib_udata *udata); | ||
904 | int (*query_qp)(struct ib_qp *qp, | 923 | int (*query_qp)(struct ib_qp *qp, |
905 | struct ib_qp_attr *qp_attr, | 924 | struct ib_qp_attr *qp_attr, |
906 | int qp_attr_mask, | 925 | int qp_attr_mask, |
diff --git a/include/rdma/iw_cm.h b/include/rdma/iw_cm.h new file mode 100644 index 000000000000..aeefa9b740dc --- /dev/null +++ b/include/rdma/iw_cm.h | |||
@@ -0,0 +1,258 @@ | |||
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 | |||
41 | enum iw_cm_event_type { | ||
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 | enum iw_cm_event_status { | ||
50 | IW_CM_EVENT_STATUS_OK = 0, /* request successful */ | ||
51 | IW_CM_EVENT_STATUS_ACCEPTED = 0, /* connect request accepted */ | ||
52 | IW_CM_EVENT_STATUS_REJECTED, /* connect request rejected */ | ||
53 | IW_CM_EVENT_STATUS_TIMEOUT, /* the operation timed out */ | ||
54 | IW_CM_EVENT_STATUS_RESET, /* reset from remote peer */ | ||
55 | IW_CM_EVENT_STATUS_EINVAL, /* asynchronous failure for bad parm */ | ||
56 | }; | ||
57 | |||
58 | struct iw_cm_event { | ||
59 | enum iw_cm_event_type event; | ||
60 | enum iw_cm_event_status status; | ||
61 | struct sockaddr_in local_addr; | ||
62 | struct sockaddr_in remote_addr; | ||
63 | void *private_data; | ||
64 | u8 private_data_len; | ||
65 | void* provider_data; | ||
66 | }; | ||
67 | |||
68 | /** | ||
69 | * iw_cm_handler - Function to be called by the IW CM when delivering events | ||
70 | * to the client. | ||
71 | * | ||
72 | * @cm_id: The IW CM identifier associated with the event. | ||
73 | * @event: Pointer to the event structure. | ||
74 | */ | ||
75 | typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id, | ||
76 | struct iw_cm_event *event); | ||
77 | |||
78 | /** | ||
79 | * iw_event_handler - Function called by the provider when delivering provider | ||
80 | * events to the IW CM. Returns either 0 indicating the event was processed | ||
81 | * or -errno if the event could not be processed. | ||
82 | * | ||
83 | * @cm_id: The IW CM identifier associated with the event. | ||
84 | * @event: Pointer to the event structure. | ||
85 | */ | ||
86 | typedef int (*iw_event_handler)(struct iw_cm_id *cm_id, | ||
87 | struct iw_cm_event *event); | ||
88 | |||
89 | struct iw_cm_id { | ||
90 | iw_cm_handler cm_handler; /* client callback function */ | ||
91 | void *context; /* client cb context */ | ||
92 | struct ib_device *device; | ||
93 | struct sockaddr_in local_addr; | ||
94 | struct sockaddr_in remote_addr; | ||
95 | void *provider_data; /* provider private data */ | ||
96 | iw_event_handler event_handler; /* cb for provider | ||
97 | events */ | ||
98 | /* Used by provider to add and remove refs on IW cm_id */ | ||
99 | void (*add_ref)(struct iw_cm_id *); | ||
100 | void (*rem_ref)(struct iw_cm_id *); | ||
101 | }; | ||
102 | |||
103 | struct iw_cm_conn_param { | ||
104 | const void *private_data; | ||
105 | u16 private_data_len; | ||
106 | u32 ord; | ||
107 | u32 ird; | ||
108 | u32 qpn; | ||
109 | }; | ||
110 | |||
111 | struct iw_cm_verbs { | ||
112 | void (*add_ref)(struct ib_qp *qp); | ||
113 | |||
114 | void (*rem_ref)(struct ib_qp *qp); | ||
115 | |||
116 | struct ib_qp * (*get_qp)(struct ib_device *device, | ||
117 | int qpn); | ||
118 | |||
119 | int (*connect)(struct iw_cm_id *cm_id, | ||
120 | struct iw_cm_conn_param *conn_param); | ||
121 | |||
122 | int (*accept)(struct iw_cm_id *cm_id, | ||
123 | struct iw_cm_conn_param *conn_param); | ||
124 | |||
125 | int (*reject)(struct iw_cm_id *cm_id, | ||
126 | const void *pdata, u8 pdata_len); | ||
127 | |||
128 | int (*create_listen)(struct iw_cm_id *cm_id, | ||
129 | int backlog); | ||
130 | |||
131 | int (*destroy_listen)(struct iw_cm_id *cm_id); | ||
132 | }; | ||
133 | |||
134 | /** | ||
135 | * iw_create_cm_id - Create an IW CM identifier. | ||
136 | * | ||
137 | * @device: The IB device on which to create the IW CM identier. | ||
138 | * @event_handler: User callback invoked to report events associated with the | ||
139 | * returned IW CM identifier. | ||
140 | * @context: User specified context associated with the id. | ||
141 | */ | ||
142 | struct iw_cm_id *iw_create_cm_id(struct ib_device *device, | ||
143 | iw_cm_handler cm_handler, void *context); | ||
144 | |||
145 | /** | ||
146 | * iw_destroy_cm_id - Destroy an IW CM identifier. | ||
147 | * | ||
148 | * @cm_id: The previously created IW CM identifier to destroy. | ||
149 | * | ||
150 | * The client can assume that no events will be delivered for the CM ID after | ||
151 | * this function returns. | ||
152 | */ | ||
153 | void iw_destroy_cm_id(struct iw_cm_id *cm_id); | ||
154 | |||
155 | /** | ||
156 | * iw_cm_bind_qp - Unbind the specified IW CM identifier and QP | ||
157 | * | ||
158 | * @cm_id: The IW CM idenfier to unbind from the QP. | ||
159 | * @qp: The QP | ||
160 | * | ||
161 | * This is called by the provider when destroying the QP to ensure | ||
162 | * that any references held by the IWCM are released. It may also | ||
163 | * be called by the IWCM when destroying a CM_ID to that any | ||
164 | * references held by the provider are released. | ||
165 | */ | ||
166 | void iw_cm_unbind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp); | ||
167 | |||
168 | /** | ||
169 | * iw_cm_get_qp - Return the ib_qp associated with a QPN | ||
170 | * | ||
171 | * @ib_device: The IB device | ||
172 | * @qpn: The queue pair number | ||
173 | */ | ||
174 | struct ib_qp *iw_cm_get_qp(struct ib_device *device, int qpn); | ||
175 | |||
176 | /** | ||
177 | * iw_cm_listen - Listen for incoming connection requests on the | ||
178 | * specified IW CM id. | ||
179 | * | ||
180 | * @cm_id: The IW CM identifier. | ||
181 | * @backlog: The maximum number of outstanding un-accepted inbound listen | ||
182 | * requests to queue. | ||
183 | * | ||
184 | * The source address and port number are specified in the IW CM identifier | ||
185 | * structure. | ||
186 | */ | ||
187 | int iw_cm_listen(struct iw_cm_id *cm_id, int backlog); | ||
188 | |||
189 | /** | ||
190 | * iw_cm_accept - Called to accept an incoming connect request. | ||
191 | * | ||
192 | * @cm_id: The IW CM identifier associated with the connection request. | ||
193 | * @iw_param: Pointer to a structure containing connection establishment | ||
194 | * parameters. | ||
195 | * | ||
196 | * The specified cm_id will have been provided in the event data for a | ||
197 | * CONNECT_REQUEST event. Subsequent events related to this connection will be | ||
198 | * delivered to the specified IW CM identifier prior and may occur prior to | ||
199 | * the return of this function. If this function returns a non-zero value, the | ||
200 | * client can assume that no events will be delivered to the specified IW CM | ||
201 | * identifier. | ||
202 | */ | ||
203 | int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); | ||
204 | |||
205 | /** | ||
206 | * iw_cm_reject - Reject an incoming connection request. | ||
207 | * | ||
208 | * @cm_id: Connection identifier associated with the request. | ||
209 | * @private_daa: Pointer to data to deliver to the remote peer as part of the | ||
210 | * reject message. | ||
211 | * @private_data_len: The number of bytes in the private_data parameter. | ||
212 | * | ||
213 | * The client can assume that no events will be delivered to the specified IW | ||
214 | * CM identifier following the return of this function. The private_data | ||
215 | * buffer is available for reuse when this function returns. | ||
216 | */ | ||
217 | int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data, | ||
218 | u8 private_data_len); | ||
219 | |||
220 | /** | ||
221 | * iw_cm_connect - Called to request a connection to a remote peer. | ||
222 | * | ||
223 | * @cm_id: The IW CM identifier for the connection. | ||
224 | * @iw_param: Pointer to a structure containing connection establishment | ||
225 | * parameters. | ||
226 | * | ||
227 | * Events may be delivered to the specified IW CM identifier prior to the | ||
228 | * return of this function. If this function returns a non-zero value, the | ||
229 | * client can assume that no events will be delivered to the specified IW CM | ||
230 | * identifier. | ||
231 | */ | ||
232 | int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); | ||
233 | |||
234 | /** | ||
235 | * iw_cm_disconnect - Close the specified connection. | ||
236 | * | ||
237 | * @cm_id: The IW CM identifier to close. | ||
238 | * @abrupt: If 0, the connection will be closed gracefully, otherwise, the | ||
239 | * connection will be reset. | ||
240 | * | ||
241 | * The IW CM identifier is still active until the IW_CM_EVENT_CLOSE event is | ||
242 | * delivered. | ||
243 | */ | ||
244 | int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt); | ||
245 | |||
246 | /** | ||
247 | * iw_cm_init_qp_attr - Called to initialize the attributes of the QP | ||
248 | * associated with a IW CM identifier. | ||
249 | * | ||
250 | * @cm_id: The IW CM identifier associated with the QP | ||
251 | * @qp_attr: Pointer to the QP attributes structure. | ||
252 | * @qp_attr_mask: Pointer to a bit vector specifying which QP attributes are | ||
253 | * valid. | ||
254 | */ | ||
255 | int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr, | ||
256 | int *qp_attr_mask); | ||
257 | |||
258 | #endif /* IW_CM_H */ | ||
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index 402c63d7226b..deb5a0a4cee5 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h | |||
@@ -117,6 +117,14 @@ struct rdma_cm_id { | |||
117 | struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, | 117 | struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, |
118 | void *context, enum rdma_port_space ps); | 118 | void *context, enum rdma_port_space ps); |
119 | 119 | ||
120 | /** | ||
121 | * rdma_destroy_id - Destroys an RDMA identifier. | ||
122 | * | ||
123 | * @id: RDMA identifier. | ||
124 | * | ||
125 | * Note: calling this function has the effect of canceling in-flight | ||
126 | * asynchronous operations associated with the id. | ||
127 | */ | ||
120 | void rdma_destroy_id(struct rdma_cm_id *id); | 128 | void rdma_destroy_id(struct rdma_cm_id *id); |
121 | 129 | ||
122 | /** | 130 | /** |
@@ -237,6 +245,10 @@ int rdma_listen(struct rdma_cm_id *id, int backlog); | |||
237 | * Typically, this routine is only called by the listener to accept a connection | 245 | * Typically, this routine is only called by the listener to accept a connection |
238 | * request. It must also be called on the active side of a connection if the | 246 | * request. It must also be called on the active side of a connection if the |
239 | * user is performing their own QP transitions. | 247 | * user is performing their own QP transitions. |
248 | * | ||
249 | * In the case of error, a reject message is sent to the remote side and the | ||
250 | * state of the qp associated with the id is modified to error, such that any | ||
251 | * previously posted receive buffers would be flushed. | ||
240 | */ | 252 | */ |
241 | int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param); | 253 | int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param); |
242 | 254 | ||