This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / drivers / infiniband / include / ib_verbs.h
1 /*
2  * Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
3  * Copyright (c) 2004 Infinicon Corporation.  All rights reserved.
4  * Copyright (c) 2004 Intel Corporation.  All rights reserved.
5  * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
6  * Copyright (c) 2004 Voltaire Corporation.  All rights reserved.
7  *
8  * This software is available to you under a choice of one of two
9  * licenses.  You may choose to be licensed under the terms of the GNU
10  * General Public License (GPL) Version 2, available from the file
11  * COPYING in the main directory of this source tree, or the
12  * OpenIB.org BSD license below:
13  *
14  *     Redistribution and use in source and binary forms, with or
15  *     without modification, are permitted provided that the following
16  *     conditions are met:
17  *
18  *      - Redistributions of source code must retain the above
19  *        copyright notice, this list of conditions and the following
20  *        disclaimer.
21  *
22  *      - Redistributions in binary form must reproduce the above
23  *        copyright notice, this list of conditions and the following
24  *        disclaimer in the documentation and/or other materials
25  *        provided with the distribution.
26  *
27  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34  * SOFTWARE.
35  *
36  * $Id: ib_verbs.h 1349 2004-12-16 21:09:43Z roland $
37  */
38
39 #if !defined(IB_VERBS_H)
40 #define IB_VERBS_H
41
42 #include <linux/types.h>
43 #include <linux/device.h>
44 #include <asm/atomic.h>
45
46 union ib_gid {
47         u8      raw[16];
48         struct {
49                 u64     subnet_prefix;
50                 u64     interface_id;
51         } global;
52 };
53
54 enum ib_node_type {
55         IB_NODE_CA      = 1,
56         IB_NODE_SWITCH,
57         IB_NODE_ROUTER
58 };
59
60 enum ib_device_cap_flags {
61         IB_DEVICE_RESIZE_MAX_WR         = 1,
62         IB_DEVICE_BAD_PKEY_CNTR         = (1<<1),
63         IB_DEVICE_BAD_QKEY_CNTR         = (1<<2),
64         IB_DEVICE_RAW_MULTI             = (1<<3),
65         IB_DEVICE_AUTO_PATH_MIG         = (1<<4),
66         IB_DEVICE_CHANGE_PHY_PORT       = (1<<5),
67         IB_DEVICE_UD_AV_PORT_ENFORCE    = (1<<6),
68         IB_DEVICE_CURR_QP_STATE_MOD     = (1<<7),
69         IB_DEVICE_SHUTDOWN_PORT         = (1<<8),
70         IB_DEVICE_INIT_TYPE             = (1<<9),
71         IB_DEVICE_PORT_ACTIVE_EVENT     = (1<<10),
72         IB_DEVICE_SYS_IMAGE_GUID        = (1<<11),
73         IB_DEVICE_RC_RNR_NAK_GEN        = (1<<12),
74         IB_DEVICE_SRQ_RESIZE            = (1<<13),
75         IB_DEVICE_N_NOTIFY_CQ           = (1<<14),
76         IB_DEVICE_RQ_SIG_TYPE           = (1<<15)
77 };
78
79 enum ib_atomic_cap {
80         IB_ATOMIC_NONE,
81         IB_ATOMIC_HCA,
82         IB_ATOMIC_GLOB
83 };
84
85 struct ib_device_attr {
86         u64                     fw_ver;
87         u64                     node_guid;
88         u64                     sys_image_guid;
89         u64                     max_mr_size;
90         u64                     page_size_cap;
91         u32                     vendor_id;
92         u32                     vendor_part_id;
93         u32                     hw_ver;
94         int                     max_qp;
95         int                     max_qp_wr;
96         int                     device_cap_flags;
97         int                     max_sge;
98         int                     max_sge_rd;
99         int                     max_cq;
100         int                     max_cqe;
101         int                     max_mr;
102         int                     max_pd;
103         int                     max_qp_rd_atom;
104         int                     max_ee_rd_atom;
105         int                     max_res_rd_atom;
106         int                     max_qp_init_rd_atom;
107         int                     max_ee_init_rd_atom;
108         enum ib_atomic_cap      atomic_cap;
109         int                     max_ee;
110         int                     max_rdd;
111         int                     max_mw;
112         int                     max_raw_ipv6_qp;
113         int                     max_raw_ethy_qp;
114         int                     max_mcast_grp;
115         int                     max_mcast_qp_attach;
116         int                     max_total_mcast_qp_attach;
117         int                     max_ah;
118         int                     max_fmr;
119         int                     max_map_per_fmr;
120         int                     max_srq;
121         int                     max_srq_wr;
122         int                     max_srq_sge;
123         u16                     max_pkeys;
124         u8                      local_ca_ack_delay;
125 };
126
127 enum ib_mtu {
128         IB_MTU_256  = 1,
129         IB_MTU_512  = 2,
130         IB_MTU_1024 = 3,
131         IB_MTU_2048 = 4,
132         IB_MTU_4096 = 5
133 };
134
135 static inline int ib_mtu_enum_to_int(enum ib_mtu mtu)
136 {
137         switch (mtu) {
138         case IB_MTU_256:  return  256;
139         case IB_MTU_512:  return  512;
140         case IB_MTU_1024: return 1024;
141         case IB_MTU_2048: return 2048;
142         case IB_MTU_4096: return 4096;
143         default:          return -1;
144         }
145 }
146
147 enum ib_port_state {
148         IB_PORT_NOP             = 0,
149         IB_PORT_DOWN            = 1,
150         IB_PORT_INIT            = 2,
151         IB_PORT_ARMED           = 3,
152         IB_PORT_ACTIVE          = 4,
153         IB_PORT_ACTIVE_DEFER    = 5
154 };
155
156 enum ib_port_cap_flags {
157         IB_PORT_SM                              = 1 <<  1,
158         IB_PORT_NOTICE_SUP                      = 1 <<  2,
159         IB_PORT_TRAP_SUP                        = 1 <<  3,
160         IB_PORT_OPT_IPD_SUP                     = 1 <<  4,
161         IB_PORT_AUTO_MIGR_SUP                   = 1 <<  5,
162         IB_PORT_SL_MAP_SUP                      = 1 <<  6,
163         IB_PORT_MKEY_NVRAM                      = 1 <<  7,
164         IB_PORT_PKEY_NVRAM                      = 1 <<  8,
165         IB_PORT_LED_INFO_SUP                    = 1 <<  9,
166         IB_PORT_SM_DISABLED                     = 1 << 10,
167         IB_PORT_SYS_IMAGE_GUID_SUP              = 1 << 11,
168         IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP       = 1 << 12,
169         IB_PORT_CM_SUP                          = 1 << 16,
170         IB_PORT_SNMP_TUNNEL_SUP                 = 1 << 17,
171         IB_PORT_REINIT_SUP                      = 1 << 18,
172         IB_PORT_DEVICE_MGMT_SUP                 = 1 << 19,
173         IB_PORT_VENDOR_CLASS_SUP                = 1 << 20,
174         IB_PORT_DR_NOTICE_SUP                   = 1 << 21,
175         IB_PORT_CAP_MASK_NOTICE_SUP             = 1 << 22,
176         IB_PORT_BOOT_MGMT_SUP                   = 1 << 23,
177         IB_PORT_LINK_LATENCY_SUP                = 1 << 24,
178         IB_PORT_CLIENT_REG_SUP                  = 1 << 25
179 };
180
181 enum ib_port_width {
182         IB_WIDTH_1X     = 1,
183         IB_WIDTH_4X     = 2,
184         IB_WIDTH_8X     = 4,
185         IB_WIDTH_12X    = 8
186 };
187
188 static inline int ib_width_enum_to_int(enum ib_port_width width)
189 {
190         switch (width) {
191         case IB_WIDTH_1X:  return  1;
192         case IB_WIDTH_4X:  return  4;
193         case IB_WIDTH_8X:  return  8;
194         case IB_WIDTH_12X: return 12;
195         default:          return -1;
196         }
197 }
198
199 struct ib_port_attr {
200         enum ib_port_state      state;
201         enum ib_mtu             max_mtu;
202         enum ib_mtu             active_mtu;
203         int                     gid_tbl_len;
204         u32                     port_cap_flags;
205         u32                     max_msg_sz;
206         u32                     bad_pkey_cntr;
207         u32                     qkey_viol_cntr;
208         u16                     pkey_tbl_len;
209         u16                     lid;
210         u16                     sm_lid;
211         u8                      lmc;
212         u8                      max_vl_num;
213         u8                      sm_sl;
214         u8                      subnet_timeout;
215         u8                      init_type_reply;
216         u8                      active_width;
217         u8                      active_speed;
218         u8                      phys_state;
219 };
220
221 enum ib_device_modify_flags {
222         IB_DEVICE_MODIFY_SYS_IMAGE_GUID = 1
223 };
224
225 struct ib_device_modify {
226         u64     sys_image_guid;
227 };
228
229 enum ib_port_modify_flags {
230         IB_PORT_SHUTDOWN                = 1,
231         IB_PORT_INIT_TYPE               = (1<<2),
232         IB_PORT_RESET_QKEY_CNTR         = (1<<3)
233 };
234
235 struct ib_port_modify {
236         u32     set_port_cap_mask;
237         u32     clr_port_cap_mask;
238         u8      init_type;
239 };
240
241 enum ib_event_type {
242         IB_EVENT_CQ_ERR,
243         IB_EVENT_QP_FATAL,
244         IB_EVENT_QP_REQ_ERR,
245         IB_EVENT_QP_ACCESS_ERR,
246         IB_EVENT_COMM_EST,
247         IB_EVENT_SQ_DRAINED,
248         IB_EVENT_PATH_MIG,
249         IB_EVENT_PATH_MIG_ERR,
250         IB_EVENT_DEVICE_FATAL,
251         IB_EVENT_PORT_ACTIVE,
252         IB_EVENT_PORT_ERR,
253         IB_EVENT_LID_CHANGE,
254         IB_EVENT_PKEY_CHANGE,
255         IB_EVENT_SM_CHANGE
256 };
257
258 struct ib_event {
259         struct ib_device        *device;
260         union {
261                 struct ib_cq    *cq;
262                 struct ib_qp    *qp;
263                 u8              port_num;
264         } element;
265         enum ib_event_type      event;
266 };
267
268 struct ib_event_handler {
269         struct ib_device *device;
270         void            (*handler)(struct ib_event_handler *, struct ib_event *);
271         struct list_head  list;
272 };
273
274 #define INIT_IB_EVENT_HANDLER(_ptr, _device, _handler)          \
275         do {                                                    \
276                 (_ptr)->device  = _device;                      \
277                 (_ptr)->handler = _handler;                     \
278                 INIT_LIST_HEAD(&(_ptr)->list);                  \
279         } while (0)
280
281 struct ib_global_route {
282         union ib_gid    dgid;
283         u32             flow_label;
284         u8              sgid_index;
285         u8              hop_limit;
286         u8              traffic_class;
287 };
288
289 enum {
290         IB_MULTICAST_QPN = 0xffffff
291 };
292
293 enum ib_ah_flags {
294         IB_AH_GRH       = 1
295 };
296
297 struct ib_ah_attr {
298         struct ib_global_route  grh;
299         u16                     dlid;
300         u8                      sl;
301         u8                      src_path_bits;
302         u8                      static_rate;
303         u8                      ah_flags;
304         u8                      port_num;
305 };
306
307 enum ib_wc_status {
308         IB_WC_SUCCESS,
309         IB_WC_LOC_LEN_ERR,
310         IB_WC_LOC_QP_OP_ERR,
311         IB_WC_LOC_EEC_OP_ERR,
312         IB_WC_LOC_PROT_ERR,
313         IB_WC_WR_FLUSH_ERR,
314         IB_WC_MW_BIND_ERR,
315         IB_WC_BAD_RESP_ERR,
316         IB_WC_LOC_ACCESS_ERR,
317         IB_WC_REM_INV_REQ_ERR,
318         IB_WC_REM_ACCESS_ERR,
319         IB_WC_REM_OP_ERR,
320         IB_WC_RETRY_EXC_ERR,
321         IB_WC_RNR_RETRY_EXC_ERR,
322         IB_WC_LOC_RDD_VIOL_ERR,
323         IB_WC_REM_INV_RD_REQ_ERR,
324         IB_WC_REM_ABORT_ERR,
325         IB_WC_INV_EECN_ERR,
326         IB_WC_INV_EEC_STATE_ERR,
327         IB_WC_FATAL_ERR,
328         IB_WC_RESP_TIMEOUT_ERR,
329         IB_WC_GENERAL_ERR
330 };
331
332 enum ib_wc_opcode {
333         IB_WC_SEND,
334         IB_WC_RDMA_WRITE,
335         IB_WC_RDMA_READ,
336         IB_WC_COMP_SWAP,
337         IB_WC_FETCH_ADD,
338         IB_WC_BIND_MW,
339 /*
340  * Set value of IB_WC_RECV so consumers can test if a completion is a
341  * receive by testing (opcode & IB_WC_RECV).
342  */
343         IB_WC_RECV                      = 1 << 7,
344         IB_WC_RECV_RDMA_WITH_IMM
345 };
346
347 enum ib_wc_flags {
348         IB_WC_GRH               = 1,
349         IB_WC_WITH_IMM          = (1<<1)
350 };
351
352 struct ib_wc {
353         u64                     wr_id;
354         enum ib_wc_status       status;
355         enum ib_wc_opcode       opcode;
356         u32                     vendor_err;
357         u32                     byte_len;
358         __be32                  imm_data;
359         u32                     qp_num;
360         u32                     src_qp;
361         int                     wc_flags;
362         u16                     pkey_index;
363         u16                     slid;
364         u8                      sl;
365         u8                      dlid_path_bits;
366         u8                      port_num;       /* valid only for DR SMPs on switches */
367 };
368
369 enum ib_cq_notify {
370         IB_CQ_SOLICITED,
371         IB_CQ_NEXT_COMP
372 };
373
374 struct ib_qp_cap {
375         u32     max_send_wr;
376         u32     max_recv_wr;
377         u32     max_send_sge;
378         u32     max_recv_sge;
379         u32     max_inline_data;
380 };
381
382 enum ib_sig_type {
383         IB_SIGNAL_ALL_WR,
384         IB_SIGNAL_REQ_WR
385 };
386
387 enum ib_qp_type {
388         /*
389          * IB_QPT_SMI and IB_QPT_GSI have to be the first two entries
390          * here (and in that order) since the MAD layer uses them as
391          * indices into a 2-entry table.
392          */
393         IB_QPT_SMI,
394         IB_QPT_GSI,
395
396         IB_QPT_RC,
397         IB_QPT_UC,
398         IB_QPT_UD,
399         IB_QPT_RAW_IPV6,
400         IB_QPT_RAW_ETY
401 };
402
403 struct ib_qp_init_attr {
404         void                  (*event_handler)(struct ib_event *, void *);
405         void                   *qp_context;
406         struct ib_cq           *send_cq;
407         struct ib_cq           *recv_cq;
408         struct ib_srq          *srq;
409         struct ib_qp_cap        cap;
410         enum ib_sig_type        sq_sig_type;
411         enum ib_sig_type        rq_sig_type;
412         enum ib_qp_type         qp_type;
413         u8                      port_num; /* special QP types only */
414 };
415
416 enum ib_rnr_timeout {
417         IB_RNR_TIMER_655_36 =  0,
418         IB_RNR_TIMER_000_01 =  1,
419         IB_RNR_TIMER_000_02 =  2,
420         IB_RNR_TIMER_000_03 =  3,
421         IB_RNR_TIMER_000_04 =  4,
422         IB_RNR_TIMER_000_06 =  5,
423         IB_RNR_TIMER_000_08 =  6,
424         IB_RNR_TIMER_000_12 =  7,
425         IB_RNR_TIMER_000_16 =  8,
426         IB_RNR_TIMER_000_24 =  9,
427         IB_RNR_TIMER_000_32 = 10,
428         IB_RNR_TIMER_000_48 = 11,
429         IB_RNR_TIMER_000_64 = 12,
430         IB_RNR_TIMER_000_96 = 13,
431         IB_RNR_TIMER_001_28 = 14,
432         IB_RNR_TIMER_001_92 = 15,
433         IB_RNR_TIMER_002_56 = 16,
434         IB_RNR_TIMER_003_84 = 17,
435         IB_RNR_TIMER_005_12 = 18,
436         IB_RNR_TIMER_007_68 = 19,
437         IB_RNR_TIMER_010_24 = 20,
438         IB_RNR_TIMER_015_36 = 21,
439         IB_RNR_TIMER_020_48 = 22,
440         IB_RNR_TIMER_030_72 = 23,
441         IB_RNR_TIMER_040_96 = 24,
442         IB_RNR_TIMER_061_44 = 25,
443         IB_RNR_TIMER_081_92 = 26,
444         IB_RNR_TIMER_122_88 = 27,
445         IB_RNR_TIMER_163_84 = 28,
446         IB_RNR_TIMER_245_76 = 29,
447         IB_RNR_TIMER_327_68 = 30,
448         IB_RNR_TIMER_491_52 = 31
449 };
450
451 enum ib_qp_attr_mask {
452         IB_QP_STATE                     = 1,
453         IB_QP_CUR_STATE                 = (1<<1),
454         IB_QP_EN_SQD_ASYNC_NOTIFY       = (1<<2),
455         IB_QP_ACCESS_FLAGS              = (1<<3),
456         IB_QP_PKEY_INDEX                = (1<<4),
457         IB_QP_PORT                      = (1<<5),
458         IB_QP_QKEY                      = (1<<6),
459         IB_QP_AV                        = (1<<7),
460         IB_QP_PATH_MTU                  = (1<<8),
461         IB_QP_TIMEOUT                   = (1<<9),
462         IB_QP_RETRY_CNT                 = (1<<10),
463         IB_QP_RNR_RETRY                 = (1<<11),
464         IB_QP_RQ_PSN                    = (1<<12),
465         IB_QP_MAX_QP_RD_ATOMIC          = (1<<13),
466         IB_QP_ALT_PATH                  = (1<<14),
467         IB_QP_MIN_RNR_TIMER             = (1<<15),
468         IB_QP_SQ_PSN                    = (1<<16),
469         IB_QP_MAX_DEST_RD_ATOMIC        = (1<<17),
470         IB_QP_PATH_MIG_STATE            = (1<<18),
471         IB_QP_CAP                       = (1<<19),
472         IB_QP_DEST_QPN                  = (1<<20)
473 };
474
475 enum ib_qp_state {
476         IB_QPS_RESET,
477         IB_QPS_INIT,
478         IB_QPS_RTR,
479         IB_QPS_RTS,
480         IB_QPS_SQD,
481         IB_QPS_SQE,
482         IB_QPS_ERR
483 };
484
485 enum ib_mig_state {
486         IB_MIG_MIGRATED,
487         IB_MIG_REARM,
488         IB_MIG_ARMED
489 };
490
491 struct ib_qp_attr {
492         enum ib_qp_state        qp_state;
493         enum ib_qp_state        cur_qp_state;
494         enum ib_mtu             path_mtu;
495         enum ib_mig_state       path_mig_state;
496         u32                     qkey;
497         u32                     rq_psn;
498         u32                     sq_psn;
499         u32                     dest_qp_num;
500         int                     qp_access_flags;
501         struct ib_qp_cap        cap;
502         struct ib_ah_attr       ah_attr;
503         struct ib_ah_attr       alt_ah_attr;
504         u16                     pkey_index;
505         u16                     alt_pkey_index;
506         u8                      en_sqd_async_notify;
507         u8                      sq_draining;
508         u8                      max_rd_atomic;
509         u8                      max_dest_rd_atomic;
510         u8                      min_rnr_timer;
511         u8                      port_num;
512         u8                      timeout;
513         u8                      retry_cnt;
514         u8                      rnr_retry;
515         u8                      alt_port_num;
516         u8                      alt_timeout;
517 };
518
519 enum ib_wr_opcode {
520         IB_WR_RDMA_WRITE,
521         IB_WR_RDMA_WRITE_WITH_IMM,
522         IB_WR_SEND,
523         IB_WR_SEND_WITH_IMM,
524         IB_WR_RDMA_READ,
525         IB_WR_ATOMIC_CMP_AND_SWP,
526         IB_WR_ATOMIC_FETCH_AND_ADD
527 };
528
529 enum ib_send_flags {
530         IB_SEND_FENCE           = 1,
531         IB_SEND_SIGNALED        = (1<<1),
532         IB_SEND_SOLICITED       = (1<<2),
533         IB_SEND_INLINE          = (1<<3)
534 };
535
536 enum ib_recv_flags {
537         IB_RECV_SIGNALED        = 1
538 };
539
540 struct ib_sge {
541         u64     addr;
542         u32     length;
543         u32     lkey;
544 };
545
546 struct ib_send_wr {
547         struct ib_send_wr      *next;
548         u64                     wr_id;
549         struct ib_sge          *sg_list;
550         int                     num_sge;
551         enum ib_wr_opcode       opcode;
552         int                     send_flags;
553         u32                     imm_data;
554         union {
555                 struct {
556                         u64     remote_addr;
557                         u32     rkey;
558                 } rdma;
559                 struct {
560                         u64     remote_addr;
561                         u64     compare_add;
562                         u64     swap;
563                         u32     rkey;
564                 } atomic;
565                 struct {
566                         struct ib_ah *ah;
567                         struct ib_mad_hdr *mad_hdr;
568                         u32     remote_qpn;
569                         u32     remote_qkey;
570                         int     timeout_ms; /* valid for MADs only */
571                         u16     pkey_index; /* valid for GSI only */
572                         u8      port_num;   /* valid for DR SMPs on switch only */
573                 } ud;
574         } wr;
575 };
576
577 struct ib_recv_wr {
578         struct ib_recv_wr      *next;
579         u64                     wr_id;
580         struct ib_sge          *sg_list;
581         int                     num_sge;
582         int                     recv_flags;
583 };
584
585 enum ib_access_flags {
586         IB_ACCESS_LOCAL_WRITE   = 1,
587         IB_ACCESS_REMOTE_WRITE  = (1<<1),
588         IB_ACCESS_REMOTE_READ   = (1<<2),
589         IB_ACCESS_REMOTE_ATOMIC = (1<<3),
590         IB_ACCESS_MW_BIND       = (1<<4)
591 };
592
593 struct ib_phys_buf {
594         u64      addr;
595         u64      size;
596 };
597
598 struct ib_mr_attr {
599         struct ib_pd    *pd;
600         u64             device_virt_addr;
601         u64             size;
602         int             mr_access_flags;
603         u32             lkey;
604         u32             rkey;
605 };
606
607 enum ib_mr_rereg_flags {
608         IB_MR_REREG_TRANS       = 1,
609         IB_MR_REREG_PD          = (1<<1),
610         IB_MR_REREG_ACCESS      = (1<<2)
611 };
612
613 struct ib_mw_bind {
614         struct ib_mr   *mr;
615         u64             wr_id;
616         u64             addr;
617         u32             length;
618         int             send_flags;
619         int             mw_access_flags;
620 };
621
622 struct ib_fmr_attr {
623         int     max_pages;
624         int     max_maps;
625         u8      page_size;
626 };
627
628 struct ib_pd {
629         struct ib_device *device;
630         atomic_t          usecnt; /* count all resources */
631 };
632
633 struct ib_ah {
634         struct ib_device        *device;
635         struct ib_pd            *pd;
636 };
637
638 typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
639
640 struct ib_cq {
641         struct ib_device *device;
642         ib_comp_handler   comp_handler;
643         void             (*event_handler)(struct ib_event *, void *);
644         void *            cq_context;
645         int               cqe;
646         atomic_t          usecnt; /* count number of work queues */
647 };
648
649 struct ib_srq {
650         struct ib_device        *device;
651         struct ib_pd            *pd;
652         void                    *srq_context;
653         atomic_t                usecnt;
654 };
655
656 struct ib_qp {
657         struct ib_device       *device;
658         struct ib_pd           *pd;
659         struct ib_cq           *send_cq;
660         struct ib_cq           *recv_cq;
661         struct ib_srq          *srq;
662         void                  (*event_handler)(struct ib_event *, void *);
663         void                   *qp_context;
664         u32                     qp_num;
665         enum ib_qp_type         qp_type;
666 };
667
668 struct ib_mr {
669         struct ib_device *device;
670         struct ib_pd     *pd;
671         u32               lkey;
672         u32               rkey;
673         atomic_t          usecnt; /* count number of MWs */
674 };
675
676 struct ib_mw {
677         struct ib_device        *device;
678         struct ib_pd            *pd;
679         u32                     rkey;
680 };
681
682 struct ib_fmr {
683         struct ib_device        *device;
684         struct ib_pd            *pd;
685         struct list_head        list;
686         u32                     lkey;
687         u32                     rkey;
688 };
689
690 struct ib_mad;
691 struct ib_grh;
692
693 enum ib_process_mad_flags {
694         IB_MAD_IGNORE_MKEY      = 1,
695         IB_MAD_IGNORE_BKEY      = 2,
696         IB_MAD_IGNORE_ALL       = IB_MAD_IGNORE_MKEY | IB_MAD_IGNORE_BKEY
697 };
698
699 enum ib_mad_result {
700         IB_MAD_RESULT_FAILURE  = 0,      /* (!SUCCESS is the important flag) */
701         IB_MAD_RESULT_SUCCESS  = 1 << 0, /* MAD was successfully processed   */
702         IB_MAD_RESULT_REPLY    = 1 << 1, /* Reply packet needs to be sent    */
703         IB_MAD_RESULT_CONSUMED = 1 << 2  /* Packet consumed: stop processing */
704 };
705
706 #define IB_DEVICE_NAME_MAX 64
707
708 struct ib_cache {
709         rwlock_t                lock;
710         struct ib_event_handler event_handler;
711         struct ib_pkey_cache  **pkey_cache;
712         struct ib_gid_cache   **gid_cache;
713 };
714
715 struct ib_device {
716         struct device                *dma_device;
717
718         char                          name[IB_DEVICE_NAME_MAX];
719
720         struct list_head              event_handler_list;
721         spinlock_t                    event_handler_lock;
722
723         struct list_head              core_list;
724         struct list_head              client_data_list;
725         spinlock_t                    client_data_lock;
726
727         struct ib_cache               cache;
728
729         u32                           flags;
730
731         int                        (*query_device)(struct ib_device *device,
732                                                    struct ib_device_attr *device_attr);
733         int                        (*query_port)(struct ib_device *device,
734                                                  u8 port_num,
735                                                  struct ib_port_attr *port_attr);
736         int                        (*query_gid)(struct ib_device *device,
737                                                 u8 port_num, int index,
738                                                 union ib_gid *gid);
739         int                        (*query_pkey)(struct ib_device *device,
740                                                  u8 port_num, u16 index, u16 *pkey);
741         int                        (*modify_device)(struct ib_device *device,
742                                                     int device_modify_mask,
743                                                     struct ib_device_modify *device_modify);
744         int                        (*modify_port)(struct ib_device *device,
745                                                   u8 port_num, int port_modify_mask,
746                                                   struct ib_port_modify *port_modify);
747         struct ib_pd *             (*alloc_pd)(struct ib_device *device);
748         int                        (*dealloc_pd)(struct ib_pd *pd);
749         struct ib_ah *             (*create_ah)(struct ib_pd *pd,
750                                                 struct ib_ah_attr *ah_attr);
751         int                        (*modify_ah)(struct ib_ah *ah,
752                                                 struct ib_ah_attr *ah_attr);
753         int                        (*query_ah)(struct ib_ah *ah,
754                                                struct ib_ah_attr *ah_attr);
755         int                        (*destroy_ah)(struct ib_ah *ah);
756         struct ib_qp *             (*create_qp)(struct ib_pd *pd,
757                                                 struct ib_qp_init_attr *qp_init_attr);
758         int                        (*modify_qp)(struct ib_qp *qp,
759                                                 struct ib_qp_attr *qp_attr,
760                                                 int qp_attr_mask);
761         int                        (*query_qp)(struct ib_qp *qp,
762                                                struct ib_qp_attr *qp_attr,
763                                                int qp_attr_mask,
764                                                struct ib_qp_init_attr *qp_init_attr);
765         int                        (*destroy_qp)(struct ib_qp *qp);
766         int                        (*post_send)(struct ib_qp *qp,
767                                                 struct ib_send_wr *send_wr,
768                                                 struct ib_send_wr **bad_send_wr);
769         int                        (*post_recv)(struct ib_qp *qp,
770                                                 struct ib_recv_wr *recv_wr,
771                                                 struct ib_recv_wr **bad_recv_wr);
772         struct ib_cq *             (*create_cq)(struct ib_device *device,
773                                                 int cqe);
774         int                        (*destroy_cq)(struct ib_cq *cq);
775         int                        (*resize_cq)(struct ib_cq *cq, int *cqe);
776         int                        (*poll_cq)(struct ib_cq *cq, int num_entries,
777                                               struct ib_wc *wc);
778         int                        (*peek_cq)(struct ib_cq *cq, int wc_cnt);
779         int                        (*req_notify_cq)(struct ib_cq *cq,
780                                                     enum ib_cq_notify cq_notify);
781         int                        (*req_ncomp_notif)(struct ib_cq *cq,
782                                                       int wc_cnt);
783         struct ib_mr *             (*get_dma_mr)(struct ib_pd *pd,
784                                                  int mr_access_flags);
785         struct ib_mr *             (*reg_phys_mr)(struct ib_pd *pd,
786                                                   struct ib_phys_buf *phys_buf_array,
787                                                   int num_phys_buf,
788                                                   int mr_access_flags,
789                                                   u64 *iova_start);
790         int                        (*query_mr)(struct ib_mr *mr,
791                                                struct ib_mr_attr *mr_attr);
792         int                        (*dereg_mr)(struct ib_mr *mr);
793         int                        (*rereg_phys_mr)(struct ib_mr *mr,
794                                                     int mr_rereg_mask,
795                                                     struct ib_pd *pd,
796                                                     struct ib_phys_buf *phys_buf_array,
797                                                     int num_phys_buf,
798                                                     int mr_access_flags,
799                                                     u64 *iova_start);
800         struct ib_mw *             (*alloc_mw)(struct ib_pd *pd);
801         int                        (*bind_mw)(struct ib_qp *qp,
802                                               struct ib_mw *mw,
803                                               struct ib_mw_bind *mw_bind);
804         int                        (*dealloc_mw)(struct ib_mw *mw);
805         struct ib_fmr *            (*alloc_fmr)(struct ib_pd *pd,
806                                                 int mr_access_flags,
807                                                 struct ib_fmr_attr *fmr_attr);
808         int                        (*map_phys_fmr)(struct ib_fmr *fmr,
809                                                    u64 *page_list, int list_len,
810                                                    u64 iova);
811         int                        (*unmap_fmr)(struct list_head *fmr_list);
812         int                        (*dealloc_fmr)(struct ib_fmr *fmr);
813         int                        (*attach_mcast)(struct ib_qp *qp,
814                                                    union ib_gid *gid,
815                                                    u16 lid);
816         int                        (*detach_mcast)(struct ib_qp *qp,
817                                                    union ib_gid *gid,
818                                                    u16 lid);
819         int                        (*process_mad)(struct ib_device *device,
820                                                   int process_mad_flags,
821                                                   u8 port_num,
822                                                   struct ib_wc *in_wc,
823                                                   struct ib_grh *in_grh,
824                                                   struct ib_mad *in_mad,
825                                                   struct ib_mad *out_mad);
826
827         struct class_device          class_dev;
828         struct kobject               ports_parent;
829         struct list_head             port_list;
830
831         enum {
832                 IB_DEV_UNINITIALIZED,
833                 IB_DEV_REGISTERED,
834                 IB_DEV_UNREGISTERED
835         }                            reg_state;
836
837         u8                           node_type;
838         u8                           phys_port_cnt;
839 };
840
841 struct ib_client {
842         char  *name;
843         void (*add)   (struct ib_device *);
844         void (*remove)(struct ib_device *);
845
846         struct list_head list;
847 };
848
849 struct ib_device *ib_alloc_device(size_t size);
850 void ib_dealloc_device(struct ib_device *device);
851
852 int ib_register_device   (struct ib_device *device);
853 void ib_unregister_device(struct ib_device *device);
854
855 int ib_register_client   (struct ib_client *client);
856 void ib_unregister_client(struct ib_client *client);
857
858 void *ib_get_client_data(struct ib_device *device, struct ib_client *client);
859 void  ib_set_client_data(struct ib_device *device, struct ib_client *client,
860                          void *data);
861
862 int ib_register_event_handler  (struct ib_event_handler *event_handler);
863 int ib_unregister_event_handler(struct ib_event_handler *event_handler);
864 void ib_dispatch_event(struct ib_event *event);
865
866 int ib_query_device(struct ib_device *device,
867                     struct ib_device_attr *device_attr);
868
869 int ib_query_port(struct ib_device *device,
870                   u8 port_num, struct ib_port_attr *port_attr);
871
872 int ib_query_gid(struct ib_device *device,
873                  u8 port_num, int index, union ib_gid *gid);
874
875 int ib_query_pkey(struct ib_device *device,
876                   u8 port_num, u16 index, u16 *pkey);
877
878 int ib_modify_device(struct ib_device *device,
879                      int device_modify_mask,
880                      struct ib_device_modify *device_modify);
881
882 int ib_modify_port(struct ib_device *device,
883                    u8 port_num, int port_modify_mask,
884                    struct ib_port_modify *port_modify);
885
886 /**
887  * ib_alloc_pd - Allocates an unused protection domain.
888  * @device: The device on which to allocate the protection domain.
889  *
890  * A protection domain object provides an association between QPs, shared
891  * receive queues, address handles, memory regions, and memory windows.
892  */
893 struct ib_pd *ib_alloc_pd(struct ib_device *device);
894
895 /**
896  * ib_dealloc_pd - Deallocates a protection domain.
897  * @pd: The protection domain to deallocate.
898  */
899 int ib_dealloc_pd(struct ib_pd *pd);
900
901 /**
902  * ib_create_ah - Creates an address handle for the given address vector.
903  * @pd: The protection domain associated with the address handle.
904  * @ah_attr: The attributes of the address vector.
905  *
906  * The address handle is used to reference a local or global destination
907  * in all UD QP post sends.
908  */
909 struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
910
911 /**
912  * ib_modify_ah - Modifies the address vector associated with an address
913  *   handle.
914  * @ah: The address handle to modify.
915  * @ah_attr: The new address vector attributes to associate with the
916  *   address handle.
917  */
918 int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
919
920 /**
921  * ib_query_ah - Queries the address vector associated with an address
922  *   handle.
923  * @ah: The address handle to query.
924  * @ah_attr: The address vector attributes associated with the address
925  *   handle.
926  */
927 int ib_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
928
929 /**
930  * ib_destroy_ah - Destroys an address handle.
931  * @ah: The address handle to destroy.
932  */
933 int ib_destroy_ah(struct ib_ah *ah);
934
935 /**
936  * ib_create_qp - Creates a QP associated with the specified protection
937  *   domain.
938  * @pd: The protection domain associated with the QP.
939  * @qp_init_attr: A list of initial attributes required to create the QP.
940  */
941 struct ib_qp *ib_create_qp(struct ib_pd *pd,
942                            struct ib_qp_init_attr *qp_init_attr);
943
944 /**
945  * ib_modify_qp - Modifies the attributes for the specified QP and then
946  *   transitions the QP to the given state.
947  * @qp: The QP to modify.
948  * @qp_attr: On input, specifies the QP attributes to modify.  On output,
949  *   the current values of selected QP attributes are returned.
950  * @qp_attr_mask: A bit-mask used to specify which attributes of the QP
951  *   are being modified.
952  */
953 int ib_modify_qp(struct ib_qp *qp,
954                  struct ib_qp_attr *qp_attr,
955                  int qp_attr_mask);
956
957 /**
958  * ib_query_qp - Returns the attribute list and current values for the
959  *   specified QP.
960  * @qp: The QP to query.
961  * @qp_attr: The attributes of the specified QP.
962  * @qp_attr_mask: A bit-mask used to select specific attributes to query.
963  * @qp_init_attr: Additional attributes of the selected QP.
964  *
965  * The qp_attr_mask may be used to limit the query to gathering only the
966  * selected attributes.
967  */
968 int ib_query_qp(struct ib_qp *qp,
969                 struct ib_qp_attr *qp_attr,
970                 int qp_attr_mask,
971                 struct ib_qp_init_attr *qp_init_attr);
972
973 /**
974  * ib_destroy_qp - Destroys the specified QP.
975  * @qp: The QP to destroy.
976  */
977 int ib_destroy_qp(struct ib_qp *qp);
978
979 /**
980  * ib_post_send - Posts a list of work requests to the send queue of
981  *   the specified QP.
982  * @qp: The QP to post the work request on.
983  * @send_wr: A list of work requests to post on the send queue.
984  * @bad_send_wr: On an immediate failure, this parameter will reference
985  *   the work request that failed to be posted on the QP.
986  */
987 static inline int ib_post_send(struct ib_qp *qp,
988                                struct ib_send_wr *send_wr,
989                                struct ib_send_wr **bad_send_wr)
990 {
991         return qp->device->post_send(qp, send_wr, bad_send_wr);
992 }
993
994 /**
995  * ib_post_recv - Posts a list of work requests to the receive queue of
996  *   the specified QP.
997  * @qp: The QP to post the work request on.
998  * @recv_wr: A list of work requests to post on the receive queue.
999  * @bad_recv_wr: On an immediate failure, this parameter will reference
1000  *   the work request that failed to be posted on the QP.
1001  */
1002 static inline int ib_post_recv(struct ib_qp *qp,
1003                                struct ib_recv_wr *recv_wr,
1004                                struct ib_recv_wr **bad_recv_wr)
1005 {
1006         return qp->device->post_recv(qp, recv_wr, bad_recv_wr);
1007 }
1008
1009 /**
1010  * ib_create_cq - Creates a CQ on the specified device.
1011  * @device: The device on which to create the CQ.
1012  * @comp_handler: A user-specified callback that is invoked when a
1013  *   completion event occurs on the CQ.
1014  * @event_handler: A user-specified callback that is invoked when an
1015  *   asynchronous event not associated with a completion occurs on the CQ.
1016  * @cq_context: Context associated with the CQ returned to the user via
1017  *   the associated completion and event handlers.
1018  * @cqe: The minimum size of the CQ.
1019  *
1020  * Users can examine the cq structure to determine the actual CQ size.
1021  */
1022 struct ib_cq *ib_create_cq(struct ib_device *device,
1023                            ib_comp_handler comp_handler,
1024                            void (*event_handler)(struct ib_event *, void *),
1025                            void *cq_context, int cqe);
1026
1027 /**
1028  * ib_resize_cq - Modifies the capacity of the CQ.
1029  * @cq: The CQ to resize.
1030  * @cqe: The minimum size of the CQ.
1031  *
1032  * Users can examine the cq structure to determine the actual CQ size.
1033  */
1034 int ib_resize_cq(struct ib_cq *cq, int cqe);
1035
1036 /**
1037  * ib_destroy_cq - Destroys the specified CQ.
1038  * @cq: The CQ to destroy.
1039  */
1040 int ib_destroy_cq(struct ib_cq *cq);
1041
1042 /**
1043  * ib_poll_cq - poll a CQ for completion(s)
1044  * @cq:the CQ being polled
1045  * @num_entries:maximum number of completions to return
1046  * @wc:array of at least @num_entries &struct ib_wc where completions
1047  *   will be returned
1048  *
1049  * Poll a CQ for (possibly multiple) completions.  If the return value
1050  * is < 0, an error occurred.  If the return value is >= 0, it is the
1051  * number of completions returned.  If the return value is
1052  * non-negative and < num_entries, then the CQ was emptied.
1053  */
1054 static inline int ib_poll_cq(struct ib_cq *cq, int num_entries,
1055                              struct ib_wc *wc)
1056 {
1057         return cq->device->poll_cq(cq, num_entries, wc);
1058 }
1059
1060 /**
1061  * ib_peek_cq - Returns the number of unreaped completions currently
1062  *   on the specified CQ.
1063  * @cq: The CQ to peek.
1064  * @wc_cnt: A minimum number of unreaped completions to check for.
1065  *
1066  * If the number of unreaped completions is greater than or equal to wc_cnt,
1067  * this function returns wc_cnt, otherwise, it returns the actual number of
1068  * unreaped completions.
1069  */
1070 int ib_peek_cq(struct ib_cq *cq, int wc_cnt);
1071
1072 /**
1073  * ib_req_notify_cq - Request completion notification on a CQ.
1074  * @cq: The CQ to generate an event for.
1075  * @cq_notify: If set to %IB_CQ_SOLICITED, completion notification will
1076  *   occur on the next solicited event. If set to %IB_CQ_NEXT_COMP,
1077  *   notification will occur on the next completion.
1078  */
1079 static inline int ib_req_notify_cq(struct ib_cq *cq,
1080                                    enum ib_cq_notify cq_notify)
1081 {
1082         return cq->device->req_notify_cq(cq, cq_notify);
1083 }
1084
1085 /**
1086  * ib_req_ncomp_notif - Request completion notification when there are
1087  *   at least the specified number of unreaped completions on the CQ.
1088  * @cq: The CQ to generate an event for.
1089  * @wc_cnt: The number of unreaped completions that should be on the
1090  *   CQ before an event is generated.
1091  */
1092 static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt)
1093 {
1094         return cq->device->req_ncomp_notif ?
1095                 cq->device->req_ncomp_notif(cq, wc_cnt) :
1096                 -ENOSYS;
1097 }
1098
1099 /**
1100  * ib_get_dma_mr - Returns a memory region for system memory that is
1101  *   usable for DMA.
1102  * @pd: The protection domain associated with the memory region.
1103  * @mr_access_flags: Specifies the memory access rights.
1104  */
1105 struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags);
1106
1107 /**
1108  * ib_reg_phys_mr - Prepares a virtually addressed memory region for use
1109  *   by an HCA.
1110  * @pd: The protection domain associated assigned to the registered region.
1111  * @phys_buf_array: Specifies a list of physical buffers to use in the
1112  *   memory region.
1113  * @num_phys_buf: Specifies the size of the phys_buf_array.
1114  * @mr_access_flags: Specifies the memory access rights.
1115  * @iova_start: The offset of the region's starting I/O virtual address.
1116  */
1117 struct ib_mr *ib_reg_phys_mr(struct ib_pd *pd,
1118                              struct ib_phys_buf *phys_buf_array,
1119                              int num_phys_buf,
1120                              int mr_access_flags,
1121                              u64 *iova_start);
1122
1123 /**
1124  * ib_rereg_phys_mr - Modifies the attributes of an existing memory region.
1125  *   Conceptually, this call performs the functions deregister memory region
1126  *   followed by register physical memory region.  Where possible,
1127  *   resources are reused instead of deallocated and reallocated.
1128  * @mr: The memory region to modify.
1129  * @mr_rereg_mask: A bit-mask used to indicate which of the following
1130  *   properties of the memory region are being modified.
1131  * @pd: If %IB_MR_REREG_PD is set in mr_rereg_mask, this field specifies
1132  *   the new protection domain to associated with the memory region,
1133  *   otherwise, this parameter is ignored.
1134  * @phys_buf_array: If %IB_MR_REREG_TRANS is set in mr_rereg_mask, this
1135  *   field specifies a list of physical buffers to use in the new
1136  *   translation, otherwise, this parameter is ignored.
1137  * @num_phys_buf: If %IB_MR_REREG_TRANS is set in mr_rereg_mask, this
1138  *   field specifies the size of the phys_buf_array, otherwise, this
1139  *   parameter is ignored.
1140  * @mr_access_flags: If %IB_MR_REREG_ACCESS is set in mr_rereg_mask, this
1141  *   field specifies the new memory access rights, otherwise, this
1142  *   parameter is ignored.
1143  * @iova_start: The offset of the region's starting I/O virtual address.
1144  */
1145 int ib_rereg_phys_mr(struct ib_mr *mr,
1146                      int mr_rereg_mask,
1147                      struct ib_pd *pd,
1148                      struct ib_phys_buf *phys_buf_array,
1149                      int num_phys_buf,
1150                      int mr_access_flags,
1151                      u64 *iova_start);
1152
1153 /**
1154  * ib_query_mr - Retrieves information about a specific memory region.
1155  * @mr: The memory region to retrieve information about.
1156  * @mr_attr: The attributes of the specified memory region.
1157  */
1158 int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
1159
1160 /**
1161  * ib_dereg_mr - Deregisters a memory region and removes it from the
1162  *   HCA translation table.
1163  * @mr: The memory region to deregister.
1164  */
1165 int ib_dereg_mr(struct ib_mr *mr);
1166
1167 /**
1168  * ib_alloc_mw - Allocates a memory window.
1169  * @pd: The protection domain associated with the memory window.
1170  */
1171 struct ib_mw *ib_alloc_mw(struct ib_pd *pd);
1172
1173 /**
1174  * ib_bind_mw - Posts a work request to the send queue of the specified
1175  *   QP, which binds the memory window to the given address range and
1176  *   remote access attributes.
1177  * @qp: QP to post the bind work request on.
1178  * @mw: The memory window to bind.
1179  * @mw_bind: Specifies information about the memory window, including
1180  *   its address range, remote access rights, and associated memory region.
1181  */
1182 static inline int ib_bind_mw(struct ib_qp *qp,
1183                              struct ib_mw *mw,
1184                              struct ib_mw_bind *mw_bind)
1185 {
1186         /* XXX reference counting in corresponding MR? */
1187         return mw->device->bind_mw ?
1188                 mw->device->bind_mw(qp, mw, mw_bind) :
1189                 -ENOSYS;
1190 }
1191
1192 /**
1193  * ib_dealloc_mw - Deallocates a memory window.
1194  * @mw: The memory window to deallocate.
1195  */
1196 int ib_dealloc_mw(struct ib_mw *mw);
1197
1198 /**
1199  * ib_alloc_fmr - Allocates a unmapped fast memory region.
1200  * @pd: The protection domain associated with the unmapped region.
1201  * @mr_access_flags: Specifies the memory access rights.
1202  * @fmr_attr: Attributes of the unmapped region.
1203  *
1204  * A fast memory region must be mapped before it can be used as part of
1205  * a work request.
1206  */
1207 struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd,
1208                             int mr_access_flags,
1209                             struct ib_fmr_attr *fmr_attr);
1210
1211 /**
1212  * ib_map_phys_fmr - Maps a list of physical pages to a fast memory region.
1213  * @fmr: The fast memory region to associate with the pages.
1214  * @page_list: An array of physical pages to map to the fast memory region.
1215  * @list_len: The number of pages in page_list.
1216  * @iova: The I/O virtual address to use with the mapped region.
1217  */
1218 static inline int ib_map_phys_fmr(struct ib_fmr *fmr,
1219                                   u64 *page_list, int list_len,
1220                                   u64 iova)
1221 {
1222         return fmr->device->map_phys_fmr(fmr, page_list, list_len, iova);
1223 }
1224
1225 /**
1226  * ib_unmap_fmr - Removes the mapping from a list of fast memory regions.
1227  * @fmr_list: A linked list of fast memory regions to unmap.
1228  */
1229 int ib_unmap_fmr(struct list_head *fmr_list);
1230
1231 /**
1232  * ib_dealloc_fmr - Deallocates a fast memory region.
1233  * @fmr: The fast memory region to deallocate.
1234  */
1235 int ib_dealloc_fmr(struct ib_fmr *fmr);
1236
1237 /**
1238  * ib_attach_mcast - Attaches the specified QP to a multicast group.
1239  * @qp: QP to attach to the multicast group.  The QP must be type
1240  *   IB_QPT_UD.
1241  * @gid: Multicast group GID.
1242  * @lid: Multicast group LID in host byte order.
1243  *
1244  * In order to send and receive multicast packets, subnet
1245  * administration must have created the multicast group and configured
1246  * the fabric appropriately.  The port associated with the specified
1247  * QP must also be a member of the multicast group.
1248  */
1249 int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
1250
1251 /**
1252  * ib_detach_mcast - Detaches the specified QP from a multicast group.
1253  * @qp: QP to detach from the multicast group.
1254  * @gid: Multicast group GID.
1255  * @lid: Multicast group LID in host byte order.
1256  */
1257 int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
1258
1259 #endif /* IB_VERBS_H */