1 /* 2 * Copyright (c) 2018-2019 Cavium, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 * 27 */ 28 29 #ifndef __QLNXR_VERBS_H__ 30 #define __QLNXR_VERBS_H__ 31 32 extern int qlnxr_iw_query_gid(struct ib_device *, 33 uint8_t port, 34 int index, 35 union ib_gid *gid); 36 37 extern int qlnxr_query_gid(struct ib_device *, 38 u8 port, 39 int index, 40 union ib_gid *gid); 41 42 extern int qlnxr_create_srq(struct ib_srq *ibsrq, 43 struct ib_srq_init_attr *, 44 struct ib_udata *); 45 46 extern void qlnxr_destroy_srq(struct ib_srq *, 47 struct ib_udata *); 48 49 extern int qlnxr_modify_srq(struct ib_srq *, 50 struct ib_srq_attr *, 51 enum ib_srq_attr_mask, 52 struct ib_udata *); 53 54 extern int qlnxr_query_srq(struct ib_srq *, 55 struct ib_srq_attr *); 56 57 extern int qlnxr_post_srq_recv(struct ib_srq *, 58 const struct ib_recv_wr *, 59 const struct ib_recv_wr **bad_recv_wr); 60 61 extern int qlnxr_query_device(struct ib_device *, struct ib_device_attr *, 62 struct ib_udata *); 63 extern int qlnxr_get_port_immutable(struct ib_device *ibdev, u8 port_num, 64 struct ib_port_immutable *immutable); 65 66 extern int qlnxr_query_port(struct ib_device *, 67 u8 port, 68 struct ib_port_attr *props); 69 70 extern int qlnxr_modify_port(struct ib_device *, 71 u8 port, 72 int mask, 73 struct ib_port_modify *props); 74 75 extern enum rdma_link_layer qlnxr_link_layer(struct ib_device *device, 76 uint8_t port_num); 77 78 extern int qlnxr_alloc_pd(struct ib_pd *ibpd, struct ib_udata *); 79 80 extern void qlnxr_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata); 81 82 extern int qlnxr_create_cq(struct ib_cq *ibcq, 83 const struct ib_cq_init_attr *attr, 84 struct ib_udata *udata); 85 86 extern void qlnxr_destroy_cq(struct ib_cq *, struct ib_udata *); 87 88 extern int qlnxr_resize_cq(struct ib_cq *, 89 int cqe, 90 struct ib_udata *); 91 92 extern int qlnxr_poll_cq(struct ib_cq *, 93 int num_entries, 94 struct ib_wc *wc); 95 96 extern struct ib_qp *qlnxr_create_qp(struct ib_pd *, 97 struct ib_qp_init_attr *attrs, 98 struct ib_udata *); 99 100 extern int qlnxr_modify_qp(struct ib_qp *, 101 struct ib_qp_attr *attr, 102 int attr_mask, 103 struct ib_udata *udata); 104 105 extern int qlnxr_query_qp(struct ib_qp *, 106 struct ib_qp_attr *qp_attr, 107 int qp_attr_mask, 108 struct ib_qp_init_attr *); 109 110 extern int qlnxr_destroy_qp(struct ib_qp *, struct ib_udata *); 111 112 extern int qlnxr_query_pkey(struct ib_device *, 113 u8 port, 114 u16 index, 115 u16 *pkey); 116 117 extern int qlnxr_create_ah(struct ib_ah *ibah, 118 struct ib_ah_attr *attr, u32 flags, 119 struct ib_udata *udata); 120 extern void qlnxr_destroy_ah(struct ib_ah *ibah, u32 flags); 121 122 extern int qlnxr_query_ah(struct ib_ah *ibah, 123 struct ib_ah_attr *attr); 124 125 extern int qlnxr_modify_ah(struct ib_ah *ibah, 126 struct ib_ah_attr *attr); 127 128 extern int qlnxr_process_mad(struct ib_device *ibdev, 129 int process_mad_flags, 130 u8 port_num, 131 const struct ib_wc *in_wc, 132 const struct ib_grh *in_grh, 133 const struct ib_mad_hdr *mad_hdr, 134 size_t in_mad_size, 135 struct ib_mad_hdr *out_mad, 136 size_t *out_mad_size, 137 u16 *out_mad_pkey_index); 138 139 extern int qlnxr_post_send(struct ib_qp *, 140 const struct ib_send_wr *, 141 const struct ib_send_wr **bad_wr); 142 143 extern int qlnxr_post_recv(struct ib_qp *, 144 const struct ib_recv_wr *, 145 const struct ib_recv_wr **bad_wr); 146 147 extern int qlnxr_arm_cq(struct ib_cq *, 148 enum ib_cq_notify_flags flags); 149 150 extern struct ib_mr *qlnxr_get_dma_mr(struct ib_pd *, 151 int acc); 152 153 extern int qlnxr_dereg_mr(struct ib_mr *, struct ib_udata *); 154 155 extern struct ib_mr *qlnxr_reg_user_mr(struct ib_pd *, 156 u64 start, 157 u64 length, 158 u64 virt, 159 int acc, 160 struct ib_udata *); 161 162 extern struct ib_mr *qlnxr_alloc_mr(struct ib_pd *pd, 163 enum ib_mr_type mr_type, u32 max_num_sg, 164 struct ib_udata *udata); 165 166 extern int qlnxr_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, 167 int sg_nents, unsigned int *sg_offset); 168 169 extern int qlnxr_alloc_ucontext(struct ib_ucontext *uctx, 170 struct ib_udata *udata); 171 172 extern void qlnxr_dealloc_ucontext(struct ib_ucontext *ibctx); 173 174 extern int qlnxr_mmap(struct ib_ucontext *, struct vm_area_struct *vma); 175 176 extern int qlnxr_iw_connect(struct iw_cm_id *cm_id, 177 struct iw_cm_conn_param *conn_param); 178 179 extern int qlnxr_iw_create_listen(struct iw_cm_id *cm_id, int backlog); 180 181 void qlnxr_iw_destroy_listen(struct iw_cm_id *cm_id); 182 183 extern int qlnxr_iw_accept(struct iw_cm_id *cm_id, 184 struct iw_cm_conn_param *conn_param); 185 186 extern int qlnxr_iw_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len); 187 188 extern void qlnxr_iw_qp_add_ref(struct ib_qp *qp); 189 190 extern void qlnxr_iw_qp_rem_ref(struct ib_qp *qp); 191 192 extern struct ib_qp *qlnxr_iw_get_qp(struct ib_device *dev, int qpn); 193 194 #endif /* #ifndef __QLNXR_VERBS_H__ */ 195