block: Use children list in bdrv_refresh_filename
[qemu/ar7.git] / hw / rdma / rdma_rm_defs.h
blob0ba61d18386c36d1b87c71d6cbdca33f796f41d8
1 /*
2 * RDMA device: Definitions of Resource Manager structures
4 * Copyright (C) 2018 Oracle
5 * Copyright (C) 2018 Red Hat Inc
7 * Authors:
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.
16 #ifndef RDMA_RM_DEFS_H
17 #define RDMA_RM_DEFS_H
19 #include "rdma_backend_defs.h"
21 #define MAX_PORTS 1 /* Do not change - we support only one port */
22 #define MAX_PORT_GIDS 255
23 #define MAX_GIDS MAX_PORT_GIDS
24 #define MAX_PORT_PKEYS 1
25 #define MAX_PKEYS MAX_PORT_PKEYS
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
37 #define MAX_RM_TBL_NAME 16
38 typedef struct RdmaRmResTbl {
39 char name[MAX_RM_TBL_NAME];
40 QemuMutex lock;
41 unsigned long *bitmap;
42 size_t tbl_sz;
43 size_t res_sz;
44 void *tbl;
45 } RdmaRmResTbl;
47 typedef struct RdmaRmPD {
48 RdmaBackendPD backend_pd;
49 uint32_t ctx_handle;
50 } RdmaRmPD;
52 typedef enum CQNotificationType {
53 CNT_CLEAR,
54 CNT_ARM,
55 CNT_SET,
56 } CQNotificationType;
58 typedef struct RdmaRmCQ {
59 RdmaBackendCQ backend_cq;
60 void *opaque;
61 CQNotificationType notify;
62 } RdmaRmCQ;
64 /* MR (DMA region) */
65 typedef struct RdmaRmMR {
66 RdmaBackendMR backend_mr;
67 void *virt;
68 uint64_t start;
69 size_t length;
70 uint32_t pd_handle;
71 uint32_t lkey;
72 uint32_t rkey;
73 } RdmaRmMR;
75 typedef struct RdmaRmUC {
76 uint64_t uc_handle;
77 } RdmaRmUC;
79 typedef struct RdmaRmQP {
80 RdmaBackendQP backend_qp;
81 void *opaque;
82 uint32_t qp_type;
83 uint32_t qpn;
84 uint32_t send_cq_handle;
85 uint32_t recv_cq_handle;
86 enum ibv_qp_state qp_state;
87 } RdmaRmQP;
89 typedef struct RdmaRmGid {
90 union ibv_gid gid;
91 int backend_gid_index;
92 } RdmaRmGid;
94 typedef struct RdmaRmPort {
95 RdmaRmGid gid_tbl[MAX_PORT_GIDS];
96 enum ibv_port_state state;
97 } RdmaRmPort;
99 typedef struct RdmaDeviceResources {
100 RdmaRmPort port;
101 RdmaRmResTbl pd_tbl;
102 RdmaRmResTbl mr_tbl;
103 RdmaRmResTbl uc_tbl;
104 RdmaRmResTbl qp_tbl;
105 RdmaRmResTbl cq_tbl;
106 RdmaRmResTbl cqe_ctx_tbl;
107 GHashTable *qp_hash; /* Keeps mapping between real and emulated */
108 } RdmaDeviceResources;
110 #endif