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