xref: /titanic_51/usr/src/lib/udapl/libdat/include/dat/dat.h (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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 #ifndef	_DAT_H_
32 #define	_DAT_H_
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 /*
37  *
38  * HEADER: dat.h
39  *
40  * PURPOSE: defines the common DAT API for uDAPL and kDAPL.
41  *
42  * Description: Header file for "uDAPL: User Direct Access Programming
43  *		Library, Version: 1.2"
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 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 #include <dat/dat_error.h>
58 
59 /* Generic DAT types */
60 
61 typedef char *DAT_NAME_PTR;   /* Format for ia_name and attributes */
62 #define	DAT_NAME_MAX_LENGTH	256
63 
64 /*
65  * Used for provider, vendor, transport, hardware specific attributes
66  * definitions.
67  */
68 
69 typedef struct dat_named_attr {
70 	const char	*name;   /* Name of attribute  */
71 	const char	*value;  /* Value of attribute */
72 } DAT_NAMED_ATTR;
73 
74 typedef enum dat_boolean {
75 	DAT_FALSE = 0,
76 	DAT_TRUE = 1
77 } DAT_BOOLEAN;
78 
79 typedef union dat_context {
80 	DAT_PVOID	as_ptr;
81 	DAT_UINT64	as_64;
82 	DAT_UVERYLONG	as_index;
83 } DAT_CONTEXT;
84 
85 typedef DAT_CONTEXT	DAT_DTO_COOKIE;
86 typedef DAT_CONTEXT	DAT_RMR_COOKIE;
87 
88 typedef enum dat_completion_flags {
89 	/* Completes with notification					*/
90 	DAT_COMPLETION_DEFAULT_FLAG			= 0x00,
91 
92 	/* Completions suppressed if successful				*/
93 	DAT_COMPLETION_SUPPRESS_FLAG			= 0x01,
94 
95 	/* Sender controlled notification for recv completion		*/
96 	DAT_COMPLETION_SOLICITED_WAIT_FLAG		= 0x02,
97 
98 	/* Completions with unsignaled notifications			*/
99 	DAT_COMPLETION_UNSIGNALLED_FLAG			= 0x04,
100 
101 	/* Do not start processing until all previous RDMA reads complete. */
102 	DAT_COMPLETION_BARRIER_FENCE_FLAG		= 0x08,
103 
104 	/*
105 	 * Only valid for uDAPL as EP attribute for Recv Completion flags.
106 	 * Waiter unblocking is controlled by Threshold value of dat_evd_wait.
107 	 * UNSIGNALLED for RECV not allowed when EP has this attribute
108 	 */
109 	DAT_COMPLETION_EVD_THRESHOLD_FLAG		= 0x10
110 
111 } DAT_COMPLETION_FLAGS;
112 
113 
114 typedef	DAT_UINT32	DAT_TIMEOUT;		/* microseconds */
115 
116 /* timeout = infinity */
117 #define	DAT_TIMEOUT_INFINITE	((DAT_TIMEOUT) ~0)
118 
119 /* dat handles */
120 typedef DAT_PVOID	DAT_HANDLE;
121 typedef DAT_HANDLE	DAT_CR_HANDLE;
122 typedef DAT_HANDLE	DAT_EP_HANDLE;
123 typedef DAT_HANDLE	DAT_EVD_HANDLE;
124 typedef DAT_HANDLE	DAT_IA_HANDLE;
125 typedef DAT_HANDLE	DAT_LMR_HANDLE;
126 typedef DAT_HANDLE	DAT_PSP_HANDLE;
127 typedef DAT_HANDLE	DAT_PZ_HANDLE;
128 typedef DAT_HANDLE	DAT_RMR_HANDLE;
129 typedef DAT_HANDLE	DAT_RSP_HANDLE;
130 typedef DAT_HANDLE	DAT_SRQ_HANDLE;
131 
132 
133 /* dat NULL handles */
134 #define	DAT_HANDLE_NULL	((DAT_HANDLE)NULL)
135 
136 typedef DAT_SOCK_ADDR   *DAT_IA_ADDRESS_PTR;
137 
138 typedef DAT_UINT64	DAT_CONN_QUAL;
139 typedef DAT_UINT64	DAT_PORT_QUAL;
140 
141 /* QOS definitions */
142 typedef enum dat_qos {
143 	DAT_QOS_BEST_EFFORT		= 0x00,
144 	DAT_QOS_HIGH_THROUGHPUT		= 0x01,
145 	DAT_QOS_LOW_LATENCY		= 0x02,
146 	/* not low latency, nor high throughput   */
147 	DAT_QOS_ECONOMY			= 0x04,
148 	/* both low latency and high throughput   */
149 	DAT_QOS_PREMIUM			= 0x08
150 } DAT_QOS;
151 
152 /*
153  * FLAGS
154  */
155 
156 typedef enum dat_connect_flags {
157 	DAT_CONNECT_DEFAULT_FLAG	= 0x00,
158 	DAT_CONNECT_MULTIPATH_FLAG	= 0x01
159 } DAT_CONNECT_FLAGS;
160 
161 typedef enum dat_close_flags {
162 	DAT_CLOSE_ABRUPT_FLAG		= 0x00,
163 	DAT_CLOSE_GRACEFUL_FLAG		= 0x01
164 } DAT_CLOSE_FLAGS;
165 
166 #define	DAT_CLOSE_DEFAULT	DAT_CLOSE_ABRUPT_FLAG
167 
168 typedef enum dat_evd_flags {
169 	DAT_EVD_SOFTWARE_FLAG		= 0x001,
170 	DAT_EVD_CR_FLAG			= 0x010,
171 	DAT_EVD_DTO_FLAG		= 0x020,
172 	DAT_EVD_CONNECTION_FLAG		= 0x040,
173 	DAT_EVD_RMR_BIND_FLAG		= 0x080,
174 	DAT_EVD_ASYNC_FLAG		= 0x100,
175 	/* DAT events only, no software events */
176 	DAT_EVD_DEFAULT_FLAG		= 0x1F0
177 } DAT_EVD_FLAGS;
178 
179 typedef enum dat_psp_flags {
180 	DAT_PSP_CONSUMER_FLAG	= 0x00, /*  Consumer creates an endpoint */
181 	DAT_PSP_PROVIDER_FLAG	= 0x01  /*  Provider creates an endpoint */
182 } DAT_PSP_FLAGS;
183 
184 /*
185  * Memory Buffers
186  *
187  * Both LMR and RMR triplets specify 64-bit addresses in the local host's byte
188  * order, even when that exceeds the size of a DAT_PVOID for the host
189  * architecture.
190  */
191 
192 /*
193  * Both LMR and RMR Triplets specify 64-bit addresses in the local host
194  * order, even when that exceeds the size of a void pointer for the host
195  * architecture. The DAT_VADDR type that represents addresses is in the
196  * native byte-order of the local host. Helper macros that allow Consumers
197  * to convert DAT_VADDR into various orders that might be useful for
198  * inclusion of RMR Triplets into a payload of a message follow.
199  *
200  * DAT defines the following macros to convert the fields on an RMR Triplet
201  * to defined byte orders to allow their export by the Consumer over wire
202  * protocols. DAT does not define how the two peers decide which byte should be
203  * used.
204  *
205  * DAT_LMRC_TO_LSB(lmrc) returns the supplied LMR Context in ls-byte
206  * order.
207  * DAT_LMRC_TO_MSB(lmrc) returns the supplied LMR Context in ms-byte
208  * order.
209  * DAT_RMRC_TO_LSB(rmrc) returns the supplied RMR Context in ls-byte
210  * order.
211  * DAT_RMRC_TO_MSB(rmrc) returns the supplied RMR Context in ms-byte
212  * order.
213  * DAT_VADDR_TO_LSB(vaddr) returns the supplied Virtual Address in ls-byte
214  * order.
215  * DAT_VADDR_TO_MSB(vaddr) returns the supplied Virtual Address in
216  * ms-byte order.
217  * DAT_VLEN_TO_LSB(vlen) returns the supplied length in ls-byte order.
218  * DAT_VLEN_TO_MSB(vlen) returns the supplied length in ms-byte order.
219  *
220  * Consumers are free to use 64-bit or 32-bit arithmetic for local or remote
221  * memory address and length manipulation in their preferred byte-order. Only
222  * the LMR and RMR Triplets passed to a Provider as part of a Posted DTO are
223  * required to be in 64-bit address and local host order formats. Providers
224  * shall convert RMR_Triplets to a Transport-required wire format.
225  *
226  * For the best performance, Consumers should align each buffer segment to
227  * the boundary specified by the dat_optimal_alignment.
228  */
229 typedef	DAT_UINT32	DAT_LMR_CONTEXT;
230 typedef DAT_UINT32	DAT_RMR_CONTEXT;
231 
232 typedef DAT_UINT64	DAT_VLEN;
233 typedef DAT_UINT64	DAT_VADDR;
234 
235 typedef struct dat_provider_attr	DAT_PROVIDER_ATTR;
236 typedef struct dat_evd_param		DAT_EVD_PARAM;
237 typedef struct dat_lmr_param		DAT_LMR_PARAM;
238 
239 /*
240  * It is legal for Consumer to specify zero for segment_length
241  * of the dat_lmr_triplet. When 0 is specified for the
242  * segment_length then the other two elements of the
243  * dat_lmr_triplet are irrelevant and can be invalid.
244  */
245 
246 typedef struct dat_lmr_triplet {
247 	DAT_LMR_CONTEXT		lmr_context;
248 	DAT_UINT32		pad;
249 	DAT_VADDR		virtual_address;
250 	DAT_VLEN		segment_length;
251 } DAT_LMR_TRIPLET;
252 
253 typedef struct dat_rmr_triplet {
254 	DAT_RMR_CONTEXT		rmr_context;
255 	DAT_UINT32		pad;
256 	DAT_VADDR		target_address;
257 	DAT_VLEN		segment_length;
258 } DAT_RMR_TRIPLET;
259 
260 /*
261  * The extra padding ensures that context, address, and length parameters are
262  * aligned on 64-bit boundaries.
263  */
264 
265 /* Memory privileges */
266 
267 typedef enum dat_mem_priv_flags {
268 	DAT_MEM_PRIV_NONE_FLAG		= 0x00,
269 	DAT_MEM_PRIV_LOCAL_READ_FLAG	= 0x01,
270 	DAT_MEM_PRIV_REMOTE_READ_FLAG	= 0x02,
271 	DAT_MEM_PRIV_LOCAL_WRITE_FLAG	= 0x10,
272 	DAT_MEM_PRIV_REMOTE_WRITE_FLAG	= 0x20,
273 	DAT_MEM_PRIV_ALL_FLAG		= 0x33
274 } DAT_MEM_PRIV_FLAGS;
275 
276 /*
277  * For backwards compatibility with DAT-1.0 memory privileges values
278  * are supported
279  */
280 #define	DAT_MEM_PRIV_READ_FLAG  (DAT_MEM_PRIV_LOCAL_READ_FLAG |		\
281 					DAT_MEM_PRIV_REMOTE_READ_FLAG)
282 #define	DAT_MEM_PRIV_WRITE_FLAG (DAT_MEM_PRIV_LOCAL_WRITE_FLAG |	\
283 					DAT_MEM_PRIV_REMOTE_WRITE_FLAG)
284 
285 /* LMR Arguments Mask */
286 
287 typedef enum dat_lmr_param_mask {
288 	DAT_LMR_FIELD_IA_HANDLE			= 0x001,
289 	DAT_LMR_FIELD_MEM_TYPE			= 0x002,
290 	DAT_LMR_FIELD_REGION_DESC		= 0x004,
291 	DAT_LMR_FIELD_LENGTH			= 0x008,
292 	DAT_LMR_FIELD_PZ_HANDLE			= 0x010,
293 	DAT_LMR_FIELD_MEM_PRIV			= 0x020,
294 	DAT_LMR_FIELD_LMR_CONTEXT		= 0x040,
295 	DAT_LMR_FIELD_RMR_CONTEXT		= 0x080,
296 	DAT_LMR_FIELD_REGISTERED_SIZE		= 0x100,
297 	DAT_LMR_FIELD_REGISTERED_ADDRESS	= 0x200,
298 
299 	DAT_LMR_FIELD_ALL			= 0x3FF
300 } DAT_LMR_PARAM_MASK;
301 
302 /* RMR Argumments & RMR Arguments Mask */
303 
304 typedef struct dat_rmr_param {
305 	DAT_IA_HANDLE		ia_handle;
306 	DAT_PZ_HANDLE		pz_handle;
307 	DAT_LMR_TRIPLET		lmr_triplet;
308 	DAT_MEM_PRIV_FLAGS	mem_priv;
309 	DAT_RMR_CONTEXT		rmr_context;
310 } DAT_RMR_PARAM;
311 
312 typedef enum dat_rmr_param_mask {
313 	DAT_RMR_FIELD_IA_HANDLE		= 0x01,
314 	DAT_RMR_FIELD_PZ_HANDLE		= 0x02,
315 	DAT_RMR_FIELD_LMR_TRIPLET	= 0x04,
316 	DAT_RMR_FIELD_MEM_PRIV		= 0x08,
317 	DAT_RMR_FIELD_RMR_CONTEXT	= 0x10,
318 
319 	DAT_RMR_FIELD_ALL		= 0x1F
320 } DAT_RMR_PARAM_MASK;
321 
322 /* Provider attributes */
323 
324 typedef enum dat_iov_ownership {
325 	/* Not modification by provider, consumer can use anytime.	*/
326 	DAT_IOV_CONSUMER		= 0x0,
327 
328 	/* Provider does not modify returned IOV DTO on completion.	*/
329 	DAT_IOV_PROVIDER_NOMOD		= 0x1,
330 
331 	/* Provider may modify IOV DTO on completion, can't trust it.	*/
332 	DAT_IOV_PROVIDER_MOD		= 0x2
333 
334 } DAT_IOV_OWNERSHIP;
335 
336 typedef enum dat_ep_creator_for_psp {
337 	DAT_PSP_CREATES_EP_NEVER,	/* provider never creates endpoint    */
338 	DAT_PSP_CREATES_EP_IFASKED,	/* provider creates endpoint if asked */
339 	DAT_PSP_CREATES_EP_ALWAYS	/* provider always creates endpoint   */
340 } DAT_EP_CREATOR_FOR_PSP;
341 
342 /* General Interface Adapter attributes. These apply to both udat and kdat. */
343 
344 /* To support backwards compatibility for DAPL-1.0 */
345 #define	max_rdma_read_per_ep 		max_rdma_read_per_ep_in
346 #define	DAT_IA_FIELD_IA_MAX_DTO_PER_OP 	DAT_IA_FIELD_IA_ MAX_DTO_PER_EP_IN
347 
348 /* to support backwards compatibility for DAPL-1.0 & DAPL-1.1 */
349 #define	max_mtu_size max_message_size
350 
351 typedef struct dat_ia_attr
352 {
353 	char				adapter_name[DAT_NAME_MAX_LENGTH];
354 	char				vendor_name[DAT_NAME_MAX_LENGTH];
355 	DAT_UINT32			hardware_version_major;
356 	DAT_UINT32			hardware_version_minor;
357 	DAT_UINT32			firmware_version_major;
358 	DAT_UINT32			firmware_version_minor;
359 	DAT_IA_ADDRESS_PTR		ia_address_ptr;
360 	DAT_COUNT			max_eps;
361 	DAT_COUNT			max_dto_per_ep;
362 	DAT_COUNT			max_rdma_read_per_ep_in;
363 	DAT_COUNT			max_rdma_read_per_ep_out;
364 	DAT_COUNT			max_evds;
365 	DAT_COUNT			max_evd_qlen;
366 	DAT_COUNT			max_iov_segments_per_dto;
367 	DAT_COUNT			max_lmrs;
368 	DAT_VLEN			max_lmr_block_size;
369 	DAT_VADDR			max_lmr_virtual_address;
370 	DAT_COUNT			max_pzs;
371 	DAT_VLEN			max_message_size;
372 	DAT_VLEN			max_rdma_size;
373 	DAT_COUNT			max_rmrs;
374 	DAT_VADDR			max_rmr_target_address;
375 	DAT_COUNT			max_srqs;
376 	DAT_COUNT			max_ep_per_srq;
377 	DAT_COUNT			max_recv_per_srq;
378 	DAT_COUNT			max_iov_segments_per_rdma_read;
379 	DAT_COUNT			max_iov_segments_per_rdma_write;
380 	DAT_COUNT			max_rdma_read_in;
381 	DAT_COUNT			max_rdma_read_out;
382 	DAT_BOOLEAN			max_rdma_read_per_ep_in_guaranteed;
383 	DAT_BOOLEAN			max_rdma_read_per_ep_out_guaranteed;
384 	DAT_COUNT			num_transport_attr;
385 	DAT_NAMED_ATTR			*transport_attr;
386 	DAT_COUNT			num_vendor_attr;
387 	DAT_NAMED_ATTR			*vendor_attr;
388 } DAT_IA_ATTR;
389 
390 /* To support backwards compatibility for DAPL-1.0 & DAPL-1.1 */
391 #define	DAT_IA_FIELD_IA_MAX_MTU_SIZE	DAT_IA_FIELD_IA_MAX_MESSAGE_SIZE
392 
393 typedef DAT_UINT64 DAT_IA_ATTR_MASK;
394 
395 #define	DAT_IA_FIELD_IA_ADAPTER_NAME			UINT64_C(0x000000001)
396 #define	DAT_IA_FIELD_IA_VENDOR_NAME			UINT64_C(0x000000002)
397 #define	DAT_IA_FIELD_IA_HARDWARE_MAJOR_VERSION		UINT64_C(0x000000004)
398 #define	DAT_IA_FIELD_IA_HARDWARE_MINOR_VERSION		UINT64_C(0x000000008)
399 #define	DAT_IA_FIELD_IA_FIRMWARE_MAJOR_VERSION		UINT64_C(0x000000010)
400 #define	DAT_IA_FIELD_IA_FIRMWARE_MINOR_VERSION		UINT64_C(0x000000020)
401 #define	DAT_IA_FIELD_IA_ADDRESS_PTR			UINT64_C(0x000000040)
402 #define	DAT_IA_FIELD_IA_MAX_EPS				UINT64_C(0x000000080)
403 #define	DAT_IA_FIELD_IA_MAX_DTO_PER_EP			UINT64_C(0x000000100)
404 #define	DAT_IA_FIELD_IA_MAX_RDMA_READ_PER_EP_IN		UINT64_C(0x000000200)
405 #define	DAT_IA_FIELD_IA_MAX_RDMA_READ_PER_EP_OUT	UINT64_C(0x000000400)
406 #define	DAT_IA_FIELD_IA_MAX_EVDS			UINT64_C(0x000000800)
407 #define	DAT_IA_FIELD_IA_MAX_EVD_QLEN			UINT64_C(0x000001000)
408 #define	DAT_IA_FIELD_IA_MAX_IOV_SEGMENTS_PER_DTO	UINT64_C(0x000002000)
409 #define	DAT_IA_FIELD_IA_MAX_LMRS			UINT64_C(0x000004000)
410 #define	DAT_IA_FIELD_IA_MAX_LMR_BLOCK_SIZE		UINT64_C(0x000008000)
411 #define	DAT_IA_FIELD_IA_MAX_LMR_VIRTUAL_ADDRESS		UINT64_C(0x000010000)
412 #define	DAT_IA_FIELD_IA_MAX_PZS				UINT64_C(0x000020000)
413 #define	DAT_IA_FIELD_IA_MAX_MESSAGE_SIZE		UINT64_C(0x000040000)
414 #define	DAT_IA_FIELD_IA_MAX_RDMA_SIZE			UINT64_C(0x000080000)
415 #define	DAT_IA_FIELD_IA_MAX_RMRS			UINT64_C(0x000100000)
416 #define	DAT_IA_FIELD_IA_MAX_RMR_TARGET_ADDRESS		UINT64_C(0x000200000)
417 #define	DAT_IA_FIELD_IA_MAX_SRQS			UINT64_C(0x000400000)
418 #define	DAT_IA_FIELD_IA_MAX_EP_PER_SRQ			UINT64_C(0x000800000)
419 #define	DAT_IA_FIELD_IA_MAX_RECV_PER_SRQ		UINT64_C(0x001000000)
420 #define	DAT_IA_FIELD_IA_MAX_IOV_SEGMENTS_PER_RDMA_READ	UINT64_C(0x002000000)
421 #define	DAT_IA_FIELD_IA_MAX_IOV_SEGMENTS_PER_RDMA_WRITE	UINT64_C(0x004000000)
422 #define	DAT_IA_FIELD_IA_MAX_RDMA_READ_IN		UINT64_C(0x008000000)
423 #define	DAT_IA_FIELD_IA_MAX_RDMA_READ_OUT		UINT64_C(0x010000000)
424 #define	DAT_IA_FIELD_IA_MAX_RDMA_READ_PER_EP_IN_GUARANTEED \
425 							UINT64_C(0x020000000)
426 #define	DAT_IA_FIELD_IA_MAX_RDMA_READ_PER_EP_OUT_GUARANTEED \
427 							UINT64_C(0x040000000)
428 #define	DAT_IA_FIELD_IA_NUM_TRANSPORT_ATTR		UINT64_C(0x080000000)
429 #define	DAT_IA_FIELD_IA_TRANSPORT_ATTR			UINT64_C(0x100000000)
430 #define	DAT_IA_FIELD_IA_NUM_VENDOR_ATTR			UINT64_C(0x200000000)
431 #define	DAT_IA_FIELD_IA_VENDOR_ATTR			UINT64_C(0x400000000)
432 
433 /* To support backwards compatibility for DAPL-1.0 & DAPL-1.1 */
434 #define	DAT_IA_ALL 					DAT_IA_FIELD_ALL
435 #define	DAT_IA_FIELD_ALL				UINT64_C(0x7FFFFFFFF)
436 #define	DAT_IA_FIELD_NONE				UINT64_C(0x0)
437 
438 /* Endpoint attributes */
439 
440 typedef enum dat_service_type {
441 	DAT_SERVICE_TYPE_RC		/* reliable connections */
442 } DAT_SERVICE_TYPE;
443 
444 typedef struct dat_ep_attr {
445 	DAT_SERVICE_TYPE		service_type;
446 	DAT_VLEN			max_message_size;
447 	DAT_VLEN			max_rdma_size;
448 	DAT_QOS				qos;
449 	DAT_COMPLETION_FLAGS		recv_completion_flags;
450 	DAT_COMPLETION_FLAGS		request_completion_flags;
451 	DAT_COUNT			max_recv_dtos;
452 	DAT_COUNT			max_request_dtos;
453 	DAT_COUNT			max_recv_iov;
454 	DAT_COUNT			max_request_iov;
455 	DAT_COUNT			max_rdma_read_in;
456 	DAT_COUNT			max_rdma_read_out;
457 	DAT_COUNT			srq_soft_hw;
458 	DAT_COUNT			max_rdma_read_iov;
459 	DAT_COUNT			max_rdma_write_iov;
460 	DAT_COUNT			ep_transport_specific_count;
461 	DAT_NAMED_ATTR *		ep_transport_specific;
462 	DAT_COUNT			ep_provider_specific_count;
463 	DAT_NAMED_ATTR *		ep_provider_specific;
464 } DAT_EP_ATTR;
465 
466 /* Endpoint Parameters */
467 
468 /* For backwards compatability */
469 #define	DAT_EP_STATE_ERROR	DAT_EP_STATE_DISCONNECTED
470 
471 typedef enum dat_ep_state {
472 	DAT_EP_STATE_UNCONNECTED,	/* quiescent state */
473 	DAT_EP_STATE_UNCONFIGURED_UNCONNECTED,
474 	DAT_EP_STATE_RESERVED,
475 	DAT_EP_STATE_UNCONFIGURED_RESERVED,
476 	DAT_EP_STATE_PASSIVE_CONNECTION_PENDING,
477 	DAT_EP_STATE_UNCONFIGURED_PASSIVE,
478 	DAT_EP_STATE_ACTIVE_CONNECTION_PENDING,
479 	DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING,
480 	DAT_EP_STATE_UNCONFIGURED_TENTATIVE,
481 	DAT_EP_STATE_CONNECTED,
482 	DAT_EP_STATE_DISCONNECT_PENDING,
483 	DAT_EP_STATE_DISCONNECTED,
484 	DAT_EP_STATE_COMPLETION_PENDING
485 } DAT_EP_STATE;
486 
487 typedef struct dat_ep_param {
488 	DAT_IA_HANDLE			ia_handle;
489 	DAT_EP_STATE			ep_state;
490 	DAT_IA_ADDRESS_PTR		local_ia_address_ptr;
491 	DAT_PORT_QUAL			local_port_qual;
492 	DAT_IA_ADDRESS_PTR		remote_ia_address_ptr;
493 	DAT_PORT_QUAL			remote_port_qual;
494 	DAT_PZ_HANDLE			pz_handle;
495 	DAT_EVD_HANDLE			recv_evd_handle;
496 	DAT_EVD_HANDLE			request_evd_handle;
497 	DAT_EVD_HANDLE			connect_evd_handle;
498 	DAT_SRQ_HANDLE			srq_handle;
499 	DAT_EP_ATTR			ep_attr;
500 } DAT_EP_PARAM;
501 
502 typedef DAT_UINT64 DAT_EP_PARAM_MASK;
503 #define	DAT_EP_FIELD_IA_HANDLE				UINT64_C(0x00000001)
504 #define	DAT_EP_FIELD_EP_STATE				UINT64_C(0x00000002)
505 #define	DAT_EP_FIELD_LOCAL_IA_ADDRESS_PTR		UINT64_C(0x00000004)
506 #define	DAT_EP_FIELD_LOCAL_PORT_QUAL			UINT64_C(0x00000008)
507 #define	DAT_EP_FIELD_REMOTE_IA_ADDRESS_PTR		UINT64_C(0x00000010)
508 #define	DAT_EP_FIELD_REMOTE_PORT_QUAL			UINT64_C(0x00000020)
509 #define	DAT_EP_FIELD_PZ_HANDLE				UINT64_C(0x00000040)
510 #define	DAT_EP_FIELD_RECV_EVD_HANDLE			UINT64_C(0x00000080)
511 #define	DAT_EP_FIELD_REQUEST_EVD_HANDLE			UINT64_C(0x00000100)
512 #define	DAT_EP_FIELD_CONNECT_EVD_HANDLE			UINT64_C(0x00000200)
513 #define	DAT_EP_FIELD_SRQ_HANDLE				UINT64_C(0x00000400)
514 
515 	/* Remainder of values from EP_ATTR, 0x00001000 and up */
516 
517 #define	DAT_EP_FIELD_EP_ATTR_SERVICE_TYPE		UINT64_C(0x00001000)
518 #define	DAT_EP_FIELD_EP_ATTR_MAX_MESSAGE_SIZE		UINT64_C(0x00002000)
519 #define	DAT_EP_FIELD_EP_ATTR_MAX_RDMA_SIZE		UINT64_C(0x00004000)
520 #define	DAT_EP_FIELD_EP_ATTR_QOS			UINT64_C(0x00008000)
521 
522 #define	DAT_EP_FIELD_EP_ATTR_RECV_COMPLETION_FLAGS	UINT64_C(0x00010000)
523 #define	DAT_EP_FIELD_EP_ATTR_REQUEST_COMPLETION_FLAGS	UINT64_C(0x00020000)
524 #define	DAT_EP_FIELD_EP_ATTR_MAX_RECV_DTOS		UINT64_C(0x00040000)
525 #define	DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_DTOS		UINT64_C(0x00080000)
526 
527 #define	DAT_EP_FIELD_EP_ATTR_MAX_RECV_IOV		UINT64_C(0x00100000)
528 #define	DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_IOV		UINT64_C(0x00200000)
529 
530 #define	DAT_EP_FIELD_EP_ATTR_MAX_RDMA_READ_IN		UINT64_C(0x00400000)
531 #define	DAT_EP_FIELD_EP_ATTR_MAX_RDMA_READ_OUT		UINT64_C(0x00800000)
532 
533 #define	DAT_EP_FIELD_EP_ATTR_SRQ_SOFT_HW		UINT64_C(0x01000000)
534 
535 #define	DAT_EP_FIELD_EP_ATTR_MAX_RDMA_READ_IOV		UINT64_C(0x02000000)
536 #define	DAT_EP_FIELD_EP_ATTR_MAX_RDMA_WRITE_IOV		UINT64_C(0x04000000)
537 
538 #define	DAT_EP_FIELD_EP_ATTR_NUM_TRANSPORT_ATTR		UINT64_C(0x08000000)
539 #define	DAT_EP_FIELD_EP_ATTR_TRANSPORT_SPECIFIC_ATTR	UINT64_C(0x10000000)
540 
541 #define	DAT_EP_FIELD_EP_ATTR_NUM_PROVIDER_ATTR		UINT64_C(0x20000000)
542 #define	DAT_EP_FIELD_EP_ATTR_PROVIDER_SPECIFIC_ATTR	UINT64_C(0x40000000)
543 
544 #define	DAT_EP_FIELD_EP_ATTR_ALL			UINT64_C(0x7FFFF000)
545 #define	DAT_EP_FIELD_ALL				UINT64_C(0x7FFFF7FF)
546 
547 #define	DAT_WATERMARK_INFINITE ((DAT_COUNT)~0)
548 
549 #define	DAT_HW_DEFAULT DAT_WATERMARK_INFINITE
550 
551 #define	DAT_SRQ_LW_DEFAULT 0x0
552 
553 typedef enum dat_srq_state {
554 	DAT_SRQ_STATE_OPERATIONAL,
555 	DAT_SRQ_STATE_ERROR
556 } DAT_SRQ_STATE;
557 
558 #define	DAT_VALUE_UNKNOWN	(((DAT_COUNT) ~0)-1)
559 
560 typedef struct dat_srq_attr {
561 	DAT_COUNT	max_recv_dtos;
562 	DAT_COUNT	max_recv_iov;
563 	DAT_COUNT	low_watermark;
564 } DAT_SRQ_ATTR;
565 
566 typedef struct dat_srq_param {
567 	DAT_IA_HANDLE		ia_handle;
568 	DAT_SRQ_STATE		srq_state;
569 	DAT_PZ_HANDLE		pz_handle;
570 	DAT_COUNT		max_recv_dtos;
571 	DAT_COUNT		max_recv_iov;
572 	DAT_COUNT		low_watermark;
573 	DAT_COUNT 		available_dto_count;
574 	DAT_COUNT		outstanding_dto_count;
575 } DAT_SRQ_PARAM;
576 
577 typedef enum dat_srq_param_mask {
578 	DAT_SRQ_FIELD_IA_HANDLE				= 0x001,
579 	DAT_SRQ_FIELD_SRQ_STATE				= 0x002,
580 	DAT_SRQ_FIELD_PZ_HANDLE				= 0x004,
581 	DAT_SRQ_FIELD_MAX_RECV_DTO			= 0x008,
582 	DAT_SRQ_FIELD_MAX_RECV_IOV			= 0x010,
583 	DAT_SRQ_FIELD_LOW_WATERMARK			= 0x020,
584 	DAT_SRQ_FIELD_AVAILABLE_DTO_COUNT		= 0x040,
585 	DAT_SRQ_FIELD_OUTSTANDING_DTO_COUNT		= 0x080,
586 
587 	DAT_SRQ_FIELD_ALL				= 0x0FF
588 } DAT_SRQ_PARAM_MASK;
589 
590 /* PZ Parameters */
591 
592 typedef struct dat_pz_param {
593 	DAT_IA_HANDLE		ia_handle;
594 } DAT_PZ_PARAM;
595 
596 typedef enum dat_pz_param_mask {
597     DAT_PZ_FIELD_IA_HANDLE	= 0x01,
598 
599     DAT_PZ_FIELD_ALL		= 0x01
600 } DAT_PZ_PARAM_MASK;
601 
602 /* PSP Parameters */
603 
604 typedef struct dat_psp_param {
605 	DAT_IA_HANDLE		ia_handle;
606 	DAT_CONN_QUAL		conn_qual;
607 	DAT_EVD_HANDLE		evd_handle;
608 	DAT_PSP_FLAGS		psp_flags;
609 } DAT_PSP_PARAM;
610 
611 typedef enum dat_psp_param_mask {
612     DAT_PSP_FIELD_IA_HANDLE	= 0x01,
613     DAT_PSP_FIELD_CONN_QUAL	= 0x02,
614     DAT_PSP_FIELD_EVD_HANDLE	= 0x04,
615     DAT_PSP_FIELD_PSP_FLAGS	= 0x08,
616 
617     DAT_PSP_FIELD_ALL		= 0x0F
618 } DAT_PSP_PARAM_MASK;
619 
620 /* RSP Parameters */
621 
622 typedef struct dat_rsp_param {
623 	DAT_IA_HANDLE		ia_handle;
624 	DAT_CONN_QUAL		conn_qual;
625 	DAT_EVD_HANDLE		evd_handle;
626 	DAT_EP_HANDLE		ep_handle;
627 } DAT_RSP_PARAM;
628 
629 typedef enum dat_rsp_param_mask {
630 	DAT_RSP_FIELD_IA_HANDLE		= 0x01,
631 	DAT_RSP_FIELD_CONN_QUAL		= 0x02,
632 	DAT_RSP_FIELD_EVD_HANDLE	= 0x04,
633 	DAT_RSP_FIELD_EP_HANDLE		= 0x08,
634 
635 	DAT_RSP_FIELD_ALL		= 0x0F
636 } DAT_RSP_PARAM_MASK;
637 
638 /*
639  * Connection Request Parameters.
640  *
641  * The Connection Request does not provide Remote Endpoint attributes.
642  * If a local Consumer needs this information, the remote Consumer should
643  * encode it into Private Data.
644  */
645 
646 typedef struct dat_cr_param {
647 	/* Remote IA whose Endpoint requested the connection.		*/
648 	DAT_IA_ADDRESS_PTR	remote_ia_address_ptr;
649 
650 	/* Port qualifier of the remote Endpoint of the requested connection. */
651 	DAT_PORT_QUAL		remote_port_qual;
652 
653 	/* Size of the Private Data.					*/
654 	DAT_COUNT		private_data_size;
655 
656 	/*
657 	 * Pointer to the Private Data passed by remote side in the Connection
658 	 * Request.
659 	 */
660 	DAT_PVOID		private_data;
661 
662 	/*
663 	 * The local Endpoint provided by the Service Point for the requested
664 	 * connection. It is the only Endpoint that can accept a Connection
665 	 * Request on this Service Point. The value DAT_HANDLE_NULL represents
666 	 * that there is no associated local Endpoint for the requested
667 	 * connection.
668 	 */
669 	DAT_EP_HANDLE			local_ep_handle;
670 
671 } DAT_CR_PARAM;
672 
673 typedef enum dat_cr_param_mask {
674 	DAT_CR_FIELD_REMOTE_IA_ADDRESS_PTR	= 0x01,
675 	DAT_CR_FIELD_REMOTE_PORT_QUAL		= 0x02,
676 	DAT_CR_FIELD_PRIVATE_DATA_SIZE		= 0x04,
677 	DAT_CR_FIELD_PRIVATE_DATA		= 0x08,
678 	DAT_CR_FIELD_LOCAL_EP_HANDLE		= 0x10,
679 
680 	DAT_CR_FIELD_ALL			= 0x1F
681 } DAT_CR_PARAM_MASK;
682 
683 /*
684  * *********************** Events *****************************************
685  */
686 
687 /* Completion status flags */
688 
689 /* dto completion status */
690 
691 /* For backwards compatability */
692 #define	DAT_DTO_LENGTH_ERROR    DAT_DTO_ERR_LOCAL_LENGTH
693 #define	DAT_DTO_FAILURE		DAT_DTO_ERR_FLUSHED
694 
695 typedef enum dat_dto_completion_status {
696 	DAT_DTO_SUCCESS			= 0,
697 	DAT_DTO_ERR_FLUSHED		= 1,
698 	DAT_DTO_ERR_LOCAL_LENGTH	= 2,
699 	DAT_DTO_ERR_LOCAL_EP		= 3,
700 	DAT_DTO_ERR_LOCAL_PROTECTION	= 4,
701 	DAT_DTO_ERR_BAD_RESPONSE	= 5,
702 	DAT_DTO_ERR_REMOTE_ACCESS	= 6,
703 	DAT_DTO_ERR_REMOTE_RESPONDER	= 7,
704 	DAT_DTO_ERR_TRANSPORT		= 8,
705 	DAT_DTO_ERR_RECEIVER_NOT_READY	= 9,
706 	DAT_DTO_ERR_PARTIAL_PACKET	= 10,
707 	DAT_RMR_OPERATION_FAILED	= 11
708 } DAT_DTO_COMPLETION_STATUS;
709 
710 /* RMR completion status */
711 
712 /* For backwards compatability */
713 #define	DAT_RMR_BIND_SUCCESS    DAT_DTO_SUCCESS
714 #define	DAT_RMR_BIND_FAILURE    DAT_DTO_ERR_FLUSHED
715 
716 #define	DAT_RMR_BIND_COMPLETION_STATUS DAT_DTO_COMPLETION_STATUS
717 
718 /* Completion group structs (six total) */
719 
720 /* DTO completion event data */
721 /* transferred_length is not defined if status is not DAT_SUCCESS */
722 typedef struct dat_dto_completion_event_data {
723 	DAT_EP_HANDLE				ep_handle;
724 	DAT_DTO_COOKIE				user_cookie;
725 	DAT_DTO_COMPLETION_STATUS		status;
726 	DAT_VLEN				transfered_length;
727 } DAT_DTO_COMPLETION_EVENT_DATA;
728 
729 /* RMR bind completion event data */
730 typedef struct dat_rmr_bind_completion_event_data {
731 	DAT_RMR_HANDLE				rmr_handle;
732 	DAT_RMR_COOKIE				user_cookie;
733 	DAT_RMR_BIND_COMPLETION_STATUS		status;
734 } DAT_RMR_BIND_COMPLETION_EVENT_DATA;
735 
736 typedef union dat_sp_handle {
737 	DAT_RSP_HANDLE		rsp_handle;
738 	DAT_PSP_HANDLE		psp_handle;
739 } DAT_SP_HANDLE;
740 
741 /* Connection Request Arrival event data */
742 typedef struct dat_cr_arrival_event_data {
743 	/*
744 	 * Handle to the Service Point that received the Connection Request
745 	 * from the remote side. If the Service Point was Reserved, sp is
746 	 * DAT_HANDLE_NULL because the reserved Service Point is automatically
747 	 * destroyed upon generating this event. Can be PSP or RSP.
748 	 */
749 	DAT_SP_HANDLE			sp_handle;
750 
751 	/* Address of the IA on which the Connection Request arrived. */
752 	DAT_IA_ADDRESS_PTR		local_ia_address_ptr;
753 
754 	/*
755 	 * Connection Qualifier of the IA on which the Service Point received a
756 	 * Connection Request.
757 	 */
758 	DAT_CONN_QUAL			conn_qual;
759 
760 	/*
761 	 * The Connection Request instance created by a Provider for the
762 	 * arrived Connection Request. Consumers can find out private_data
763 	 * passed by a remote Consumer from cr_handle. It is up to a Consumer
764 	 * to dat_cr_accept or dat_cr_reject of the Connection Request.
765 	 */
766 	DAT_CR_HANDLE			cr_handle;
767 
768 } DAT_CR_ARRIVAL_EVENT_DATA;
769 
770 
771 /* Connection event data */
772 typedef struct dat_connection_event_data {
773 	DAT_EP_HANDLE		ep_handle;
774 	DAT_COUNT		private_data_size;
775 	DAT_PVOID		private_data;
776 } DAT_CONNECTION_EVENT_DATA;
777 
778 /* Async Error event data */
779 /*
780  * For unaffiliated asynchronous event dat_handle is ia_handle. For Endpoint
781  * affiliated asynchronous event dat_handle is ep_handle. For EVD affiliated
782  * asynchronous event dat_handle is evd_handle. For SRQ affiliated asynchronous
783  * event dat_handle is srq_handle. For Memory affiliated asynchronous event
784  * dat_handle is either lmr_handle, rmr_handle or pz_handle.
785  */
786 typedef struct dat_asynch_error_event_data {
787 	DAT_HANDLE		dat_handle;	/* either IA, EP, EVD, SRQ */
788 						/* LMR, RMR, or PZ handle  */
789 	DAT_COUNT		reason;		/* object specific	   */
790 } DAT_ASYNCH_ERROR_EVENT_DATA;
791 
792 /* The reason is object type specific and its values are defined below */
793 typedef enum ia_async_error_reason {
794 	DAT_IA_CATASTROPHIC_ERROR,
795 	DAT_IA_OTHER_ERROR
796 } DAT_IA_ASYNC_ERROR_REASON;
797 
798 typedef enum ep_async_error_reason {
799 	DAT_EP_TRANSFER_TO_ERROR,
800 	DAT_EP_OTHER_ERROR,
801 	DAT_SRQ_SOFT_HIGH_WATERMARK_EVENT
802 } DAT_EP_ASYNC_ERROR_REASON;
803 
804 typedef enum ep_evd_error_reason {
805 	DAT_EVD_OVERFLOW_ERROR,
806 	DAT_EVD_OTHER_ERROR
807 } DAT_EVD_ASYNC_ERROR_REASON;
808 
809 typedef enum ep_srq_error_reason {
810 	DAT_SRQ_TRANSFER_TO_ERROR,
811 	DAT_SRQ_OTHER_ERROR,
812 	DAT_SRQ_LOW_WATERMARK_EVENT
813 } DAT_SRQ_ASYNC_ERROR_REASON;
814 
815 typedef enum lmr_async_error_reason {
816 	DAT_LMR_OTHER_ERROR
817 } DAT_LMR_ASYNC_ERROR_REASON;
818 
819 typedef enum rmr_async_error_reason {
820 	DAT_RMR_OTHER_ERROR
821 } DAT_RMR_ASYNC_ERROR_REASON;
822 
823 typedef enum pz_async_error_reason {
824 	DAT_PZ_OTHER_ERROR
825 } DAT_PZ_ASYNC_ERROR_REASON;
826 
827 
828 /* Software event data */
829 typedef struct dat_software_event_data {
830 	DAT_PVOID	pointer;
831 } DAT_SOFTWARE_EVENT_DATA;
832 
833 typedef enum dat_event_number {
834 	DAT_DTO_COMPLETION_EVENT				= 0x00001,
835 
836 	DAT_RMR_BIND_COMPLETION_EVENT				= 0x01001,
837 
838 	DAT_CONNECTION_REQUEST_EVENT				= 0x02001,
839 
840 	DAT_CONNECTION_EVENT_ESTABLISHED			= 0x04001,
841 	DAT_CONNECTION_EVENT_PEER_REJECTED			= 0x04002,
842 	DAT_CONNECTION_EVENT_NON_PEER_REJECTED			= 0x04003,
843 	DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR		= 0x04004,
844 	DAT_CONNECTION_EVENT_DISCONNECTED			= 0x04005,
845 	DAT_CONNECTION_EVENT_BROKEN				= 0x04006,
846 	DAT_CONNECTION_EVENT_TIMED_OUT				= 0x04007,
847 	DAT_CONNECTION_EVENT_UNREACHABLE			= 0x04008,
848 
849 	DAT_ASYNC_ERROR_EVD_OVERFLOW				= 0x08001,
850 	DAT_ASYNC_ERROR_IA_CATASTROPHIC				= 0x08002,
851 	DAT_ASYNC_ERROR_EP_BROKEN				= 0x08003,
852 	DAT_ASYNC_ERROR_TIMED_OUT				= 0x08004,
853 	DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR			= 0x08005,
854 
855 	DAT_SOFTWARE_EVENT					= 0x10001
856 } DAT_EVENT_NUMBER;
857 
858 /* Union for event Data */
859 
860 typedef union dat_event_data {
861 	DAT_DTO_COMPLETION_EVENT_DATA		dto_completion_event_data;
862 	DAT_RMR_BIND_COMPLETION_EVENT_DATA	rmr_completion_event_data;
863 	DAT_CR_ARRIVAL_EVENT_DATA		cr_arrival_event_data;
864 	DAT_CONNECTION_EVENT_DATA		connect_event_data;
865 	DAT_ASYNCH_ERROR_EVENT_DATA		asynch_error_event_data;
866 	DAT_SOFTWARE_EVENT_DATA			software_event_data;
867 } DAT_EVENT_DATA;
868 
869 /* Event struct that holds all event information */
870 
871 typedef struct dat_event {
872 	DAT_EVENT_NUMBER	event_number;
873 	DAT_EVD_HANDLE		evd_handle;
874 	DAT_EVENT_DATA		event_data;
875 } DAT_EVENT;
876 
877 /* Provider/registration info */
878 
879 typedef struct dat_provider_info {
880 	char			ia_name[DAT_NAME_MAX_LENGTH];
881 	DAT_UINT32		dapl_version_major;
882 	DAT_UINT32		dapl_version_minor;
883 	DAT_BOOLEAN		is_thread_safe;
884 } DAT_PROVIDER_INFO;
885 
886 /*
887  * FUNCTION PROTOTYPES
888  */
889 /*
890  * IA functions
891  *
892  * Note that there are actual 'dat_ia_open' and 'dat_ia_close'
893  * functions, it is not just a re-directing #define. That is
894  * because the functions may have to ensure that the provider
895  * library is loaded before it can call it, and may choose to
896  * unload the library after the last close.
897  */
898 
899 extern DAT_RETURN dat_ia_openv(
900 	IN	const DAT_NAME_PTR,	/* provider		*/
901 	IN	DAT_COUNT,		/* asynch_evd_min_qlen  */
902 	INOUT	DAT_EVD_HANDLE *,	/* asynch_evd_handle    */
903 	OUT	DAT_IA_HANDLE *,	/* ia_handle		*/
904 	IN	DAT_UINT32,		/* dat major version number */
905 	IN	DAT_UINT32,		/* dat minor version number */
906 	IN	DAT_BOOLEAN);		/* dat thread safety */
907 
908 #define	dat_ia_open(name, qlen, async_evd, ia) \
909 	dat_ia_openv((name), (qlen), (async_evd), (ia), \
910 		DAT_VERSION_MAJOR, DAT_VERSION_MINOR, \
911 		DAT_THREADSAFE)
912 
913 extern DAT_RETURN dat_ia_query(
914 	IN	DAT_IA_HANDLE,		/* ia handle		*/
915 	OUT	DAT_EVD_HANDLE *,	/* async_evd_handle	*/
916 	IN	DAT_IA_ATTR_MASK,	/* ia_attr_mask		*/
917 	OUT	DAT_IA_ATTR *,		/* ia_attr		*/
918 	IN	DAT_PROVIDER_ATTR_MASK,	/* provider_attr_mask	*/
919 	OUT	DAT_PROVIDER_ATTR *);	/* provider_attr	*/
920 
921 extern DAT_RETURN dat_ia_close(
922 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
923 	IN	DAT_CLOSE_FLAGS);	/* close_flags		*/
924 
925 /* helper functions */
926 
927 extern DAT_RETURN dat_set_consumer_context(
928 	IN	DAT_HANDLE,		/* dat handle		*/
929 	IN	DAT_CONTEXT);		/* context		*/
930 
931 extern DAT_RETURN dat_get_consumer_context(
932 	IN	DAT_HANDLE,		/* dat handle		*/
933 	OUT	DAT_CONTEXT *);		/* context		*/
934 
935 extern DAT_RETURN dat_get_handle_type(
936 	IN	DAT_HANDLE,		/* dat_handle		*/
937 	OUT	DAT_HANDLE_TYPE *);	/* handle_type		*/
938 
939 /* CR Functions */
940 
941 extern DAT_RETURN dat_cr_query(
942 	IN	DAT_CR_HANDLE,		/* cr_handle		*/
943 	IN	DAT_CR_PARAM_MASK,	/* cr_param_mask	*/
944 	OUT	DAT_CR_PARAM *);	/* cr_param		*/
945 
946 extern DAT_RETURN dat_cr_accept(
947 	IN	DAT_CR_HANDLE,		/* cr_handle		*/
948 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
949 	IN	DAT_COUNT,		/* private_data_size	*/
950 	IN	const DAT_PVOID);	/* private_data		*/
951 
952 extern DAT_RETURN dat_cr_reject(
953 	IN	DAT_CR_HANDLE);
954 
955 /*
956  * For DAT-1.1 and above, this function is defined for both uDAPL and kDAPL.
957  * For DAT-1.0 it was only defined for uDAPL.
958  */
959 extern DAT_RETURN dat_cr_handoff(
960 	IN	DAT_CR_HANDLE,		/* cr_handle		*/
961 	IN	DAT_CONN_QUAL);		/* handoff		*/
962 
963 /* EVD Functions */
964 
965 extern DAT_RETURN dat_evd_resize(
966 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
967 	IN	DAT_COUNT);		/* evd_min_qlen		*/
968 
969 extern DAT_RETURN dat_evd_post_se(
970 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
971 	IN	const DAT_EVENT *);	/* event		*/
972 
973 extern DAT_RETURN dat_evd_dequeue(
974 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
975 	OUT	DAT_EVENT *);		/* event		*/
976 
977 extern DAT_RETURN dat_evd_query(
978 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
979 	IN	DAT_EVD_PARAM_MASK,	/* evd_param_mask	*/
980 	OUT	DAT_EVD_PARAM *);	/* evd_param		*/
981 
982 extern DAT_RETURN dat_evd_free(
983 	IN	DAT_EVD_HANDLE);	/* evd_handle		*/
984 
985 /* EP functions */
986 
987 extern DAT_RETURN dat_ep_create(
988 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
989 	IN	DAT_PZ_HANDLE,		/* pz_handle		*/
990 	IN	DAT_EVD_HANDLE,		/* recv_completion_evd_handle */
991 	IN	DAT_EVD_HANDLE,		/* request_completion_evd_handle */
992 	IN	DAT_EVD_HANDLE,		/* connect_evd_handle   */
993 	IN	const DAT_EP_ATTR *,	/* ep_attributes	*/
994 	OUT	DAT_EP_HANDLE *);	/* ep_handle		*/
995 
996 extern DAT_RETURN dat_ep_query(
997 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
998 	IN	DAT_EP_PARAM_MASK,	/* ep_param_mask	*/
999 	OUT	DAT_EP_PARAM *);	/* ep_param		*/
1000 
1001 extern DAT_RETURN dat_ep_modify(
1002 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1003 	IN	DAT_EP_PARAM_MASK,	/* ep_param_mask	*/
1004 	IN	const DAT_EP_PARAM *);	/* ep_param		*/
1005 
1006 extern DAT_RETURN dat_ep_connect(
1007 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1008 	IN	DAT_IA_ADDRESS_PTR,	/* remote_ia_address	*/
1009 	IN	DAT_CONN_QUAL,		/* remote_conn_qual	*/
1010 	IN	DAT_TIMEOUT,		/* timeout		*/
1011 	IN	DAT_COUNT,		/* private_data_size	*/
1012 	IN	const DAT_PVOID,	/* private_data		*/
1013 	IN	DAT_QOS,		/* quality_of_service	*/
1014 	IN	DAT_CONNECT_FLAGS);	/* connect_flags	*/
1015 
1016 extern DAT_RETURN dat_ep_dup_connect(
1017 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1018 	IN	DAT_EP_HANDLE,		/* ep_dup_handle	*/
1019 	IN	DAT_TIMEOUT,		/* timeout		*/
1020 	IN	DAT_COUNT,		/* private_data_size	*/
1021 	IN	const DAT_PVOID,	/* private_data		*/
1022 	IN	DAT_QOS);		/* quality_of_service	*/
1023 
1024 extern DAT_RETURN dat_ep_disconnect(
1025 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1026 	IN	DAT_CLOSE_FLAGS);	/* close_flags		*/
1027 
1028 extern DAT_RETURN dat_ep_post_send(
1029 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1030 	IN	DAT_COUNT,		/* num_segments		*/
1031 	IN	DAT_LMR_TRIPLET *,	/* local_iov		*/
1032 	IN	DAT_DTO_COOKIE,		/* user_cookie		*/
1033 	IN	DAT_COMPLETION_FLAGS);	/* completion_flags	*/
1034 
1035 extern DAT_RETURN dat_ep_post_recv(
1036 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1037 	IN	DAT_COUNT,		/* num_segments		*/
1038 	IN	DAT_LMR_TRIPLET *,	/* local_iov		*/
1039 	IN	DAT_DTO_COOKIE,		/* user_cookie		*/
1040 	IN	DAT_COMPLETION_FLAGS);	/* completion_flags	*/
1041 
1042 extern DAT_RETURN dat_ep_post_rdma_read(
1043 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1044 	IN	DAT_COUNT,		/* num_segments		*/
1045 	IN	DAT_LMR_TRIPLET *,	/* local_iov		*/
1046 	IN	DAT_DTO_COOKIE,		/* user_cookie		*/
1047 	IN	const DAT_RMR_TRIPLET *,	/* remote_iov		*/
1048 	IN	DAT_COMPLETION_FLAGS);	/* completion_flags	*/
1049 
1050 extern DAT_RETURN dat_ep_post_rdma_write(
1051 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1052 	IN	DAT_COUNT,		/* num_segments		*/
1053 	IN	DAT_LMR_TRIPLET *,	/* local_iov		*/
1054 	IN	DAT_DTO_COOKIE,		/* user_cookie		*/
1055 	IN	const DAT_RMR_TRIPLET *,	/* remote_iov		*/
1056 	IN	DAT_COMPLETION_FLAGS);	/* completion_flags	*/
1057 
1058 extern DAT_RETURN dat_ep_get_status(
1059 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1060 	OUT	DAT_EP_STATE *,		/* ep_state		*/
1061 	OUT	DAT_BOOLEAN *,		/* recv_idle		*/
1062 	OUT	DAT_BOOLEAN *);		/* request_idle		*/
1063 
1064 extern DAT_RETURN dat_ep_free(
1065 	IN	DAT_EP_HANDLE);		/* ep_handle		*/
1066 
1067 extern DAT_RETURN dat_ep_reset(
1068 	IN	DAT_EP_HANDLE);		/* ep_handle		*/
1069 
1070 /* LMR functions */
1071 
1072 extern DAT_RETURN dat_lmr_query(
1073 	IN	DAT_LMR_HANDLE,		/* lmr_handle		*/
1074 	IN	DAT_LMR_PARAM_MASK,	/* lmr_param_mask	*/
1075 	OUT	DAT_LMR_PARAM *);	/* lmr_param		*/
1076 
1077 extern DAT_RETURN dat_lmr_free(
1078 	IN	DAT_LMR_HANDLE);	/* lmr_handle		*/
1079 
1080 /* Non-coherent memory functions */
1081 
1082 extern DAT_RETURN dat_lmr_sync_rdma_read(
1083 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
1084 	IN 	const DAT_LMR_TRIPLET *, /* local_segments	*/
1085 	IN	DAT_VLEN);		/* num_segments		*/
1086 
1087 extern DAT_RETURN dat_lmr_sync_rdma_write(
1088 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
1089 	IN 	const DAT_LMR_TRIPLET *, /* local_segments	*/
1090 	IN	DAT_VLEN);		/* num_segments		*/
1091 
1092 /* RMR Functions */
1093 
1094 extern DAT_RETURN dat_rmr_create(
1095 	IN	DAT_PZ_HANDLE,		/* pz_handle		*/
1096 	OUT	DAT_RMR_HANDLE *);	/* rmr_handle		*/
1097 
1098 extern DAT_RETURN dat_rmr_query(
1099 	IN	DAT_RMR_HANDLE,		/* rmr_handle		*/
1100 	IN	DAT_RMR_PARAM_MASK,	/* rmr_param_mask	*/
1101 	OUT	DAT_RMR_PARAM *);	/* rmr_param		*/
1102 
1103 extern DAT_RETURN dat_rmr_bind(
1104 	IN	DAT_RMR_HANDLE,		/* rmr_handle		*/
1105 	IN	const DAT_LMR_TRIPLET *,	/* lmr_triplet		*/
1106 	IN	DAT_MEM_PRIV_FLAGS,	/* mem_priv		*/
1107 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1108 	IN	DAT_RMR_COOKIE,		/* user_cookie		*/
1109 	IN	DAT_COMPLETION_FLAGS,	/* completion_flags	*/
1110 	OUT	DAT_RMR_CONTEXT *);	/* context		*/
1111 
1112 extern DAT_RETURN dat_rmr_free(
1113 	IN	DAT_RMR_HANDLE);	/* rmr_handle		*/
1114 
1115 /* PSP Functions */
1116 
1117 extern DAT_RETURN dat_psp_create(
1118 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
1119 	IN	DAT_CONN_QUAL,		/* conn_qual		*/
1120 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
1121 	IN	DAT_PSP_FLAGS,		/* psp_flags		*/
1122 	OUT	DAT_PSP_HANDLE *);	/* psp_handle		*/
1123 
1124 extern DAT_RETURN dat_psp_create_any(
1125 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
1126 	OUT	DAT_CONN_QUAL *,	/* conn_qual		*/
1127 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
1128 	IN	DAT_PSP_FLAGS,		/* psp_flags		*/
1129 	OUT	DAT_PSP_HANDLE *);	/* psp_handle		*/
1130 
1131 extern DAT_RETURN dat_psp_query(
1132 	IN	DAT_PSP_HANDLE,		/* psp_handle		*/
1133 	IN	DAT_PSP_PARAM_MASK,	/* psp_param_mask	*/
1134 	OUT	DAT_PSP_PARAM *);	/* psp_param		*/
1135 
1136 extern DAT_RETURN dat_psp_free(
1137 	IN	DAT_PSP_HANDLE);	/* psp_handle		*/
1138 
1139 /* RSP Functions */
1140 
1141 extern DAT_RETURN dat_rsp_create(
1142 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
1143 	IN	DAT_CONN_QUAL,		/* conn_qual		*/
1144 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1145 	IN	DAT_EVD_HANDLE,		/* evd_handle		*/
1146 	OUT	DAT_RSP_HANDLE *);	/* rsp_handle		*/
1147 
1148 extern DAT_RETURN dat_rsp_query(
1149 	IN	DAT_RSP_HANDLE,		/* rsp_handle		*/
1150 	IN	DAT_RSP_PARAM_MASK,	/* rsp_param_mask	*/
1151 	OUT	DAT_RSP_PARAM *);	/* rsp_param		*/
1152 
1153 extern DAT_RETURN dat_rsp_free(
1154 	IN	DAT_RSP_HANDLE);	/* rsp_handle		*/
1155 
1156 /* PZ Functions */
1157 
1158 extern DAT_RETURN dat_pz_create(
1159 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
1160 	OUT	DAT_PZ_HANDLE *);	/* pz_handle		*/
1161 
1162 extern DAT_RETURN dat_pz_query(
1163 	IN	DAT_PZ_HANDLE,		/* pz_handle		*/
1164 	IN	DAT_PZ_PARAM_MASK,	/* pz_param_mask	*/
1165 	OUT	DAT_PZ_PARAM *);	/* pz_param		*/
1166 
1167 extern DAT_RETURN dat_pz_free(
1168 	IN	DAT_PZ_HANDLE);		/* pz_handle		*/
1169 
1170 /*
1171  * SRQ functions
1172  */
1173 extern DAT_RETURN dat_ep_create_with_srq(
1174 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
1175 	IN	DAT_PZ_HANDLE,		/* pz_handle		*/
1176 	IN	DAT_EVD_HANDLE,		/* recv_evd_handle	*/
1177 	IN	DAT_EVD_HANDLE,		/* request_evd_handle	*/
1178 	IN	DAT_EVD_HANDLE,		/* connect_evd_handle	*/
1179 	IN	DAT_SRQ_HANDLE,		/* srq_handle 		*/
1180 	IN	const DAT_EP_ATTR *,	/* ep_attributes	*/
1181 	OUT	DAT_EP_HANDLE *);	/* ep_handle		*/
1182 
1183 extern DAT_RETURN dat_ep_recv_query(
1184 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1185 	OUT	DAT_COUNT *,		/* nbufs_allocated	*/
1186 	OUT	DAT_COUNT *);		/* bufs_alloc_span	*/
1187 
1188 extern DAT_RETURN dat_ep_set_watermark(
1189 	IN	DAT_EP_HANDLE,		/* ep_handle		*/
1190 	IN	DAT_COUNT,		/* soft_high_watermark	*/
1191 	IN	DAT_COUNT);		/* hard_high_watermark	*/
1192 
1193 extern DAT_RETURN dat_srq_create(
1194 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
1195 	IN	DAT_PZ_HANDLE,		/* pz_handle		*/
1196 	IN	DAT_SRQ_ATTR *,		/* srq_attr		*/
1197 	OUT	DAT_SRQ_HANDLE *);	/* srq_handle		*/
1198 
1199 extern DAT_RETURN dat_srq_free(
1200 	IN	DAT_SRQ_HANDLE);	/* srq_handle		*/
1201 
1202 extern DAT_RETURN dat_srq_post_recv(
1203 	IN	DAT_SRQ_HANDLE,		/* srq_handle		*/
1204 	IN	DAT_COUNT,		/* num_segments		*/
1205 	IN	DAT_LMR_TRIPLET *,	/* local_iov		*/
1206 	IN	DAT_DTO_COOKIE);	/* user_cookie		*/
1207 
1208 extern DAT_RETURN dat_srq_query(
1209 	IN	DAT_SRQ_HANDLE,		/* srq_handle		*/
1210 	IN	DAT_SRQ_PARAM_MASK,	/* srq_param_mask	*/
1211 	OUT	DAT_SRQ_PARAM *);	/* srq_param		*/
1212 
1213 extern DAT_RETURN dat_srq_resize(
1214 	IN	DAT_SRQ_HANDLE,		/* srq_handle		*/
1215 	IN	DAT_COUNT);		/* srq_max_recv_dto	*/
1216 
1217 extern DAT_RETURN dat_srq_set_lw(
1218 	IN	DAT_SRQ_HANDLE,		/* srq_handle		*/
1219 	IN	DAT_COUNT);		/* low_watermark	*/
1220 
1221 /*
1222  * DAT registry functions.
1223  *
1224  * Note the dat_ia_open and dat_ia_close functions are linked to
1225  * registration code which "redirects" to the appropriate provider.
1226  */
1227 extern DAT_RETURN dat_registry_list_providers(
1228 	IN	DAT_COUNT,		/* max_to_return */
1229 	OUT	DAT_COUNT *,		/* entries_returned */
1230 	/* dat_provider_list */
1231 	OUT	DAT_PROVIDER_INFO *(dat_provider_list[]));
1232 /*
1233  * DAT error functions.
1234  */
1235 extern DAT_RETURN dat_strerror(
1236 	IN	DAT_RETURN,		/* dat function return */
1237 	OUT	const char **,		/* major message string */
1238 	OUT	const char **);		/* minor message string */
1239 
1240 
1241 #ifdef __cplusplus
1242 }
1243 #endif
1244 
1245 #endif /* _DAT_H_ */
1246