2 * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44 struct ibv_context_1_0 *context;
47 struct ibv_pd *real_pd;
51 struct ibv_context_1_0 *context;
52 struct ibv_pd_1_0 *pd;
57 struct ibv_mr *real_mr;
61 struct ibv_context_1_0 *context;
63 struct ibv_pd_1_0 *pd;
66 pthread_mutex_t mutex;
68 uint32_t events_completed;
70 struct ibv_srq *real_srq;
73 struct ibv_qp_init_attr_1_0 {
75 struct ibv_cq_1_0 *send_cq;
76 struct ibv_cq_1_0 *recv_cq;
77 struct ibv_srq_1_0 *srq;
78 struct ibv_qp_cap cap;
79 enum ibv_qp_type qp_type;
83 struct ibv_send_wr_1_0 {
84 struct ibv_send_wr_1_0 *next;
86 struct ibv_sge *sg_list;
88 enum ibv_wr_opcode opcode;
103 struct ibv_ah_1_0 *ah;
105 uint32_t remote_qkey;
110 struct ibv_recv_wr_1_0 {
111 struct ibv_recv_wr_1_0 *next;
113 struct ibv_sge *sg_list;
118 struct ibv_context_1_0 *context;
120 struct ibv_pd_1_0 *pd;
121 struct ibv_cq_1_0 *send_cq;
122 struct ibv_cq_1_0 *recv_cq;
123 struct ibv_srq_1_0 *srq;
126 enum ibv_qp_state state;
127 enum ibv_qp_type qp_type;
129 pthread_mutex_t mutex;
131 uint32_t events_completed;
133 struct ibv_qp *real_qp;
137 struct ibv_context_1_0 *context;
142 pthread_mutex_t mutex;
144 uint32_t comp_events_completed;
145 uint32_t async_events_completed;
147 struct ibv_cq *real_cq;
151 struct ibv_context_1_0 *context;
152 struct ibv_pd_1_0 *pd;
155 struct ibv_ah *real_ah;
158 struct ibv_device_1_0 {
159 void *obsolete_sysfs_dev;
160 void *obsolete_sysfs_ibdev;
161 struct ibv_device *real_device; /* was obsolete driver member */
162 struct _ibv_device_ops _ops;
165 struct ibv_context_ops_1_0 {
166 int (*query_device)(struct ibv_context *context,
167 struct ibv_device_attr *device_attr);
168 int (*query_port)(struct ibv_context *context, uint8_t port_num,
169 struct ibv_port_attr *port_attr);
170 struct ibv_pd * (*alloc_pd)(struct ibv_context *context);
171 int (*dealloc_pd)(struct ibv_pd *pd);
172 struct ibv_mr * (*reg_mr)(struct ibv_pd *pd, void *addr, size_t length,
174 int (*dereg_mr)(struct ibv_mr *mr);
175 struct ibv_cq * (*create_cq)(struct ibv_context *context, int cqe,
176 struct ibv_comp_channel *channel,
178 int (*poll_cq)(struct ibv_cq_1_0 *cq, int num_entries,
180 int (*req_notify_cq)(struct ibv_cq_1_0 *cq,
182 void (*cq_event)(struct ibv_cq *cq);
183 int (*resize_cq)(struct ibv_cq *cq, int cqe);
184 int (*destroy_cq)(struct ibv_cq *cq);
185 struct ibv_srq * (*create_srq)(struct ibv_pd *pd,
186 struct ibv_srq_init_attr *srq_init_attr);
187 int (*modify_srq)(struct ibv_srq *srq,
188 struct ibv_srq_attr *srq_attr,
190 int (*query_srq)(struct ibv_srq *srq,
191 struct ibv_srq_attr *srq_attr);
192 int (*destroy_srq)(struct ibv_srq *srq);
193 int (*post_srq_recv)(struct ibv_srq_1_0 *srq,
194 struct ibv_recv_wr_1_0 *recv_wr,
195 struct ibv_recv_wr_1_0 **bad_recv_wr);
196 struct ibv_qp * (*create_qp)(struct ibv_pd *pd, struct ibv_qp_init_attr *attr);
197 int (*query_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr,
199 struct ibv_qp_init_attr *init_attr);
200 int (*modify_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr,
202 int (*destroy_qp)(struct ibv_qp *qp);
203 int (*post_send)(struct ibv_qp_1_0 *qp,
204 struct ibv_send_wr_1_0 *wr,
205 struct ibv_send_wr_1_0 **bad_wr);
206 int (*post_recv)(struct ibv_qp_1_0 *qp,
207 struct ibv_recv_wr_1_0 *wr,
208 struct ibv_recv_wr_1_0 **bad_wr);
209 struct ibv_ah * (*create_ah)(struct ibv_pd *pd, struct ibv_ah_attr *attr);
210 int (*destroy_ah)(struct ibv_ah *ah);
211 int (*attach_mcast)(struct ibv_qp *qp, union ibv_gid *gid,
213 int (*detach_mcast)(struct ibv_qp *qp, union ibv_gid *gid,
217 struct ibv_context_1_0 {
218 struct ibv_device_1_0 *device;
219 struct ibv_context_ops_1_0 ops;
222 int num_comp_vectors;
224 struct ibv_context *real_context; /* was abi_compat member */
227 typedef struct ibv_device *(*ibv_driver_init_func_1_1)(const char *uverbs_sys_path,
230 /* Hack to avoid GCC's -Wmissing-prototypes and the similar error from sparse
231 with these prototypes. Symbol versionining requires the goofy names, the
232 prototype must match the version in the historical 1.0 verbs.h.
234 struct ibv_device_1_0 **__ibv_get_device_list_1_0(int *num);
235 void __ibv_free_device_list_1_0(struct ibv_device_1_0 **list);
236 const char *__ibv_get_device_name_1_0(struct ibv_device_1_0 *device);
237 __be64 __ibv_get_device_guid_1_0(struct ibv_device_1_0 *device);
238 struct ibv_context_1_0 *__ibv_open_device_1_0(struct ibv_device_1_0 *device);
239 int __ibv_close_device_1_0(struct ibv_context_1_0 *context);
240 int __ibv_get_async_event_1_0(struct ibv_context_1_0 *context,
241 struct ibv_async_event *event);
242 void __ibv_ack_async_event_1_0(struct ibv_async_event *event);
243 int __ibv_query_device_1_0(struct ibv_context_1_0 *context,
244 struct ibv_device_attr *device_attr);
245 int __ibv_query_port_1_0(struct ibv_context_1_0 *context, uint8_t port_num,
246 struct ibv_port_attr *port_attr);
247 int __ibv_query_gid_1_0(struct ibv_context_1_0 *context, uint8_t port_num,
248 int index, union ibv_gid *gid);
249 int __ibv_query_pkey_1_0(struct ibv_context_1_0 *context, uint8_t port_num,
250 int index, __be16 *pkey);
251 struct ibv_pd_1_0 *__ibv_alloc_pd_1_0(struct ibv_context_1_0 *context);
252 int __ibv_dealloc_pd_1_0(struct ibv_pd_1_0 *pd);
253 struct ibv_mr_1_0 *__ibv_reg_mr_1_0(struct ibv_pd_1_0 *pd, void *addr,
254 size_t length, int access);
255 int __ibv_dereg_mr_1_0(struct ibv_mr_1_0 *mr);
256 struct ibv_cq_1_0 *__ibv_create_cq_1_0(struct ibv_context_1_0 *context, int cqe,
258 struct ibv_comp_channel *channel,
260 int __ibv_resize_cq_1_0(struct ibv_cq_1_0 *cq, int cqe);
261 int __ibv_destroy_cq_1_0(struct ibv_cq_1_0 *cq);
262 int __ibv_get_cq_event_1_0(struct ibv_comp_channel *channel,
263 struct ibv_cq_1_0 **cq, void **cq_context);
264 void __ibv_ack_cq_events_1_0(struct ibv_cq_1_0 *cq, unsigned int nevents);
266 __ibv_create_srq_1_0(struct ibv_pd_1_0 *pd,
267 struct ibv_srq_init_attr *srq_init_attr);
268 int __ibv_modify_srq_1_0(struct ibv_srq_1_0 *srq, struct ibv_srq_attr *srq_attr,
270 int __ibv_query_srq_1_0(struct ibv_srq_1_0 *srq, struct ibv_srq_attr *srq_attr);
271 int __ibv_destroy_srq_1_0(struct ibv_srq_1_0 *srq);
273 __ibv_create_qp_1_0(struct ibv_pd_1_0 *pd,
274 struct ibv_qp_init_attr_1_0 *qp_init_attr);
275 int __ibv_query_qp_1_0(struct ibv_qp_1_0 *qp, struct ibv_qp_attr *attr,
276 int attr_mask, struct ibv_qp_init_attr_1_0 *init_attr);
277 int __ibv_modify_qp_1_0(struct ibv_qp_1_0 *qp, struct ibv_qp_attr *attr,
279 int __ibv_destroy_qp_1_0(struct ibv_qp_1_0 *qp);
280 struct ibv_ah_1_0 *__ibv_create_ah_1_0(struct ibv_pd_1_0 *pd,
281 struct ibv_ah_attr *attr);
282 int __ibv_destroy_ah_1_0(struct ibv_ah_1_0 *ah);
283 int __ibv_attach_mcast_1_0(struct ibv_qp_1_0 *qp, union ibv_gid *gid,
285 int __ibv_detach_mcast_1_0(struct ibv_qp_1_0 *qp, union ibv_gid *gid,
287 void __ibv_register_driver_1_1(const char *name,
288 ibv_driver_init_func_1_1 init_func);
290 struct ibv_device_1_0 **__ibv_get_device_list_1_0(int *num)
292 struct ibv_device **real_list;
293 struct ibv_device_1_0 **l;
296 real_list = ibv_get_device_list(&n);
300 l = calloc(n + 2, sizeof (struct ibv_device_1_0 *));
302 goto free_device_list;
304 l[0] = (void *) real_list;
306 for (i = 0; i < n; ++i) {
307 l[i + 1] = calloc(1, sizeof (struct ibv_device_1_0));
310 l[i + 1]->real_device = real_list[i];
319 for (i = 1; i <= n; ++i)
325 ibv_free_device_list(real_list);
328 symver(__ibv_get_device_list_1_0, ibv_get_device_list, IBVERBS_1.0);
330 void __ibv_free_device_list_1_0(struct ibv_device_1_0 **list)
332 struct ibv_device_1_0 **l = list;
339 ibv_free_device_list((void *) list[-1]);
342 symver(__ibv_free_device_list_1_0, ibv_free_device_list, IBVERBS_1.0);
344 const char *__ibv_get_device_name_1_0(struct ibv_device_1_0 *device)
346 return ibv_get_device_name(device->real_device);
348 symver(__ibv_get_device_name_1_0, ibv_get_device_name, IBVERBS_1.0);
350 __be64 __ibv_get_device_guid_1_0(struct ibv_device_1_0 *device)
352 return ibv_get_device_guid(device->real_device);
354 symver(__ibv_get_device_guid_1_0, ibv_get_device_guid, IBVERBS_1.0);
356 static int poll_cq_wrapper_1_0(struct ibv_cq_1_0 *cq, int num_entries,
359 return cq->context->real_context->ops.poll_cq(cq->real_cq, num_entries, wc);
362 static int req_notify_cq_wrapper_1_0(struct ibv_cq_1_0 *cq, int sol_only)
364 return cq->context->real_context->ops.req_notify_cq(cq->real_cq, sol_only);
367 static int post_srq_recv_wrapper_1_0(struct ibv_srq_1_0 *srq, struct ibv_recv_wr_1_0 *wr,
368 struct ibv_recv_wr_1_0 **bad_wr)
370 struct ibv_recv_wr_1_0 *w;
371 struct ibv_recv_wr *real_wr, *head_wr = NULL, *tail_wr = NULL, *real_bad_wr;
374 for (w = wr; w; w = w->next) {
375 real_wr = alloca(sizeof *real_wr);
376 real_wr->wr_id = w->wr_id;
377 real_wr->sg_list = w->sg_list;
378 real_wr->num_sge = w->num_sge;
379 real_wr->next = NULL;
381 tail_wr->next = real_wr;
388 ret = srq->context->real_context->ops.post_srq_recv(srq->real_srq, head_wr,
392 for (real_wr = head_wr, w = wr;
394 real_wr = real_wr->next, w = w->next)
395 if (real_wr == real_bad_wr) {
404 static int post_send_wrapper_1_0(struct ibv_qp_1_0 *qp, struct ibv_send_wr_1_0 *wr,
405 struct ibv_send_wr_1_0 **bad_wr)
407 struct ibv_send_wr_1_0 *w;
408 struct ibv_send_wr *real_wr, *head_wr = NULL, *tail_wr = NULL, *real_bad_wr;
409 int is_ud = qp->qp_type == IBV_QPT_UD;
412 for (w = wr; w; w = w->next) {
413 real_wr = alloca(sizeof *real_wr);
414 real_wr->wr_id = w->wr_id;
415 real_wr->next = NULL;
417 #define TEST_SIZE_2_POINT(f1, f2) \
418 ((offsetof(struct ibv_send_wr, f1) - offsetof(struct ibv_send_wr, f2)) \
419 == offsetof(struct ibv_send_wr_1_0, f1) - offsetof(struct ibv_send_wr_1_0, f2))
420 #define TEST_SIZE_TO_END(f1) \
421 ((sizeof(struct ibv_send_wr) - offsetof(struct ibv_send_wr, f1)) == \
422 (sizeof(struct ibv_send_wr_1_0) - offsetof(struct ibv_send_wr_1_0, f1)))
424 if (TEST_SIZE_TO_END (sg_list))
425 memcpy(&real_wr->sg_list, &w->sg_list, sizeof *real_wr
426 - offsetof(struct ibv_send_wr, sg_list));
427 else if (TEST_SIZE_2_POINT (imm_data, sg_list) &&
428 TEST_SIZE_TO_END (wr)) {
429 /* we have alignment up to wr, but padding between
430 * imm_data and wr, and we know wr itself is the
432 memcpy(&real_wr->sg_list, &w->sg_list,
433 offsetof(struct ibv_send_wr, imm_data) -
434 offsetof(struct ibv_send_wr, sg_list) +
435 sizeof real_wr->imm_data);
436 memcpy(&real_wr->wr, &w->wr, sizeof real_wr->wr);
438 real_wr->sg_list = w->sg_list;
439 real_wr->num_sge = w->num_sge;
440 real_wr->opcode = w->opcode;
441 real_wr->send_flags = w->send_flags;
442 real_wr->imm_data = w->imm_data;
443 if (TEST_SIZE_TO_END (wr))
444 memcpy(&real_wr->wr, &w->wr,
447 real_wr->wr.atomic.remote_addr =
448 w->wr.atomic.remote_addr;
449 real_wr->wr.atomic.compare_add =
450 w->wr.atomic.compare_add;
451 real_wr->wr.atomic.swap =
453 real_wr->wr.atomic.rkey =
459 real_wr->wr.ud.ah = w->wr.ud.ah->real_ah;
462 tail_wr->next = real_wr;
469 ret = qp->context->real_context->ops.post_send(qp->real_qp, head_wr,
473 for (real_wr = head_wr, w = wr;
475 real_wr = real_wr->next, w = w->next)
476 if (real_wr == real_bad_wr) {
485 static int post_recv_wrapper_1_0(struct ibv_qp_1_0 *qp, struct ibv_recv_wr_1_0 *wr,
486 struct ibv_recv_wr_1_0 **bad_wr)
488 struct ibv_recv_wr_1_0 *w;
489 struct ibv_recv_wr *real_wr, *head_wr = NULL, *tail_wr = NULL, *real_bad_wr;
492 for (w = wr; w; w = w->next) {
493 real_wr = alloca(sizeof *real_wr);
494 real_wr->wr_id = w->wr_id;
495 real_wr->sg_list = w->sg_list;
496 real_wr->num_sge = w->num_sge;
497 real_wr->next = NULL;
499 tail_wr->next = real_wr;
506 ret = qp->context->real_context->ops.post_recv(qp->real_qp, head_wr,
510 for (real_wr = head_wr, w = wr;
512 real_wr = real_wr->next, w = w->next)
513 if (real_wr == real_bad_wr) {
522 struct ibv_context_1_0 *__ibv_open_device_1_0(struct ibv_device_1_0 *device)
524 struct ibv_context *real_ctx;
525 struct ibv_context_1_0 *ctx;
527 ctx = malloc(sizeof *ctx);
531 real_ctx = ibv_open_device(device->real_device);
537 ctx->device = device;
538 ctx->real_context = real_ctx;
540 ctx->ops.poll_cq = poll_cq_wrapper_1_0;
541 ctx->ops.req_notify_cq = req_notify_cq_wrapper_1_0;
542 ctx->ops.post_send = post_send_wrapper_1_0;
543 ctx->ops.post_recv = post_recv_wrapper_1_0;
544 ctx->ops.post_srq_recv = post_srq_recv_wrapper_1_0;
548 symver(__ibv_open_device_1_0, ibv_open_device, IBVERBS_1.0);
550 int __ibv_close_device_1_0(struct ibv_context_1_0 *context)
554 ret = ibv_close_device(context->real_context);
561 symver(__ibv_close_device_1_0, ibv_close_device, IBVERBS_1.0);
563 int __ibv_get_async_event_1_0(struct ibv_context_1_0 *context,
564 struct ibv_async_event *event)
568 ret = ibv_get_async_event(context->real_context, event);
572 switch (event->event_type) {
573 case IBV_EVENT_CQ_ERR:
574 event->element.cq = event->element.cq->cq_context;
577 case IBV_EVENT_QP_FATAL:
578 case IBV_EVENT_QP_REQ_ERR:
579 case IBV_EVENT_QP_ACCESS_ERR:
580 case IBV_EVENT_COMM_EST:
581 case IBV_EVENT_SQ_DRAINED:
582 case IBV_EVENT_PATH_MIG:
583 case IBV_EVENT_PATH_MIG_ERR:
584 case IBV_EVENT_QP_LAST_WQE_REACHED:
585 event->element.qp = event->element.qp->qp_context;
588 case IBV_EVENT_SRQ_ERR:
589 case IBV_EVENT_SRQ_LIMIT_REACHED:
590 event->element.srq = event->element.srq->srq_context;
599 symver(__ibv_get_async_event_1_0, ibv_get_async_event, IBVERBS_1.0);
601 void __ibv_ack_async_event_1_0(struct ibv_async_event *event)
603 struct ibv_async_event real_event = *event;
605 switch (event->event_type) {
606 case IBV_EVENT_CQ_ERR:
607 real_event.element.cq =
608 ((struct ibv_cq_1_0 *) event->element.cq)->real_cq;
611 case IBV_EVENT_QP_FATAL:
612 case IBV_EVENT_QP_REQ_ERR:
613 case IBV_EVENT_QP_ACCESS_ERR:
614 case IBV_EVENT_COMM_EST:
615 case IBV_EVENT_SQ_DRAINED:
616 case IBV_EVENT_PATH_MIG:
617 case IBV_EVENT_PATH_MIG_ERR:
618 case IBV_EVENT_QP_LAST_WQE_REACHED:
619 real_event.element.qp =
620 ((struct ibv_qp_1_0 *) event->element.qp)->real_qp;
623 case IBV_EVENT_SRQ_ERR:
624 case IBV_EVENT_SRQ_LIMIT_REACHED:
625 real_event.element.srq =
626 ((struct ibv_srq_1_0 *) event->element.srq)->real_srq;
633 ibv_ack_async_event(&real_event);
635 symver(__ibv_ack_async_event_1_0, ibv_ack_async_event, IBVERBS_1.0);
637 int __ibv_query_device_1_0(struct ibv_context_1_0 *context,
638 struct ibv_device_attr *device_attr)
640 return ibv_query_device(context->real_context, device_attr);
642 symver(__ibv_query_device_1_0, ibv_query_device, IBVERBS_1.0);
644 int __ibv_query_port_1_0(struct ibv_context_1_0 *context, uint8_t port_num,
645 struct ibv_port_attr *port_attr)
647 return ibv_query_port(context->real_context, port_num, port_attr);
649 symver(__ibv_query_port_1_0, ibv_query_port, IBVERBS_1.0);
651 int __ibv_query_gid_1_0(struct ibv_context_1_0 *context, uint8_t port_num,
652 int index, union ibv_gid *gid)
654 return ibv_query_gid(context->real_context, port_num, index, gid);
656 symver(__ibv_query_gid_1_0, ibv_query_gid, IBVERBS_1.0);
658 int __ibv_query_pkey_1_0(struct ibv_context_1_0 *context, uint8_t port_num,
659 int index, __be16 *pkey)
661 return ibv_query_pkey(context->real_context, port_num, index, pkey);
663 symver(__ibv_query_pkey_1_0, ibv_query_pkey, IBVERBS_1.0);
665 struct ibv_pd_1_0 *__ibv_alloc_pd_1_0(struct ibv_context_1_0 *context)
667 struct ibv_pd *real_pd;
668 struct ibv_pd_1_0 *pd;
670 pd = malloc(sizeof *pd);
674 real_pd = ibv_alloc_pd(context->real_context);
680 pd->context = context;
681 pd->real_pd = real_pd;
685 symver(__ibv_alloc_pd_1_0, ibv_alloc_pd, IBVERBS_1.0);
687 int __ibv_dealloc_pd_1_0(struct ibv_pd_1_0 *pd)
691 ret = ibv_dealloc_pd(pd->real_pd);
698 symver(__ibv_dealloc_pd_1_0, ibv_dealloc_pd, IBVERBS_1.0);
700 struct ibv_mr_1_0 *__ibv_reg_mr_1_0(struct ibv_pd_1_0 *pd, void *addr,
701 size_t length, int access)
703 struct ibv_mr *real_mr;
704 struct ibv_mr_1_0 *mr;
706 mr = malloc(sizeof *mr);
710 real_mr = ibv_reg_mr(pd->real_pd, addr, length, access);
716 mr->context = pd->context;
718 mr->lkey = real_mr->lkey;
719 mr->rkey = real_mr->rkey;
720 mr->real_mr = real_mr;
724 symver(__ibv_reg_mr_1_0, ibv_reg_mr, IBVERBS_1.0);
726 int __ibv_dereg_mr_1_0(struct ibv_mr_1_0 *mr)
730 ret = ibv_dereg_mr(mr->real_mr);
737 symver(__ibv_dereg_mr_1_0, ibv_dereg_mr, IBVERBS_1.0);
739 struct ibv_cq_1_0 *__ibv_create_cq_1_0(struct ibv_context_1_0 *context, int cqe,
741 struct ibv_comp_channel *channel,
744 struct ibv_cq *real_cq;
745 struct ibv_cq_1_0 *cq;
747 cq = malloc(sizeof *cq);
751 real_cq = ibv_create_cq(context->real_context, cqe, cq_context,
752 channel, comp_vector);
758 cq->context = context;
759 cq->cq_context = cq_context;
761 cq->real_cq = real_cq;
763 real_cq->cq_context = cq;
767 symver(__ibv_create_cq_1_0, ibv_create_cq, IBVERBS_1.0);
769 int __ibv_resize_cq_1_0(struct ibv_cq_1_0 *cq, int cqe)
771 return ibv_resize_cq(cq->real_cq, cqe);
773 symver(__ibv_resize_cq_1_0, ibv_resize_cq, IBVERBS_1.0);
775 int __ibv_destroy_cq_1_0(struct ibv_cq_1_0 *cq)
779 ret = ibv_destroy_cq(cq->real_cq);
786 symver(__ibv_destroy_cq_1_0, ibv_destroy_cq, IBVERBS_1.0);
788 int __ibv_get_cq_event_1_0(struct ibv_comp_channel *channel,
789 struct ibv_cq_1_0 **cq, void **cq_context)
791 struct ibv_cq *real_cq;
795 ret = ibv_get_cq_event(channel, &real_cq, &cq_ptr);
800 *cq_context = (*cq)->cq_context;
804 symver(__ibv_get_cq_event_1_0, ibv_get_cq_event, IBVERBS_1.0);
806 void __ibv_ack_cq_events_1_0(struct ibv_cq_1_0 *cq, unsigned int nevents)
808 ibv_ack_cq_events(cq->real_cq, nevents);
810 symver(__ibv_ack_cq_events_1_0, ibv_ack_cq_events, IBVERBS_1.0);
812 struct ibv_srq_1_0 *__ibv_create_srq_1_0(struct ibv_pd_1_0 *pd,
813 struct ibv_srq_init_attr *srq_init_attr)
815 struct ibv_srq *real_srq;
816 struct ibv_srq_1_0 *srq;
818 srq = malloc(sizeof *srq);
822 real_srq = ibv_create_srq(pd->real_pd, srq_init_attr);
828 srq->context = pd->context;
829 srq->srq_context = srq_init_attr->srq_context;
831 srq->real_srq = real_srq;
833 real_srq->srq_context = srq;
837 symver(__ibv_create_srq_1_0, ibv_create_srq, IBVERBS_1.0);
839 int __ibv_modify_srq_1_0(struct ibv_srq_1_0 *srq,
840 struct ibv_srq_attr *srq_attr,
843 return ibv_modify_srq(srq->real_srq, srq_attr, srq_attr_mask);
845 symver(__ibv_modify_srq_1_0, ibv_modify_srq, IBVERBS_1.0);
847 int __ibv_query_srq_1_0(struct ibv_srq_1_0 *srq, struct ibv_srq_attr *srq_attr)
849 return ibv_query_srq(srq->real_srq, srq_attr);
851 symver(__ibv_query_srq_1_0, ibv_query_srq, IBVERBS_1.0);
853 int __ibv_destroy_srq_1_0(struct ibv_srq_1_0 *srq)
857 ret = ibv_destroy_srq(srq->real_srq);
864 symver(__ibv_destroy_srq_1_0, ibv_destroy_srq, IBVERBS_1.0);
866 struct ibv_qp_1_0 *__ibv_create_qp_1_0(struct ibv_pd_1_0 *pd,
867 struct ibv_qp_init_attr_1_0 *qp_init_attr)
869 struct ibv_qp *real_qp;
870 struct ibv_qp_1_0 *qp;
871 struct ibv_qp_init_attr real_init_attr;
873 qp = malloc(sizeof *qp);
877 real_init_attr.qp_context = qp_init_attr->qp_context;
878 real_init_attr.send_cq = qp_init_attr->send_cq->real_cq;
879 real_init_attr.recv_cq = qp_init_attr->recv_cq->real_cq;
880 real_init_attr.srq = qp_init_attr->srq ?
881 qp_init_attr->srq->real_srq : NULL;
882 real_init_attr.cap = qp_init_attr->cap;
883 real_init_attr.qp_type = qp_init_attr->qp_type;
884 real_init_attr.sq_sig_all = qp_init_attr->sq_sig_all;
886 real_qp = ibv_create_qp(pd->real_pd, &real_init_attr);
892 qp->context = pd->context;
893 qp->qp_context = qp_init_attr->qp_context;
895 qp->send_cq = qp_init_attr->send_cq;
896 qp->recv_cq = qp_init_attr->recv_cq;
897 qp->srq = qp_init_attr->srq;
898 qp->qp_type = qp_init_attr->qp_type;
899 qp->qp_num = real_qp->qp_num;
900 qp->real_qp = real_qp;
902 qp_init_attr->cap = real_init_attr.cap;
904 real_qp->qp_context = qp;
908 symver(__ibv_create_qp_1_0, ibv_create_qp, IBVERBS_1.0);
910 int __ibv_query_qp_1_0(struct ibv_qp_1_0 *qp, struct ibv_qp_attr *attr,
912 struct ibv_qp_init_attr_1_0 *init_attr)
914 struct ibv_qp_init_attr real_init_attr;
917 ret = ibv_query_qp(qp->real_qp, attr, attr_mask, &real_init_attr);
921 init_attr->qp_context = qp->qp_context;
922 init_attr->send_cq = real_init_attr.send_cq->cq_context;
923 init_attr->recv_cq = real_init_attr.recv_cq->cq_context;
924 init_attr->srq = real_init_attr.srq->srq_context;
925 init_attr->qp_type = real_init_attr.qp_type;
926 init_attr->cap = real_init_attr.cap;
927 init_attr->sq_sig_all = real_init_attr.sq_sig_all;
931 symver(__ibv_query_qp_1_0, ibv_query_qp, IBVERBS_1.0);
933 int __ibv_modify_qp_1_0(struct ibv_qp_1_0 *qp, struct ibv_qp_attr *attr,
936 return ibv_modify_qp(qp->real_qp, attr, attr_mask);
938 symver(__ibv_modify_qp_1_0, ibv_modify_qp, IBVERBS_1.0);
940 int __ibv_destroy_qp_1_0(struct ibv_qp_1_0 *qp)
944 ret = ibv_destroy_qp(qp->real_qp);
951 symver(__ibv_destroy_qp_1_0, ibv_destroy_qp, IBVERBS_1.0);
953 struct ibv_ah_1_0 *__ibv_create_ah_1_0(struct ibv_pd_1_0 *pd,
954 struct ibv_ah_attr *attr)
956 struct ibv_ah *real_ah;
957 struct ibv_ah_1_0 *ah;
959 ah = malloc(sizeof *ah);
963 real_ah = ibv_create_ah(pd->real_pd, attr);
969 ah->context = pd->context;
971 ah->real_ah = real_ah;
975 symver(__ibv_create_ah_1_0, ibv_create_ah, IBVERBS_1.0);
977 int __ibv_destroy_ah_1_0(struct ibv_ah_1_0 *ah)
981 ret = ibv_destroy_ah(ah->real_ah);
988 symver(__ibv_destroy_ah_1_0, ibv_destroy_ah, IBVERBS_1.0);
990 int __ibv_attach_mcast_1_0(struct ibv_qp_1_0 *qp, union ibv_gid *gid, uint16_t lid)
992 return ibv_attach_mcast(qp->real_qp, gid, lid);
994 symver(__ibv_attach_mcast_1_0, ibv_attach_mcast, IBVERBS_1.0);
996 int __ibv_detach_mcast_1_0(struct ibv_qp_1_0 *qp, union ibv_gid *gid, uint16_t lid)
998 return ibv_detach_mcast(qp->real_qp, gid, lid);
1000 symver(__ibv_detach_mcast_1_0, ibv_detach_mcast, IBVERBS_1.0);
1002 void __ibv_register_driver_1_1(const char *name, ibv_driver_init_func_1_1 init_func)
1004 /* The driver interface is private as of rdma-core 13. This stub is
1005 * left to preserve dynamic-link compatibility with old libfabrics
1006 * usnic providers which use this function only to suppress a fprintf
1007 * in old versions of libibverbs. */
1009 symver(__ibv_register_driver_1_1, ibv_register_driver, IBVERBS_1.1);