xref: /titanic_51/usr/src/lib/udapl/libdat/include/dat/udat_redirection.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2002-2004, Network Appliance, Inc. All rights reserved.
24  */
25 
26 /*
27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 
32 #ifndef _UDAT_REDIRECTION_H_
33 #define	_UDAT_REDIRECTION_H_
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 /*
38  *
39  * HEADER: udat_redirection.h
40  *
41  * PURPOSE: User DAT macro definitions
42  *
43  * Description: Macros to invoke DAPL functions from the dat_registry
44  *
45  * Mapping rules:
46  *      All global symbols are prepended with "DAT_" or "dat_"
47  *      All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'
48  *      The method table is in the provider definition structure.
49  *
50  *
51  *
52  */
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 #define	DAT_LMR_CREATE(ia, mem_type, reg_desc, len, pz, priv,\
59 			lmr, lmr_context, rmr_context, reg_len, reg_addr) \
60 	(*DAT_HANDLE_TO_PROVIDER(ia)->lmr_create_func)(\
61 		(ia),\
62 		(mem_type),\
63 		(reg_desc),\
64 		(len),\
65 		(pz),\
66 		(priv),\
67 		(lmr),\
68 		(lmr_context),\
69 		(rmr_context),\
70 		(reg_len),\
71 		(reg_addr))
72 
73 #define	DAT_EVD_CREATE(ia, qlen, cno, flags, handle) \
74 	(*DAT_HANDLE_TO_PROVIDER(ia)->evd_create_func)(\
75 		(ia),\
76 		(qlen),\
77 		(cno),\
78 		(flags),\
79 		(handle))
80 
81 #define	DAT_EVD_ENABLE(evd) \
82 	(*DAT_HANDLE_TO_PROVIDER(evd)->evd_enable_func)(\
83 		(evd))
84 
85 #define	DAT_EVD_WAIT(evd, timeout, threshold, event, nmore) \
86 	(*DAT_HANDLE_TO_PROVIDER(evd)->evd_wait_func)(\
87 		(evd),\
88 		(timeout),\
89 		(threshold),\
90 		(event),\
91 		(nmore))
92 
93 #define	DAT_EVD_DISABLE(evd) \
94 	(*DAT_HANDLE_TO_PROVIDER(evd)->evd_disable_func)(\
95 		(evd))
96 
97 #define	DAT_EVD_SET_UNWAITABLE(evd) \
98 	(*DAT_HANDLE_TO_PROVIDER(evd)->evd_set_unwaitable_func)(\
99 		(evd))
100 
101 #define	DAT_EVD_CLEAR_UNWAITABLE(evd) \
102 	(*DAT_HANDLE_TO_PROVIDER(evd)->evd_clear_unwaitable_func)(\
103 		(evd))
104 
105 #define	DAT_EVD_MODIFY_CNO(evd, cno) \
106 	(*DAT_HANDLE_TO_PROVIDER(evd)->evd_modify_cno_func)(\
107 		(evd),\
108 		(cno))
109 
110 #define	DAT_CNO_CREATE(ia, proxy, cno) \
111 	(*DAT_HANDLE_TO_PROVIDER(ia)->cno_create_func)(\
112 		(ia),\
113 		(proxy),\
114 		(cno))
115 
116 #define	DAT_CNO_MODIFY_AGENT(cno, proxy) \
117 	(*DAT_HANDLE_TO_PROVIDER(cno)->cno_modify_agent_func)(\
118 		(cno),\
119 		(proxy))
120 
121 #define	DAT_CNO_QUERY(cno, mask, param) \
122 	(*DAT_HANDLE_TO_PROVIDER(cno)->cno_query_func)(\
123 		(cno),\
124 		(mask),\
125 		(param))
126 
127 #define	DAT_CNO_FREE(cno) \
128 	(*DAT_HANDLE_TO_PROVIDER(cno)->cno_free_func)(\
129 		(cno))
130 
131 #define	DAT_CNO_WAIT(cno, timeout, evd) \
132 	(*DAT_HANDLE_TO_PROVIDER(cno)->cno_wait_func)(\
133 		(cno),\
134 		(timeout),\
135 		(evd))
136 /*
137  * FUNCTION PROTOTYPES
138  *
139  * User DAT function call definitions
140  *
141  */
142 
143 typedef DAT_RETURN (*DAT_LMR_CREATE_FUNC)(
144 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
145 	IN	DAT_MEM_TYPE,		/* mem_type		*/
146 	IN	DAT_REGION_DESCRIPTION,	/* region_description   */
147 	IN	DAT_VLEN,		/* length		*/
148 	IN	DAT_PZ_HANDLE,		/* pz_handle		*/
149 	IN	DAT_MEM_PRIV_FLAGS,	/* privileges		*/
150 	OUT	DAT_LMR_HANDLE *,	/* lmr_handle		*/
151 	OUT	DAT_LMR_CONTEXT *,	/* lmr_context		*/
152 	OUT	DAT_RMR_CONTEXT *,	/* rmr_context		*/
153 	OUT	DAT_VLEN *,		/* registered_length	*/
154 	OUT	DAT_VADDR *);		/* registered_address   */
155 
156 /* Event Functions */
157 
158 typedef DAT_RETURN (*DAT_EVD_CREATE_FUNC)(
159 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
160 	IN	DAT_COUNT,		/* evd_min_qlen		*/
161 	IN	DAT_CNO_HANDLE,		/* cno_handle		*/
162 	IN	DAT_EVD_FLAGS,		/* evd_flags		*/
163 	OUT	DAT_EVD_HANDLE *);	/* evd_handle		*/
164 
165 typedef DAT_RETURN (*DAT_EVD_MODIFY_CNO_FUNC)(
166 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
167 	IN	DAT_CNO_HANDLE);	/* cno_handle		*/
168 
169 typedef DAT_RETURN (*DAT_CNO_CREATE_FUNC)(
170 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
171 	IN	DAT_OS_WAIT_PROXY_AGENT,	/* agent		*/
172 	OUT	DAT_CNO_HANDLE *);	/* cno_handle		*/
173 
174 typedef DAT_RETURN (*DAT_CNO_MODIFY_AGENT_FUNC)(
175 	IN	DAT_CNO_HANDLE,			/* cno_handle		*/
176 	IN	DAT_OS_WAIT_PROXY_AGENT);	/* agent		*/
177 
178 typedef DAT_RETURN (*DAT_CNO_QUERY_FUNC)(
179 	IN	DAT_CNO_HANDLE,		/* cno_handle		*/
180 	IN	DAT_CNO_PARAM_MASK,	/* cno_param_mask	*/
181 	OUT	DAT_CNO_PARAM *);	/* cno_param		*/
182 
183 typedef DAT_RETURN (*DAT_CNO_FREE_FUNC)(
184 	IN DAT_CNO_HANDLE);		/* cno_handle		*/
185 
186 typedef DAT_RETURN(*DAT_CNO_WAIT_FUNC)(
187 	IN	DAT_CNO_HANDLE,		/* cno_handle		*/
188 	IN	DAT_TIMEOUT,		/* timeout		*/
189 	OUT	DAT_EVD_HANDLE *);	/* evd_handle		*/
190 
191 typedef DAT_RETURN (*DAT_EVD_ENABLE_FUNC)(
192 	IN	DAT_EVD_HANDLE);	/* evd_handle		*/
193 
194 typedef DAT_RETURN (*DAT_EVD_WAIT_FUNC)(
195 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
196 	IN	DAT_TIMEOUT,		/* Timeout		*/
197 	IN	DAT_COUNT,		/* Threshold		*/
198 	OUT	DAT_EVENT *,		/* event		*/
199 	OUT	DAT_COUNT *);		/* N more events	*/
200 
201 typedef DAT_RETURN (*DAT_EVD_DISABLE_FUNC)(
202 	IN	DAT_EVD_HANDLE);	/* evd_handle		*/
203 
204 typedef DAT_RETURN (*DAT_EVD_SET_UNWAITABLE_FUNC)(
205 	IN DAT_EVD_HANDLE);		/* evd_handle */
206 
207 typedef DAT_RETURN (*DAT_EVD_CLEAR_UNWAITABLE_FUNC)(
208 	IN DAT_EVD_HANDLE); /* evd_handle */
209 
210 
211 #include <dat/dat_redirection.h>
212 
213 struct dat_provider
214 {
215 	const char			*device_name;
216 	DAT_PVOID			extension;
217 
218 	DAT_IA_OPEN_FUNC		ia_open_func;
219 	DAT_IA_QUERY_FUNC		ia_query_func;
220 	DAT_IA_CLOSE_FUNC		ia_close_func;
221 
222 	DAT_SET_CONSUMER_CONTEXT_FUNC	set_consumer_context_func;
223 	DAT_GET_CONSUMER_CONTEXT_FUNC	get_consumer_context_func;
224 	DAT_GET_HANDLE_TYPE_FUNC	get_handle_type_func;
225 
226 	DAT_CNO_CREATE_FUNC		cno_create_func;	/* udat only */
227 	DAT_CNO_MODIFY_AGENT_FUNC	cno_modify_agent_func;	/* udat only */
228 	DAT_CNO_QUERY_FUNC		cno_query_func;		/* udat only */
229 	DAT_CNO_FREE_FUNC		cno_free_func;		/* udat only */
230 	DAT_CNO_WAIT_FUNC		cno_wait_func;		/* udat only */
231 
232 	DAT_CR_QUERY_FUNC		cr_query_func;
233 	DAT_CR_ACCEPT_FUNC		cr_accept_func;
234 	DAT_CR_REJECT_FUNC		cr_reject_func;
235 	DAT_CR_HANDOFF_FUNC		cr_handoff_func;
236 
237 	DAT_EVD_CREATE_FUNC		evd_create_func;
238 	DAT_EVD_QUERY_FUNC		evd_query_func;
239 
240 	DAT_EVD_MODIFY_CNO_FUNC		evd_modify_cno_func;    /* udat only */
241 	DAT_EVD_ENABLE_FUNC		evd_enable_func;	/* udat only */
242 	DAT_EVD_DISABLE_FUNC		evd_disable_func;	/* udat only */
243 	DAT_EVD_WAIT_FUNC		evd_wait_func;		/* udat only */
244 
245 	DAT_EVD_RESIZE_FUNC		evd_resize_func;
246 	DAT_EVD_POST_SE_FUNC		evd_post_se_func;
247 	DAT_EVD_DEQUEUE_FUNC		evd_dequeue_func;
248 	DAT_EVD_FREE_FUNC		evd_free_func;
249 
250 	DAT_EP_CREATE_FUNC		ep_create_func;
251 	DAT_EP_QUERY_FUNC		ep_query_func;
252 	DAT_EP_MODIFY_FUNC		ep_modify_func;
253 	DAT_EP_CONNECT_FUNC		ep_connect_func;
254 	DAT_EP_DUP_CONNECT_FUNC		ep_dup_connect_func;
255 	DAT_EP_DISCONNECT_FUNC		ep_disconnect_func;
256 	DAT_EP_POST_SEND_FUNC		ep_post_send_func;
257 	DAT_EP_POST_RECV_FUNC		ep_post_recv_func;
258 	DAT_EP_POST_RDMA_READ_FUNC	ep_post_rdma_read_func;
259 	DAT_EP_POST_RDMA_WRITE_FUNC	ep_post_rdma_write_func;
260 	DAT_EP_GET_STATUS_FUNC		ep_get_status_func;
261 	DAT_EP_FREE_FUNC		ep_free_func;
262 
263 	DAT_LMR_CREATE_FUNC		lmr_create_func;
264 	DAT_LMR_QUERY_FUNC		lmr_query_func;
265 
266 	DAT_LMR_FREE_FUNC		lmr_free_func;
267 
268 	DAT_RMR_CREATE_FUNC		rmr_create_func;
269 	DAT_RMR_QUERY_FUNC		rmr_query_func;
270 	DAT_RMR_BIND_FUNC		rmr_bind_func;
271 	DAT_RMR_FREE_FUNC		rmr_free_func;
272 
273 	DAT_PSP_CREATE_FUNC		psp_create_func;
274 	DAT_PSP_QUERY_FUNC		psp_query_func;
275 	DAT_PSP_FREE_FUNC		psp_free_func;
276 
277 	DAT_RSP_CREATE_FUNC		rsp_create_func;
278 	DAT_RSP_QUERY_FUNC		rsp_query_func;
279 	DAT_RSP_FREE_FUNC		rsp_free_func;
280 
281 	DAT_PZ_CREATE_FUNC		pz_create_func;
282 	DAT_PZ_QUERY_FUNC		pz_query_func;
283 	DAT_PZ_FREE_FUNC		pz_free_func;
284 
285 	/* dat-1.1 */
286 	DAT_PSP_CREATE_ANY_FUNC		psp_create_any_func;
287 	DAT_EP_RESET_FUNC		ep_reset_func;
288 
289 	/* udat-1.1 */
290 	DAT_EVD_SET_UNWAITABLE_FUNC	evd_set_unwaitable_func;
291 	DAT_EVD_CLEAR_UNWAITABLE_FUNC	evd_clear_unwaitable_func;
292 
293 	/* dat-1.2 */
294 	DAT_LMR_SYNC_RDMA_READ_FUNC	lmr_sync_rdma_read_func;
295 	DAT_LMR_SYNC_RDMA_WRITE_FUNC	lmr_sync_rdma_write_func;
296 
297 	DAT_EP_CREATE_WITH_SRQ_FUNC	ep_create_with_srq_func;
298 	DAT_EP_RECV_QUERY_FUNC		ep_recv_query_func;
299 	DAT_EP_SET_WATERMARK_FUNC	ep_set_watermark_func;
300 	DAT_SRQ_CREATE_FUNC		srq_create_func;
301 	DAT_SRQ_FREE_FUNC		srq_free_func;
302 	DAT_SRQ_POST_RECV_FUNC		srq_post_recv_func;
303 	DAT_SRQ_QUERY_FUNC		srq_query_func;
304 	DAT_SRQ_RESIZE_FUNC		srq_resize_func;
305 	DAT_SRQ_SET_LW_FUNC		srq_set_lw_func;
306 };
307 
308 #ifdef __cplusplus
309 }
310 #endif
311 
312 #endif /* _UDAT_REDIRECTION_H_ */
313