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 19#include <infiniband/verbs.h> 20#include "qemu/thread.h" 21 22typedef struct RdmaDeviceResources RdmaDeviceResources; 23 24typedef struct RdmaBackendThread { 25 QemuThread thread; 26 QemuMutex mutex; 27 bool run; /* Set by thread manager to let thread know it should exit */ 28 bool is_running; /* Set by the thread to report its status */ 29} RdmaBackendThread; 30 31typedef struct RdmaBackendDev { 32 struct ibv_device_attr dev_attr; 33 RdmaBackendThread comp_thread; 34 union ibv_gid gid; 35 PCIDevice *dev; 36 RdmaDeviceResources *rdma_dev_res; 37 struct ibv_device *ib_dev; 38 struct ibv_context *context; 39 struct ibv_comp_channel *channel; 40 uint8_t port_num; 41 uint8_t backend_gid_idx; 42} RdmaBackendDev; 43 44typedef struct RdmaBackendPD { 45 struct ibv_pd *ibpd; 46} RdmaBackendPD; 47 48typedef struct RdmaBackendMR { 49 struct ibv_pd *ibpd; 50 struct ibv_mr *ibmr; 51} RdmaBackendMR; 52 53typedef struct RdmaBackendCQ { 54 RdmaBackendDev *backend_dev; 55 struct ibv_cq *ibcq; 56} RdmaBackendCQ; 57 58typedef struct RdmaBackendQP { 59 struct ibv_pd *ibpd; 60 struct ibv_qp *ibqp; 61} RdmaBackendQP; 62 63#endif 64