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