/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright(c) 2016 - 2018 Intel Corporation.3*/45#ifndef DEF_RDMAVT_INCCQ_H6#define DEF_RDMAVT_INCCQ_H78#include <linux/kthread.h>9#include <rdma/ib_user_verbs.h>10#include <rdma/ib_verbs.h>1112/*13* Define an ib_cq_notify value that is not valid so we know when CQ14* notifications are armed.15*/16#define RVT_CQ_NONE (IB_CQ_NEXT_COMP + 1)1718/*19* Define read macro that apply smp_load_acquire memory barrier20* when reading indice of circular buffer that mmaped to user space.21*/22#define RDMA_READ_UAPI_ATOMIC(member) smp_load_acquire(&(member).val)2324/*25* Define write macro that uses smp_store_release memory barrier26* when writing indice of circular buffer that mmaped to user space.27*/28#define RDMA_WRITE_UAPI_ATOMIC(member, x) smp_store_release(&(member).val, x)29#include <rdma/rvt-abi.h>3031/*32* This structure is used to contain the head pointer, tail pointer,33* and completion queue entries as a single memory allocation so34* it can be mmap'ed into user space.35*/36struct rvt_k_cq_wc {37u32 head; /* index of next entry to fill */38u32 tail; /* index of next ib_poll_cq() entry */39struct ib_wc kqueue[];40};4142/*43* The completion queue structure.44*/45struct rvt_cq {46struct ib_cq ibcq;47struct work_struct comptask;48spinlock_t lock; /* protect changes in this struct */49u8 notify;50u8 triggered;51u8 cq_full;52int comp_vector_cpu;53struct rvt_dev_info *rdi;54struct rvt_cq_wc *queue;55struct rvt_mmap_info *ip;56struct rvt_k_cq_wc *kqueue;57};5859static inline struct rvt_cq *ibcq_to_rvtcq(struct ib_cq *ibcq)60{61return container_of(ibcq, struct rvt_cq, ibcq);62}6364bool rvt_cq_enter(struct rvt_cq *cq, struct ib_wc *entry, bool solicited);6566#endif /* DEF_RDMAVT_INCCQH */676869