xref: /titanic_52/usr/src/lib/udapl/libdat/common/dat_api.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
24*7c478bd9Sstevel@tonic-gate  */
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate /*
27*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
29*7c478bd9Sstevel@tonic-gate  */
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate /*
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * MODULE: dat_api.c
36*7c478bd9Sstevel@tonic-gate  *
37*7c478bd9Sstevel@tonic-gate  * PURPOSE: DAT Provider and Consumer registry functions.
38*7c478bd9Sstevel@tonic-gate  *
39*7c478bd9Sstevel@tonic-gate  */
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #include "dat_osd.h"
42*7c478bd9Sstevel@tonic-gate #include <dat/dat_registry.h>
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_set_consumer_context(
46*7c478bd9Sstevel@tonic-gate 	IN	DAT_HANDLE		dat_handle,
47*7c478bd9Sstevel@tonic-gate 	IN	DAT_CONTEXT		context)
48*7c478bd9Sstevel@tonic-gate {
49*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(dat_handle)) {
50*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1));
51*7c478bd9Sstevel@tonic-gate 	}
52*7c478bd9Sstevel@tonic-gate 	return DAT_SET_CONSUMER_CONTEXT(dat_handle,
53*7c478bd9Sstevel@tonic-gate 				context);
54*7c478bd9Sstevel@tonic-gate }
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_get_consumer_context(
58*7c478bd9Sstevel@tonic-gate 	IN	DAT_HANDLE		dat_handle,
59*7c478bd9Sstevel@tonic-gate 	OUT	DAT_CONTEXT		*context)
60*7c478bd9Sstevel@tonic-gate {
61*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(dat_handle)) {
62*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1));
63*7c478bd9Sstevel@tonic-gate 	}
64*7c478bd9Sstevel@tonic-gate 	return DAT_GET_CONSUMER_CONTEXT(dat_handle,
65*7c478bd9Sstevel@tonic-gate 				context);
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate }
68*7c478bd9Sstevel@tonic-gate 
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_get_handle_type(
71*7c478bd9Sstevel@tonic-gate 	IN	DAT_HANDLE		dat_handle,
72*7c478bd9Sstevel@tonic-gate 	OUT	DAT_HANDLE_TYPE		*type)
73*7c478bd9Sstevel@tonic-gate {
74*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(dat_handle)) {
75*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1));
76*7c478bd9Sstevel@tonic-gate 	}
77*7c478bd9Sstevel@tonic-gate 	return DAT_GET_HANDLE_TYPE(dat_handle,
78*7c478bd9Sstevel@tonic-gate 				type);
79*7c478bd9Sstevel@tonic-gate }
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_cr_query(
83*7c478bd9Sstevel@tonic-gate 	IN	DAT_CR_HANDLE		cr_handle,
84*7c478bd9Sstevel@tonic-gate 	IN	DAT_CR_PARAM_MASK	cr_param_mask,
85*7c478bd9Sstevel@tonic-gate 	OUT	DAT_CR_PARAM		*cr_param)
86*7c478bd9Sstevel@tonic-gate {
87*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(cr_handle)) {
88*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR));
89*7c478bd9Sstevel@tonic-gate 	}
90*7c478bd9Sstevel@tonic-gate 	return DAT_CR_QUERY(cr_handle,
91*7c478bd9Sstevel@tonic-gate 			    cr_param_mask,
92*7c478bd9Sstevel@tonic-gate 			    cr_param);
93*7c478bd9Sstevel@tonic-gate }
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_cr_accept(
97*7c478bd9Sstevel@tonic-gate 	IN	DAT_CR_HANDLE		cr_handle,
98*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
99*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT		private_data_size,
100*7c478bd9Sstevel@tonic-gate 	IN	const DAT_PVOID		private_data)
101*7c478bd9Sstevel@tonic-gate {
102*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(cr_handle)) {
103*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR));
104*7c478bd9Sstevel@tonic-gate 	}
105*7c478bd9Sstevel@tonic-gate 	return DAT_CR_ACCEPT(cr_handle,
106*7c478bd9Sstevel@tonic-gate 			    ep_handle,
107*7c478bd9Sstevel@tonic-gate 			    private_data_size,
108*7c478bd9Sstevel@tonic-gate 			    private_data);
109*7c478bd9Sstevel@tonic-gate }
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_cr_reject(
113*7c478bd9Sstevel@tonic-gate 	IN	DAT_CR_HANDLE 		cr_handle)
114*7c478bd9Sstevel@tonic-gate {
115*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(cr_handle)) {
116*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR));
117*7c478bd9Sstevel@tonic-gate 	}
118*7c478bd9Sstevel@tonic-gate 	return (DAT_CR_REJECT(cr_handle));
119*7c478bd9Sstevel@tonic-gate }
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_evd_resize(
123*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE		evd_handle,
124*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT		evd_min_qlen)
125*7c478bd9Sstevel@tonic-gate {
126*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(evd_handle)) {
127*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1));
128*7c478bd9Sstevel@tonic-gate 	}
129*7c478bd9Sstevel@tonic-gate 	return DAT_EVD_RESIZE(evd_handle,
130*7c478bd9Sstevel@tonic-gate 			evd_min_qlen);
131*7c478bd9Sstevel@tonic-gate }
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_evd_post_se(
135*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE		evd_handle,
136*7c478bd9Sstevel@tonic-gate 	IN	const DAT_EVENT		*event)
137*7c478bd9Sstevel@tonic-gate {
138*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(evd_handle)) {
139*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1));
140*7c478bd9Sstevel@tonic-gate 	}
141*7c478bd9Sstevel@tonic-gate 	return DAT_EVD_POST_SE(evd_handle,
142*7c478bd9Sstevel@tonic-gate 			    event);
143*7c478bd9Sstevel@tonic-gate }
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_evd_dequeue(
147*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE		evd_handle,
148*7c478bd9Sstevel@tonic-gate 	OUT	DAT_EVENT		*event)
149*7c478bd9Sstevel@tonic-gate {
150*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(evd_handle)) {
151*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1));
152*7c478bd9Sstevel@tonic-gate 	}
153*7c478bd9Sstevel@tonic-gate 	return DAT_EVD_DEQUEUE(evd_handle,
154*7c478bd9Sstevel@tonic-gate 				event);
155*7c478bd9Sstevel@tonic-gate }
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_evd_free(
159*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE 		evd_handle)
160*7c478bd9Sstevel@tonic-gate {
161*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(evd_handle)) {
162*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1));
163*7c478bd9Sstevel@tonic-gate 	}
164*7c478bd9Sstevel@tonic-gate 	return (DAT_EVD_FREE(evd_handle));
165*7c478bd9Sstevel@tonic-gate }
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate 
168*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_create(
169*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_HANDLE		ia_handle,
170*7c478bd9Sstevel@tonic-gate 	IN	DAT_PZ_HANDLE		pz_handle,
171*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE		recv_completion_evd_handle,
172*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE		request_completion_evd_handle,
173*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE		connect_evd_handle,
174*7c478bd9Sstevel@tonic-gate 	IN	const DAT_EP_ATTR 	*ep_attributes,
175*7c478bd9Sstevel@tonic-gate 	OUT	DAT_EP_HANDLE		*ep_handle)
176*7c478bd9Sstevel@tonic-gate {
177*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ia_handle)) {
178*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA));
179*7c478bd9Sstevel@tonic-gate 	}
180*7c478bd9Sstevel@tonic-gate 	return DAT_EP_CREATE(ia_handle,
181*7c478bd9Sstevel@tonic-gate 			    pz_handle,
182*7c478bd9Sstevel@tonic-gate 			    recv_completion_evd_handle,
183*7c478bd9Sstevel@tonic-gate 			    request_completion_evd_handle,
184*7c478bd9Sstevel@tonic-gate 			    connect_evd_handle,
185*7c478bd9Sstevel@tonic-gate 			    ep_attributes,
186*7c478bd9Sstevel@tonic-gate 			    ep_handle);
187*7c478bd9Sstevel@tonic-gate }
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_query(
191*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
192*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_PARAM_MASK	ep_param_mask,
193*7c478bd9Sstevel@tonic-gate 	OUT	DAT_EP_PARAM		*ep_param)
194*7c478bd9Sstevel@tonic-gate {
195*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
196*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
197*7c478bd9Sstevel@tonic-gate 	}
198*7c478bd9Sstevel@tonic-gate 	return DAT_EP_QUERY(ep_handle,
199*7c478bd9Sstevel@tonic-gate 			    ep_param_mask,
200*7c478bd9Sstevel@tonic-gate 			    ep_param);
201*7c478bd9Sstevel@tonic-gate }
202*7c478bd9Sstevel@tonic-gate 
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_modify(
205*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
206*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_PARAM_MASK	ep_param_mask,
207*7c478bd9Sstevel@tonic-gate 	IN	const DAT_EP_PARAM 	*ep_param)
208*7c478bd9Sstevel@tonic-gate {
209*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
210*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
211*7c478bd9Sstevel@tonic-gate 	}
212*7c478bd9Sstevel@tonic-gate 	return DAT_EP_MODIFY(ep_handle,
213*7c478bd9Sstevel@tonic-gate 			    ep_param_mask,
214*7c478bd9Sstevel@tonic-gate 			    ep_param);
215*7c478bd9Sstevel@tonic-gate }
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_connect(
219*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
220*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_ADDRESS_PTR	remote_ia_address,
221*7c478bd9Sstevel@tonic-gate 	IN	DAT_CONN_QUAL		remote_conn_qual,
222*7c478bd9Sstevel@tonic-gate 	IN	DAT_TIMEOUT		timeout,
223*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT		private_data_size,
224*7c478bd9Sstevel@tonic-gate 	IN	const DAT_PVOID		private_data,
225*7c478bd9Sstevel@tonic-gate 	IN	DAT_QOS			quality_of_service,
226*7c478bd9Sstevel@tonic-gate 	IN	DAT_CONNECT_FLAGS	connect_flags)
227*7c478bd9Sstevel@tonic-gate {
228*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
229*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
230*7c478bd9Sstevel@tonic-gate 	}
231*7c478bd9Sstevel@tonic-gate 	return DAT_EP_CONNECT(ep_handle,
232*7c478bd9Sstevel@tonic-gate 			    remote_ia_address,
233*7c478bd9Sstevel@tonic-gate 			    remote_conn_qual,
234*7c478bd9Sstevel@tonic-gate 			    timeout,
235*7c478bd9Sstevel@tonic-gate 			    private_data_size,
236*7c478bd9Sstevel@tonic-gate 			    private_data,
237*7c478bd9Sstevel@tonic-gate 			    quality_of_service,
238*7c478bd9Sstevel@tonic-gate 			    connect_flags);
239*7c478bd9Sstevel@tonic-gate }
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate 
242*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_dup_connect(
243*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
244*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_dup_handle,
245*7c478bd9Sstevel@tonic-gate 	IN	DAT_TIMEOUT		timeout,
246*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT		private_data_size,
247*7c478bd9Sstevel@tonic-gate 	IN	const DAT_PVOID		private_data,
248*7c478bd9Sstevel@tonic-gate 	IN	DAT_QOS			quality_of_service)
249*7c478bd9Sstevel@tonic-gate {
250*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
251*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
252*7c478bd9Sstevel@tonic-gate 	}
253*7c478bd9Sstevel@tonic-gate 	return DAT_EP_DUP_CONNECT(ep_handle,
254*7c478bd9Sstevel@tonic-gate 			    ep_dup_handle,
255*7c478bd9Sstevel@tonic-gate 			    timeout,
256*7c478bd9Sstevel@tonic-gate 			    private_data_size,
257*7c478bd9Sstevel@tonic-gate 			    private_data,
258*7c478bd9Sstevel@tonic-gate 			    quality_of_service);
259*7c478bd9Sstevel@tonic-gate }
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_disconnect(
263*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
264*7c478bd9Sstevel@tonic-gate 	IN	DAT_CLOSE_FLAGS		close_flags)
265*7c478bd9Sstevel@tonic-gate {
266*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
267*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
268*7c478bd9Sstevel@tonic-gate 	}
269*7c478bd9Sstevel@tonic-gate 	return DAT_EP_DISCONNECT(ep_handle,
270*7c478bd9Sstevel@tonic-gate 				close_flags);
271*7c478bd9Sstevel@tonic-gate }
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_post_send(
275*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
276*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT		num_segments,
277*7c478bd9Sstevel@tonic-gate 	IN	DAT_LMR_TRIPLET		*local_iov,
278*7c478bd9Sstevel@tonic-gate 	IN	DAT_DTO_COOKIE		user_cookie,
279*7c478bd9Sstevel@tonic-gate 	IN	DAT_COMPLETION_FLAGS	completion_flags)
280*7c478bd9Sstevel@tonic-gate {
281*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
282*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
283*7c478bd9Sstevel@tonic-gate 	}
284*7c478bd9Sstevel@tonic-gate 	return DAT_EP_POST_SEND(ep_handle,
285*7c478bd9Sstevel@tonic-gate 			    num_segments,
286*7c478bd9Sstevel@tonic-gate 			    local_iov,
287*7c478bd9Sstevel@tonic-gate 			    user_cookie,
288*7c478bd9Sstevel@tonic-gate 			    completion_flags);
289*7c478bd9Sstevel@tonic-gate }
290*7c478bd9Sstevel@tonic-gate 
291*7c478bd9Sstevel@tonic-gate 
292*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_post_recv(
293*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
294*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT		num_segments,
295*7c478bd9Sstevel@tonic-gate 	IN	DAT_LMR_TRIPLET		*local_iov,
296*7c478bd9Sstevel@tonic-gate 	IN	DAT_DTO_COOKIE		user_cookie,
297*7c478bd9Sstevel@tonic-gate 	IN	DAT_COMPLETION_FLAGS	completion_flags)
298*7c478bd9Sstevel@tonic-gate {
299*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
300*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
301*7c478bd9Sstevel@tonic-gate 	}
302*7c478bd9Sstevel@tonic-gate 	return DAT_EP_POST_RECV(ep_handle,
303*7c478bd9Sstevel@tonic-gate 			    num_segments,
304*7c478bd9Sstevel@tonic-gate 			    local_iov,
305*7c478bd9Sstevel@tonic-gate 			    user_cookie,
306*7c478bd9Sstevel@tonic-gate 			    completion_flags);
307*7c478bd9Sstevel@tonic-gate }
308*7c478bd9Sstevel@tonic-gate 
309*7c478bd9Sstevel@tonic-gate 
310*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_post_rdma_read(
311*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
312*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT		num_segments,
313*7c478bd9Sstevel@tonic-gate 	IN	DAT_LMR_TRIPLET		*local_iov,
314*7c478bd9Sstevel@tonic-gate 	IN	DAT_DTO_COOKIE		user_cookie,
315*7c478bd9Sstevel@tonic-gate 	IN	const DAT_RMR_TRIPLET	*remote_iov,
316*7c478bd9Sstevel@tonic-gate 	IN	DAT_COMPLETION_FLAGS	completion_flags)
317*7c478bd9Sstevel@tonic-gate {
318*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
319*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
320*7c478bd9Sstevel@tonic-gate 	}
321*7c478bd9Sstevel@tonic-gate 	return DAT_EP_POST_RDMA_READ(ep_handle,
322*7c478bd9Sstevel@tonic-gate 				    num_segments,
323*7c478bd9Sstevel@tonic-gate 				    local_iov,
324*7c478bd9Sstevel@tonic-gate 				    user_cookie,
325*7c478bd9Sstevel@tonic-gate 				    remote_iov,
326*7c478bd9Sstevel@tonic-gate 				    completion_flags);
327*7c478bd9Sstevel@tonic-gate }
328*7c478bd9Sstevel@tonic-gate 
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_post_rdma_write(
331*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
332*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT		num_segments,
333*7c478bd9Sstevel@tonic-gate 	IN	DAT_LMR_TRIPLET		*local_iov,
334*7c478bd9Sstevel@tonic-gate 	IN	DAT_DTO_COOKIE		user_cookie,
335*7c478bd9Sstevel@tonic-gate 	IN	const DAT_RMR_TRIPLET	*remote_iov,
336*7c478bd9Sstevel@tonic-gate 	IN	DAT_COMPLETION_FLAGS	completion_flags)
337*7c478bd9Sstevel@tonic-gate {
338*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
339*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
340*7c478bd9Sstevel@tonic-gate 	}
341*7c478bd9Sstevel@tonic-gate 	return DAT_EP_POST_RDMA_WRITE(ep_handle,
342*7c478bd9Sstevel@tonic-gate 				    num_segments,
343*7c478bd9Sstevel@tonic-gate 				    local_iov,
344*7c478bd9Sstevel@tonic-gate 				    user_cookie,
345*7c478bd9Sstevel@tonic-gate 				    remote_iov,
346*7c478bd9Sstevel@tonic-gate 				    completion_flags);
347*7c478bd9Sstevel@tonic-gate }
348*7c478bd9Sstevel@tonic-gate 
349*7c478bd9Sstevel@tonic-gate 
350*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_get_status(
351*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
352*7c478bd9Sstevel@tonic-gate 	OUT	DAT_EP_STATE		*ep_state,
353*7c478bd9Sstevel@tonic-gate 	OUT	DAT_BOOLEAN 		*recv_idle,
354*7c478bd9Sstevel@tonic-gate 	OUT	DAT_BOOLEAN 		*request_idle)
355*7c478bd9Sstevel@tonic-gate {
356*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
357*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
358*7c478bd9Sstevel@tonic-gate 	}
359*7c478bd9Sstevel@tonic-gate 	return DAT_EP_GET_STATUS(ep_handle,
360*7c478bd9Sstevel@tonic-gate 				ep_state,
361*7c478bd9Sstevel@tonic-gate 				recv_idle,
362*7c478bd9Sstevel@tonic-gate 				request_idle);
363*7c478bd9Sstevel@tonic-gate }
364*7c478bd9Sstevel@tonic-gate 
365*7c478bd9Sstevel@tonic-gate 
366*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_free(
367*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle)
368*7c478bd9Sstevel@tonic-gate {
369*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
370*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
371*7c478bd9Sstevel@tonic-gate 	}
372*7c478bd9Sstevel@tonic-gate 	return (DAT_EP_FREE(ep_handle));
373*7c478bd9Sstevel@tonic-gate }
374*7c478bd9Sstevel@tonic-gate 
375*7c478bd9Sstevel@tonic-gate 
376*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_reset(
377*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle)
378*7c478bd9Sstevel@tonic-gate {
379*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
380*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
381*7c478bd9Sstevel@tonic-gate 	}
382*7c478bd9Sstevel@tonic-gate 	return (DAT_EP_RESET(ep_handle));
383*7c478bd9Sstevel@tonic-gate }
384*7c478bd9Sstevel@tonic-gate 
385*7c478bd9Sstevel@tonic-gate 
386*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_lmr_free(
387*7c478bd9Sstevel@tonic-gate 	IN	DAT_LMR_HANDLE		lmr_handle)
388*7c478bd9Sstevel@tonic-gate {
389*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(lmr_handle)) {
390*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR));
391*7c478bd9Sstevel@tonic-gate 	}
392*7c478bd9Sstevel@tonic-gate 	return (DAT_LMR_FREE(lmr_handle));
393*7c478bd9Sstevel@tonic-gate }
394*7c478bd9Sstevel@tonic-gate 
395*7c478bd9Sstevel@tonic-gate 
396*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_rmr_create(
397*7c478bd9Sstevel@tonic-gate 	IN	DAT_PZ_HANDLE		pz_handle,
398*7c478bd9Sstevel@tonic-gate 	OUT	DAT_RMR_HANDLE		*rmr_handle)
399*7c478bd9Sstevel@tonic-gate {
400*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(pz_handle)) {
401*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ));
402*7c478bd9Sstevel@tonic-gate 	}
403*7c478bd9Sstevel@tonic-gate 	return DAT_RMR_CREATE(pz_handle,
404*7c478bd9Sstevel@tonic-gate 			rmr_handle);
405*7c478bd9Sstevel@tonic-gate }
406*7c478bd9Sstevel@tonic-gate 
407*7c478bd9Sstevel@tonic-gate 
408*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_rmr_query(
409*7c478bd9Sstevel@tonic-gate 	IN	DAT_RMR_HANDLE		rmr_handle,
410*7c478bd9Sstevel@tonic-gate 	IN	DAT_RMR_PARAM_MASK	rmr_param_mask,
411*7c478bd9Sstevel@tonic-gate 	OUT	DAT_RMR_PARAM		*rmr_param)
412*7c478bd9Sstevel@tonic-gate {
413*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(rmr_handle)) {
414*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR));
415*7c478bd9Sstevel@tonic-gate 	}
416*7c478bd9Sstevel@tonic-gate 	return DAT_RMR_QUERY(rmr_handle,
417*7c478bd9Sstevel@tonic-gate 			    rmr_param_mask,
418*7c478bd9Sstevel@tonic-gate 			    rmr_param);
419*7c478bd9Sstevel@tonic-gate }
420*7c478bd9Sstevel@tonic-gate 
421*7c478bd9Sstevel@tonic-gate 
422*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_rmr_bind(
423*7c478bd9Sstevel@tonic-gate 	IN	DAT_RMR_HANDLE		rmr_handle,
424*7c478bd9Sstevel@tonic-gate 	IN	const DAT_LMR_TRIPLET	*lmr_triplet,
425*7c478bd9Sstevel@tonic-gate 	IN	DAT_MEM_PRIV_FLAGS	mem_priv,
426*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
427*7c478bd9Sstevel@tonic-gate 	IN	DAT_RMR_COOKIE		user_cookie,
428*7c478bd9Sstevel@tonic-gate 	IN	DAT_COMPLETION_FLAGS	completion_flags,
429*7c478bd9Sstevel@tonic-gate 	OUT	DAT_RMR_CONTEXT		*context)
430*7c478bd9Sstevel@tonic-gate {
431*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(rmr_handle)) {
432*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR));
433*7c478bd9Sstevel@tonic-gate 	}
434*7c478bd9Sstevel@tonic-gate 	return DAT_RMR_BIND(rmr_handle,
435*7c478bd9Sstevel@tonic-gate 			    lmr_triplet,
436*7c478bd9Sstevel@tonic-gate 			    mem_priv,
437*7c478bd9Sstevel@tonic-gate 			    ep_handle,
438*7c478bd9Sstevel@tonic-gate 			    user_cookie,
439*7c478bd9Sstevel@tonic-gate 			    completion_flags,
440*7c478bd9Sstevel@tonic-gate 			    context);
441*7c478bd9Sstevel@tonic-gate }
442*7c478bd9Sstevel@tonic-gate 
443*7c478bd9Sstevel@tonic-gate 
444*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_rmr_free(
445*7c478bd9Sstevel@tonic-gate 	IN	DAT_RMR_HANDLE		rmr_handle)
446*7c478bd9Sstevel@tonic-gate {
447*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(rmr_handle)) {
448*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR));
449*7c478bd9Sstevel@tonic-gate 	}
450*7c478bd9Sstevel@tonic-gate 	return (DAT_RMR_FREE(rmr_handle));
451*7c478bd9Sstevel@tonic-gate }
452*7c478bd9Sstevel@tonic-gate 
453*7c478bd9Sstevel@tonic-gate 
454*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_psp_create(
455*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_HANDLE		ia_handle,
456*7c478bd9Sstevel@tonic-gate 	IN	DAT_CONN_QUAL		conn_qual,
457*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE		evd_handle,
458*7c478bd9Sstevel@tonic-gate 	IN	DAT_PSP_FLAGS		psp_flags,
459*7c478bd9Sstevel@tonic-gate 	OUT	DAT_PSP_HANDLE		*psp_handle)
460*7c478bd9Sstevel@tonic-gate {
461*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ia_handle)) {
462*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA));
463*7c478bd9Sstevel@tonic-gate 	}
464*7c478bd9Sstevel@tonic-gate 	return DAT_PSP_CREATE(ia_handle,
465*7c478bd9Sstevel@tonic-gate 			    conn_qual,
466*7c478bd9Sstevel@tonic-gate 			    evd_handle,
467*7c478bd9Sstevel@tonic-gate 			    psp_flags,
468*7c478bd9Sstevel@tonic-gate 			    psp_handle);
469*7c478bd9Sstevel@tonic-gate }
470*7c478bd9Sstevel@tonic-gate 
471*7c478bd9Sstevel@tonic-gate 
472*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_psp_query(
473*7c478bd9Sstevel@tonic-gate 	IN	DAT_PSP_HANDLE		psp_handle,
474*7c478bd9Sstevel@tonic-gate 	IN	DAT_PSP_PARAM_MASK	psp_param_mask,
475*7c478bd9Sstevel@tonic-gate 	OUT	DAT_PSP_PARAM 		*psp_param)
476*7c478bd9Sstevel@tonic-gate {
477*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(psp_handle)) {
478*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP));
479*7c478bd9Sstevel@tonic-gate 	}
480*7c478bd9Sstevel@tonic-gate 	return DAT_PSP_QUERY(psp_handle,
481*7c478bd9Sstevel@tonic-gate 			    psp_param_mask,
482*7c478bd9Sstevel@tonic-gate 			    psp_param);
483*7c478bd9Sstevel@tonic-gate }
484*7c478bd9Sstevel@tonic-gate 
485*7c478bd9Sstevel@tonic-gate 
486*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_psp_free(
487*7c478bd9Sstevel@tonic-gate 	IN	DAT_PSP_HANDLE	psp_handle)
488*7c478bd9Sstevel@tonic-gate {
489*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(psp_handle)) {
490*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP));
491*7c478bd9Sstevel@tonic-gate 	}
492*7c478bd9Sstevel@tonic-gate 	return (DAT_PSP_FREE(psp_handle));
493*7c478bd9Sstevel@tonic-gate }
494*7c478bd9Sstevel@tonic-gate 
495*7c478bd9Sstevel@tonic-gate 
496*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_rsp_create(
497*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_HANDLE		ia_handle,
498*7c478bd9Sstevel@tonic-gate 	IN	DAT_CONN_QUAL		conn_qual,
499*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE		ep_handle,
500*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE		evd_handle,
501*7c478bd9Sstevel@tonic-gate 	OUT	DAT_RSP_HANDLE		*rsp_handle)
502*7c478bd9Sstevel@tonic-gate {
503*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ia_handle)) {
504*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA));
505*7c478bd9Sstevel@tonic-gate 	}
506*7c478bd9Sstevel@tonic-gate 	return DAT_RSP_CREATE(ia_handle,
507*7c478bd9Sstevel@tonic-gate 			    conn_qual,
508*7c478bd9Sstevel@tonic-gate 			    ep_handle,
509*7c478bd9Sstevel@tonic-gate 			    evd_handle,
510*7c478bd9Sstevel@tonic-gate 			    rsp_handle);
511*7c478bd9Sstevel@tonic-gate }
512*7c478bd9Sstevel@tonic-gate 
513*7c478bd9Sstevel@tonic-gate 
514*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_rsp_query(
515*7c478bd9Sstevel@tonic-gate 	IN	DAT_RSP_HANDLE		rsp_handle,
516*7c478bd9Sstevel@tonic-gate 	IN	DAT_RSP_PARAM_MASK	rsp_param_mask,
517*7c478bd9Sstevel@tonic-gate 	OUT	DAT_RSP_PARAM		*rsp_param)
518*7c478bd9Sstevel@tonic-gate {
519*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(rsp_handle)) {
520*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RSP));
521*7c478bd9Sstevel@tonic-gate 	}
522*7c478bd9Sstevel@tonic-gate 	return DAT_RSP_QUERY(rsp_handle,
523*7c478bd9Sstevel@tonic-gate 			    rsp_param_mask,
524*7c478bd9Sstevel@tonic-gate 			    rsp_param);
525*7c478bd9Sstevel@tonic-gate }
526*7c478bd9Sstevel@tonic-gate 
527*7c478bd9Sstevel@tonic-gate 
528*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_rsp_free(
529*7c478bd9Sstevel@tonic-gate 	IN	DAT_RSP_HANDLE		rsp_handle)
530*7c478bd9Sstevel@tonic-gate {
531*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(rsp_handle)) {
532*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RSP));
533*7c478bd9Sstevel@tonic-gate 	}
534*7c478bd9Sstevel@tonic-gate 	return (DAT_RSP_FREE(rsp_handle));
535*7c478bd9Sstevel@tonic-gate }
536*7c478bd9Sstevel@tonic-gate 
537*7c478bd9Sstevel@tonic-gate 
538*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_pz_create(
539*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_HANDLE		ia_handle,
540*7c478bd9Sstevel@tonic-gate 	OUT	DAT_PZ_HANDLE		*pz_handle)
541*7c478bd9Sstevel@tonic-gate {
542*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ia_handle)) {
543*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA));
544*7c478bd9Sstevel@tonic-gate 	}
545*7c478bd9Sstevel@tonic-gate 	return DAT_PZ_CREATE(ia_handle,
546*7c478bd9Sstevel@tonic-gate 			pz_handle);
547*7c478bd9Sstevel@tonic-gate }
548*7c478bd9Sstevel@tonic-gate 
549*7c478bd9Sstevel@tonic-gate 
550*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_pz_query(
551*7c478bd9Sstevel@tonic-gate 	IN	DAT_PZ_HANDLE		pz_handle,
552*7c478bd9Sstevel@tonic-gate 	IN	DAT_PZ_PARAM_MASK	pz_param_mask,
553*7c478bd9Sstevel@tonic-gate 	OUT	DAT_PZ_PARAM		*pz_param)
554*7c478bd9Sstevel@tonic-gate {
555*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(pz_handle)) {
556*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ));
557*7c478bd9Sstevel@tonic-gate 	}
558*7c478bd9Sstevel@tonic-gate 	return DAT_PZ_QUERY(pz_handle,
559*7c478bd9Sstevel@tonic-gate 			pz_param_mask,
560*7c478bd9Sstevel@tonic-gate 			pz_param);
561*7c478bd9Sstevel@tonic-gate }
562*7c478bd9Sstevel@tonic-gate 
563*7c478bd9Sstevel@tonic-gate 
564*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_pz_free(
565*7c478bd9Sstevel@tonic-gate 	IN	DAT_PZ_HANDLE		pz_handle)
566*7c478bd9Sstevel@tonic-gate {
567*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(pz_handle)) {
568*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ));
569*7c478bd9Sstevel@tonic-gate 	}
570*7c478bd9Sstevel@tonic-gate 	return (DAT_PZ_FREE(pz_handle));
571*7c478bd9Sstevel@tonic-gate }
572*7c478bd9Sstevel@tonic-gate 
573*7c478bd9Sstevel@tonic-gate /* ARGSUSED */
574*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_lmr_sync_rdma_read(
575*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_HANDLE	ia_handle,
576*7c478bd9Sstevel@tonic-gate 	IN	const DAT_LMR_TRIPLET *local_segments,
577*7c478bd9Sstevel@tonic-gate 	IN	DAT_VLEN num_segments)
578*7c478bd9Sstevel@tonic-gate {
579*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ia_handle)) {
580*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA));
581*7c478bd9Sstevel@tonic-gate 	}
582*7c478bd9Sstevel@tonic-gate 
583*7c478bd9Sstevel@tonic-gate #if defined(__x86)
584*7c478bd9Sstevel@tonic-gate 	return (DAT_SUCCESS);
585*7c478bd9Sstevel@tonic-gate #elif defined(__sparc)
586*7c478bd9Sstevel@tonic-gate 	return (DAT_LMR_SYNC_RDMA_READ(ia_handle, local_segments,
587*7c478bd9Sstevel@tonic-gate 		num_segments));
588*7c478bd9Sstevel@tonic-gate #else
589*7c478bd9Sstevel@tonic-gate #error "ISA not supported"
590*7c478bd9Sstevel@tonic-gate #endif
591*7c478bd9Sstevel@tonic-gate }
592*7c478bd9Sstevel@tonic-gate 
593*7c478bd9Sstevel@tonic-gate /* ARGSUSED */
594*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_lmr_sync_rdma_write(
595*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_HANDLE	ia_handle,
596*7c478bd9Sstevel@tonic-gate 	IN	const DAT_LMR_TRIPLET *local_segments,
597*7c478bd9Sstevel@tonic-gate 	IN	DAT_VLEN num_segments)
598*7c478bd9Sstevel@tonic-gate {
599*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ia_handle)) {
600*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA));
601*7c478bd9Sstevel@tonic-gate 	}
602*7c478bd9Sstevel@tonic-gate 
603*7c478bd9Sstevel@tonic-gate #if defined(__x86)
604*7c478bd9Sstevel@tonic-gate 	return (DAT_SUCCESS);
605*7c478bd9Sstevel@tonic-gate #elif defined(__sparc)
606*7c478bd9Sstevel@tonic-gate 	return (DAT_LMR_SYNC_RDMA_WRITE(ia_handle, local_segments,
607*7c478bd9Sstevel@tonic-gate 		num_segments));
608*7c478bd9Sstevel@tonic-gate #else
609*7c478bd9Sstevel@tonic-gate #error "ISA not supported"
610*7c478bd9Sstevel@tonic-gate #endif
611*7c478bd9Sstevel@tonic-gate }
612*7c478bd9Sstevel@tonic-gate 
613*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_create_with_srq(
614*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_HANDLE	ia_handle,
615*7c478bd9Sstevel@tonic-gate 	IN	DAT_PZ_HANDLE	pz_handle,
616*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE	recv_evd_handle,
617*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE	request_evd_handle,
618*7c478bd9Sstevel@tonic-gate 	IN	DAT_EVD_HANDLE	connect_evd_handle,
619*7c478bd9Sstevel@tonic-gate 	IN	DAT_SRQ_HANDLE	srq_handle,
620*7c478bd9Sstevel@tonic-gate 	IN	const DAT_EP_ATTR *ep_attributes,
621*7c478bd9Sstevel@tonic-gate 	OUT	DAT_EP_HANDLE	*ep_handle)
622*7c478bd9Sstevel@tonic-gate {
623*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ia_handle)) {
624*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA));
625*7c478bd9Sstevel@tonic-gate 	}
626*7c478bd9Sstevel@tonic-gate 	return DAT_EP_CREATE_WITH_SRQ(ia_handle,
627*7c478bd9Sstevel@tonic-gate 				pz_handle,
628*7c478bd9Sstevel@tonic-gate 				recv_evd_handle,
629*7c478bd9Sstevel@tonic-gate 				request_evd_handle,
630*7c478bd9Sstevel@tonic-gate 				connect_evd_handle,
631*7c478bd9Sstevel@tonic-gate 				srq_handle,
632*7c478bd9Sstevel@tonic-gate 				ep_attributes,
633*7c478bd9Sstevel@tonic-gate 				ep_handle);
634*7c478bd9Sstevel@tonic-gate }
635*7c478bd9Sstevel@tonic-gate 
636*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_recv_query(
637*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE	ep_handle,
638*7c478bd9Sstevel@tonic-gate 	OUT	DAT_COUNT	*nbufs_allocated,
639*7c478bd9Sstevel@tonic-gate 	OUT	DAT_COUNT	*bufs_alloc_span)
640*7c478bd9Sstevel@tonic-gate {
641*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
642*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
643*7c478bd9Sstevel@tonic-gate 	}
644*7c478bd9Sstevel@tonic-gate 	return DAT_EP_RECV_QUERY(ep_handle,
645*7c478bd9Sstevel@tonic-gate 				nbufs_allocated,
646*7c478bd9Sstevel@tonic-gate 				bufs_alloc_span);
647*7c478bd9Sstevel@tonic-gate }
648*7c478bd9Sstevel@tonic-gate 
649*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_ep_set_watermark(
650*7c478bd9Sstevel@tonic-gate 	IN	DAT_EP_HANDLE	ep_handle,
651*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT	soft_high_watermark,
652*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT	hard_high_watermark)
653*7c478bd9Sstevel@tonic-gate {
654*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ep_handle)) {
655*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP));
656*7c478bd9Sstevel@tonic-gate 	}
657*7c478bd9Sstevel@tonic-gate 	return DAT_EP_SET_WATERMARK(ep_handle,
658*7c478bd9Sstevel@tonic-gate 				soft_high_watermark,
659*7c478bd9Sstevel@tonic-gate 				hard_high_watermark);
660*7c478bd9Sstevel@tonic-gate }
661*7c478bd9Sstevel@tonic-gate 
662*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_srq_create(
663*7c478bd9Sstevel@tonic-gate 	IN	DAT_IA_HANDLE	ia_handle,
664*7c478bd9Sstevel@tonic-gate 	IN	DAT_PZ_HANDLE	pz_handle,
665*7c478bd9Sstevel@tonic-gate 	IN	DAT_SRQ_ATTR	*srq_attr,
666*7c478bd9Sstevel@tonic-gate 	OUT	DAT_SRQ_HANDLE	*srq_handle)
667*7c478bd9Sstevel@tonic-gate {
668*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(ia_handle)) {
669*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA));
670*7c478bd9Sstevel@tonic-gate 	}
671*7c478bd9Sstevel@tonic-gate 	return DAT_SRQ_CREATE(ia_handle,
672*7c478bd9Sstevel@tonic-gate 				pz_handle,
673*7c478bd9Sstevel@tonic-gate 				srq_attr,
674*7c478bd9Sstevel@tonic-gate 				srq_handle);
675*7c478bd9Sstevel@tonic-gate }
676*7c478bd9Sstevel@tonic-gate 
677*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_srq_free(
678*7c478bd9Sstevel@tonic-gate 	IN	DAT_SRQ_HANDLE	srq_handle)
679*7c478bd9Sstevel@tonic-gate {
680*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(srq_handle)) {
681*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ));
682*7c478bd9Sstevel@tonic-gate 	}
683*7c478bd9Sstevel@tonic-gate 	return (DAT_SRQ_FREE(srq_handle));
684*7c478bd9Sstevel@tonic-gate }
685*7c478bd9Sstevel@tonic-gate 
686*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_srq_post_recv(
687*7c478bd9Sstevel@tonic-gate 	IN	DAT_SRQ_HANDLE	srq_handle,
688*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT	num_segments,
689*7c478bd9Sstevel@tonic-gate 	IN	DAT_LMR_TRIPLET	*local_iov,
690*7c478bd9Sstevel@tonic-gate 	IN	DAT_DTO_COOKIE	user_cookie)
691*7c478bd9Sstevel@tonic-gate {
692*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(srq_handle)) {
693*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ));
694*7c478bd9Sstevel@tonic-gate 	}
695*7c478bd9Sstevel@tonic-gate 	return DAT_SRQ_POST_RECV(srq_handle,
696*7c478bd9Sstevel@tonic-gate 				num_segments,
697*7c478bd9Sstevel@tonic-gate 				local_iov,
698*7c478bd9Sstevel@tonic-gate 				user_cookie);
699*7c478bd9Sstevel@tonic-gate }
700*7c478bd9Sstevel@tonic-gate 
701*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_srq_query(
702*7c478bd9Sstevel@tonic-gate 	IN	DAT_SRQ_HANDLE		srq_handle,
703*7c478bd9Sstevel@tonic-gate 	IN	DAT_SRQ_PARAM_MASK	srq_param_mask,
704*7c478bd9Sstevel@tonic-gate 	OUT	DAT_SRQ_PARAM		*srq_param)
705*7c478bd9Sstevel@tonic-gate {
706*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(srq_handle)) {
707*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ));
708*7c478bd9Sstevel@tonic-gate 	}
709*7c478bd9Sstevel@tonic-gate 	return DAT_SRQ_QUERY(srq_handle,
710*7c478bd9Sstevel@tonic-gate 			srq_param_mask,
711*7c478bd9Sstevel@tonic-gate 			srq_param);
712*7c478bd9Sstevel@tonic-gate }
713*7c478bd9Sstevel@tonic-gate 
714*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_srq_resize(
715*7c478bd9Sstevel@tonic-gate 	IN	DAT_SRQ_HANDLE	srq_handle,
716*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT	srq_max_recv_dto)
717*7c478bd9Sstevel@tonic-gate {
718*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(srq_handle)) {
719*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ));
720*7c478bd9Sstevel@tonic-gate 	}
721*7c478bd9Sstevel@tonic-gate 	return DAT_SRQ_RESIZE(srq_handle,
722*7c478bd9Sstevel@tonic-gate 			srq_max_recv_dto);
723*7c478bd9Sstevel@tonic-gate }
724*7c478bd9Sstevel@tonic-gate 
725*7c478bd9Sstevel@tonic-gate DAT_RETURN dat_srq_set_lw(
726*7c478bd9Sstevel@tonic-gate 	IN	DAT_SRQ_HANDLE	srq_handle,
727*7c478bd9Sstevel@tonic-gate 	IN	DAT_COUNT	low_watermark)
728*7c478bd9Sstevel@tonic-gate {
729*7c478bd9Sstevel@tonic-gate 	if (DAT_BAD_HANDLE(srq_handle)) {
730*7c478bd9Sstevel@tonic-gate 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ));
731*7c478bd9Sstevel@tonic-gate 	}
732*7c478bd9Sstevel@tonic-gate 	return DAT_SRQ_SET_LW(srq_handle,
733*7c478bd9Sstevel@tonic-gate 			low_watermark);
734*7c478bd9Sstevel@tonic-gate }
735