rdma_backend_defs.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #ifndef RDMA_BACKEND_DEFS_H
  16. #define RDMA_BACKEND_DEFS_H
  17. #include "qemu/thread.h"
  18. #include "chardev/char-fe.h"
  19. #include <infiniband/verbs.h>
  20. #include "contrib/rdmacm-mux/rdmacm-mux.h"
  21. #include "rdma_utils.h"
  22. typedef struct RdmaDeviceResources RdmaDeviceResources;
  23. typedef struct RdmaBackendThread {
  24. QemuThread thread;
  25. bool run; /* Set by thread manager to let thread know it should exit */
  26. bool is_running; /* Set by the thread to report its status */
  27. } RdmaBackendThread;
  28. typedef struct RdmaCmMux {
  29. CharBackend *chr_be;
  30. int can_receive;
  31. } RdmaCmMux;
  32. typedef struct RdmaBackendDev {
  33. RdmaBackendThread comp_thread;
  34. PCIDevice *dev;
  35. RdmaDeviceResources *rdma_dev_res;
  36. struct ibv_device *ib_dev;
  37. struct ibv_context *context;
  38. struct ibv_comp_channel *channel;
  39. uint8_t port_num;
  40. RdmaProtectedQList recv_mads_list;
  41. RdmaCmMux rdmacm_mux;
  42. } RdmaBackendDev;
  43. typedef struct RdmaBackendPD {
  44. struct ibv_pd *ibpd;
  45. } RdmaBackendPD;
  46. typedef struct RdmaBackendMR {
  47. struct ibv_pd *ibpd;
  48. struct ibv_mr *ibmr;
  49. } RdmaBackendMR;
  50. typedef struct RdmaBackendCQ {
  51. RdmaBackendDev *backend_dev;
  52. struct ibv_cq *ibcq;
  53. } RdmaBackendCQ;
  54. typedef struct RdmaBackendQP {
  55. struct ibv_pd *ibpd;
  56. struct ibv_qp *ibqp;
  57. uint8_t sgid_idx;
  58. RdmaProtectedGSList cqe_ctx_list;
  59. } RdmaBackendQP;
  60. typedef struct RdmaBackendSRQ {
  61. struct ibv_srq *ibsrq;
  62. RdmaProtectedGSList cqe_ctx_list;
  63. } RdmaBackendSRQ;
  64. #endif