162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci/* Authors: Bernard Metzler <bmt@zurich.ibm.com> */ 462306a36Sopenharmony_ci/* Copyright (c) 2008-2019, IBM Corporation */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef _SIW_VERBS_H 762306a36Sopenharmony_ci#define _SIW_VERBS_H 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/errno.h> 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <rdma/iw_cm.h> 1262306a36Sopenharmony_ci#include <rdma/ib_verbs.h> 1362306a36Sopenharmony_ci#include <rdma/ib_user_verbs.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include "siw.h" 1662306a36Sopenharmony_ci#include "siw_cm.h" 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* 1962306a36Sopenharmony_ci * siw_copy_sgl() 2062306a36Sopenharmony_ci * 2162306a36Sopenharmony_ci * Copy SGL from RDMA core representation to local 2262306a36Sopenharmony_ci * representation. 2362306a36Sopenharmony_ci */ 2462306a36Sopenharmony_cistatic inline void siw_copy_sgl(struct ib_sge *sge, struct siw_sge *siw_sge, 2562306a36Sopenharmony_ci int num_sge) 2662306a36Sopenharmony_ci{ 2762306a36Sopenharmony_ci while (num_sge--) { 2862306a36Sopenharmony_ci siw_sge->laddr = sge->addr; 2962306a36Sopenharmony_ci siw_sge->length = sge->length; 3062306a36Sopenharmony_ci siw_sge->lkey = sge->lkey; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci siw_sge++; 3362306a36Sopenharmony_ci sge++; 3462306a36Sopenharmony_ci } 3562306a36Sopenharmony_ci} 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ciint siw_alloc_ucontext(struct ib_ucontext *base_ctx, struct ib_udata *udata); 3862306a36Sopenharmony_civoid siw_dealloc_ucontext(struct ib_ucontext *base_ctx); 3962306a36Sopenharmony_ciint siw_query_port(struct ib_device *base_dev, u32 port, 4062306a36Sopenharmony_ci struct ib_port_attr *attr); 4162306a36Sopenharmony_ciint siw_get_port_immutable(struct ib_device *base_dev, u32 port, 4262306a36Sopenharmony_ci struct ib_port_immutable *port_immutable); 4362306a36Sopenharmony_ciint siw_query_device(struct ib_device *base_dev, struct ib_device_attr *attr, 4462306a36Sopenharmony_ci struct ib_udata *udata); 4562306a36Sopenharmony_ciint siw_create_cq(struct ib_cq *base_cq, const struct ib_cq_init_attr *attr, 4662306a36Sopenharmony_ci struct ib_udata *udata); 4762306a36Sopenharmony_ciint siw_query_port(struct ib_device *base_dev, u32 port, 4862306a36Sopenharmony_ci struct ib_port_attr *attr); 4962306a36Sopenharmony_ciint siw_query_gid(struct ib_device *base_dev, u32 port, int idx, 5062306a36Sopenharmony_ci union ib_gid *gid); 5162306a36Sopenharmony_ciint siw_alloc_pd(struct ib_pd *base_pd, struct ib_udata *udata); 5262306a36Sopenharmony_ciint siw_dealloc_pd(struct ib_pd *base_pd, struct ib_udata *udata); 5362306a36Sopenharmony_ciint siw_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attr, 5462306a36Sopenharmony_ci struct ib_udata *udata); 5562306a36Sopenharmony_ciint siw_query_qp(struct ib_qp *base_qp, struct ib_qp_attr *qp_attr, 5662306a36Sopenharmony_ci int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); 5762306a36Sopenharmony_ciint siw_verbs_modify_qp(struct ib_qp *base_qp, struct ib_qp_attr *attr, 5862306a36Sopenharmony_ci int attr_mask, struct ib_udata *udata); 5962306a36Sopenharmony_ciint siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata); 6062306a36Sopenharmony_ciint siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr, 6162306a36Sopenharmony_ci const struct ib_send_wr **bad_wr); 6262306a36Sopenharmony_ciint siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr, 6362306a36Sopenharmony_ci const struct ib_recv_wr **bad_wr); 6462306a36Sopenharmony_ciint siw_destroy_cq(struct ib_cq *base_cq, struct ib_udata *udata); 6562306a36Sopenharmony_ciint siw_poll_cq(struct ib_cq *base_cq, int num_entries, struct ib_wc *wc); 6662306a36Sopenharmony_ciint siw_req_notify_cq(struct ib_cq *base_cq, enum ib_cq_notify_flags flags); 6762306a36Sopenharmony_cistruct ib_mr *siw_reg_user_mr(struct ib_pd *base_pd, u64 start, u64 len, 6862306a36Sopenharmony_ci u64 rnic_va, int rights, struct ib_udata *udata); 6962306a36Sopenharmony_cistruct ib_mr *siw_alloc_mr(struct ib_pd *base_pd, enum ib_mr_type mr_type, 7062306a36Sopenharmony_ci u32 max_sge); 7162306a36Sopenharmony_cistruct ib_mr *siw_get_dma_mr(struct ib_pd *base_pd, int rights); 7262306a36Sopenharmony_ciint siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle, 7362306a36Sopenharmony_ci unsigned int *sg_off); 7462306a36Sopenharmony_ciint siw_dereg_mr(struct ib_mr *base_mr, struct ib_udata *udata); 7562306a36Sopenharmony_ciint siw_create_srq(struct ib_srq *base_srq, struct ib_srq_init_attr *attr, 7662306a36Sopenharmony_ci struct ib_udata *udata); 7762306a36Sopenharmony_ciint siw_modify_srq(struct ib_srq *base_srq, struct ib_srq_attr *attr, 7862306a36Sopenharmony_ci enum ib_srq_attr_mask mask, struct ib_udata *udata); 7962306a36Sopenharmony_ciint siw_query_srq(struct ib_srq *base_srq, struct ib_srq_attr *attr); 8062306a36Sopenharmony_ciint siw_destroy_srq(struct ib_srq *base_srq, struct ib_udata *udata); 8162306a36Sopenharmony_ciint siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr, 8262306a36Sopenharmony_ci const struct ib_recv_wr **bad_wr); 8362306a36Sopenharmony_ciint siw_mmap(struct ib_ucontext *ctx, struct vm_area_struct *vma); 8462306a36Sopenharmony_civoid siw_mmap_free(struct rdma_user_mmap_entry *rdma_entry); 8562306a36Sopenharmony_civoid siw_qp_event(struct siw_qp *qp, enum ib_event_type type); 8662306a36Sopenharmony_civoid siw_cq_event(struct siw_cq *cq, enum ib_event_type type); 8762306a36Sopenharmony_civoid siw_srq_event(struct siw_srq *srq, enum ib_event_type type); 8862306a36Sopenharmony_civoid siw_port_event(struct siw_device *dev, u32 port, enum ib_event_type type); 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci#endif 91