2 * RDMA device: Definitions of Resource Manager functions
4 * Copyright (C) 2018 Oracle
5 * Copyright (C) 2018 Red Hat Inc
8 * Yuval Shaia <yuval.shaia@oracle.com>
9 * Marcel Apfelbaum <marcel@redhat.com>
11 * This work is licensed under the terms of the GNU GPL, version 2 or later.
12 * See the COPYING file in the top-level directory.
19 #include "qapi/error.h"
20 #include "rdma_backend_defs.h"
21 #include "rdma_rm_defs.h"
23 int rdma_rm_init(RdmaDeviceResources
*dev_res
, struct ibv_device_attr
*dev_attr
,
25 void rdma_rm_fini(RdmaDeviceResources
*dev_res
);
27 int rdma_rm_alloc_pd(RdmaDeviceResources
*dev_res
, RdmaBackendDev
*backend_dev
,
28 uint32_t *pd_handle
, uint32_t ctx_handle
);
29 RdmaRmPD
*rdma_rm_get_pd(RdmaDeviceResources
*dev_res
, uint32_t pd_handle
);
30 void rdma_rm_dealloc_pd(RdmaDeviceResources
*dev_res
, uint32_t pd_handle
);
32 int rdma_rm_alloc_mr(RdmaDeviceResources
*dev_res
, uint32_t pd_handle
,
33 uint64_t guest_start
, size_t guest_length
, void *host_virt
,
34 int access_flags
, uint32_t *mr_handle
, uint32_t *lkey
,
36 RdmaRmMR
*rdma_rm_get_mr(RdmaDeviceResources
*dev_res
, uint32_t mr_handle
);
37 void rdma_rm_dealloc_mr(RdmaDeviceResources
*dev_res
, uint32_t mr_handle
);
39 int rdma_rm_alloc_uc(RdmaDeviceResources
*dev_res
, uint32_t pfn
,
41 RdmaRmUC
*rdma_rm_get_uc(RdmaDeviceResources
*dev_res
, uint32_t uc_handle
);
42 void rdma_rm_dealloc_uc(RdmaDeviceResources
*dev_res
, uint32_t uc_handle
);
44 int rdma_rm_alloc_cq(RdmaDeviceResources
*dev_res
, RdmaBackendDev
*backend_dev
,
45 uint32_t cqe
, uint32_t *cq_handle
, void *opaque
);
46 RdmaRmCQ
*rdma_rm_get_cq(RdmaDeviceResources
*dev_res
, uint32_t cq_handle
);
47 void rdma_rm_req_notify_cq(RdmaDeviceResources
*dev_res
, uint32_t cq_handle
,
49 void rdma_rm_dealloc_cq(RdmaDeviceResources
*dev_res
, uint32_t cq_handle
);
51 int rdma_rm_alloc_qp(RdmaDeviceResources
*dev_res
, uint32_t pd_handle
,
52 uint8_t qp_type
, uint32_t max_send_wr
,
53 uint32_t max_send_sge
, uint32_t send_cq_handle
,
54 uint32_t max_recv_wr
, uint32_t max_recv_sge
,
55 uint32_t recv_cq_handle
, void *opaque
, uint32_t *qpn
);
56 RdmaRmQP
*rdma_rm_get_qp(RdmaDeviceResources
*dev_res
, uint32_t qpn
);
57 int rdma_rm_modify_qp(RdmaDeviceResources
*dev_res
, RdmaBackendDev
*backend_dev
,
58 uint32_t qp_handle
, uint32_t attr_mask
,
59 union ibv_gid
*dgid
, uint32_t dqpn
,
60 enum ibv_qp_state qp_state
, uint32_t qkey
,
61 uint32_t rq_psn
, uint32_t sq_psn
);
62 int rdma_rm_query_qp(RdmaDeviceResources
*dev_res
, RdmaBackendDev
*backend_dev
,
63 uint32_t qp_handle
, struct ibv_qp_attr
*attr
,
64 int attr_mask
, struct ibv_qp_init_attr
*init_attr
);
65 void rdma_rm_dealloc_qp(RdmaDeviceResources
*dev_res
, uint32_t qp_handle
);
67 int rdma_rm_alloc_cqe_ctx(RdmaDeviceResources
*dev_res
, uint32_t *cqe_ctx_id
,
69 void *rdma_rm_get_cqe_ctx(RdmaDeviceResources
*dev_res
, uint32_t cqe_ctx_id
);
70 void rdma_rm_dealloc_cqe_ctx(RdmaDeviceResources
*dev_res
, uint32_t cqe_ctx_id
);