]>
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" |
b3a92277 YS |
23 | |
24 | typedef struct RdmaDeviceResources RdmaDeviceResources; | |
25 | ||
26 | typedef struct RdmaBackendThread { | |
27 | QemuThread thread; | |
28 | QemuMutex mutex; | |
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 | ||
605ec166 YS |
33 | typedef struct RecvMadList { |
34 | QemuMutex lock; | |
35 | QList *list; | |
36 | } RecvMadList; | |
37 | ||
2b05705d YS |
38 | typedef struct RdmaCmMux { |
39 | CharBackend *chr_be; | |
40 | int can_receive; | |
41 | } RdmaCmMux; | |
42 | ||
b3a92277 | 43 | typedef struct RdmaBackendDev { |
b3a92277 | 44 | RdmaBackendThread comp_thread; |
b3a92277 YS |
45 | PCIDevice *dev; |
46 | RdmaDeviceResources *rdma_dev_res; | |
47 | struct ibv_device *ib_dev; | |
48 | struct ibv_context *context; | |
49 | struct ibv_comp_channel *channel; | |
50 | uint8_t port_num; | |
605ec166 | 51 | RecvMadList recv_mads_list; |
2b05705d | 52 | RdmaCmMux rdmacm_mux; |
b3a92277 YS |
53 | } RdmaBackendDev; |
54 | ||
55 | typedef struct RdmaBackendPD { | |
56 | struct ibv_pd *ibpd; | |
57 | } RdmaBackendPD; | |
58 | ||
59 | typedef struct RdmaBackendMR { | |
60 | struct ibv_pd *ibpd; | |
61 | struct ibv_mr *ibmr; | |
62 | } RdmaBackendMR; | |
63 | ||
64 | typedef struct RdmaBackendCQ { | |
65 | RdmaBackendDev *backend_dev; | |
66 | struct ibv_cq *ibcq; | |
67 | } RdmaBackendCQ; | |
68 | ||
69 | typedef struct RdmaBackendQP { | |
70 | struct ibv_pd *ibpd; | |
71 | struct ibv_qp *ibqp; | |
2b05705d | 72 | uint8_t sgid_idx; |
b3a92277 YS |
73 | } RdmaBackendQP; |
74 | ||
75 | #endif |