Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * IBM eServer eHCA Infiniband device driver for Linux on POWER |
| 3 | * |
| 4 | * Function definitions for internal functions |
| 5 | * |
| 6 | * Authors: Heiko J Schick <schickhj@de.ibm.com> |
| 7 | * Dietmar Decker <ddecker@de.ibm.com> |
| 8 | * |
| 9 | * Copyright (c) 2005 IBM Corporation |
| 10 | * |
| 11 | * All rights reserved. |
| 12 | * |
| 13 | * This source code is distributed under a dual license of GPL v2.0 and OpenIB |
| 14 | * BSD. |
| 15 | * |
| 16 | * OpenIB BSD License |
| 17 | * |
| 18 | * Redistribution and use in source and binary forms, with or without |
| 19 | * modification, are permitted provided that the following conditions are met: |
| 20 | * |
| 21 | * Redistributions of source code must retain the above copyright notice, this |
| 22 | * list of conditions and the following disclaimer. |
| 23 | * |
| 24 | * Redistributions in binary form must reproduce the above copyright notice, |
| 25 | * this list of conditions and the following disclaimer in the documentation |
| 26 | * and/or other materials |
| 27 | * provided with the distribution. |
| 28 | * |
| 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 30 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 31 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 32 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 33 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 34 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 35 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 36 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 37 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 38 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 39 | * POSSIBILITY OF SUCH DAMAGE. |
| 40 | */ |
| 41 | |
| 42 | #ifndef __EHCA_IVERBS_H__ |
| 43 | #define __EHCA_IVERBS_H__ |
| 44 | |
| 45 | #include "ehca_classes.h" |
| 46 | |
| 47 | int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props); |
| 48 | |
| 49 | int ehca_query_port(struct ib_device *ibdev, u8 port, |
| 50 | struct ib_port_attr *props); |
| 51 | |
Michael Wang | 6b90a6d | 2015-05-05 14:50:18 +0200 | [diff] [blame] | 52 | enum rdma_protocol_type |
| 53 | ehca_query_protocol(struct ib_device *device, u8 port_num); |
| 54 | |
Joachim Fenkes | 8705ce5 | 2007-07-09 15:32:22 +0200 | [diff] [blame] | 55 | int ehca_query_sma_attr(struct ehca_shca *shca, u8 port, |
| 56 | struct ehca_sma_attr *attr); |
| 57 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 58 | int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 * pkey); |
| 59 | |
| 60 | int ehca_query_gid(struct ib_device *ibdev, u8 port, int index, |
| 61 | union ib_gid *gid); |
| 62 | |
| 63 | int ehca_modify_port(struct ib_device *ibdev, u8 port, int port_modify_mask, |
| 64 | struct ib_port_modify *props); |
| 65 | |
| 66 | struct ib_pd *ehca_alloc_pd(struct ib_device *device, |
| 67 | struct ib_ucontext *context, |
| 68 | struct ib_udata *udata); |
| 69 | |
| 70 | int ehca_dealloc_pd(struct ib_pd *pd); |
| 71 | |
| 72 | struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); |
| 73 | |
| 74 | int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr); |
| 75 | |
| 76 | int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr); |
| 77 | |
| 78 | int ehca_destroy_ah(struct ib_ah *ah); |
| 79 | |
| 80 | struct ib_mr *ehca_get_dma_mr(struct ib_pd *pd, int mr_access_flags); |
| 81 | |
| 82 | struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd, |
| 83 | struct ib_phys_buf *phys_buf_array, |
| 84 | int num_phys_buf, |
| 85 | int mr_access_flags, u64 *iova_start); |
| 86 | |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame] | 87 | struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, |
| 88 | u64 virt, int mr_access_flags, |
| 89 | struct ib_udata *udata); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 90 | |
| 91 | int ehca_rereg_phys_mr(struct ib_mr *mr, |
| 92 | int mr_rereg_mask, |
| 93 | struct ib_pd *pd, |
| 94 | struct ib_phys_buf *phys_buf_array, |
| 95 | int num_phys_buf, int mr_access_flags, u64 *iova_start); |
| 96 | |
| 97 | int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr); |
| 98 | |
| 99 | int ehca_dereg_mr(struct ib_mr *mr); |
| 100 | |
Shani Michaeli | 7083e42 | 2013-02-06 16:19:12 +0000 | [diff] [blame] | 101 | struct ib_mw *ehca_alloc_mw(struct ib_pd *pd, enum ib_mw_type type); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 102 | |
| 103 | int ehca_bind_mw(struct ib_qp *qp, struct ib_mw *mw, |
| 104 | struct ib_mw_bind *mw_bind); |
| 105 | |
| 106 | int ehca_dealloc_mw(struct ib_mw *mw); |
| 107 | |
| 108 | struct ib_fmr *ehca_alloc_fmr(struct ib_pd *pd, |
| 109 | int mr_access_flags, |
| 110 | struct ib_fmr_attr *fmr_attr); |
| 111 | |
| 112 | int ehca_map_phys_fmr(struct ib_fmr *fmr, |
| 113 | u64 *page_list, int list_len, u64 iova); |
| 114 | |
| 115 | int ehca_unmap_fmr(struct list_head *fmr_list); |
| 116 | |
| 117 | int ehca_dealloc_fmr(struct ib_fmr *fmr); |
| 118 | |
| 119 | enum ehca_eq_type { |
| 120 | EHCA_EQ = 0, /* Event Queue */ |
| 121 | EHCA_NEQ /* Notification Event Queue */ |
| 122 | }; |
| 123 | |
| 124 | int ehca_create_eq(struct ehca_shca *shca, struct ehca_eq *eq, |
| 125 | enum ehca_eq_type type, const u32 length); |
| 126 | |
| 127 | int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq); |
| 128 | |
| 129 | void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq); |
| 130 | |
| 131 | |
Michael S. Tsirkin | f4fd0b2 | 2007-05-03 13:48:47 +0300 | [diff] [blame] | 132 | struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector, |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 133 | struct ib_ucontext *context, |
| 134 | struct ib_udata *udata); |
| 135 | |
| 136 | int ehca_destroy_cq(struct ib_cq *cq); |
| 137 | |
| 138 | int ehca_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata); |
| 139 | |
| 140 | int ehca_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc); |
| 141 | |
| 142 | int ehca_peek_cq(struct ib_cq *cq, int wc_cnt); |
| 143 | |
Roland Dreier | ed23a72 | 2007-05-06 21:02:48 -0700 | [diff] [blame] | 144 | int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 145 | |
| 146 | struct ib_qp *ehca_create_qp(struct ib_pd *pd, |
| 147 | struct ib_qp_init_attr *init_attr, |
| 148 | struct ib_udata *udata); |
| 149 | |
| 150 | int ehca_destroy_qp(struct ib_qp *qp); |
| 151 | |
Ralph Campbell | 9bc57e2 | 2006-08-11 14:58:09 -0700 | [diff] [blame] | 152 | int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, |
| 153 | struct ib_udata *udata); |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 154 | |
| 155 | int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, |
| 156 | int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); |
| 157 | |
| 158 | int ehca_post_send(struct ib_qp *qp, struct ib_send_wr *send_wr, |
| 159 | struct ib_send_wr **bad_send_wr); |
| 160 | |
| 161 | int ehca_post_recv(struct ib_qp *qp, struct ib_recv_wr *recv_wr, |
| 162 | struct ib_recv_wr **bad_recv_wr); |
| 163 | |
Joachim Fenkes | a6a1294 | 2007-07-09 15:25:10 +0200 | [diff] [blame] | 164 | int ehca_post_srq_recv(struct ib_srq *srq, |
| 165 | struct ib_recv_wr *recv_wr, |
| 166 | struct ib_recv_wr **bad_recv_wr); |
| 167 | |
| 168 | struct ib_srq *ehca_create_srq(struct ib_pd *pd, |
| 169 | struct ib_srq_init_attr *init_attr, |
| 170 | struct ib_udata *udata); |
| 171 | |
| 172 | int ehca_modify_srq(struct ib_srq *srq, struct ib_srq_attr *attr, |
| 173 | enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); |
| 174 | |
| 175 | int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr); |
| 176 | |
| 177 | int ehca_destroy_srq(struct ib_srq *srq); |
| 178 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 179 | u64 ehca_define_sqp(struct ehca_shca *shca, struct ehca_qp *ibqp, |
| 180 | struct ib_qp_init_attr *qp_init_attr); |
| 181 | |
| 182 | int ehca_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid); |
| 183 | |
| 184 | int ehca_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid); |
| 185 | |
| 186 | struct ib_ucontext *ehca_alloc_ucontext(struct ib_device *device, |
| 187 | struct ib_udata *udata); |
| 188 | |
| 189 | int ehca_dealloc_ucontext(struct ib_ucontext *context); |
| 190 | |
| 191 | int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma); |
| 192 | |
Hoang-Nam Nguyen | 2b5e6b1 | 2008-01-25 21:18:27 +0100 | [diff] [blame] | 193 | int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, |
Ira Weiny | a97e2d8 | 2015-05-31 17:15:30 -0400 | [diff] [blame^] | 194 | const struct ib_wc *in_wc, const struct ib_grh *in_grh, |
| 195 | const struct ib_mad *in_mad, |
Hoang-Nam Nguyen | 2b5e6b1 | 2008-01-25 21:18:27 +0100 | [diff] [blame] | 196 | struct ib_mad *out_mad); |
| 197 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 198 | void ehca_poll_eqs(unsigned long data); |
| 199 | |
Joachim Fenkes | 51aaa54 | 2007-11-02 15:41:49 +0200 | [diff] [blame] | 200 | int ehca_calc_ipd(struct ehca_shca *shca, int port, |
| 201 | enum ib_rate path_rate, u32 *ipd); |
| 202 | |
Alexander Schmidt | b9012e0 | 2008-09-20 20:05:21 -0700 | [diff] [blame] | 203 | void ehca_add_to_err_list(struct ehca_qp *qp, int on_sq); |
| 204 | |
Hoang-Nam Nguyen | 7e28db5 | 2006-11-07 00:56:39 +0100 | [diff] [blame] | 205 | #ifdef CONFIG_PPC_64K_PAGES |
Hoang-Nam Nguyen | f2d9136 | 2007-01-09 18:04:14 +0100 | [diff] [blame] | 206 | void *ehca_alloc_fw_ctrlblock(gfp_t flags); |
Hoang-Nam Nguyen | 7e28db5 | 2006-11-07 00:56:39 +0100 | [diff] [blame] | 207 | void ehca_free_fw_ctrlblock(void *ptr); |
| 208 | #else |
Hoang-Nam Nguyen | 2b94397 | 2007-07-12 17:53:47 +0200 | [diff] [blame] | 209 | #define ehca_alloc_fw_ctrlblock(flags) ((void *)get_zeroed_page(flags)) |
Hoang-Nam Nguyen | 7e28db5 | 2006-11-07 00:56:39 +0100 | [diff] [blame] | 210 | #define ehca_free_fw_ctrlblock(ptr) free_page((unsigned long)(ptr)) |
| 211 | #endif |
| 212 | |
Hoang-Nam Nguyen | bbdd267 | 2008-01-17 15:05:45 +0100 | [diff] [blame] | 213 | void ehca_recover_sqp(struct ib_qp *sqp); |
| 214 | |
Heiko J Schick | fab9722 | 2006-09-22 15:22:22 -0700 | [diff] [blame] | 215 | #endif |