18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci/* 48c2ecf20Sopenharmony_ci * This file contains defines, structures, etc. that are used 58c2ecf20Sopenharmony_ci * to communicate between kernel and user code. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef RVT_ABI_USER_H 98c2ecf20Sopenharmony_ci#define RVT_ABI_USER_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/types.h> 128c2ecf20Sopenharmony_ci#include <rdma/ib_user_verbs.h> 138c2ecf20Sopenharmony_ci#ifndef RDMA_ATOMIC_UAPI 148c2ecf20Sopenharmony_ci#define RDMA_ATOMIC_UAPI(_type, _name) struct{ _type val; } _name 158c2ecf20Sopenharmony_ci#endif 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cistruct rvt_wqe_sge { 188c2ecf20Sopenharmony_ci __aligned_u64 addr; 198c2ecf20Sopenharmony_ci __u32 length; 208c2ecf20Sopenharmony_ci __u32 lkey; 218c2ecf20Sopenharmony_ci}; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* 248c2ecf20Sopenharmony_ci * This structure is used to contain the head pointer, tail pointer, 258c2ecf20Sopenharmony_ci * and completion queue entries as a single memory allocation so 268c2ecf20Sopenharmony_ci * it can be mmap'ed into user space. 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_cistruct rvt_cq_wc { 298c2ecf20Sopenharmony_ci /* index of next entry to fill */ 308c2ecf20Sopenharmony_ci RDMA_ATOMIC_UAPI(__u32, head); 318c2ecf20Sopenharmony_ci /* index of next ib_poll_cq() entry */ 328c2ecf20Sopenharmony_ci RDMA_ATOMIC_UAPI(__u32, tail); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci /* these are actually size ibcq.cqe + 1 */ 358c2ecf20Sopenharmony_ci struct ib_uverbs_wc uqueue[]; 368c2ecf20Sopenharmony_ci}; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* 398c2ecf20Sopenharmony_ci * Receive work request queue entry. 408c2ecf20Sopenharmony_ci * The size of the sg_list is determined when the QP (or SRQ) is created 418c2ecf20Sopenharmony_ci * and stored in qp->r_rq.max_sge (or srq->rq.max_sge). 428c2ecf20Sopenharmony_ci */ 438c2ecf20Sopenharmony_cistruct rvt_rwqe { 448c2ecf20Sopenharmony_ci __u64 wr_id; 458c2ecf20Sopenharmony_ci __u8 num_sge; 468c2ecf20Sopenharmony_ci __u8 padding[7]; 478c2ecf20Sopenharmony_ci struct rvt_wqe_sge sg_list[]; 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci/* 518c2ecf20Sopenharmony_ci * This structure is used to contain the head pointer, tail pointer, 528c2ecf20Sopenharmony_ci * and receive work queue entries as a single memory allocation so 538c2ecf20Sopenharmony_ci * it can be mmap'ed into user space. 548c2ecf20Sopenharmony_ci * Note that the wq array elements are variable size so you can't 558c2ecf20Sopenharmony_ci * just index into the array to get the N'th element; 568c2ecf20Sopenharmony_ci * use get_rwqe_ptr() for user space and rvt_get_rwqe_ptr() 578c2ecf20Sopenharmony_ci * for kernel space. 588c2ecf20Sopenharmony_ci */ 598c2ecf20Sopenharmony_cistruct rvt_rwq { 608c2ecf20Sopenharmony_ci /* new work requests posted to the head */ 618c2ecf20Sopenharmony_ci RDMA_ATOMIC_UAPI(__u32, head); 628c2ecf20Sopenharmony_ci /* receives pull requests from here. */ 638c2ecf20Sopenharmony_ci RDMA_ATOMIC_UAPI(__u32, tail); 648c2ecf20Sopenharmony_ci struct rvt_rwqe wq[]; 658c2ecf20Sopenharmony_ci}; 668c2ecf20Sopenharmony_ci#endif /* RVT_ABI_USER_H */ 67