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 * $FreeBSD$ 28 */ 29 30 31 #ifndef __QLNXR_VERBS_H__ 32 #define __QLNXR_VERBS_H__ 33 34 extern int qlnxr_iw_query_gid(struct ib_device *, 35 uint8_t port, 36 int index, 37 union ib_gid *gid); 38 39 extern int qlnxr_query_gid(struct ib_device *, 40 u8 port, 41 int index, 42 union ib_gid *gid); 43 44 extern struct ib_srq *qlnxr_create_srq(struct ib_pd *, 45 struct ib_srq_init_attr *, 46 struct ib_udata *); 47 48 extern int qlnxr_destroy_srq(struct ib_srq *); 49 50 51 extern int qlnxr_modify_srq(struct ib_srq *, 52 struct ib_srq_attr *, 53 enum ib_srq_attr_mask, 54 struct ib_udata *); 55 56 extern int qlnxr_query_srq(struct ib_srq *, 57 struct ib_srq_attr *); 58 59 extern int qlnxr_post_srq_recv(struct ib_srq *, 60 struct ib_recv_wr *, 61 struct ib_recv_wr **bad_recv_wr); 62 63 #if __FreeBSD_version < 1102000 64 extern int qlnxr_query_device(struct ib_device *, struct ib_device_attr *); 65 #else 66 extern int qlnxr_query_device(struct ib_device *, struct ib_device_attr *, 67 struct ib_udata *); 68 extern int qlnxr_get_port_immutable(struct ib_device *ibdev, u8 port_num, 69 struct ib_port_immutable *immutable); 70 #endif 71 72 extern int qlnxr_query_port(struct ib_device *, 73 u8 port, 74 struct ib_port_attr *props); 75 76 extern int qlnxr_modify_port(struct ib_device *, 77 u8 port, 78 int mask, 79 struct ib_port_modify *props); 80 81 extern enum rdma_link_layer qlnxr_link_layer(struct ib_device *device, 82 uint8_t port_num); 83 84 struct ib_pd *qlnxr_alloc_pd(struct ib_device *, 85 struct ib_ucontext *, 86 struct ib_udata *); 87 88 extern int qlnxr_dealloc_pd(struct ib_pd *pd); 89 90 #if __FreeBSD_version >= 1102000 91 extern struct ib_cq *qlnxr_create_cq(struct ib_device *ibdev, 92 const struct ib_cq_init_attr *attr, 93 struct ib_ucontext *ib_ctx, 94 struct ib_udata *udata); 95 #else 96 #if __FreeBSD_version >= 1100000 97 extern struct ib_cq *qlnxr_create_cq(struct ib_device *ibdev, 98 struct ib_cq_init_attr *attr, 99 struct ib_ucontext *ib_ctx, 100 struct ib_udata *udata); 101 #else 102 extern struct ib_cq *qlnxr_create_cq(struct ib_device *ibdev, 103 int cqe, 104 int comp_vector, 105 struct ib_ucontext *ib_ctx, 106 struct ib_udata *udata); 107 #endif 108 #endif /* #if __FreeBSD_version >= 1102000 */ 109 110 extern int qlnxr_destroy_cq(struct ib_cq *); 111 112 extern int qlnxr_resize_cq(struct ib_cq *, 113 int cqe, 114 struct ib_udata *); 115 116 extern int qlnxr_poll_cq(struct ib_cq *, 117 int num_entries, 118 struct ib_wc *wc); 119 120 121 extern struct ib_qp *qlnxr_create_qp(struct ib_pd *, 122 struct ib_qp_init_attr *attrs, 123 struct ib_udata *); 124 125 extern int qlnxr_modify_qp(struct ib_qp *, 126 struct ib_qp_attr *attr, 127 int attr_mask, 128 struct ib_udata *udata); 129 130 extern int qlnxr_query_qp(struct ib_qp *, 131 struct ib_qp_attr *qp_attr, 132 int qp_attr_mask, 133 struct ib_qp_init_attr *); 134 135 extern int qlnxr_destroy_qp(struct ib_qp *); 136 137 extern int qlnxr_query_pkey(struct ib_device *, 138 u8 port, 139 u16 index, 140 u16 *pkey); 141 142 #if __FreeBSD_version >= 1102000 143 extern struct ib_ah *qlnxr_create_ah(struct ib_pd *ibpd, 144 struct ib_ah_attr *attr, struct ib_udata *udata); 145 #else 146 extern struct ib_ah *qlnxr_create_ah(struct ib_pd *ibpd, 147 struct ib_ah_attr *attr); 148 #endif /* #if __FreeBSD_version >= 1102000 */ 149 150 extern int qlnxr_destroy_ah(struct ib_ah *ibah); 151 152 extern int qlnxr_query_ah(struct ib_ah *ibah, 153 struct ib_ah_attr *attr); 154 155 extern int qlnxr_modify_ah(struct ib_ah *ibah, 156 struct ib_ah_attr *attr); 157 158 #if __FreeBSD_version >= 1102000 159 extern int qlnxr_process_mad(struct ib_device *ibdev, 160 int process_mad_flags, 161 u8 port_num, 162 const struct ib_wc *in_wc, 163 const struct ib_grh *in_grh, 164 const struct ib_mad_hdr *mad_hdr, 165 size_t in_mad_size, 166 struct ib_mad_hdr *out_mad, 167 size_t *out_mad_size, 168 u16 *out_mad_pkey_index); 169 #else 170 extern int qlnxr_process_mad(struct ib_device *ibdev, 171 int process_mad_flags, 172 u8 port_num, 173 struct ib_wc *in_wc, 174 struct ib_grh *in_grh, 175 struct ib_mad *in_mad, 176 struct ib_mad *out_mad); 177 #endif /* #if __FreeBSD_version >= 1102000 */ 178 179 extern int qlnxr_post_send(struct ib_qp *, 180 struct ib_send_wr *, 181 struct ib_send_wr **bad_wr); 182 183 extern int qlnxr_post_recv(struct ib_qp *, 184 struct ib_recv_wr *, 185 struct ib_recv_wr **bad_wr); 186 187 extern int qlnxr_arm_cq(struct ib_cq *, 188 enum ib_cq_notify_flags flags); 189 190 extern struct ib_mr *qlnxr_get_dma_mr(struct ib_pd *, 191 int acc); 192 193 #if __FreeBSD_version < 1102000 194 extern struct ib_mr *qlnxr_reg_kernel_mr(struct ib_pd *, 195 struct ib_phys_buf *buffer_list, 196 int num_phys_buf, 197 int acc, 198 u64 *iova_start); 199 #endif /* #if __FreeBSD_version < 1102000 */ 200 201 extern int qlnxr_dereg_mr(struct ib_mr *); 202 203 #if __FreeBSD_version >= 1102000 204 extern struct ib_mr *qlnxr_reg_user_mr(struct ib_pd *, 205 u64 start, 206 u64 length, 207 u64 virt, 208 int acc, 209 struct ib_udata *); 210 #else 211 extern struct ib_mr *qlnxr_reg_user_mr(struct ib_pd *, 212 u64 start, 213 u64 length, 214 u64 virt, 215 int acc, 216 struct ib_udata *, 217 int mr_id); 218 #endif /* #if __FreeBSD_version >= 1102000 */ 219 220 #if __FreeBSD_version >= 1102000 221 222 extern struct ib_mr *qlnxr_alloc_mr(struct ib_pd *pd, 223 enum ib_mr_type mr_type, u32 max_num_sg); 224 extern int qlnxr_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, 225 int sg_nents, unsigned int *sg_offset); 226 #else 227 228 extern struct ib_mr *qlnxr_alloc_frmr(struct ib_pd *pd, 229 int max_page_list_len); 230 231 232 extern struct ib_fast_reg_page_list *qlnxr_alloc_frmr_page_list( 233 struct ib_device *ibdev, 234 int page_list_len); 235 236 extern void qlnxr_free_frmr_page_list(struct ib_fast_reg_page_list *page_list); 237 238 #endif /* #if __FreeBSD_version >= 1102000 */ 239 240 extern struct ib_ucontext *qlnxr_alloc_ucontext(struct ib_device *ibdev, 241 struct ib_udata *udata); 242 243 extern int qlnxr_dealloc_ucontext(struct ib_ucontext *ibctx); 244 245 246 extern int qlnxr_mmap(struct ib_ucontext *, struct vm_area_struct *vma); 247 248 extern int qlnxr_iw_connect(struct iw_cm_id *cm_id, 249 struct iw_cm_conn_param *conn_param); 250 251 extern int qlnxr_iw_create_listen(struct iw_cm_id *cm_id, int backlog); 252 253 void qlnxr_iw_destroy_listen(struct iw_cm_id *cm_id); 254 255 extern int qlnxr_iw_accept(struct iw_cm_id *cm_id, 256 struct iw_cm_conn_param *conn_param); 257 258 extern int qlnxr_iw_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len); 259 260 extern void qlnxr_iw_qp_add_ref(struct ib_qp *qp); 261 262 extern void qlnxr_iw_qp_rem_ref(struct ib_qp *qp); 263 264 extern struct ib_qp *qlnxr_iw_get_qp(struct ib_device *dev, int qpn); 265 266 #endif /* #ifndef __QLNXR_VERBS_H__ */ 267 268