1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _DAPL_TAVOR_IMPL_H 28 #define _DAPL_TAVOR_IMPL_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #include <sys/types.h> 35 36 #include "dapl_hash.h" 37 #include "dapl_tavor_ibtf.h" 38 #include "dapl_tavor_wr.h" 39 40 /* 41 * Struct defining the hca handle 42 */ 43 struct dapls_ib_hca_handle { 44 int ia_fd; /* fd corresponding to the IA */ 45 minor_t ia_rnum; /* Kernel resource number of the IA */ 46 int hca_fd; /* fd for the HCA ie. tavor */ 47 int *ia_bf_toggle; /* toggle between the 2 bf buffers */ 48 dapls_hw_uar_t ia_uar; /* pointer to the HCA UAR page */ 49 void *ia_bf; /* pointer to the Hermon Blueflame page */ 50 }; 51 52 /* 53 * Struct defining the CQ handle 54 */ 55 struct dapls_ib_cq_handle { 56 uint64_t evd_hkey; 57 uint32_t cq_num; 58 uint32_t cq_size; 59 uint32_t cq_cqesz; 60 off64_t cq_map_offset; 61 uint64_t cq_map_len; 62 dapls_hw_uar_t cq_iauar; /* copy of the UAR doorbell page */ 63 dapls_hw_cqe_t cq_addr; 64 uint32_t cq_consindx; 65 uint32_t cq_log_cqsz; 66 /* For Work Request ID processing */ 67 DAPL_OS_LOCK cq_wrid_wqhdr_lock; 68 DAPL_HASH_TABLE *cq_wrid_wqhdr_list; 69 dapls_tavor_wrid_list_hdr_t *cq_wrid_reap_head; 70 dapls_tavor_wrid_list_hdr_t *cq_wrid_reap_tail; 71 /* For Arbel or Hermon */ 72 uint32_t *cq_poll_dbp; 73 uint32_t *cq_arm_dbp; 74 /* For Hermon cq_resize */ 75 dapls_hw_cqe_t cq_resize_addr; 76 off64_t cq_resize_map_offset; 77 uint64_t cq_resize_map_len; 78 uint32_t cq_resize_size; 79 uint32_t cq_resize_cqesz; 80 }; 81 82 struct dapls_ib_qp_handle { 83 uint64_t ep_hkey; 84 caddr_t qp_addr; 85 uint64_t qp_map_len; 86 uint32_t qp_num; 87 dapls_hw_uar_t qp_iauar; /* copy of the UAR doorbell page */ 88 void *qp_ia_bf; /* copy of the Hermon Blueflame pg */ 89 int *qp_ia_bf_toggle; /* ptr to adapter toggle */ 90 uint32_t qp_num_mpt_shift; /* Max # of MPT entries */ 91 /* in bit shift */ 92 uint32_t qp_num_premature_events; 93 ib_work_completion_t *qp_premature_events; 94 95 /* Send Work Queue */ 96 ib_cq_handle_t qp_sq_cqhdl; 97 uint64_t *qp_sq_lastwqeaddr; 98 dapls_tavor_workq_hdr_t *qp_sq_wqhdr; 99 caddr_t qp_sq_buf; 100 uint32_t qp_sq_desc_addr; 101 uint32_t qp_sq_numwqe; 102 uint32_t qp_sq_wqesz; 103 uint32_t qp_sq_sgl; 104 uint16_t qp_sq_counter; 105 uint32_t qp_sq_headroom; /* For Hermon */ 106 int qp_sq_inline; 107 uint32_t *qp_sq_dbp; /* For Arbel */ 108 109 /* Receive Work Queue */ 110 ib_cq_handle_t qp_rq_cqhdl; 111 uint64_t *qp_rq_lastwqeaddr; 112 dapls_tavor_workq_hdr_t *qp_rq_wqhdr; 113 caddr_t qp_rq_buf; 114 uint32_t qp_rq_desc_addr; 115 uint32_t qp_rq_numwqe; 116 uint32_t qp_rq_wqesz; 117 uint32_t qp_rq_sgl; 118 uint32_t *qp_rq_dbp; /* For Arbel or Hermon */ 119 uint16_t qp_rq_counter; /* For Arbel or Hermon */ 120 121 /* SRQ related */ 122 uint32_t qp_srq_enabled; /* QP will use an SRQ */ 123 ib_srq_handle_t qp_srq; 124 }; 125 126 /* 127 * Structure defining the protection domain handle 128 */ 129 struct dapls_ib_pd_handle { 130 uint64_t pd_hkey; 131 }; 132 133 /* 134 * Structure defining the memory region handle 135 */ 136 struct dapls_ib_mr_handle { 137 uint64_t mr_hkey; 138 }; 139 140 /* 141 * Structure defining the memory window handle 142 */ 143 struct dapls_ib_mw_handle { 144 uint64_t mw_hkey; 145 }; 146 147 /* 148 * Structure defining the service provider handle 149 */ 150 struct dapls_ib_cm_srvc_handle { 151 uint64_t sv_sp_hkey; 152 }; 153 154 /* 155 * Structure defining the service provider handle 156 */ 157 struct dapls_ib_srq_handle { 158 uint64_t srq_hkey; 159 caddr_t srq_addr; 160 uint64_t srq_map_offset; 161 uint64_t srq_map_len; 162 uint32_t srq_num; 163 dapls_hw_uar_t srq_iauar; /* copy of the UAR doorbell page */ 164 uint32_t *srq_dbp; /* For Arbel or Hermon */ 165 166 /* Work Queue */ 167 int32_t srq_wq_lastwqeindex; 168 uint32_t srq_wq_desc_addr; 169 uint32_t srq_wq_numwqe; 170 uint32_t srq_wq_wqesz; 171 uint32_t srq_wq_sgl; 172 uint16_t srq_counter; 173 /* premature events */ 174 ib_work_completion_t *srq_premature_events; 175 uint32_t *srq_freepr_events; /* free premature events */ 176 uint32_t srq_freepr_head; 177 uint32_t srq_freepr_tail; 178 uint32_t srq_freepr_num_events; 179 /* For Work Request ID processing */ 180 dapls_tavor_wrid_list_hdr_t *srq_wridlist; 181 /* EP Hash Table, key is QP number */ 182 DAPL_HASH_TABLE *srq_ep_table; 183 }; 184 185 /* 186 * Struct that defines key per HCA instance information for OS 187 * bypass implementation. 188 */ 189 struct dapls_ib_hca_state { 190 int hca_fd; 191 void *uarpg_baseaddr; /* base addr of the UAR page */ 192 size_t uarpg_size; /* size of the UAR page */ 193 void *bf_pg_baseaddr; /* base addr of the Hermon Blueflame page */ 194 int bf_toggle; 195 char hca_path[MAXPATHLEN]; 196 }; 197 198 extern DAPL_OS_LOCK dapls_ib_dbp_lock; 199 200 /* Function that returns a pointer to the specified doorbell entry */ 201 uint32_t *dapls_ib_get_dbp(uint64_t maplen, int fd, uint64_t mapoffset, 202 uint32_t offset); 203 204 #ifdef __cplusplus 205 } 206 #endif 207 208 #endif /* _DAPL_TAVOR_IMPL_H */ 209