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 2003 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 /*
32  *
33  * HEADER: dapl_evd_util.h
34  *
35  * PURPOSE: Utility defs & routines for the EVD data structure
36  *
37  * $Id: dapl_evd_util.h,v 1.10 2003/06/13 12:21:09 sjs2 Exp $
38  *
39  */
40 
41 #ifndef _DAPL_EVD_UTIL_H_
42 #define	_DAPL_EVD_UTIL_H_
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #include "dapl.h"
49 
50 DAT_RETURN
51 dapls_evd_internal_create(
52     IN DAPL_IA		*ia_ptr,
53     IN DAPL_CNO		*cno_ptr,
54     IN DAT_COUNT	min_qlen,
55     IN DAT_EVD_FLAGS	evd_flags,
56     OUT DAPL_EVD	**evd_ptr_ptr);
57 
58 DAPL_EVD *
59 dapls_evd_alloc(
60     IN DAPL_IA		*ia_ptr,
61     IN DAPL_CNO		*cno_ptr,
62     IN DAT_EVD_FLAGS	evd_flags,
63     IN DAT_COUNT	qlen);
64 
65 DAT_RETURN
66 dapls_evd_dealloc(
67     IN DAPL_EVD 	*evd_ptr);
68 
69 /*
70  * Each of these functions will retrieve a free event from
71  * the specified EVD, fill in the elements of that event, and
72  * post the event back to the EVD.  If there is no EVD available,
73  * an overflow event will be posted to the async EVD associated
74  * with the EVD.
75  *
76  * DAT_INSUFFICIENT_RESOURCES will be returned on overflow,
77  * DAT_SUCCESS otherwise.
78  */
79 
80 DAT_RETURN
81 dapls_evd_post_cr_arrival_event(
82     IN DAPL_EVD				*evd_ptr,
83     IN DAT_EVENT_NUMBER			event_number,
84     IN DAT_SP_HANDLE			sp_handle,
85     DAT_IA_ADDRESS_PTR			ia_address_ptr,
86     DAT_CONN_QUAL			conn_qual,
87     DAT_CR_HANDLE			cr_handle);
88 
89 DAT_RETURN
90 dapls_evd_post_connection_event(
91     IN DAPL_EVD			*evd_ptr,
92     IN DAT_EVENT_NUMBER		event_number,
93     IN DAT_EP_HANDLE		ep_handle,
94     IN DAT_COUNT		private_data_size,
95     IN DAT_PVOID		private_data);
96 
97 DAT_RETURN
98 dapls_evd_post_async_error_event(
99     IN DAPL_EVD				*evd_ptr,
100     IN DAT_EVENT_NUMBER			event_number,
101     IN DAT_IA_HANDLE			ia_handle);
102 
103 DAT_RETURN
104 dapls_evd_post_software_event(
105     IN DAPL_EVD				*evd_ptr,
106     IN DAT_EVENT_NUMBER			event_number,
107     IN DAT_PVOID			pointer);
108 
109 /*
110  * dapl internal callbacks functions
111  */
112 
113 /* connection verb callback */
114 extern void dapl_evd_connection_callback(
115     IN	ib_cm_handle_t		ib_cm_handle,
116     IN	const ib_cm_events_t	ib_cm_events,
117     IN	const void 		*instant_data_p,
118     IN	const void *		context);
119 
120 /* dto verb callback */
121 extern void dapl_evd_dto_callback(
122     IN  ib_hca_handle_t 	ib_hca_handle,
123     IN  ib_cq_handle_t 		ib_cq_handle,
124     IN  void* 			context);
125 
126 /* async verb callbacks */
127 extern void dapl_evd_un_async_error_callback(
128     IN	ib_hca_handle_t		ib_hca_handle,
129     IN	ib_error_record_t	*cause_ptr,
130     IN	void			*context);
131 
132 extern void dapl_evd_cq_async_error_callback(
133     IN	ib_hca_handle_t 	ib_hca_handle,
134     IN	ib_cq_handle_t		ib_cq_handle,
135     IN	ib_error_record_t	*cause_ptr,
136     IN	void			*context);
137 
138 extern void dapl_evd_qp_async_error_callback(
139     IN	ib_hca_handle_t 	ib_hca_handle,
140     IN	ib_qp_handle_t		ib_qp_handle,
141     IN	ib_error_record_t	*cause_ptr,
142     IN	void			*context);
143 
144 extern void dapls_cr_callback(
145     ib_cm_handle_t		ib_cm_handle,
146     IN    const ib_cm_events_t  ib_cm_event,
147     IN    const void		*instant_data_p,
148     IN    const void		*context);
149 
150 extern void dapls_evd_copy_cq(
151     IN	 DAPL_EVD 		*evd_ptr,
152     OUT  int			*nevents);
153 
154 extern DAT_RETURN dapls_evd_copy_events(
155     DAPL_EVD 			*evd_ptr,
156     DAT_TIMEOUT			timeout);
157 
158 extern void dapls_evd_post_premature_events(
159     DAPL_EP			*ep_ptr);
160 
161 extern DAT_RETURN dapls_evd_cq_poll_to_event(
162     IN DAPL_EVD 		*evd_ptr,
163     OUT DAT_EVENT		*event);
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* _DAPL_EVD_UTIL_H_ */
170