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