#include <linux/errno.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include <linux/xarray.h>
#include <net/addrconf.h>
#include <rdma/iw_cm.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/uverbs_ioctl.h>
#include "siw.h"
#include "siw_verbs.h"
#include "siw_mem.h"
static int siw_qp_state_to_ib_qp_state[SIW_QP_STATE_COUNT] = …;
static int ib_qp_state_to_siw_qp_state[IB_QPS_ERR + 1] = …;
static char ib_qp_state_to_string[IB_QPS_ERR + 1][sizeof("RESET")] = …;
void siw_mmap_free(struct rdma_user_mmap_entry *rdma_entry)
{ … }
int siw_mmap(struct ib_ucontext *ctx, struct vm_area_struct *vma)
{ … }
int siw_alloc_ucontext(struct ib_ucontext *base_ctx, struct ib_udata *udata)
{ … }
void siw_dealloc_ucontext(struct ib_ucontext *base_ctx)
{ … }
int siw_query_device(struct ib_device *base_dev, struct ib_device_attr *attr,
struct ib_udata *udata)
{ … }
int siw_query_port(struct ib_device *base_dev, u32 port,
struct ib_port_attr *attr)
{ … }
int siw_get_port_immutable(struct ib_device *base_dev, u32 port,
struct ib_port_immutable *port_immutable)
{ … }
int siw_query_gid(struct ib_device *base_dev, u32 port, int idx,
union ib_gid *gid)
{ … }
int siw_alloc_pd(struct ib_pd *pd, struct ib_udata *udata)
{ … }
int siw_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata)
{ … }
void siw_qp_get_ref(struct ib_qp *base_qp)
{ … }
void siw_qp_put_ref(struct ib_qp *base_qp)
{ … }
static struct rdma_user_mmap_entry *
siw_mmap_entry_insert(struct siw_ucontext *uctx,
void *address, size_t length,
u64 *offset)
{ … }
int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
struct ib_udata *udata)
{ … }
int siw_query_qp(struct ib_qp *base_qp, struct ib_qp_attr *qp_attr,
int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr)
{ … }
int siw_verbs_modify_qp(struct ib_qp *base_qp, struct ib_qp_attr *attr,
int attr_mask, struct ib_udata *udata)
{ … }
int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata)
{ … }
static int siw_copy_inline_sgl(const struct ib_send_wr *core_wr,
struct siw_sqe *sqe)
{ … }
static int siw_sq_flush_wr(struct siw_qp *qp, const struct ib_send_wr *wr,
const struct ib_send_wr **bad_wr)
{ … }
static int siw_rq_flush_wr(struct siw_qp *qp, const struct ib_recv_wr *wr,
const struct ib_recv_wr **bad_wr)
{ … }
int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr,
const struct ib_send_wr **bad_wr)
{ … }
int siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr,
const struct ib_recv_wr **bad_wr)
{ … }
int siw_destroy_cq(struct ib_cq *base_cq, struct ib_udata *udata)
{ … }
int siw_create_cq(struct ib_cq *base_cq, const struct ib_cq_init_attr *attr,
struct uverbs_attr_bundle *attrs)
{ … }
int siw_poll_cq(struct ib_cq *base_cq, int num_cqe, struct ib_wc *wc)
{ … }
int siw_req_notify_cq(struct ib_cq *base_cq, enum ib_cq_notify_flags flags)
{ … }
int siw_dereg_mr(struct ib_mr *base_mr, struct ib_udata *udata)
{ … }
struct ib_mr *siw_reg_user_mr(struct ib_pd *pd, u64 start, u64 len,
u64 rnic_va, int rights, struct ib_udata *udata)
{ … }
struct ib_mr *siw_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
u32 max_sge)
{ … }
static int siw_set_pbl_page(struct ib_mr *base_mr, u64 buf_addr)
{ … }
int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle,
unsigned int *sg_off)
{ … }
struct ib_mr *siw_get_dma_mr(struct ib_pd *pd, int rights)
{ … }
int siw_create_srq(struct ib_srq *base_srq,
struct ib_srq_init_attr *init_attrs, struct ib_udata *udata)
{ … }
int siw_modify_srq(struct ib_srq *base_srq, struct ib_srq_attr *attrs,
enum ib_srq_attr_mask attr_mask, struct ib_udata *udata)
{ … }
int siw_query_srq(struct ib_srq *base_srq, struct ib_srq_attr *attrs)
{ … }
int siw_destroy_srq(struct ib_srq *base_srq, struct ib_udata *udata)
{ … }
int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr,
const struct ib_recv_wr **bad_wr)
{ … }
void siw_qp_event(struct siw_qp *qp, enum ib_event_type etype)
{ … }
void siw_cq_event(struct siw_cq *cq, enum ib_event_type etype)
{ … }
void siw_srq_event(struct siw_srq *srq, enum ib_event_type etype)
{ … }
void siw_port_event(struct siw_device *sdev, u32 port, enum ib_event_type etype)
{ … }