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.
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.
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]
22 * Copyright (c) 2002-2004, Network Appliance, Inc. All rights reserved.
26 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
38 * PURPOSE: defines the user DAT API
40 * Description: Header file for "uDAPL: User Direct Access Programming
41 * Library, Version: 1.2"
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.
55 #include <dat/udat_config.h>
57 #include <dat/dat_platform_specific.h>
59 typedef enum dat_mem_type
61 /* Shared between udat and kdat */
62 DAT_MEM_TYPE_VIRTUAL
= 0x00,
63 DAT_MEM_TYPE_LMR
= 0x01,
65 DAT_MEM_TYPE_SHARED_VIRTUAL
= 0x02,
66 DAT_MEM_TYPE_SO_VIRTUAL
= 0x03
69 /* dat handle types */
70 typedef enum dat_handle_type
86 * EVD state consists of 3 orthogonal substates. One for
87 * enabled/disabled, one for waitable/unwaitable, and one
88 * for configuration. Within each substates the values are
91 typedef enum dat_evd_state
93 DAT_EVD_STATE_ENABLED
= 0x01,
94 DAT_EVD_STATE_DISABLED
= 0x02,
95 DAT_EVD_STATE_WAITABLE
= 0x04,
96 DAT_EVD_STATE_UNWAITABLE
= 0x08,
97 DAT_EVD_STATE_CONFIG_NOTIFY
= 0x10,
98 DAT_EVD_STATE_CONFIG_SOLICITED
= 0x20,
99 DAT_EVD_STATE_CONFIG_THRESHOLD
= 0x30
102 typedef enum dat_evd_param_mask
104 DAT_EVD_FIELD_IA_HANDLE
= 0x01,
105 DAT_EVD_FIELD_EVD_QLEN
= 0x02,
106 DAT_EVD_FIELD_EVD_STATE
= 0x04,
107 DAT_EVD_FIELD_CNO
= 0x08,
108 DAT_EVD_FIELD_EVD_FLAGS
= 0x10,
110 DAT_EVD_FIELD_ALL
= 0x1F
111 } DAT_EVD_PARAM_MASK
;
113 typedef DAT_UINT64 DAT_PROVIDER_ATTR_MASK
;
117 typedef DAT_HANDLE DAT_CNO_HANDLE
;
121 DAT_IA_HANDLE ia_handle
;
123 DAT_EVD_STATE evd_state
;
124 DAT_CNO_HANDLE cno_handle
;
125 DAT_EVD_FLAGS evd_flags
;
128 #define DAT_LMR_COOKIE_SIZE 40 /* size of DAT_LMR_COOKIE in bytes */
129 typedef char (* DAT_LMR_COOKIE
)[DAT_LMR_COOKIE_SIZE
];
131 /* Format for OS wait proxy agent function */
133 typedef void (*DAT_AGENT_FUNC
)(
134 DAT_PVOID
, /* instance data */
135 DAT_EVD_HANDLE
/* Event Dispatcher*/);
139 typedef struct dat_os_wait_proxy_agent
141 DAT_PVOID instance_data
;
142 DAT_AGENT_FUNC proxy_agent_func
;
143 } DAT_OS_WAIT_PROXY_AGENT
;
145 /* Define NULL Proxy agent */
147 #define DAT_OS_WAIT_PROXY_AGENT_NULL \
148 (DAT_OS_WAIT_PROXY_AGENT) { \
150 (DAT_AGENT_FUNC) NULL }
156 * The value specified by the uDAPL Consumer for dat_ia_open to indicate
157 * that not async EVD should be created for the opening instance of an IA.
158 * The same IA have been open before that has the only async EVD to
159 * handle async errors for all open instances of the IA.
162 #define DAT_EVD_ASYNC_EXISTS (DAT_EVD_HANDLE) 0x1
165 * The value return by the dat_ia_query for the case when there is no
166 * async EVD for the IA instance. Consumer had specified the value of
167 * DAT_EVD_ASYNC_EXISTS for the async_evd_handle for dat_ia_open.
170 #define DAT_EVD_OUT_OF_SCOPE (DAT_EVD_HANDLE) 0x2
175 * Specifing memory type for LMR create. A consumer must use a single
176 * value when registering memory. The union of any of these
177 * flags is used in the provider parameters to indicate what memory
178 * type provider supports for LMR memory creation.
185 typedef struct dat_shared_memory
187 DAT_PVOID virtual_address
;
188 DAT_LMR_COOKIE shared_memory_id
;
191 typedef union dat_region_description
194 DAT_LMR_HANDLE for_lmr_handle
;
195 DAT_SHARED_MEMORY for_shared_memory
; /* For udapl only */
196 } DAT_REGION_DESCRIPTION
;
202 DAT_IA_HANDLE ia_handle
;
203 DAT_MEM_TYPE mem_type
;
204 DAT_REGION_DESCRIPTION region_desc
;
206 DAT_PZ_HANDLE pz_handle
;
207 DAT_MEM_PRIV_FLAGS mem_priv
;
208 DAT_LMR_CONTEXT lmr_context
;
209 DAT_RMR_CONTEXT rmr_context
;
210 DAT_VLEN registered_size
;
211 DAT_VADDR registered_address
;
215 typedef struct dat_cno_param
217 DAT_IA_HANDLE ia_handle
;
218 DAT_OS_WAIT_PROXY_AGENT agent
;
221 typedef enum dat_cno_param_mask
223 DAT_CNO_FIELD_IA_HANDLE
= 0x1,
224 DAT_CNO_FIELD_AGENT
= 0x2,
226 DAT_CNO_FIELD_ALL
= 0x3
227 } DAT_CNO_PARAM_MASK
;
230 /* General Provider attributes. udat specific. */
231 typedef enum dat_pz_support
239 * Provider should support merging of all event stream types. Provider
240 * attribute specify support for merging different event stream types.
241 * It is a 2D binary matrix where each row and column represents an event
242 * stream type. Each binary entry is 1 if the event streams of its raw
243 * and column can fed the same EVD, and 0 otherwise. The order of event
244 * streams in row and column is the same as in the definition of
245 * DAT_EVD_FLAGS: index 0 - Software Event, 1- Connection Request,
246 * 2 - DTO Completion, 3 - Connection event, 4 - RMR Bind Completion,
247 * 5 - Asynchronous event. By definition each diagonal entry is 1.
248 * Consumer allocates an array for it and passes it IN as a pointer
249 * for the array that Provider fills. Provider must fill the array
250 * that Consumer passes.
253 struct dat_provider_attr
255 char provider_name
[DAT_NAME_MAX_LENGTH
];
256 DAT_UINT32 provider_version_major
;
257 DAT_UINT32 provider_version_minor
;
258 DAT_UINT32 dapl_version_major
;
259 DAT_UINT32 dapl_version_minor
;
260 DAT_MEM_TYPE lmr_mem_types_supported
;
261 DAT_IOV_OWNERSHIP iov_ownership_on_return
;
262 DAT_QOS dat_qos_supported
;
263 DAT_COMPLETION_FLAGS completion_flags_supported
;
264 DAT_BOOLEAN is_thread_safe
;
265 DAT_COUNT max_private_data_size
;
266 DAT_BOOLEAN supports_multipath
;
267 DAT_EP_CREATOR_FOR_PSP ep_creator
;
268 DAT_PZ_SUPPORT pz_support
;
269 DAT_UINT32 optimal_buffer_alignment
;
270 const DAT_BOOLEAN evd_stream_merging_supported
[6][6];
271 DAT_BOOLEAN srq_supported
;
272 DAT_COUNT srq_watermarks_supported
;
273 DAT_BOOLEAN srq_ep_pz_difference_supported
;
274 DAT_COUNT srq_info_supported
;
275 DAT_COUNT ep_recv_info_supported
;
276 DAT_BOOLEAN lmr_sync_req
;
277 DAT_BOOLEAN dto_async_return_guaranteed
;
278 DAT_BOOLEAN rdma_write_for_rdma_read_req
;
279 DAT_COUNT num_provider_specific_attr
;
280 DAT_NAMED_ATTR
* provider_specific_attr
;
283 #define DAT_PROVIDER_FIELD_PROVIDER_NAME UINT64_C(0x0000001)
284 #define DAT_PROVIDER_FIELD_PROVIDER_VERSION_MAJOR UINT64_C(0x0000002)
285 #define DAT_PROVIDER_FIELD_PROVIDER_VERSION_MINOR UINT64_C(0x0000004)
286 #define DAT_PROVIDER_FIELD_DAPL_VERSION_MAJOR UINT64_C(0x0000008)
287 #define DAT_PROVIDER_FIELD_DAPL_VERSION_MINOR UINT64_C(0x0000010)
288 #define DAT_PROVIDER_FIELD_LMR_MEM_TYPE_SUPPORTED UINT64_C(0x0000020)
289 #define DAT_PROVIDER_FIELD_IOV_OWNERSHIP UINT64_C(0x0000040)
290 #define DAT_PROVIDER_FIELD_DAT_QOS_SUPPORTED UINT64_C(0x0000080)
291 #define DAT_PROVIDER_FIELD_COMPLETION_FLAGS_SUPPORTED UINT64_C(0x0000100)
292 #define DAT_PROVIDER_FIELD_IS_THREAD_SAFE UINT64_C(0x0000200)
293 #define DAT_PROVIDER_FIELD_MAX_PRIVATE_DATA_SIZE UINT64_C(0x0000400)
294 #define DAT_PROVIDER_FIELD_SUPPORTS_MULTIPATH UINT64_C(0x0000800)
295 #define DAT_PROVIDER_FIELD_EP_CREATOR UINT64_C(0x0001000)
296 #define DAT_PROVIDER_FIELD_PZ_SUPPORT UINT64_C(0x0002000)
297 #define DAT_PROVIDER_FIELD_OPTIMAL_BUFFER_ALIGNMENT UINT64_C(0x0004000)
298 #define DAT_PROVIDER_FIELD_EVD_STREAM_MERGING_SUPPORTED UINT64_C(0x0008000)
299 #define DAT_PROVIDER_FIELD_SRQ_SUPPORTED UINT64_C(0x0010000)
300 #define DAT_PROVIDER_FIELD_SRQ_WATERMARKS_SUPPORTED UINT64_C(0x0020000)
301 #define DAT_PROVIDER_FIELD_SRQ_EP_PZ_DIFFERENCE_SUPPORTED \
303 #define DAT_PROVIDER_FIELD_SRQ_INFO_SUPPORTED UINT64_C(0x0080000)
304 #define DAT_PROVIDER_FIELD_EP_RECV_INFO_SUPPORTED UINT64_C(0x0100000)
305 #define DAT_PROVIDER_FIELD_LMR_SYNC_REQ UINT64_C(0x0200000)
306 #define DAT_PROVIDER_FIELD_DTO_ASYNC_RETURN_GUARANTEED UINT64_C(0x0400000)
307 #define DAT_PROVIDER_FIELD_RDMA_WRITE_FOR_RDMA_READ_REQ UINT64_C(0x0800000)
308 #define DAT_PROVIDER_FIELD_NUM_PROVIDER_SPECIFIC_ATTR UINT64_C(0x1000000)
309 #define DAT_PROVIDER_FIELD_PROVIDER_SPECIFIC_ATTR UINT64_C(0x2000000)
311 #define DAT_PROVIDER_FIELD_ALL UINT64_C(0x3FFFFFF)
312 #define DAT_PROVIDER_FIELD_NONE UINT64_C(0x0)
314 #include <dat/udat_vendor_specific.h>
316 /* ************************************************************************ */
319 * User DAT functions definitions.
323 extern DAT_RETURN
dat_lmr_create(
324 IN DAT_IA_HANDLE
, /* ia_handle */
325 IN DAT_MEM_TYPE
, /* mem_type */
326 IN DAT_REGION_DESCRIPTION
, /* region_description */
327 IN DAT_VLEN
, /* length */
328 IN DAT_PZ_HANDLE
, /* pz_handle */
329 IN DAT_MEM_PRIV_FLAGS
, /* privileges */
330 OUT DAT_LMR_HANDLE
*, /* lmr_handle */
331 OUT DAT_LMR_CONTEXT
*, /* lmr_context */
332 OUT DAT_RMR_CONTEXT
*, /* rmr_context */
333 OUT DAT_VLEN
*, /* registered_length */
334 OUT DAT_VADDR
*); /* registered_address */
336 /* Event Functions */
338 extern DAT_RETURN
dat_evd_create(
339 IN DAT_IA_HANDLE
, /* ia_handle */
340 IN DAT_COUNT
, /* evd_min_qlen */
341 IN DAT_CNO_HANDLE
, /* cno_handle */
342 IN DAT_EVD_FLAGS
, /* evd_flags */
343 OUT DAT_EVD_HANDLE
*); /* evd_handle */
345 extern DAT_RETURN
dat_evd_modify_cno(
346 IN DAT_EVD_HANDLE
, /* evd_handle */
347 IN DAT_CNO_HANDLE
); /* cno_handle */
349 extern DAT_RETURN
dat_cno_create(
350 IN DAT_IA_HANDLE
, /* ia_handle */
351 IN DAT_OS_WAIT_PROXY_AGENT
, /* agent */
352 OUT DAT_CNO_HANDLE
*); /* cno_handle */
354 extern DAT_RETURN
dat_cno_modify_agent(
355 IN DAT_CNO_HANDLE
, /* cno_handle */
356 IN DAT_OS_WAIT_PROXY_AGENT
); /* agent */
358 extern DAT_RETURN
dat_cno_query(
359 IN DAT_CNO_HANDLE
, /* cno_handle */
360 IN DAT_CNO_PARAM_MASK
, /* cno_param_mask */
361 OUT DAT_CNO_PARAM
*); /* cno_param */
363 extern DAT_RETURN
dat_cno_free(
364 IN DAT_CNO_HANDLE
); /* cno_handle */
366 extern DAT_RETURN
dat_cno_wait(
367 IN DAT_CNO_HANDLE
, /* cno_handle */
368 IN DAT_TIMEOUT
, /* timeout */
369 OUT DAT_EVD_HANDLE
*); /* evd_handle */
371 extern DAT_RETURN
dat_evd_enable(
372 IN DAT_EVD_HANDLE
); /* evd_handle */
374 extern DAT_RETURN
dat_evd_wait(
375 IN DAT_EVD_HANDLE
, /* evd_handle */
376 IN DAT_TIMEOUT
, /* Timeout */
377 IN DAT_COUNT
, /* Threshold */
378 OUT DAT_EVENT
*, /* event */
379 OUT DAT_COUNT
*); /* N more events */
381 extern DAT_RETURN
dat_evd_disable(
382 IN DAT_EVD_HANDLE
); /* evd_handle */
384 extern DAT_RETURN
dat_evd_set_unwaitable(
385 IN DAT_EVD_HANDLE
); /* evd_handle */
387 extern DAT_RETURN
dat_evd_clear_unwaitable(
388 IN DAT_EVD_HANDLE
); /* evd_handle */
394 #endif /* _UDAT_H_ */