siw_verbs.h (3759B)
1/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ 2 3/* Authors: Bernard Metzler <bmt@zurich.ibm.com> */ 4/* Copyright (c) 2008-2019, IBM Corporation */ 5 6#ifndef _SIW_VERBS_H 7#define _SIW_VERBS_H 8 9#include <linux/errno.h> 10 11#include <rdma/iw_cm.h> 12#include <rdma/ib_verbs.h> 13#include <rdma/ib_user_verbs.h> 14 15#include "siw.h" 16#include "siw_cm.h" 17 18/* 19 * siw_copy_sgl() 20 * 21 * Copy SGL from RDMA core representation to local 22 * representation. 23 */ 24static inline void siw_copy_sgl(struct ib_sge *sge, struct siw_sge *siw_sge, 25 int num_sge) 26{ 27 while (num_sge--) { 28 siw_sge->laddr = sge->addr; 29 siw_sge->length = sge->length; 30 siw_sge->lkey = sge->lkey; 31 32 siw_sge++; 33 sge++; 34 } 35} 36 37int siw_alloc_ucontext(struct ib_ucontext *base_ctx, struct ib_udata *udata); 38void siw_dealloc_ucontext(struct ib_ucontext *base_ctx); 39int siw_query_port(struct ib_device *base_dev, u32 port, 40 struct ib_port_attr *attr); 41int siw_get_port_immutable(struct ib_device *base_dev, u32 port, 42 struct ib_port_immutable *port_immutable); 43int siw_query_device(struct ib_device *base_dev, struct ib_device_attr *attr, 44 struct ib_udata *udata); 45int siw_create_cq(struct ib_cq *base_cq, const struct ib_cq_init_attr *attr, 46 struct ib_udata *udata); 47int siw_query_port(struct ib_device *base_dev, u32 port, 48 struct ib_port_attr *attr); 49int siw_query_gid(struct ib_device *base_dev, u32 port, int idx, 50 union ib_gid *gid); 51int siw_alloc_pd(struct ib_pd *base_pd, struct ib_udata *udata); 52int siw_dealloc_pd(struct ib_pd *base_pd, struct ib_udata *udata); 53int siw_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attr, 54 struct ib_udata *udata); 55int siw_query_qp(struct ib_qp *base_qp, struct ib_qp_attr *qp_attr, 56 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); 57int siw_verbs_modify_qp(struct ib_qp *base_qp, struct ib_qp_attr *attr, 58 int attr_mask, struct ib_udata *udata); 59int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata); 60int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr, 61 const struct ib_send_wr **bad_wr); 62int siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr, 63 const struct ib_recv_wr **bad_wr); 64int siw_destroy_cq(struct ib_cq *base_cq, struct ib_udata *udata); 65int siw_poll_cq(struct ib_cq *base_cq, int num_entries, struct ib_wc *wc); 66int siw_req_notify_cq(struct ib_cq *base_cq, enum ib_cq_notify_flags flags); 67struct ib_mr *siw_reg_user_mr(struct ib_pd *base_pd, u64 start, u64 len, 68 u64 rnic_va, int rights, struct ib_udata *udata); 69struct ib_mr *siw_alloc_mr(struct ib_pd *base_pd, enum ib_mr_type mr_type, 70 u32 max_sge); 71struct ib_mr *siw_get_dma_mr(struct ib_pd *base_pd, int rights); 72int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle, 73 unsigned int *sg_off); 74int siw_dereg_mr(struct ib_mr *base_mr, struct ib_udata *udata); 75int siw_create_srq(struct ib_srq *base_srq, struct ib_srq_init_attr *attr, 76 struct ib_udata *udata); 77int siw_modify_srq(struct ib_srq *base_srq, struct ib_srq_attr *attr, 78 enum ib_srq_attr_mask mask, struct ib_udata *udata); 79int siw_query_srq(struct ib_srq *base_srq, struct ib_srq_attr *attr); 80int siw_destroy_srq(struct ib_srq *base_srq, struct ib_udata *udata); 81int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr, 82 const struct ib_recv_wr **bad_wr); 83int siw_mmap(struct ib_ucontext *ctx, struct vm_area_struct *vma); 84void siw_mmap_free(struct rdma_user_mmap_entry *rdma_entry); 85void siw_qp_event(struct siw_qp *qp, enum ib_event_type type); 86void siw_cq_event(struct siw_cq *cq, enum ib_event_type type); 87void siw_srq_event(struct siw_srq *srq, enum ib_event_type type); 88void siw_port_event(struct siw_device *dev, u32 port, enum ib_event_type type); 89 90#endif