xref: /titanic_52/usr/src/uts/common/sys/ib/ibtl/ibti.h (revision 1a7c1b724419d3cb5fa6eea75123c6b2060ba31b)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_IB_IBTL_IBTI_H
28 #define	_SYS_IB_IBTL_IBTI_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * ibti.h
34  *
35  * This file contains the IBTI prototypes and associated data structures.
36  * It is the only header file that should be included by IBTI clients.
37  */
38 #include <sys/ib/ibtl/ibti_common.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  * Allocate channel flags.
46  */
47 typedef enum ibt_chan_alloc_flags_e {
48 	IBT_ACHAN_NO_FLAGS		= 0,
49 	IBT_ACHAN_CLONE			= (1 << 0),
50 	IBT_ACHAN_USER_MAP		= (1 << 1),
51 	IBT_ACHAN_DEFER_ALLOC		= (1 << 2),
52 	IBT_ACHAN_USES_SRQ		= (1 << 3)
53 } ibt_chan_alloc_flags_t;
54 
55 
56 /*
57  * Allocate RC channel ibt_alloc_rc_channel() argument.
58  */
59 typedef struct ibt_rc_chan_alloc_args_s {
60 	ibt_attr_flags_t	rc_flags;	/* Signal type etc */
61 	ibt_cep_flags_t		rc_control;
62 	uint8_t			rc_hca_port_num;
63 	ibt_chan_sizes_t	rc_sizes;
64 	ibt_cq_hdl_t		rc_scq;	/* Send CQ */
65 	ibt_cq_hdl_t		rc_rcq;	/* Recv CQ */
66 	ibt_pd_hdl_t		rc_pd;	/* PD */
67 	ibt_channel_hdl_t	rc_clone_chan;	/* Optional Clone handle */
68 	ibt_srq_hdl_t		rc_srq;		/* Optional Shared Rcv Queue */
69 } ibt_rc_chan_alloc_args_t;
70 
71 /*
72  * RC channel query attributes structure.
73  */
74 typedef struct ibt_rc_chan_query_attr_s {
75 	ib_guid_t		rc_hca_guid;	/* Local HCA GUID */
76 	ibt_cq_hdl_t		rc_scq;		/* SendCQ handle */
77 	ibt_cq_hdl_t		rc_rcq;		/* RecvCQ handle */
78 	ibt_pd_hdl_t		rc_pd;		/* PD Handle. */
79 	ibt_cep_state_t		rc_state;	/* Channel state */
80 	ib_mtu_t		rc_path_mtu;
81 	uint8_t			rc_path_retry_cnt:3;
82 	ibt_rnr_retry_cnt_t	rc_path_rnr_retry_cnt;
83 	ibt_rnr_nak_time_t	rc_min_rnr_nak;	/* min RNR-NAK timer */
84 	ibt_cep_path_t		rc_prim_path;
85 	ibt_cep_path_t		rc_alt_path;
86 	ibt_chan_sizes_t	rc_chan_sizes;	/* Queue/SGL sizes */
87 	uint8_t			rc_rdma_ra_out;	/* max RDMA-Reads/Atomics out */
88 	uint8_t			rc_rdma_ra_in;	/* max RDMA-Reads/Atomics in */
89 	ibt_attr_flags_t	rc_flags;	/* SQ Signaling Type etc */
90 	ibt_cep_flags_t		rc_control;	/* Control Flags */
91 	ibt_cep_cmstate_t	rc_mig_state;
92 	ib_qpn_t		rc_qpn;		/* Local QPN */
93 	ib_qpn_t		rc_dst_qpn;	/* Destination QPN */
94 	ibt_srq_hdl_t		rc_srq;		/* Optional Shared Rcv Queue */
95 } ibt_rc_chan_query_attr_t;
96 
97 /*
98  * RC Channel Modify Attributes definition.
99  *
100  * It is only possible to modify a channel that has previously been
101  * opened. The channel must either be in operational state (IBT_STATE_RTS)
102  * or paused (IBT_STATE_SQD). If channel is in paused state, then a modify
103  * operation will unpause the channel.
104  *
105  * Attributes that can be modified on an operational channel are:
106  *
107  *	rc_sq_sz
108  *	rc_rq_sz
109  *	rc_alt_adds_vect/rc_alt_port_num
110  *	rc_control
111  *	rc_min_rnr_nak
112  *
113  * Attributes that can be modified on an paused channel are:
114  *
115  *	rc_control
116  *	rc_sq_sz
117  *	rc_rq_sz
118  *	rc_prim_adds_vect
119  *	rc_prim_port_num
120  *	rc_alt_adds_vect/rc_alt_port_num
121  *	rc_path_retry_cnt
122  *	rc_path_rnr_retry_cnt
123  *	rc_min_rnr_nak
124  *	rc_rdma_ra_out
125  *	rc_rdma_ra_in
126  *
127  * An Attempt to Modify these attributes for an un-paused channel will result
128  * in an error.
129  *
130  * See the ibt_modify_rc_channel() for details of the required corresponding
131  * modify flags.
132  * Not specified attributes should be set to "NULL" or "0".
133  */
134 typedef struct ibt_rc_chan_modify_attr_s {
135 	ibt_cep_flags_t		rc_control;	/* Channel Control Flags */
136 	uint_t			rc_sq_sz;	/* Set SQ Max outstanding WRs */
137 	uint_t			rc_rq_sz;	/* Set RQ Max outstanding WRs */
138 
139 	ibt_adds_vect_t		rc_prim_adds_vect; /* Primary Path Address */
140 	ibt_adds_vect_t		rc_alt_adds_vect; /* Alternate Path Address */
141 	uint8_t			rc_path_retry_cnt:3;
142 	ibt_rnr_retry_cnt_t	rc_path_rnr_retry_cnt;
143 	ibt_rnr_nak_time_t	rc_min_rnr_nak;	/* min RNR-NAK timer */
144 	uint8_t			rc_prim_port_num; /* Port of Primary Path */
145 	uint8_t			rc_alt_port_num; /* Port of Alternate Path */
146 	uint8_t			rc_rdma_ra_out;	/* Initiator Depth, Number of */
147 						/* RDMA RD's & Atomics */
148 						/* outstanding. */
149 	uint8_t			rc_rdma_ra_in; /* Responder resources for */
150 						/* handling incoming RDMA rds */
151 						/* and Atomics. */
152 } ibt_rc_chan_modify_attr_t;
153 
154 /*
155  * UD remote destination query attributes
156  */
157 typedef struct ibt_ud_dest_query_attr_s {
158 	ibt_hca_hdl_t		ud_hca_hdl;	/* Local HCA Handle */
159 	ib_qpn_t		ud_dst_qpn;	/* Destination QPN */
160 	ib_qkey_t		ud_qkey;	/* Q_Key */
161 	ibt_adds_vect_t 	ud_addr_vect;	/* Address Information */
162 	ibt_pd_hdl_t		ud_pd;
163 } ibt_ud_dest_query_attr_t;
164 
165 
166 /*
167  * Allocate UD channel ibt_alloc_ud_channel() arguments; see below at
168  * ibt_alloc_ud_channel() for a description of what's required and optional.
169  */
170 typedef struct ibt_ud_chan_alloc_args_s {
171 	ibt_attr_flags_t	ud_flags;	/* Sig type etc */
172 	uint8_t			ud_hca_port_num;
173 	uint16_t		ud_pkey_ix;	/* P_Key Index */
174 	ibt_chan_sizes_t	ud_sizes;
175 	ib_qkey_t		ud_qkey;	/* Q_Key */
176 	ibt_cq_hdl_t		ud_scq;		/* Send CQ */
177 	ibt_cq_hdl_t		ud_rcq;		/* Recv CQ */
178 	ibt_pd_hdl_t		ud_pd;		/* PD */
179 	ibt_channel_hdl_t	ud_clone_chan;	/* Optional clone handle */
180 	ibt_srq_hdl_t		ud_srq;		/* Optional Shared Rcv Queue */
181 } ibt_ud_chan_alloc_args_t;
182 
183 /*
184  * UD channel query attributes.
185  */
186 typedef struct ibt_ud_chan_query_attr_s {
187 	ib_qpn_t		ud_qpn;			/* QPN */
188 	ib_guid_t		ud_hca_guid;		/* Local HCA GUID */
189 	ibt_cq_hdl_t		ud_scq;			/* SendCQ handle. */
190 	ibt_cq_hdl_t		ud_rcq;			/* RecvCQ handle. */
191 	ibt_pd_hdl_t		ud_pd;			/* PD Handle. */
192 	uint8_t			ud_hca_port_num;	/* Local HCA port */
193 	ibt_cep_state_t		ud_state;		/* Channel state */
194 	uint16_t		ud_pkey_ix;		/* P_Key Index */
195 	ib_qkey_t		ud_qkey;		/* Q_Key */
196 	ibt_chan_sizes_t	ud_chan_sizes;		/* Queue/SGL sizes */
197 	ibt_attr_flags_t	ud_flags;		/* Signaling Type etc */
198 	ibt_srq_hdl_t		ud_srq;		/* Optional Shared Rcv Queue */
199 } ibt_ud_chan_query_attr_t;
200 
201 /*
202  * UD Channel Modify Attributes definition.
203  *
204  * It is only possible to modify a channel that is either in the operational
205  * state (IBT_STATE_RTS) or paused (IBT_STATE_SQD). If channel is in paused
206  * state, then a modify operation will unpause the channel.
207  *
208  * See the ibt_modify_ud_channel() for details of the required corresponding
209  * modify flags.
210  */
211 typedef struct ibt_ud_chan_modify_attr_s {
212 	uint_t			ud_sq_sz;	/* Set SQ Max outstanding WRs */
213 	uint_t			ud_rq_sz;	/* Set RQ Max outstanding WRs */
214 	ib_qkey_t		ud_qkey;	/* Set Q_Key */
215 } ibt_ud_chan_modify_attr_t;
216 
217 
218 /*
219  * FUNCTION PROTOTYPES
220  */
221 
222 /*
223  * CONNECTION ESTABLISHMENT/TEAR DOWN FUNCTIONS.
224  */
225 
226 /*
227  * ibt_alloc_rc_channel
228  * 	Allocates a RC communication channels that satisfy the specified
229  *	channel attributes.
230  *
231  *	hca_hdl		Specifies the channels HCA.
232  *
233  *	flags		Channel Allocate flags.
234  *
235  *			IBT_ACHAN_NO_FLAGS
236  *			IBT_ACHAN_CLONE		Allocate a channel based on the
237  *						attributes of a previously
238  *						allocated channel. Both channels
239  *						have the same local attributes.
240  *
241  *	args		A pointer to an ibt_rc_chan_alloc_args_t struct
242  *			that specifies required channel attributes. Not
243  *			specified attributes should be set to "NULL" or "0".
244  *
245  *	rc_chan_p	The returned RC Channel handle.
246  *
247  *	sizes		NULL or a pointer to ibt_chan_sizes_s struct where
248  *			new SendQ/RecvQ, and WR SGL sizes are returned.
249  *
250  *
251  * Required and optional attributes are:
252  *
253  * Required:
254  *	rc_flags		SQ Signaling Type etc
255  *	rc_control		Control Flags
256  *	rc_hca_port_num		Local HCA port
257  *	rc_scq			Send CQ
258  *	rc_rcq			Recv CQ
259  *	rc_pd			PD
260  *	rc_sizes		Queue and SGL sizes.
261  *
262  * Optional (0 or NULL if not specified):
263  *	rc_clone_chan		Clone channel handle
264  *
265  *
266  * If IBT_ACHAN_CLONE is selected then the Required/Optional attributes are:
267  *
268  * Required:
269  *	rc_clone_chan		Clone channel handle
270  * Optional:
271  *	NONE
272  */
273 ibt_status_t ibt_alloc_rc_channel(ibt_hca_hdl_t hca_hdl,
274     ibt_chan_alloc_flags_t flags, ibt_rc_chan_alloc_args_t *args,
275     ibt_channel_hdl_t *rc_chan_p, ibt_chan_sizes_t *sizes);
276 
277 /*
278  * ibt_flush_channel
279  *	Flush the specified channel. Outstanding work requests are flushed
280  *	so that the client can do the associated clean up. After that, the
281  *	client will usually deregister the previously registered memory,
282  *	then free the channel by calling ibt_free_channel().  RC channels
283  *	that have been successfully opened will fail this call, as they
284  *	need to instead be handled by ibt_close_rc_channel().
285  *
286  *	chan			The opaque channel handle.
287  */
288 ibt_status_t ibt_flush_channel(ibt_channel_hdl_t chan);
289 
290 /*
291  * ibt_free_channel
292  *	Releases the resources associated with the specified channel
293  *
294  *	chan		The opaque channel handle returned in a previous
295  *			call to ibt_alloc_{rc,ud}_channel().
296  */
297 ibt_status_t ibt_free_channel(ibt_channel_hdl_t chan);
298 
299 /*
300  * ibt_query_rc_channel
301  *	Query an RC channel's attributes. Should only be called on an
302  *	opened RC channel. If called on a channel before it is opened,
303  *	some channel attributes may change when the channel is opened.
304  *
305  *	rc_chan		A previously allocated channel handle.
306  *
307  *	chan_attrs	A pointer to ibt_rc_chan_query_attr_t struct, where
308  *			RC channel's current attributes are returned.
309  */
310 ibt_status_t ibt_query_rc_channel(ibt_channel_hdl_t rc_chan,
311     ibt_rc_chan_query_attr_t *chan_attrs);
312 
313 /*
314  * ibt_modify_rc_channel()
315  * 	Modifies a previous opened operational or paused RC channel's
316  *	attributes.
317  *
318  *	rc_chan		A previously allocated RC channel handle.
319  *
320  *	flags		Specifies which attributes in ibt_rc_chan_modify_attr_t
321  *			are to be modified.
322  *
323  *	attrs		Attributes to be modified.
324  *
325  *	actual_sz	NULL or a pointer to ibt_queue_size_s struct to
326  *			return new queue sizes.
327  *			sq_sz		Returned new SendQ size.
328  *			rq_sz		Returned new RecvQ size.
329  *
330  * NOTE:
331  *	It is only possible to modify a channel that has previously been opened.
332  *	The channel must either be in operational state (IBT_STATE_RTS) or
333  *	paused (IBT_STATE_SQD). If channel is in paused state, then a modify
334  *	operation will will unpause the channel.
335  *
336  *
337  * Paused Channel:
338  * --------------
339  *	If the channel is in a paused state (IBT_STATE_SQD) then the
340  *	ibt_rc_chan_modify_attr_t attributes that can be modified and the
341  *	corresponding ibt_cep_modify_flags_t flags are:
342  *
343  *	Attribute		flag				Comment
344  *	---------		----				-------
345  *	rc_alt_adds_vect	IBT_CEP_SET_ALT_PATH	Modify alternate Path
346  *							address vector and
347  *							HCA port number.
348  *
349  *	rc_prim_adds_vect	IBT_CEP_SET_ADDS_VECT	Modify Primary Path
350  *							Address Vector.
351  *	rc_prim_adds_vect	IBT_CEP_SET_PORT	Modify Primary Port.
352  *							(The cep_adds_vect
353  *							av_port_num of
354  *							ibt_cep_path_t).
355  *	rc_sq_sz		IBT_CEP_SET_SQ_SIZE
356  *	rc_rq_sz		IBT_CEP_SET_RQ_SIZE
357  *	rc_path_retry_cnt	IBT_CEP_SET_RETRY
358  *	rc_path_rnr_retry_cnt	IBT_CEP_SET_RNR_NAK_RETRY
359  *	rc_rdma_ra_out		IBT_CEP_SET_RDMARA_OUT
360  *	rc_rdma_ra_in		IBT_CEP_SET_RDMARA_IN
361  *
362  * Operational Channel:
363  * -------------------
364  *	If the channel is in a operational state (IBT_STATE_RTS) then the
365  *	ibt_rc_chan_modify_attr_t attributes that can be modified and the
366  *	corresponding ibt_cep_modify_flags_t flags are:
367  *
368  *	Attribute		flag				Comment
369  *	---------		----				-------
370  *	rc_alt_adds_vect	IBT_CEP_SET_ALT_PATH	Modify alternate Path
371  *							address vector and
372  *							HCA port number.
373  *	rc_sq_sz		IBT_CEP_SET_SQ_SIZE
374  *	rc_rq_sz		IBT_CEP_SET_RQ_SIZE
375  *
376  *	rc_control		IBT_CEP_SET_RDMA_R	Modify RDMA reads as
377  *							indicated by the
378  *							rc_control flags.
379  *							IBT_CEP_RDMA_RD = 0
380  *							Disable RDMA reads.
381  *							IBT_CEP_RDMA_RD = 1
382  *							Enable RDMA reads.
383  *	rc_control		IBT_CEP_SET_RDMA_W	Modify RDMA writes as
384  *							indicated by the
385  *							rc_control flags.
386  *							IBT_CEP_RDMA_WR = 0
387  *							Disable RDMA writes.
388  *							IBT_CEP_RDMA_WR = 1
389  *							Enable RDMA writes.
390  */
391 ibt_status_t ibt_modify_rc_channel(ibt_channel_hdl_t rc_chan,
392     ibt_cep_modify_flags_t flags, ibt_rc_chan_modify_attr_t *attrs,
393     ibt_queue_sizes_t *actual_sz);
394 
395 /*
396  * ibt_alloc_ud_channel
397  *	Allocate UD channels that satisfy the specified channel attributes.
398  *
399  *	hca_hdl		The handle of a HCA on which to allocate the channel.
400  *
401  *	flags		Channel Allocate flags.
402  *
403  *			IBT_ACHAN_NO_FLAGS
404  *			IBT_ACHAN_CLONE		Allocate a channel based on the
405  *						attributes of a previously
406  *						allocated channel. Both channels
407  *						have the same local attributes.
408  *
409  *	args		A pointer to an ibt_ud_chan_alloc_args_t struct that
410  *			specifies required channel attributes. Optional
411  *			attributes that are not specified should be set to
412  *			"NULL" or "0".
413  *
414  *	ud_chan_p	The returned UD Channel handle.
415  *
416  *	sizes		NULL or a pointer to ibt_chan_sizes_s struct where
417  *			new SendQ/RecvQ, and WR SGL sizes are returned.
418  *
419  * Required:
420  *	ud_flags		SQ Signaling Type etc
421  *	ud_hca_port_num		Local HCA port
422  *	ud_scq			Send CQ
423  *	ud_rcq			Recv CQ
424  *	ud_pd			PD
425  *	ud_qkey			Queue Key
426  *	ud_sizes		Queue and SGL sizes.
427  *
428  * Optional (0 or NULL if not specified):
429  *	ud_clone_chan		Clone channel handle
430  *
431  * If IBT_ACHAN_CLONE is selected then the Required/Optional attributes are:
432  *
433  * Required:
434  *	ud_clone_chan		Clone channel handle
435  *
436  * Optional:
437  *	NONE
438  */
439 ibt_status_t ibt_alloc_ud_channel(ibt_hca_hdl_t hca_hdl,
440     ibt_chan_alloc_flags_t flags, ibt_ud_chan_alloc_args_t *args,
441     ibt_channel_hdl_t *ud_chan_p, ibt_chan_sizes_t *sizes);
442 
443 /*
444  * ibt_query_ud_channel
445  *	Query a UD channel's attributes.
446  *
447  *	ud_chan		A previously allocated channel handle.
448  *
449  *	chan_attrs	Channel's current attributes.
450  */
451 ibt_status_t ibt_query_ud_channel(ibt_channel_hdl_t ud_chan,
452     ibt_ud_chan_query_attr_t *ud_chan_attrs);
453 
454 /*
455  * ibt_modify_ud_channel()
456  * 	Modifies an UD channel's attributes, as specified by a
457  *	ibt_cep_modify_flags_t parameter to those specified in the
458  *	ibt_ud_chan_modify_attr_t structure.
459  *
460  *	ud_chan		A previously allocated UD channel handle.
461  *
462  *	flags		Specifies which attributes in ibt_ud_chan_modify_attr_t
463  *			are to be modified.
464  *
465  *	attrs		Attributes to be modified.
466  *
467  *	actual_sz	NULL or a pointer to ibt_queue_size_s struct to
468  *			return new queue sizes.
469  *			sq_sz		Returned new SendQ size.
470  *			rq_sz		Returned new RecvQ size.
471  *
472  * NOTE:
473  *	It is only possible to modify a channel that is either in the
474  *	operational state (IBT_STATE_RTS) or paused (IBT_STATE_SQD). If
475  *	channel is in paused state, then a modify operation will unpause the
476  *	channel.
477  *
478  *	For UD channel the applicable ibt_ud_chan_modify_attr_t attributes
479  *	that can be modified and the corresponding ibt_cep_modify_flags_t
480  *	flags are:
481  *
482  *	Attribute		flag
483  *	---------		----
484  *	ud_sq_sz	IBT_CEP_SET_SQ_SIZE
485  *	ud_rq_sz	IBT_CEP_SET_RQ_SIZE
486  *	ud_qkey		IBT_CEP_SET_QKEY
487  */
488 ibt_status_t ibt_modify_ud_channel(ibt_channel_hdl_t ud_chan,
489     ibt_cep_modify_flags_t flags, ibt_ud_chan_modify_attr_t *attrs,
490     ibt_queue_sizes_t *actual_sz);
491 
492 /*
493  * ibt_recover_ud_channel()
494  *	Recover an UD Channel which has transitioned to SQ Error state. The
495  *	ibt_recover_ud_channel() transitions the channel from SQ Error state
496  *	to Ready-To-Send channel state.
497  *
498  *	If a work request posted to a UD channel's send queue completes with
499  *	an error (see ibt_wc_status_t), the channel gets transitioned to SQ
500  *	Error state. In order to reuse this channel, ibt_recover_ud_channel()
501  *	can be used to recover the channel to a usable (Ready-to-Send) state.
502  *
503  *	ud_chan		An UD channel handle which is in SQError state.
504  */
505 ibt_status_t ibt_recover_ud_channel(ibt_channel_hdl_t ud_chan);
506 
507 
508 /*
509  * ibt_alloc_ud_dest
510  *	Allocate a UD destination handle.  This allocates local resources
511  *	that will need subsequent modification/initialization before use
512  *	(in send work requests).  Functions that can be used to do this are
513  *	ibt_modify_ud_dest (data supplied by caller), ibt_modify_reply_ud_dest
514  *	(data supplied from a successfully completed receive work request),
515  *	and ibt_request_ud_dest (data retrieved using SIDR protocol).
516  *
517  *	hca_hdl		HCA Handle.
518  *
519  *	pd		PD Handle.
520  *
521  *	ud_dest_p	The returned UD destination handle.
522  *
523  */
524 ibt_status_t ibt_alloc_ud_dest(ibt_hca_hdl_t hca_hdl,
525     ibt_ud_dest_flags_t flags, ibt_pd_hdl_t pd, ibt_ud_dest_hdl_t *ud_dest_p);
526 
527 /*
528  * ibt_modify_ud_dest
529  *	Modify a previously allocated UD destination handle from the
530  *	argument data.  After the ud_dest has already been made usable,
531  *	the adds_vect argument to this function is optional (NULL).
532  *
533  *	ud_dest		A previously allocated UD destination handle.
534  *
535  *	qkey		Q_Key of the destination.
536  *
537  *	dest_qpn	QPN of the destination. Should be IB_MC_QPN if this is
538  *			a multicast destination handle.
539  *
540  *	adds_vect	NULL or a pointer to an address vector of th
541  *			destination.
542  */
543 ibt_status_t ibt_modify_ud_dest(ibt_ud_dest_hdl_t ud_dest, ib_qkey_t qkey,
544     ib_qpn_t dest_qpn, ibt_adds_vect_t *adds_vect);
545 
546 /*
547  * ibt_modify_reply_ud_dest
548  *	Modify a previously allocated UD destination handle, so that it
549  *	can be used to reply to the sender of the datagram contained in the
550  *	specified work request completion.
551  *
552  *	ud_chan		Channel to be used with ud_dest.
553  *
554  *	ud_dest		A previously allocated UD destination handle
555  *			as returned by ibt_alloc_ud_dest().
556  *
557  *	qkey		An Optional Q_Key, 0 if not specified. If this is
558  *			specified then the Q_Key of the existing ud_dest is
559  *			set to this, otherwise it is set to the Q_Key in the
560  *			ud_chan context.
561  *
562  *	wc		The receive work completion.
563  *
564  *	recv_buf	Pointer to the first data buffer associated
565  *			with the receive work request.
566  */
567 ibt_status_t ibt_modify_reply_ud_dest(ibt_channel_hdl_t ud_chan,
568     ibt_ud_dest_hdl_t ud_dest, ib_qkey_t qkey, ibt_wc_t *wc,
569     ib_vaddr_t recv_buf);
570 
571 /*
572  * ibt_request_ud_dest
573  *	Modify a previously allocated UD destination handle based on the
574  *	data retrieved by making an SIDR request.
575  *
576  *	ud_dest		A previously allocated UD destination handle.
577  *
578  *	mode		IBT_BLOCKING		Do not return until completed.
579  *						ud_ret_args must be supplied.
580  *			IBT_NONBLOCKING		Return as soon as possible.
581  *						This requires that the client
582  *						supplies a ud_cm_handler to
583  *						be called when this completes.
584  *						ud_ret_args must be NULL.
585  *
586  *	dest_attrs	Attributes for UD destination, including a pointer to an
587  *			ibt_adds_vect_t returned from a call to ibt_get_paths().
588  *
589  *	ud_ret_args	If the function is called in blocking mode, ud_ret_args
590  *			should be a pointer to an ibt_ud_returns_t struct.
591  *			ibt_ud_returns_t contains:
592  *
593  *			ud_status	  Indicates if the UD destination handle
594  *					  was allocated successfully. If the
595  *					  handle was not allocated the status
596  *					  code gives an indication why not.
597  *			ud_redirect	  A ibt_redirect_info_s struct, valid
598  *					  for a ud_status of
599  *					  IBT_CM_SREP_REDIRECT. The remote
600  *					  destination could not provide the
601  *					  service requested in dest_attrs. The
602  *					  request was redirected to a new
603  *					  destination, the details of which are
604  *					  returned in ud_redirect. ud_dest
605  *					  contains a valid destination handle
606  *					  for the new destination.
607  *			ud_priv_data_len  The length (in bytes) of the buffer
608  *					  pointed to by ud_priv_data.
609  *			ud_priv_data	  A pointer to a a buffer where private
610  *					  data from the destination node is
611  *					  returned.
612  *
613  *	In non blocking mode the function returns immediately. If either
614  *	ud_sid, ud_sname or ud_dgid are modified then 	an IBT client UD
615  *	handler function is called with a status code that indicates if the
616  *	UD destination was modified successfully. If the destination was not
617  *	modified the status code gives an indication why.
618  *
619  *	For blocking mode the function does not return until the UD destination
620  *	is modified successfully or the attempt to modify the destination
621  *	handle is terminated by the IBTF. If an IBT client has specified a
622  *	channel handler function, it will not be called when
623  *	ibt_request_ud_dest() is called in blocking mode.
624  */
625 ibt_status_t ibt_request_ud_dest(ibt_ud_dest_hdl_t ud_dest,
626     ibt_execution_mode_t mode, ibt_ud_dest_attr_t *dest_attrs,
627     ibt_ud_returns_t *ud_ret_args);
628 
629 /*
630  * ibt_free_ud_dest
631  *	Releases the resources associated with the specified UD destination
632  *	handle.
633  *
634  *	ud_dest		The opaque channel handle returned in a previous
635  *			call to ibt_alloc_ud_dest().
636  */
637 ibt_status_t ibt_free_ud_dest(ibt_ud_dest_hdl_t ud_dest);
638 
639 /*
640  * ibt_query_ud_dest
641  *	Query a UD destination's attributes.
642  *
643  *	ud_dest		A previously allocated destination handle.
644  *
645  *	dest_attrs	destination's current attributes.
646  */
647 ibt_status_t ibt_query_ud_dest(ibt_ud_dest_hdl_t ud_dest,
648     ibt_ud_dest_query_attr_t *dest_attrs);
649 
650 
651 /*
652  * ibt_is_privileged_ud_dest
653  *	Determine if a UD destination Handle is a privileged handle.
654  *
655  *	ud_dest		A previously allocated destination handle.
656  */
657 boolean_t ibt_is_privileged_ud_dest(ibt_ud_dest_hdl_t ud_dest);
658 
659 
660 /*
661  * ibt_update_channel_qkey
662  *
663  * 	ud_chan		The UD channel handle, that is to be used to
664  *			communicate with the specified destination.
665  *
666  *	ud_dest		A UD destination handle returned from
667  *			ibt_alloc_ud_dest().
668  *
669  * ibt_update_channel_qkey() set's the Qkey in the specified channel context
670  * to the Qkey in the specified destination handle. This function can be used
671  * to enable sends to a privileged destination. All posted Send Work Requests
672  * that contain a privileged destination handle now use the Qkey in the
673  * channel context.
674  *
675  * ibt_update_channel_qkey() can also be used to enable the caller to receive
676  * from the specified remote destination on the specified channel.
677  *
678  */
679 ibt_status_t ibt_update_channel_qkey(ibt_channel_hdl_t ud_chan,
680     ibt_ud_dest_hdl_t ud_dest);
681 
682 
683 /*
684  * ibt_set_chan_private()
685  * ibt_get_chan_private()
686  * 	Set/get a pointer to client private data.
687  *	Applicable for both RC and UD channels.
688  *
689  *	chan		A previously allocated channel handle.
690  *
691  *	clnt_private	A pointer to the client private data.
692  */
693 void ibt_set_chan_private(ibt_channel_hdl_t chan, void *clnt_private);
694 
695 void *ibt_get_chan_private(ibt_channel_hdl_t chan);
696 
697 /*
698  * ibt_channel_to_hca_guid()
699  *
700  *	A helper function to retrieve HCA GUID for the specified Channel.
701  *
702  *	chan		Channel Handle
703  *
704  *	hca_guid	Returned HCA GUID on which the specified Channel is
705  *			allocated. Valid if it is non-NULL on return.
706  */
707 ib_guid_t ibt_channel_to_hca_guid(ibt_channel_hdl_t chan);
708 
709 #ifdef __cplusplus
710 }
711 #endif
712 
713 #endif /* _SYS_IB_IBTL_IBTI_H */
714