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