]>
Commit | Line | Data |
---|---|---|
b3a92277 YS |
1 | /* |
2 | * RDMA device: Definitions of Resource Manager 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_RM_DEFS_H | |
17 | #define RDMA_RM_DEFS_H | |
18 | ||
19 | #include "rdma_backend_defs.h" | |
20 | ||
21 | #define MAX_PORTS 1 | |
22 | #define MAX_PORT_GIDS 1 | |
c387e8a4 | 23 | #define MAX_GIDS MAX_PORT_GIDS |
b3a92277 | 24 | #define MAX_PORT_PKEYS 1 |
b9e34872 | 25 | #define MAX_PKEYS MAX_PORT_PKEYS |
b3a92277 YS |
26 | #define MAX_UCS 512 |
27 | #define MAX_MR_SIZE (1UL << 27) | |
28 | #define MAX_QP 1024 | |
29 | #define MAX_SGE 4 | |
30 | #define MAX_CQ 2048 | |
31 | #define MAX_MR 1024 | |
32 | #define MAX_PD 1024 | |
33 | #define MAX_QP_RD_ATOM 16 | |
34 | #define MAX_QP_INIT_RD_ATOM 16 | |
35 | #define MAX_AH 64 | |
36 | ||
6c080b9e | 37 | #define MAX_RM_TBL_NAME 16 |
b3a92277 | 38 | typedef struct RdmaRmResTbl { |
6c080b9e | 39 | char name[MAX_RM_TBL_NAME]; |
b3a92277 YS |
40 | QemuMutex lock; |
41 | unsigned long *bitmap; | |
42 | size_t tbl_sz; | |
43 | size_t res_sz; | |
44 | void *tbl; | |
45 | } RdmaRmResTbl; | |
46 | ||
47 | typedef struct RdmaRmPD { | |
48 | RdmaBackendPD backend_pd; | |
49 | uint32_t ctx_handle; | |
50 | } RdmaRmPD; | |
51 | ||
52 | typedef struct RdmaRmCQ { | |
53 | RdmaBackendCQ backend_cq; | |
54 | void *opaque; | |
55 | bool notify; | |
56 | } RdmaRmCQ; | |
57 | ||
b3a92277 YS |
58 | /* MR (DMA region) */ |
59 | typedef struct RdmaRmMR { | |
60 | RdmaBackendMR backend_mr; | |
7f99daad YS |
61 | void *virt; |
62 | uint64_t start; | |
63 | size_t length; | |
b3a92277 YS |
64 | uint32_t pd_handle; |
65 | uint32_t lkey; | |
66 | uint32_t rkey; | |
67 | } RdmaRmMR; | |
68 | ||
69 | typedef struct RdmaRmUC { | |
70 | uint64_t uc_handle; | |
71 | } RdmaRmUC; | |
72 | ||
73 | typedef struct RdmaRmQP { | |
74 | RdmaBackendQP backend_qp; | |
75 | void *opaque; | |
76 | uint32_t qp_type; | |
77 | uint32_t qpn; | |
78 | uint32_t send_cq_handle; | |
79 | uint32_t recv_cq_handle; | |
80 | enum ibv_qp_state qp_state; | |
81 | } RdmaRmQP; | |
82 | ||
83 | typedef struct RdmaRmPort { | |
84 | union ibv_gid gid_tbl[MAX_PORT_GIDS]; | |
85 | enum ibv_port_state state; | |
b3a92277 YS |
86 | } RdmaRmPort; |
87 | ||
88 | typedef struct RdmaDeviceResources { | |
89 | RdmaRmPort ports[MAX_PORTS]; | |
90 | RdmaRmResTbl pd_tbl; | |
91 | RdmaRmResTbl mr_tbl; | |
92 | RdmaRmResTbl uc_tbl; | |
93 | RdmaRmResTbl qp_tbl; | |
94 | RdmaRmResTbl cq_tbl; | |
95 | RdmaRmResTbl cqe_ctx_tbl; | |
96 | GHashTable *qp_hash; /* Keeps mapping between real and emulated */ | |
97 | } RdmaDeviceResources; | |
98 | ||
99 | #endif |