rvt-abi.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
  2. /*
  3. * This file contains defines, structures, etc. that are used
  4. * to communicate between kernel and user code.
  5. */
  6. #ifndef RVT_ABI_USER_H
  7. #define RVT_ABI_USER_H
  8. #include <linux/types.h>
  9. #include <rdma/ib_user_verbs.h>
  10. #ifndef RDMA_ATOMIC_UAPI
  11. #define RDMA_ATOMIC_UAPI(_type, _name) struct{ _type val; } _name
  12. #endif
  13. struct rvt_wqe_sge {
  14. __aligned_u64 addr;
  15. __u32 length;
  16. __u32 lkey;
  17. };
  18. /*
  19. * This structure is used to contain the head pointer, tail pointer,
  20. * and completion queue entries as a single memory allocation so
  21. * it can be mmap'ed into user space.
  22. */
  23. struct rvt_cq_wc {
  24. /* index of next entry to fill */
  25. RDMA_ATOMIC_UAPI(__u32, head);
  26. /* index of next ib_poll_cq() entry */
  27. RDMA_ATOMIC_UAPI(__u32, tail);
  28. /* these are actually size ibcq.cqe + 1 */
  29. struct ib_uverbs_wc uqueue[];
  30. };
  31. /*
  32. * Receive work request queue entry.
  33. * The size of the sg_list is determined when the QP (or SRQ) is created
  34. * and stored in qp->r_rq.max_sge (or srq->rq.max_sge).
  35. */
  36. struct rvt_rwqe {
  37. __u64 wr_id;
  38. __u8 num_sge;
  39. __u8 padding[7];
  40. struct rvt_wqe_sge sg_list[];
  41. };
  42. /*
  43. * This structure is used to contain the head pointer, tail pointer,
  44. * and receive work queue entries as a single memory allocation so
  45. * it can be mmap'ed into user space.
  46. * Note that the wq array elements are variable size so you can't
  47. * just index into the array to get the N'th element;
  48. * use get_rwqe_ptr() for user space and rvt_get_rwqe_ptr()
  49. * for kernel space.
  50. */
  51. struct rvt_rwq {
  52. /* new work requests posted to the head */
  53. RDMA_ATOMIC_UAPI(__u32, head);
  54. /* receives pull requests from here. */
  55. RDMA_ATOMIC_UAPI(__u32, tail);
  56. struct rvt_rwqe wq[];
  57. };
  58. #endif /* RVT_ABI_USER_H */