]>
Commit | Line | Data |
---|---|---|
b3a92277 YS |
1 | /* |
2 | * RDMA device: Definitions of Backend Device structures | |
3 | * | |
4 | * Copyright (C) 2018 Oracle | |
5 | * Copyright (C) 2018 Red Hat Inc | |
6 | * | |
7 | * Authors: | |
8 | * Yuval Shaia <yuval.shaia@oracle.com> | |
9 | * Marcel Apfelbaum <marcel@redhat.com> | |
10 | * | |
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. | |
13 | * | |
14 | */ | |
15 | ||
16 | #ifndef RDMA_BACKEND_DEFS_H | |
17 | #define RDMA_BACKEND_DEFS_H | |
18 | ||
0efc9511 | 19 | #include "qemu/thread.h" |
605ec166 YS |
20 | #include "chardev/char-fe.h" |
21 | #include <infiniband/verbs.h> | |
2b05705d | 22 | #include "contrib/rdmacm-mux/rdmacm-mux.h" |
b20fc795 | 23 | #include "rdma_utils.h" |
b3a92277 YS |
24 | |
25 | typedef struct RdmaDeviceResources RdmaDeviceResources; | |
26 | ||
27 | typedef struct RdmaBackendThread { | |
28 | QemuThread thread; | |
75152227 YS |
29 | bool run; /* Set by thread manager to let thread know it should exit */ |
30 | bool is_running; /* Set by the thread to report its status */ | |
b3a92277 YS |
31 | } RdmaBackendThread; |
32 | ||
2b05705d YS |
33 | typedef struct RdmaCmMux { |
34 | CharBackend *chr_be; | |
35 | int can_receive; | |
36 | } RdmaCmMux; | |
37 | ||
b3a92277 | 38 | typedef struct RdmaBackendDev { |
b3a92277 | 39 | RdmaBackendThread comp_thread; |
b3a92277 YS |
40 | PCIDevice *dev; |
41 | RdmaDeviceResources *rdma_dev_res; | |
42 | struct ibv_device *ib_dev; | |
43 | struct ibv_context *context; | |
44 | struct ibv_comp_channel *channel; | |
45 | uint8_t port_num; | |
bce80086 | 46 | RdmaProtectedGQueue recv_mads_list; |
2b05705d | 47 | RdmaCmMux rdmacm_mux; |
b3a92277 YS |
48 | } RdmaBackendDev; |
49 | ||
50 | typedef struct RdmaBackendPD { | |
51 | struct ibv_pd *ibpd; | |
52 | } RdmaBackendPD; | |
53 | ||
54 | typedef struct RdmaBackendMR { | |
55 | struct ibv_pd *ibpd; | |
56 | struct ibv_mr *ibmr; | |
57 | } RdmaBackendMR; | |
58 | ||
59 | typedef struct RdmaBackendCQ { | |
60 | RdmaBackendDev *backend_dev; | |
61 | struct ibv_cq *ibcq; | |
62 | } RdmaBackendCQ; | |
63 | ||
64 | typedef struct RdmaBackendQP { | |
65 | struct ibv_pd *ibpd; | |
66 | struct ibv_qp *ibqp; | |
2b05705d | 67 | uint8_t sgid_idx; |
bf441451 | 68 | RdmaProtectedGSList cqe_ctx_list; |
b3a92277 YS |
69 | } RdmaBackendQP; |
70 | ||
e926c9f1 KH |
71 | typedef struct RdmaBackendSRQ { |
72 | struct ibv_srq *ibsrq; | |
73 | RdmaProtectedGSList cqe_ctx_list; | |
74 | } RdmaBackendSRQ; | |
75 | ||
b3a92277 | 76 | #endif |