1*9e39c5baSBill Taylor /*
2*9e39c5baSBill Taylor  * CDDL HEADER START
3*9e39c5baSBill Taylor  *
4*9e39c5baSBill Taylor  * The contents of this file are subject to the terms of the
5*9e39c5baSBill Taylor  * Common Development and Distribution License (the "License").
6*9e39c5baSBill Taylor  * You may not use this file except in compliance with the License.
7*9e39c5baSBill Taylor  *
8*9e39c5baSBill Taylor  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9e39c5baSBill Taylor  * or http://www.opensolaris.org/os/licensing.
10*9e39c5baSBill Taylor  * See the License for the specific language governing permissions
11*9e39c5baSBill Taylor  * and limitations under the License.
12*9e39c5baSBill Taylor  *
13*9e39c5baSBill Taylor  * When distributing Covered Code, include this CDDL HEADER in each
14*9e39c5baSBill Taylor  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9e39c5baSBill Taylor  * If applicable, add the following below this CDDL HEADER, with the
16*9e39c5baSBill Taylor  * fields enclosed by brackets "[]" replaced with your own identifying
17*9e39c5baSBill Taylor  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9e39c5baSBill Taylor  *
19*9e39c5baSBill Taylor  * CDDL HEADER END
20*9e39c5baSBill Taylor  */
21*9e39c5baSBill Taylor 
22*9e39c5baSBill Taylor /*
23*9e39c5baSBill Taylor  * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
24*9e39c5baSBill Taylor  */
25*9e39c5baSBill Taylor 
26*9e39c5baSBill Taylor /*
27*9e39c5baSBill Taylor  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
28*9e39c5baSBill Taylor  * Use is subject to license terms.
29*9e39c5baSBill Taylor  */
30*9e39c5baSBill Taylor 
31*9e39c5baSBill Taylor /*
32*9e39c5baSBill Taylor  *
33*9e39c5baSBill Taylor  * HEADER: dapl_evd_util.h
34*9e39c5baSBill Taylor  *
35*9e39c5baSBill Taylor  * PURPOSE: Utility defs & routines for the EVD data structure
36*9e39c5baSBill Taylor  *
37*9e39c5baSBill Taylor  * $Id: dapl_evd_util.h,v 1.10 2003/06/13 12:21:09 sjs2 Exp $
38*9e39c5baSBill Taylor  *
39*9e39c5baSBill Taylor  */
40*9e39c5baSBill Taylor 
41*9e39c5baSBill Taylor #ifndef _DAPL_EVD_UTIL_H_
42*9e39c5baSBill Taylor #define	_DAPL_EVD_UTIL_H_
43*9e39c5baSBill Taylor 
44*9e39c5baSBill Taylor #ifdef __cplusplus
45*9e39c5baSBill Taylor extern "C" {
46*9e39c5baSBill Taylor #endif
47*9e39c5baSBill Taylor 
48*9e39c5baSBill Taylor #include "dapl.h"
49*9e39c5baSBill Taylor 
50*9e39c5baSBill Taylor DAT_RETURN
51*9e39c5baSBill Taylor dapls_evd_internal_create(
52*9e39c5baSBill Taylor     IN DAPL_IA		*ia_ptr,
53*9e39c5baSBill Taylor     IN DAPL_CNO		*cno_ptr,
54*9e39c5baSBill Taylor     IN DAT_COUNT	min_qlen,
55*9e39c5baSBill Taylor     IN DAT_EVD_FLAGS	evd_flags,
56*9e39c5baSBill Taylor     OUT DAPL_EVD	**evd_ptr_ptr);
57*9e39c5baSBill Taylor 
58*9e39c5baSBill Taylor DAPL_EVD *
59*9e39c5baSBill Taylor dapls_evd_alloc(
60*9e39c5baSBill Taylor     IN DAPL_IA		*ia_ptr,
61*9e39c5baSBill Taylor     IN DAPL_CNO		*cno_ptr,
62*9e39c5baSBill Taylor     IN DAT_EVD_FLAGS	evd_flags,
63*9e39c5baSBill Taylor     IN DAT_COUNT	qlen);
64*9e39c5baSBill Taylor 
65*9e39c5baSBill Taylor DAT_RETURN
66*9e39c5baSBill Taylor dapls_evd_dealloc(
67*9e39c5baSBill Taylor     IN DAPL_EVD 	*evd_ptr);
68*9e39c5baSBill Taylor 
69*9e39c5baSBill Taylor /*
70*9e39c5baSBill Taylor  * Each of these functions will retrieve a free event from
71*9e39c5baSBill Taylor  * the specified EVD, fill in the elements of that event, and
72*9e39c5baSBill Taylor  * post the event back to the EVD.  If there is no EVD available,
73*9e39c5baSBill Taylor  * an overflow event will be posted to the async EVD associated
74*9e39c5baSBill Taylor  * with the EVD.
75*9e39c5baSBill Taylor  *
76*9e39c5baSBill Taylor  * DAT_INSUFFICIENT_RESOURCES will be returned on overflow,
77*9e39c5baSBill Taylor  * DAT_SUCCESS otherwise.
78*9e39c5baSBill Taylor  */
79*9e39c5baSBill Taylor 
80*9e39c5baSBill Taylor DAT_RETURN
81*9e39c5baSBill Taylor dapls_evd_post_cr_arrival_event(
82*9e39c5baSBill Taylor     IN DAPL_EVD				*evd_ptr,
83*9e39c5baSBill Taylor     IN DAT_EVENT_NUMBER			event_number,
84*9e39c5baSBill Taylor     IN DAT_SP_HANDLE			sp_handle,
85*9e39c5baSBill Taylor     DAT_IA_ADDRESS_PTR			ia_address_ptr,
86*9e39c5baSBill Taylor     DAT_CONN_QUAL			conn_qual,
87*9e39c5baSBill Taylor     DAT_CR_HANDLE			cr_handle);
88*9e39c5baSBill Taylor 
89*9e39c5baSBill Taylor DAT_RETURN
90*9e39c5baSBill Taylor dapls_evd_post_connection_event(
91*9e39c5baSBill Taylor     IN DAPL_EVD			*evd_ptr,
92*9e39c5baSBill Taylor     IN DAT_EVENT_NUMBER		event_number,
93*9e39c5baSBill Taylor     IN DAT_EP_HANDLE		ep_handle,
94*9e39c5baSBill Taylor     IN DAT_COUNT		private_data_size,
95*9e39c5baSBill Taylor     IN DAT_PVOID		private_data);
96*9e39c5baSBill Taylor 
97*9e39c5baSBill Taylor DAT_RETURN
98*9e39c5baSBill Taylor dapls_evd_post_async_error_event(
99*9e39c5baSBill Taylor     IN DAPL_EVD				*evd_ptr,
100*9e39c5baSBill Taylor     IN DAT_EVENT_NUMBER			event_number,
101*9e39c5baSBill Taylor     IN DAT_IA_HANDLE			ia_handle);
102*9e39c5baSBill Taylor 
103*9e39c5baSBill Taylor DAT_RETURN
104*9e39c5baSBill Taylor dapls_evd_post_software_event(
105*9e39c5baSBill Taylor     IN DAPL_EVD				*evd_ptr,
106*9e39c5baSBill Taylor     IN DAT_EVENT_NUMBER			event_number,
107*9e39c5baSBill Taylor     IN DAT_PVOID			pointer);
108*9e39c5baSBill Taylor 
109*9e39c5baSBill Taylor /*
110*9e39c5baSBill Taylor  * dapl internal callbacks functions
111*9e39c5baSBill Taylor  */
112*9e39c5baSBill Taylor 
113*9e39c5baSBill Taylor /* connection verb callback */
114*9e39c5baSBill Taylor extern void dapl_evd_connection_callback(
115*9e39c5baSBill Taylor     IN	ib_cm_handle_t		ib_cm_handle,
116*9e39c5baSBill Taylor     IN	const ib_cm_events_t	ib_cm_events,
117*9e39c5baSBill Taylor     IN	const void 		*instant_data_p,
118*9e39c5baSBill Taylor     IN	const void *		context);
119*9e39c5baSBill Taylor 
120*9e39c5baSBill Taylor /* dto verb callback */
121*9e39c5baSBill Taylor extern void dapl_evd_dto_callback(
122*9e39c5baSBill Taylor     IN  ib_hca_handle_t 	ib_hca_handle,
123*9e39c5baSBill Taylor     IN  ib_cq_handle_t 		ib_cq_handle,
124*9e39c5baSBill Taylor     IN  void* 			context);
125*9e39c5baSBill Taylor 
126*9e39c5baSBill Taylor /* async verb callbacks */
127*9e39c5baSBill Taylor extern void dapl_evd_un_async_error_callback(
128*9e39c5baSBill Taylor     IN	ib_hca_handle_t		ib_hca_handle,
129*9e39c5baSBill Taylor     IN	ib_error_record_t	*cause_ptr,
130*9e39c5baSBill Taylor     IN	void			*context);
131*9e39c5baSBill Taylor 
132*9e39c5baSBill Taylor extern void dapl_evd_cq_async_error_callback(
133*9e39c5baSBill Taylor     IN	ib_hca_handle_t 	ib_hca_handle,
134*9e39c5baSBill Taylor     IN	ib_cq_handle_t		ib_cq_handle,
135*9e39c5baSBill Taylor     IN	ib_error_record_t	*cause_ptr,
136*9e39c5baSBill Taylor     IN	void			*context);
137*9e39c5baSBill Taylor 
138*9e39c5baSBill Taylor extern void dapl_evd_qp_async_error_callback(
139*9e39c5baSBill Taylor     IN	ib_hca_handle_t 	ib_hca_handle,
140*9e39c5baSBill Taylor     IN	ib_qp_handle_t		ib_qp_handle,
141*9e39c5baSBill Taylor     IN	ib_error_record_t	*cause_ptr,
142*9e39c5baSBill Taylor     IN	void			*context);
143*9e39c5baSBill Taylor 
144*9e39c5baSBill Taylor extern void dapls_cr_callback(
145*9e39c5baSBill Taylor     ib_cm_handle_t		ib_cm_handle,
146*9e39c5baSBill Taylor     IN    const ib_cm_events_t  ib_cm_event,
147*9e39c5baSBill Taylor     IN    const void		*instant_data_p,
148*9e39c5baSBill Taylor     IN    const void		*context);
149*9e39c5baSBill Taylor 
150*9e39c5baSBill Taylor extern void dapls_evd_copy_cq(
151*9e39c5baSBill Taylor     IN	 DAPL_EVD 		*evd_ptr,
152*9e39c5baSBill Taylor     OUT  int			*nevents);
153*9e39c5baSBill Taylor 
154*9e39c5baSBill Taylor extern DAT_RETURN dapls_evd_copy_events(
155*9e39c5baSBill Taylor     DAPL_EVD 			*evd_ptr,
156*9e39c5baSBill Taylor     DAT_TIMEOUT			timeout);
157*9e39c5baSBill Taylor 
158*9e39c5baSBill Taylor extern void dapls_evd_post_premature_events(
159*9e39c5baSBill Taylor     DAPL_EP			*ep_ptr);
160*9e39c5baSBill Taylor 
161*9e39c5baSBill Taylor extern DAT_RETURN dapls_evd_cq_poll_to_event(
162*9e39c5baSBill Taylor     IN DAPL_EVD 		*evd_ptr,
163*9e39c5baSBill Taylor     OUT DAT_EVENT		*event);
164*9e39c5baSBill Taylor 
165*9e39c5baSBill Taylor #ifdef __cplusplus
166*9e39c5baSBill Taylor }
167*9e39c5baSBill Taylor #endif
168*9e39c5baSBill Taylor 
169*9e39c5baSBill Taylor #endif /* _DAPL_EVD_UTIL_H_ */