dapl_adapter_util.h revision 9517:b4839b0aa7a4
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 (c) 2002-2003, Network Appliance, Inc. All rights reserved. 24 */ 25 26/* 27 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31/* 32 * 33 * HEADER: dapl_adapter_util.h 34 * 35 * PURPOSE: Utility defs & routines for the adapter data structure 36 * 37 */ 38 39#ifndef _DAPL_ADAPTER_UTIL_H_ 40#define _DAPL_ADAPTER_UTIL_H_ 41 42#ifdef __cplusplus 43extern "C" { 44#endif 45 46/* Max number of cqes that can be polled from the CQ */ 47#define MAX_CQES_PER_POLL 8 48 49typedef enum async_handler_type { 50 DAPL_ASYNC_UNAFILIATED, 51 DAPL_ASYNC_CQ_ERROR, 52 DAPL_ASYNC_CQ_COMPLETION, 53 DAPL_ASYNC_QP_ERROR 54} DAPL_ASYNC_HANDLER_TYPE; 55 56 57#ifdef CM_BUSTED 58DAT_RETURN dapl_set_remote_lid(IN char *rhost_name); 59#endif /* CM_BUSTED */ 60 61/* SUNW */ 62DAT_RETURN dapls_ib_enum_hcas( 63 IN DAPL_HCA **hca_list, 64 OUT DAT_COUNT *hca_count); 65 66void dapls_ib_state_init(void); 67void dapls_ib_state_fini(void); 68/* SUNW */ 69 70DAT_RETURN dapls_ib_open_hca( 71 IN DAPL_HCA *hca_ptr, 72 OUT ib_hca_handle_t *ib_hca_handle); 73 74DAT_RETURN dapls_ib_close_hca( 75 IN ib_hca_handle_t ib_hca_handle); 76 77DAT_RETURN dapls_ib_qp_alloc( 78 IN DAPL_IA *ia_ptr, 79 IN DAPL_EP *ep_ptr, 80 IN DAPL_EP *ep_ctx_ptr); 81 82DAT_RETURN dapls_ib_qp_free( 83 IN DAPL_IA *ia_ptr, 84 IN DAPL_EP *ep_ptr); 85 86DAT_RETURN dapls_ib_qp_modify( 87 IN DAPL_IA *ia_ptr, 88 IN DAPL_EP *ep_ptr, 89 IN DAT_EP_ATTR *ep_attr); 90 91DAT_RETURN dapls_ib_connect( 92 IN DAT_EP_HANDLE ep_handle, 93 IN DAT_IA_ADDRESS_PTR remote_ia_address, 94 IN DAT_CONN_QUAL remote_conn_qual, 95 IN DAT_COUNT prd_size, 96 IN DAPL_PRIVATE *prd_ptr, 97 IN DAT_TIMEOUT timeout); 98 99DAT_RETURN dapls_ib_disconnect( 100 IN DAPL_EP *ep_ptr, 101 IN DAT_CLOSE_FLAGS completion_flags); 102 103DAT_RETURN dapls_ib_setup_conn_listener( 104 IN DAPL_IA *ia_ptr, 105 IN DAT_UINT64 ServiceID, 106 IN DAPL_SP *sp_ptr); 107 108DAT_RETURN dapls_ib_remove_conn_listener( 109 IN DAPL_IA *ia_ptr, 110 IN DAPL_SP *sp_ptr); 111 112DAT_RETURN dapls_ib_accept_connection( 113 IN DAT_CR_HANDLE cr_handle, 114 IN DAT_EP_HANDLE ep_handle, 115 IN DAPL_PRIVATE *prd_ptr); 116 117/* SUNW */ 118DAT_RETURN dapls_ib_reject_connection( 119 IN ib_cm_handle_t cm_handle, 120 IN int reject_reason, 121 IN DAPL_SP *sp_ptr); 122 123DAT_RETURN dapls_ib_handoff_connection( 124 IN DAPL_CR *cr_ptr, 125 IN DAT_CONN_QUAL cr_handoff); 126 127void dapls_ib_async_callback( 128 IN DAPL_EVD *async_evd, 129 IN ib_hca_handle_t hca_handle, 130 IN ib_error_record_t *event_ptr, 131 IN void *context); 132/* SUNW */ 133 134DAT_RETURN dapls_ib_setup_async_callback( 135 IN DAPL_IA *ia_ptr, 136 IN DAPL_ASYNC_HANDLER_TYPE handler_type, 137 IN unsigned int *callback_handle, 138 IN ib_async_handler_t callback, 139 IN void *context); 140 141DAT_RETURN dapls_ib_cq_alloc( 142 IN DAPL_IA *ia_ptr, 143 IN DAPL_EVD *evd_ptr, 144 IN DAPL_CNO *cno_ptr, 145 IN DAT_COUNT *cqlen); 146 147/* SUNW */ 148DAT_RETURN dapls_ib_cq_resize( 149 IN DAPL_EVD *evd_ptr, 150 IN DAT_COUNT cqlen); 151/* SUNW */ 152 153DAT_RETURN dapls_ib_cq_free( 154 IN DAPL_IA *ia_ptr, 155 IN DAPL_EVD *evd_ptr); 156 157DAT_RETURN dapls_set_cq_notify( 158 IN DAPL_IA *ia_ptr, 159 IN DAPL_EVD *evd_ptr); 160 161/* SUNW */ 162DAT_RETURN dapls_set_cqN_notify( 163 IN DAPL_IA *ia_ptr, 164 IN DAPL_EVD *evd_ptr, 165 IN uint32_t events_needed); 166/* SUNW */ 167 168DAT_RETURN dapls_ib_cqd_create( 169 IN DAPL_HCA *hca_ptr); 170 171DAT_RETURN dapls_ib_cqd_destroy( 172 IN DAPL_HCA *hca_ptr); 173 174DAT_RETURN dapls_ib_pd_alloc( 175 IN DAPL_IA *ia_ptr, 176 IN DAPL_PZ *pz); 177 178DAT_RETURN dapls_ib_pd_free( 179 IN DAPL_PZ *pz); 180 181DAT_RETURN dapls_ib_mr_register( 182 IN DAPL_IA *ia_ptr, 183 IN DAPL_LMR *lmr, 184 IN DAT_PVOID virt_addr, 185 IN DAT_VLEN length, 186 IN DAT_MEM_PRIV_FLAGS privileges); 187 188DAT_RETURN dapls_ib_mr_register_shared( 189 IN DAPL_IA *ia_ptr, 190 IN DAPL_LMR *lmr, 191 IN DAT_PVOID virt_addr, 192 IN DAT_VLEN length, 193 IN DAT_LMR_COOKIE cookie, 194 IN DAT_MEM_PRIV_FLAGS privileges); 195 196DAT_RETURN dapls_ib_mr_deregister( 197 IN DAPL_LMR *lmr); 198 199DAT_RETURN dapls_ib_mr_register_lmr( 200 IN DAPL_IA *ia_ptr, 201 IN DAPL_LMR *lmr, 202 IN DAT_MEM_PRIV_FLAGS privileges); 203 204DAT_RETURN dapls_ib_mw_alloc( 205 IN DAPL_RMR *rmr); 206 207DAT_RETURN dapls_ib_mw_free( 208 IN DAPL_RMR *rmr); 209 210DAT_RETURN dapls_ib_mw_bind( 211 IN DAPL_RMR *rmr, 212 IN DAT_LMR_CONTEXT lmr_context, 213 IN DAPL_EP *ep, 214 IN DAPL_COOKIE *cookie, 215 IN DAT_VADDR virtual_address, 216 IN DAT_VLEN length, 217 IN DAT_MEM_PRIV_FLAGS mem_priv, 218 IN DAT_COMPLETION_FLAGS completion_flags); 219 220DAT_RETURN dapls_ib_mw_unbind( 221 IN DAPL_RMR *rmr, 222 IN DAT_LMR_CONTEXT lmr_context, 223 IN DAPL_EP *ep, 224 IN DAPL_COOKIE *cookie, 225 IN DAT_COMPLETION_FLAGS completion_flags); 226 227DAT_RETURN dapls_ib_query_hca( 228 IN DAPL_HCA *hca_ptr, 229 OUT DAT_IA_ATTR *ia_attr, 230 OUT DAT_EP_ATTR *ep_attr, 231 OUT DAT_SOCK_ADDR6 *ip_addr, 232 OUT DAT_SRQ_ATTR *srq_attr); 233 234void dapls_ib_reinit_ep( 235 IN DAPL_EP *ep_ptr); 236 237void dapls_ib_connected( 238 IN DAPL_EP *ep_ptr); 239 240void dapls_ib_disconnect_clean( 241 IN DAPL_EP *ep_ptr, 242 IN DAT_BOOLEAN passive, 243 IN const ib_cm_events_t ib_cm_event); 244 245DAT_RETURN dapls_ib_get_async_event( 246 IN ib_error_record_t *cause_ptr, 247 OUT DAT_EVENT_NUMBER *async_event); 248 249DAT_RETURN dapls_ib_cm_remote_addr( 250 IN DAT_HANDLE dat_handle, 251 IN DAPL_PRIVATE *prd_ptr, 252 OUT DAT_SOCK_ADDR6 *remote_ia_address); 253 254/* SUNW */ 255void dapls_ib_store_premature_events( 256 IN ib_qp_handle_t qp_ptr, 257 IN ib_work_completion_t *cqe_ptr); 258 259void dapls_ib_poll_premature_events( 260 IN DAPL_EP *ep_ptr, 261 OUT ib_work_completion_t **cqe_ptr, 262 OUT int *nevents); 263 264void dapls_ib_free_premature_events( 265 IN DAPL_EP *ep_ptr, 266 IN int free_index); 267 268DAT_RETURN dapls_ib_event_poll( 269 IN DAPL_EVD *evd_ptr, 270 IN uint64_t timeout, 271 IN uint_t threshold, 272 OUT dapl_ib_event_t *evp_ptr, 273 OUT int *num_events); 274 275DAT_RETURN dapls_ib_event_wakeup( 276 IN DAPL_EVD *evd_ptr); 277 278void dapls_ib_cq_peek( 279 IN DAPL_EVD *evd_ptr, 280 OUT int *num_cqe); 281 282DAT_RETURN dapls_ib_modify_cno( 283 IN DAPL_EVD *evd_ptr, 284 IN DAPL_CNO *cno_ptr); 285 286DAT_RETURN dapls_ib_cno_wait( 287 IN DAPL_CNO *cno_ptr, 288 IN DAT_TIMEOUT timeout, 289 IN DAPL_EVD **evd_ptr_p); 290 291DAT_RETURN dapls_ib_cno_alloc( 292 IN DAPL_IA *ia_ptr, 293 IN DAPL_CNO *cno_ptr); 294 295DAT_RETURN dapls_ib_cno_free( 296 IN DAPL_CNO *cno_ptr); 297 298DAT_RETURN dapls_ib_post_recv( 299 IN DAPL_EP *ep_ptr, 300 IN DAPL_COOKIE *dto_cookie, 301 IN DAT_COUNT num_segments, 302 IN DAT_LMR_TRIPLET *local_iov, 303 IN DAT_COMPLETION_FLAGS completion_flags); 304 305DAT_RETURN dapls_ib_post_recv_one( 306 IN DAPL_EP *ep_ptr, 307 IN DAPL_COOKIE *dto_cookie, 308 IN DAT_LMR_TRIPLET *local_iov); 309 310DAT_RETURN dapls_ib_post_srq( 311 IN DAPL_SRQ *srq_ptr, 312 IN DAPL_COOKIE *dto_cookie, 313 IN DAT_COUNT num_segments, 314 IN DAT_LMR_TRIPLET *local_iov); 315 316DAT_RETURN dapls_ib_post_send( 317 IN DAPL_EP *ep_ptr, 318 IN ib_send_op_type_t op_type, 319 IN DAPL_COOKIE *dto_cookie, 320 IN DAT_COUNT num_segments, 321 IN DAT_LMR_TRIPLET *local_iov, 322 IN const DAT_RMR_TRIPLET *remote_iov, 323 IN DAT_COMPLETION_FLAGS completion_flags); 324 325DAT_RETURN dapls_ib_post_send_one( 326 IN DAPL_EP *ep_ptr, 327 IN ib_send_op_type_t op_type, 328 IN DAPL_COOKIE *dto_cookie, 329 IN DAT_LMR_TRIPLET *local_iov, 330 IN const DAT_RMR_TRIPLET *remote_iov); 331 332DAT_RETURN dapls_ib_lmr_sync_rdma_common( 333 IN DAT_IA_HANDLE ia_handle, 334 IN const DAT_LMR_TRIPLET *local_segments, 335 IN DAT_VLEN num_segments, 336 IN uint32_t op_type); 337 338DAT_RETURN dapls_ib_srq_alloc( 339 IN DAPL_IA *ia_handle, 340 IN DAPL_SRQ *srq_handle); 341 342void dapls_ib_srq_free( 343 IN DAPL_IA *ia_handle, 344 IN DAPL_SRQ *srq_handle); 345 346DAT_RETURN dapls_ib_srq_resize( 347 IN DAPL_SRQ *srq_ptr, 348 IN DAT_COUNT srqlen); 349 350DAPL_EP *dapls_ib_srq_lookup_ep( 351 IN DAPL_SRQ *srq_ptr, 352 IN ib_work_completion_t *cqe_ptr); 353 354DAT_COUNT dapls_ib_max_request_iov( 355 IN DAT_COUNT iovs, 356 IN DAT_COUNT wqes, 357 IN DAT_COUNT max_iovs, 358 IN int max_inline_bytes); 359 360/* SUNW */ 361 362 363#ifdef IBAPI 364#include "dapl_ibapi_dto.h" 365#elif VAPI 366#include "dapl_vapi_dto.h" 367#endif 368 369#ifdef __cplusplus 370} 371#endif 372 373#endif /* _DAPL_ADAPTER_UTIL_H_ */ 374