Debian Codegraph @

dat/include/dat2/kdat_redirection.h

raw
1 /*
2 * Copyright (c) 2002-2006, Network Appliance, Inc. All rights reserved.
3 *
4 * This Software is licensed under all of the following licenses:
5 *
6 * 1) under the terms of the "Common Public License 1.0" a copy of which is
7 * in the file LICENSE.txt in the root directory. The license is also
8 * available from the Open Source Initiative, see
9 * http://www.opensource.org/licenses/cpl.php.
10 *
11 * 2) under the terms of the "The BSD License" a copy of which is in the file
12 * LICENSE2.txt in the root directory. The license is also available from
13 * the Open Source Initiative, see
14 * http://www.opensource.org/licenses/bsd-license.php.
15 *
16 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
17 * copy of which is in the file LICENSE3.txt in the root directory. The
18 * license is also available from the Open Source Initiative, see
19 * http://www.opensource.org/licenses/gpl-license.php.
20 *
21 * Licensee has the right to choose one of the above licenses.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions are
25 * met:
26 *
27 * Redistributions of source code must retain both the above copyright
28 * notice and one of the license notices.
29 *
30 * Redistributions in binary form must reproduce both the above copyright
31 * notice, one of the license notices in the documentation
32 * and/or other materials provided with the distribution.
33 *
34 * Neither the name of Network Appliance, Inc. nor the names of other DAT
35 * Collaborative contributors may be used to endorse or promote
36 * products derived from this software without specific prior written
37 * permission.
38 */
39
40 /****************************************************************
41 *
42 * HEADER: kdat_redirection.h
43 *
44 * PURPOSE: Kernel DAT macro definitions
45 *
46 * Description: Macros to invoke DAPL functions from the dat_registry
47 *
48 * Mapping rules:
49 * All global symbols are prepended with DAT_ or dat_
50 * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'
51 * The method table is in the provider definition structure.
52 *
53 **********************************************************/
54
55 #ifndef _KDAT_REDIRECTION_H_
56 #define _KDAT_REDIRECTION_H_
57
58 /* ia_memtype_hint macro */
59
60 #define DAT_IA_MEMTYPE_HINT(ia, mem_type, len, mem_opt, pref_len, pref_align) \
61 (*DAT_HANDLE_TO_PROVIDER(ia)->ia_memtype_hint_func)(\
62 (ia), \
63 (mem_type), \
64 (len), \
65 (mem_opt), \
66 (pref_len), \
67 (pref_align))
68
69 /* evd_modify_upcall macro */
70
71 #define DAT_EVD_MODIFY_UPCALL(evd, policy, upcall, flag) \
72 (*DAT_HANDLE_TO_PROVIDER(evd)->evd_modify_upcall_func)(\
73 (evd), \
74 (policy), \
75 (upcall), \
76 (flag))
77
78 /* evd_create macro */
79 #define DAT_EVD_KCREATE(ia,qlen,policy,upcall,flags,handle) \
80 (*DAT_HANDLE_TO_PROVIDER(ia)->evd_kcreate_func)(\
81 (ia), \
82 (qlen), \
83 (policy), \
84 (upcall), \
85 (flags), \
86 (handle))
87
88 /* lmr_kcreate macro */
89 #define DAT_LMR_KCREATE(ia,mtype,reg_desc,len,pz,priv,mem_opt,\
90 va_type,lmr,lmr_context,rmr_context,reg_len,reg_addr) \
91 (*DAT_HANDLE_TO_PROVIDER(ia)->lmr_kcreate_func)(\
92 (ia), \
93 (mtype), \
94 (reg_desc), \
95 (len), \
96 (pz), \
97 (priv), \
98 (mem_opt), \
99 (va_type), \
100 (lmr), \
101 (lmr_context), \
102 (rmr_context), \
103 (reg_len), \
104 (reg_addr))
105
106 #define DAT_LMR_ALLOCATE(ia,pz,size,scope,lmr) \
107 (*DAT_HANDLE_TO_PROVIDER(ia)->lmr_allocate_func)(\
108 (ia), \
109 (pz), \
110 (size), \
111 (scope), \
112 (lmr))
113
114 #define DAT_LMR_FMR(lmr,mtype,reg_desc,length,priv,\
115 va_type,ep,cookie,flags,lmr_context,rmr_context) \
116 (*DAT_HANDLE_TO_PROVIDER(lmr)->lmr_fmr_func)(\
117 (lmr),\
118 (mtype),\
119 (reg_desc),\
120 (length),\
121 (priv),\
122 (va_type),\
123 (ep),\
124 (cookie),\
125 (flags),\
126 (lmr_context),\
127 (rmr_context))
128
129 #define DAT_LMR_INVALIDATE(lmr, ep,cookie,flags) \
130 (*DAT_HANDLE_TO_PROVIDER(lmr)->lmr_invalidate_func)(\
131 (lmr),\
132 (ep),\
133 (cookie),\
134 (flags))
135
136 #define DAT_IA_RESERVED_LMR(ia, lmr, lmr_context) \
137 (*DAT_HANDLE_TO_PROVIDER(ia)->ia_reserved_lmr_func)(\
138 (ia),\
139 (lmr),\
140 (lmr_context))
141
142 /***************************************************************
143 * FUNCTION PROTOTYPES
144 *
145 * Kernel DAT function call definitions,
146 *
147 ****************************************************************/
148
149 typedef DAT_RETURN (*DAT_LMR_KCREATE_FUNC) (
150 IN DAT_IA_HANDLE, /* ia_handle */
151 IN DAT_MEM_TYPE, /* mem_type */
152 IN DAT_REGION_DESCRIPTION, /* region_description */
153 IN DAT_VLEN, /* length */
154 IN DAT_PZ_HANDLE, /* pz_handle */
155 IN DAT_MEM_PRIV_FLAGS, /* privileges */
156 IN DAT_VA_TYPE, /* va_type */
157 IN DAT_MEM_OPTIMIZE_FLAGS, /* mem_optimization */
158 OUT DAT_LMR_HANDLE *, /* lmr_handle */
159 OUT DAT_LMR_CONTEXT *, /* lmr_context */
160 OUT DAT_RMR_CONTEXT *, /* rmr_context */
161 OUT DAT_VLEN *, /* registered_length */
162 OUT DAT_VADDR * ); /* registered_address */
163
164
165 typedef DAT_RETURN (*DAT_IA_MEMTYPE_HINT_FUNC) (
166 IN DAT_IA_HANDLE, /* ia_handle */
167 IN DAT_MEM_TYPE, /* mem_type */
168 IN DAT_VLEN, /* length */
169 IN DAT_MEM_OPTIMIZE_FLAGS, /* mem_optimization */
170 OUT DAT_VLEN *, /* preferred_length */
171 OUT DAT_VADDR * ); /* preferred_alignment */
172
173 typedef DAT_RETURN (*DAT_LMR_QUERY_FUNC) (
174 IN DAT_LMR_HANDLE, /* lmr_handle */
175 IN DAT_LMR_PARAM_MASK, /* lmr_param_mask */
176 OUT DAT_LMR_PARAM *); /* lmr_param */
177
178 typedef DAT_RETURN (*DAT_LMR_ALLOCATE_FUNC) (
179 IN DAT_IA_HANDLE, /* ia_handle */
180 IN DAT_PZ_HANDLE, /* pz_handle */
181 IN DAT_COUNT, /* max number of physical pages */
182 IN DAT_LMR_SCOPE, /* scope of LMR */
183 OUT DAT_LMR_HANDLE ); /* lmr_handle */
184
185 typedef DAT_RETURN (*DAT_LMR_FMR_FUNC) (
186 IN DAT_LMR_HANDLE, /* lmr_handle */
187 IN DAT_MEM_TYPE, /* mem_type */
188 IN const DAT_REGION_DESCRIPTION, /* region_description */
189 IN DAT_VLEN, /* number of pages */
190 IN DAT_MEM_PRIV_FLAGS, /* mem_privileges */
191 IN DAT_VA_TYPE, /* va_type */
192 IN DAT_EP_HANDLE, /* ep_handle */
193 IN DAT_LMR_COOKIE, /* user_cookie */
194 IN DAT_COMPLETION_FLAGS, /* completion_flags */
195 OUT DAT_LMR_CONTEXT * , /* lmr_context */
196 OUT DAT_RMR_CONTEXT * ); /* rmr_context */
197
198 typedef DAT_RETURN (*DAT_LMR_INVALIDATE_FUNC) (
199 IN DAT_LMR_HANDLE, /* lmr_handle */
200 IN DAT_EP_HANDLE, /* ep_handle */
201 IN DAT_LMR_COOKIE, /* user_cookie */
202 IN DAT_COMPLETION_FLAGS ); /* completion_flags */
203
204 typedef DAT_RETURN (*DAT_EVD_KCREATE_FUNC) (
205 IN DAT_IA_HANDLE, /* ia_handle */
206 IN DAT_COUNT, /* evd_min_qlen */
207 IN DAT_UPCALL_POLICY, /* upcall_policy */
208 IN const DAT_UPCALL_OBJECT *, /* upcall */
209 IN DAT_EVD_FLAGS, /* evd_flags */
210 OUT DAT_EVD_HANDLE * ); /* evd_handle */
211
212 typedef DAT_RETURN (*DAT_EVD_MODIFY_UPCALL_FUNC) (
213 IN DAT_EVD_HANDLE, /* evd_handle */
214 IN DAT_UPCALL_POLICY, /* upcall_policy */
215 IN const DAT_UPCALL_OBJECT *, /* upcall */
216 IN DAT_UPCALL_FLAG ); /* upcall invocation flag */
217
218 typedef DAT_RETURN (*DAT_IA_RESERVED_LMR_FUNC) (
219 IN DAT_IA_HANDLE, /* ia_handle */
220 OUT DAT_LMR_HANDLE *, /* lmr_handle */
221 OUT DAT_LMR_CONTEXT * ); /* lmr_context */
222
223 #include <dat2/dat_redirection.h>
224
225 struct dat_provider
226 {
227 const char * device_name;
228 DAT_PVOID extension;
229
230 DAT_IA_OPEN_FUNC ia_open_func;
231 DAT_IA_QUERY_FUNC ia_query_func;
232 DAT_IA_CLOSE_FUNC ia_close_func;
233 DAT_IA_MEMTYPE_HINT_FUNC ia_memtype_hint_func; /* kdat only */
234
235 DAT_SET_CONSUMER_CONTEXT_FUNC set_consumer_context_func;
236 DAT_GET_CONSUMER_CONTEXT_FUNC get_consumer_context_func;
237 DAT_GET_HANDLE_TYPE_FUNC get_handle_type_func;
238
239 DAT_CR_QUERY_FUNC cr_query_func;
240 DAT_CR_ACCEPT_FUNC cr_accept_func;
241 DAT_CR_REJECT_FUNC cr_reject_func;
242 DAT_CR_HANDOFF_FUNC cr_handoff_func;
243
244 DAT_EVD_KCREATE_FUNC evd_kcreate_func;
245 DAT_EVD_QUERY_FUNC evd_query_func;
246
247 DAT_EVD_MODIFY_UPCALL_FUNC evd_modify_upcall_func; /* kdat only */
248
249 DAT_EVD_RESIZE_FUNC evd_resize_func;
250 DAT_EVD_POST_SE_FUNC evd_post_se_func;
251 DAT_EVD_DEQUEUE_FUNC evd_dequeue_func;
252 DAT_EVD_FREE_FUNC evd_free_func;
253
254 DAT_EP_CREATE_FUNC ep_create_func;
255 DAT_EP_QUERY_FUNC ep_query_func;
256 DAT_EP_MODIFY_FUNC ep_modify_func;
257 DAT_EP_CONNECT_FUNC ep_connect_func;
258 DAT_EP_DUP_CONNECT_FUNC ep_dup_connect_func;
259 DAT_EP_DISCONNECT_FUNC ep_disconnect_func;
260 DAT_EP_POST_SEND_FUNC ep_post_send_func;
261 DAT_EP_POST_RECV_FUNC ep_post_recv_func;
262 DAT_EP_POST_RDMA_READ_FUNC ep_post_rdma_read_func;
263 DAT_EP_POST_RDMA_WRITE_FUNC ep_post_rdma_write_func;
264 DAT_EP_GET_STATUS_FUNC ep_get_status_func;
265 DAT_EP_FREE_FUNC ep_free_func;
266
267 DAT_LMR_KCREATE_FUNC lmr_kcreate_func;
268 DAT_LMR_QUERY_FUNC lmr_query_func;
269 DAT_LMR_FREE_FUNC lmr_free_func;
270
271 DAT_RMR_CREATE_FUNC rmr_create_func;
272 DAT_RMR_QUERY_FUNC rmr_query_func;
273 DAT_RMR_BIND_FUNC rmr_bind_func;
274 DAT_RMR_FREE_FUNC rmr_free_func;
275
276 DAT_PSP_CREATE_FUNC psp_create_func;
277 DAT_PSP_QUERY_FUNC psp_query_func;
278 DAT_PSP_FREE_FUNC psp_free_func;
279
280 DAT_RSP_CREATE_FUNC rsp_create_func;
281 DAT_RSP_QUERY_FUNC rsp_query_func;
282 DAT_RSP_FREE_FUNC rsp_free_func;
283
284 DAT_PZ_CREATE_FUNC pz_create_func;
285 DAT_PZ_QUERY_FUNC pz_query_func;
286 DAT_PZ_FREE_FUNC pz_free_func;
287
288 /* dat-1.1 */
289 DAT_PSP_CREATE_ANY_FUNC psp_create_any_func; /* dat-1.1 */
290 DAT_EP_RESET_FUNC ep_reset_func; /* dat-1.1 */
291
292 /* dat-1.2 */
293 DAT_LMR_SYNC_RDMA_READ_FUNC lmr_sync_rdma_read_func;
294 DAT_LMR_SYNC_RDMA_WRITE_FUNC lmr_sync_rdma_write_func;
295
296 DAT_EP_CREATE_WITH_SRQ_FUNC ep_create_with_srq_func;
297 DAT_EP_RECV_QUERY_FUNC ep_recv_query_func;
298 DAT_EP_SET_WATERMARK_FUNC ep_set_watermark_func;
299 DAT_SRQ_CREATE_FUNC srq_create_func;
300 DAT_SRQ_FREE_FUNC srq_free_func;
301 DAT_SRQ_POST_RECV_FUNC srq_post_recv_func;
302 DAT_SRQ_QUERY_FUNC srq_query_func;
303 DAT_SRQ_RESIZE_FUNC srq_resize_func;
304 DAT_SRQ_SET_LW_FUNC srq_set_lw_func;
305
306 /* DAT 2.0 functions */
307 DAT_CSP_CREATE_FUNC csp_create_func;
308 DAT_CSP_QUERY_FUNC csp_query_func;
309 DAT_CSP_FREE_FUNC csp_free_func;
310
311 DAT_EP_COMMON_CONNECT_FUNC ep_common_connect_func;
312 DAT_RMR_CREATE_FOR_EP_FUNC rmr_create_for_ep_func;
313
314 DAT_EP_POST_SEND_WITH_INVALIDATE_FUNC ep_post_send_with_invalidate_func;
315 DAT_EP_POST_RDMA_READ_TO_RMR_FUNC ep_post_rdma_read_to_rmr_func;
316
317 /* kDAT 2.0 functions */
318 DAT_LMR_ALLOCATE_FUNC lmr_allocate_func;
319 DAT_LMR_FMR_FUNC lmr_fmr_func;
320 DAT_LMR_INVALIDATE_FUNC lmr_invalidate_func;
321 DAT_IA_RESERVED_LMR_FUNC ia_reserved_lmr_func;
322
323 #ifdef DAT_EXTENSIONS
324 DAT_HANDLE_EXTENDEDOP_FUNC handle_extendedop_func;
325 #endif
326
327 DAT_IA_HA_RELATED_FUNC ia_ha_related_func;
328 };
329
330 #endif /* _KDAT_REDIRECTION_H_ */