Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
0002 
0003 /*
0004  * This file contains defines, structures, etc. that are used
0005  * to communicate between kernel and user code.
0006  */
0007 
0008 #ifndef RVT_ABI_USER_H
0009 #define RVT_ABI_USER_H
0010 
0011 #include <linux/types.h>
0012 #include <rdma/ib_user_verbs.h>
0013 #ifndef RDMA_ATOMIC_UAPI
0014 #define RDMA_ATOMIC_UAPI(_type, _name) struct{ _type val; } _name
0015 #endif
0016 
0017 struct rvt_wqe_sge {
0018     __aligned_u64 addr;
0019     __u32 length;
0020     __u32 lkey;
0021 };
0022 
0023 /*
0024  * This structure is used to contain the head pointer, tail pointer,
0025  * and completion queue entries as a single memory allocation so
0026  * it can be mmap'ed into user space.
0027  */
0028 struct rvt_cq_wc {
0029     /* index of next entry to fill */
0030     RDMA_ATOMIC_UAPI(__u32, head);
0031     /* index of next ib_poll_cq() entry */
0032     RDMA_ATOMIC_UAPI(__u32, tail);
0033 
0034     /* these are actually size ibcq.cqe + 1 */
0035     struct ib_uverbs_wc uqueue[];
0036 };
0037 
0038 /*
0039  * Receive work request queue entry.
0040  * The size of the sg_list is determined when the QP (or SRQ) is created
0041  * and stored in qp->r_rq.max_sge (or srq->rq.max_sge).
0042  */
0043 struct rvt_rwqe {
0044     __u64 wr_id;
0045     __u8 num_sge;
0046     __u8 padding[7];
0047     struct rvt_wqe_sge sg_list[];
0048 };
0049 
0050 /*
0051  * This structure is used to contain the head pointer, tail pointer,
0052  * and receive work queue entries as a single memory allocation so
0053  * it can be mmap'ed into user space.
0054  * Note that the wq array elements are variable size so you can't
0055  * just index into the array to get the N'th element;
0056  * use get_rwqe_ptr() for user space and rvt_get_rwqe_ptr()
0057  * for kernel space.
0058  */
0059 struct rvt_rwq {
0060     /* new work requests posted to the head */
0061     RDMA_ATOMIC_UAPI(__u32, head);
0062     /* receives pull requests from here. */
0063     RDMA_ATOMIC_UAPI(__u32, tail);
0064     struct rvt_rwqe wq[];
0065 };
0066 #endif /* RVT_ABI_USER_H */