rdma_backend_defs.h 1.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 *  RDMA device: Definitions of Backend Device structures
 *
 * Copyright (C) 2018 Oracle
 * Copyright (C) 2018 Red Hat Inc
 *
 * Authors:
 *     Yuval Shaia <yuval.shaia@oracle.com>
 *     Marcel Apfelbaum <marcel@redhat.com>
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 *
 */

#ifndef RDMA_BACKEND_DEFS_H
#define RDMA_BACKEND_DEFS_H

19
#include "qemu/thread.h"
Y
Yuval Shaia 已提交
20 21
#include "chardev/char-fe.h"
#include <infiniband/verbs.h>
22
#include "contrib/rdmacm-mux/rdmacm-mux.h"
Y
Yuval Shaia 已提交
23
#include "rdma_utils.h"
24 25 26 27 28

typedef struct RdmaDeviceResources RdmaDeviceResources;

typedef struct RdmaBackendThread {
    QemuThread thread;
29 30
    bool run; /* Set by thread manager to let thread know it should exit */
    bool is_running; /* Set by the thread to report its status */
31 32
} RdmaBackendThread;

33 34 35 36 37
typedef struct RdmaCmMux {
    CharBackend *chr_be;
    int can_receive;
} RdmaCmMux;

38 39 40 41 42 43 44 45
typedef struct RdmaBackendDev {
    RdmaBackendThread comp_thread;
    PCIDevice *dev;
    RdmaDeviceResources *rdma_dev_res;
    struct ibv_device *ib_dev;
    struct ibv_context *context;
    struct ibv_comp_channel *channel;
    uint8_t port_num;
Y
Yuval Shaia 已提交
46
    RdmaProtectedQList recv_mads_list;
47
    RdmaCmMux rdmacm_mux;
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
} RdmaBackendDev;

typedef struct RdmaBackendPD {
    struct ibv_pd *ibpd;
} RdmaBackendPD;

typedef struct RdmaBackendMR {
    struct ibv_pd *ibpd;
    struct ibv_mr *ibmr;
} RdmaBackendMR;

typedef struct RdmaBackendCQ {
    RdmaBackendDev *backend_dev;
    struct ibv_cq *ibcq;
} RdmaBackendCQ;

typedef struct RdmaBackendQP {
    struct ibv_pd *ibpd;
    struct ibv_qp *ibqp;
67
    uint8_t sgid_idx;
68
    RdmaProtectedGSList cqe_ctx_list;
69 70 71
} RdmaBackendQP;

#endif