xref: /onnv-gate/usr/src/uts/common/sys/ib/clients/daplt/daplt_if.h (revision 9517:b4839b0aa7a4)
1*9517SBill.Taylor@Sun.COM /*
2*9517SBill.Taylor@Sun.COM  * CDDL HEADER START
3*9517SBill.Taylor@Sun.COM  *
4*9517SBill.Taylor@Sun.COM  * The contents of this file are subject to the terms of the
5*9517SBill.Taylor@Sun.COM  * Common Development and Distribution License (the "License").
6*9517SBill.Taylor@Sun.COM  * You may not use this file except in compliance with the License.
7*9517SBill.Taylor@Sun.COM  *
8*9517SBill.Taylor@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9517SBill.Taylor@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*9517SBill.Taylor@Sun.COM  * See the License for the specific language governing permissions
11*9517SBill.Taylor@Sun.COM  * and limitations under the License.
12*9517SBill.Taylor@Sun.COM  *
13*9517SBill.Taylor@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*9517SBill.Taylor@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9517SBill.Taylor@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*9517SBill.Taylor@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*9517SBill.Taylor@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9517SBill.Taylor@Sun.COM  *
19*9517SBill.Taylor@Sun.COM  * CDDL HEADER END
20*9517SBill.Taylor@Sun.COM  */
21*9517SBill.Taylor@Sun.COM 
22*9517SBill.Taylor@Sun.COM /*
23*9517SBill.Taylor@Sun.COM  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*9517SBill.Taylor@Sun.COM  * Use is subject to license terms.
25*9517SBill.Taylor@Sun.COM  */
26*9517SBill.Taylor@Sun.COM 
27*9517SBill.Taylor@Sun.COM #ifndef	_DAPL_IF_H_
28*9517SBill.Taylor@Sun.COM #define	_DAPL_IF_H_
29*9517SBill.Taylor@Sun.COM 
30*9517SBill.Taylor@Sun.COM #ifdef __cplusplus
31*9517SBill.Taylor@Sun.COM extern "C" {
32*9517SBill.Taylor@Sun.COM #endif
33*9517SBill.Taylor@Sun.COM 
34*9517SBill.Taylor@Sun.COM /* change this "version" everytime the interface changes */
35*9517SBill.Taylor@Sun.COM #define	DAPL_IF_VERSION			(0x05302007)
36*9517SBill.Taylor@Sun.COM 
37*9517SBill.Taylor@Sun.COM #define	DAPL_IOC			(0x0da9 << 16)
38*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_IA			(DAPL_IOC | 0x11 << 8)
39*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_EVD			(DAPL_IOC | 0x12 << 8)
40*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_EP			(DAPL_IOC | 0x13 << 8)
41*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_MR			(DAPL_IOC | 0x14 << 8)
42*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_PD			(DAPL_IOC | 0x15 << 8)
43*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_SP			(DAPL_IOC | 0x16 << 8)
44*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_CNO			(DAPL_IOC | 0x17 << 8)
45*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_MW			(DAPL_IOC | 0x18 << 8)
46*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_MISC			(DAPL_IOC | 0x19 << 8)
47*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_SRQ			(DAPL_IOC | 0x1a << 8)
48*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_NONE			(DAPL_IOC | 0x1f << 8)
49*9517SBill.Taylor@Sun.COM #define	DAPL_TYPE_MASK			(0xffffff00)
50*9517SBill.Taylor@Sun.COM 
51*9517SBill.Taylor@Sun.COM /* NONE */
52*9517SBill.Taylor@Sun.COM #define	DAPL_IA_CREATE			(DAPL_TYPE_NONE | 0x01)
53*9517SBill.Taylor@Sun.COM 
54*9517SBill.Taylor@Sun.COM /* MISC */
55*9517SBill.Taylor@Sun.COM #define	DAPL_CR_ACCEPT			(DAPL_TYPE_MISC | 0x01)
56*9517SBill.Taylor@Sun.COM #define	DAPL_CR_REJECT			(DAPL_TYPE_MISC | 0x02)
57*9517SBill.Taylor@Sun.COM #define	DAPL_IA_QUERY			(DAPL_TYPE_MISC | 0x03)
58*9517SBill.Taylor@Sun.COM #define	DAPL_CR_HANDOFF			(DAPL_TYPE_MISC | 0x04)
59*9517SBill.Taylor@Sun.COM 
60*9517SBill.Taylor@Sun.COM /* EP */
61*9517SBill.Taylor@Sun.COM #define	DAPL_EP_CREATE			(DAPL_TYPE_EP | 0x01)
62*9517SBill.Taylor@Sun.COM #define	DAPL_EP_FREE			(DAPL_TYPE_EP | 0x02)
63*9517SBill.Taylor@Sun.COM #define	DAPL_EP_CONNECT			(DAPL_TYPE_EP | 0x03)
64*9517SBill.Taylor@Sun.COM #define	DAPL_EP_MODIFY			(DAPL_TYPE_EP | 0x04)
65*9517SBill.Taylor@Sun.COM #define	DAPL_EP_DISCONNECT		(DAPL_TYPE_EP | 0x05)
66*9517SBill.Taylor@Sun.COM #define	DAPL_EP_REINIT			(DAPL_TYPE_EP | 0x06)
67*9517SBill.Taylor@Sun.COM 
68*9517SBill.Taylor@Sun.COM /* EVD */
69*9517SBill.Taylor@Sun.COM #define	DAPL_EVD_CREATE			(DAPL_TYPE_EVD | 0x01)
70*9517SBill.Taylor@Sun.COM #define	DAPL_CQ_RESIZE			(DAPL_TYPE_EVD | 0x02)
71*9517SBill.Taylor@Sun.COM #define	DAPL_EVD_FREE			(DAPL_TYPE_EVD | 0x03)
72*9517SBill.Taylor@Sun.COM #define	DAPL_EVENT_POLL			(DAPL_TYPE_EVD | 0x04)
73*9517SBill.Taylor@Sun.COM #define	DAPL_EVENT_WAKEUP		(DAPL_TYPE_EVD | 0x05)
74*9517SBill.Taylor@Sun.COM #define	DAPL_EVD_MODIFY_CNO		(DAPL_TYPE_EVD | 0x06)
75*9517SBill.Taylor@Sun.COM 
76*9517SBill.Taylor@Sun.COM /* MR */
77*9517SBill.Taylor@Sun.COM #define	DAPL_MR_REGISTER		(DAPL_TYPE_MR | 0x01)
78*9517SBill.Taylor@Sun.COM #define	DAPL_MR_REGISTER_LMR		(DAPL_TYPE_MR | 0x02)
79*9517SBill.Taylor@Sun.COM #define	DAPL_MR_REGISTER_SHARED		(DAPL_TYPE_MR | 0x03)
80*9517SBill.Taylor@Sun.COM #define	DAPL_MR_DEREGISTER		(DAPL_TYPE_MR | 0x04)
81*9517SBill.Taylor@Sun.COM #define	DAPL_MR_SYNC			(DAPL_TYPE_MR | 0x05)
82*9517SBill.Taylor@Sun.COM 
83*9517SBill.Taylor@Sun.COM /* MW */
84*9517SBill.Taylor@Sun.COM #define	DAPL_MW_ALLOC			(DAPL_TYPE_MW | 0x01)
85*9517SBill.Taylor@Sun.COM #define	DAPL_MW_FREE			(DAPL_TYPE_MW | 0x02)
86*9517SBill.Taylor@Sun.COM 
87*9517SBill.Taylor@Sun.COM /* CNO */
88*9517SBill.Taylor@Sun.COM #define	DAPL_CNO_ALLOC			(DAPL_TYPE_CNO | 0x01)
89*9517SBill.Taylor@Sun.COM #define	DAPL_CNO_FREE			(DAPL_TYPE_CNO | 0x02)
90*9517SBill.Taylor@Sun.COM #define	DAPL_CNO_WAIT			(DAPL_TYPE_CNO | 0x03)
91*9517SBill.Taylor@Sun.COM 
92*9517SBill.Taylor@Sun.COM /* PD */
93*9517SBill.Taylor@Sun.COM #define	DAPL_PD_ALLOC			(DAPL_TYPE_PD | 0x01)
94*9517SBill.Taylor@Sun.COM #define	DAPL_PD_FREE			(DAPL_TYPE_PD | 0x02)
95*9517SBill.Taylor@Sun.COM 
96*9517SBill.Taylor@Sun.COM /* SP */
97*9517SBill.Taylor@Sun.COM #define	DAPL_SERVICE_REGISTER		(DAPL_TYPE_SP | 0x01)
98*9517SBill.Taylor@Sun.COM #define	DAPL_SERVICE_DEREGISTER		(DAPL_TYPE_SP | 0x02)
99*9517SBill.Taylor@Sun.COM 
100*9517SBill.Taylor@Sun.COM /* SRQ */
101*9517SBill.Taylor@Sun.COM #define	DAPL_SRQ_CREATE			(DAPL_TYPE_SRQ	| 0x01)
102*9517SBill.Taylor@Sun.COM #define	DAPL_SRQ_FREE			(DAPL_TYPE_SRQ	| 0x02)
103*9517SBill.Taylor@Sun.COM #define	DAPL_SRQ_RESIZE			(DAPL_TYPE_SRQ	| 0x03)
104*9517SBill.Taylor@Sun.COM 
105*9517SBill.Taylor@Sun.COM /*
106*9517SBill.Taylor@Sun.COM  * Drivers name and minor name.
107*9517SBill.Taylor@Sun.COM  */
108*9517SBill.Taylor@Sun.COM #define	DAPLKA_DRV_NAME		"daplt"
109*9517SBill.Taylor@Sun.COM #define	DAPLKA_MINOR_NAME	"daplt"
110*9517SBill.Taylor@Sun.COM #define	DAPLKA_DEFAULT_PATH	"/devices/ib/daplt@0:daplt"
111*9517SBill.Taylor@Sun.COM #define	DAPLKA_DRIVER_MINOR	0
112*9517SBill.Taylor@Sun.COM 
113*9517SBill.Taylor@Sun.COM /*
114*9517SBill.Taylor@Sun.COM  * Upper limit on number of events that can be polled per event_poll ioctl
115*9517SBill.Taylor@Sun.COM  * Since we allocate memory in kernel there needs to be an upper bound.
116*9517SBill.Taylor@Sun.COM  */
117*9517SBill.Taylor@Sun.COM #define	DAPL_EVD_MAX_EVENTS	16384
118*9517SBill.Taylor@Sun.COM /*
119*9517SBill.Taylor@Sun.COM  * Number of events that we generally poll for in event_poll.
120*9517SBill.Taylor@Sun.COM  */
121*9517SBill.Taylor@Sun.COM #define	NUM_EVENTS_PER_POLL	16
122*9517SBill.Taylor@Sun.COM 
123*9517SBill.Taylor@Sun.COM /* duplicated from dat.h */
124*9517SBill.Taylor@Sun.COM #ifndef _DAT_H_
125*9517SBill.Taylor@Sun.COM typedef enum dat_evd_flags {
126*9517SBill.Taylor@Sun.COM 	DAT_EVD_SOFTWARE_FLAG	= 0x01,
127*9517SBill.Taylor@Sun.COM 	DAT_EVD_CR_FLAG		= 0x10,
128*9517SBill.Taylor@Sun.COM 	DAT_EVD_DTO_FLAG	= 0x20,
129*9517SBill.Taylor@Sun.COM 	DAT_EVD_CONNECTION_FLAG	= 0x40,
130*9517SBill.Taylor@Sun.COM 	DAT_EVD_RMR_BIND_FLAG	= 0x80,
131*9517SBill.Taylor@Sun.COM 	DAT_EVD_ASYNC_FLAG	= 0x100,
132*9517SBill.Taylor@Sun.COM 	/* DAT events only, no software events */
133*9517SBill.Taylor@Sun.COM 	DAT_EVD_DEFAULT_FLAG	= 0x1F0
134*9517SBill.Taylor@Sun.COM } DAT_EVD_FLAGS;
135*9517SBill.Taylor@Sun.COM #endif /* _DAT_H_ */
136*9517SBill.Taylor@Sun.COM 
137*9517SBill.Taylor@Sun.COM #define	DAPL_MAX_PRIVATE_DATA_SIZE	IBT_MAX_PRIV_DATA_SZ
138*9517SBill.Taylor@Sun.COM #define	DAPL_ATS_NBYTES			16	/* SA record data length */
139*9517SBill.Taylor@Sun.COM 
140*9517SBill.Taylor@Sun.COM /*
141*9517SBill.Taylor@Sun.COM  * All structures defined herein are used for ioctls. On amd64,
142*9517SBill.Taylor@Sun.COM  * use pack(4) to make structures match the x86 alignment rules.
143*9517SBill.Taylor@Sun.COM  */
144*9517SBill.Taylor@Sun.COM 
145*9517SBill.Taylor@Sun.COM #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
146*9517SBill.Taylor@Sun.COM #pragma pack(4)
147*9517SBill.Taylor@Sun.COM #endif
148*9517SBill.Taylor@Sun.COM 
149*9517SBill.Taylor@Sun.COM /*
150*9517SBill.Taylor@Sun.COM  *				      Byte     Offset
151*9517SBill.Taylor@Sun.COM  * uDAPL client's private data		64	00
152*9517SBill.Taylor@Sun.COM  * Base Sockets Direct Header (BSDH)	 4	64
153*9517SBill.Taylor@Sun.COM  * Extended Header				68
154*9517SBill.Taylor@Sun.COM  *  Hello Message (HH)			24
155*9517SBill.Taylor@Sun.COM  *
156*9517SBill.Taylor@Sun.COM  *   bits	32-24		23-16		15-8	7-0
157*9517SBill.Taylor@Sun.COM  * bytes
158*9517SBill.Taylor@Sun.COM  * 00-63	uDAPL client's private data
159*9517SBill.Taylor@Sun.COM  * 64-67	MID             client_msg_len	checksum
160*9517SBill.Taylor@Sun.COM  * 68-72	MajV MinV       IPV 		rsvd1
161*9517SBill.Taylor@Sun.COM  * 73-75	rsvd2				LocalPort
162*9517SBill.Taylor@Sun.COM  * 76-79	SrcIP(127-96)
163*9517SBill.Taylor@Sun.COM  * 80-83	SrcIP(95-64)
164*9517SBill.Taylor@Sun.COM  * 84-87	SrcIP(63-32)
165*9517SBill.Taylor@Sun.COM  * 88-92	SrcIP(31-00)
166*9517SBill.Taylor@Sun.COM  *
167*9517SBill.Taylor@Sun.COM  */
168*9517SBill.Taylor@Sun.COM typedef union dapl_ia_addr_s {
169*9517SBill.Taylor@Sun.COM 	struct {
170*9517SBill.Taylor@Sun.COM 		uint32_t	iad_pad[3];
171*9517SBill.Taylor@Sun.COM 		struct in_addr	iad_v4data;
172*9517SBill.Taylor@Sun.COM 	} iad_v4_s;			/* IPv4 format */
173*9517SBill.Taylor@Sun.COM 	in6_addr_t	iad_v6data;	/* IPv6 format */
174*9517SBill.Taylor@Sun.COM 	uint8_t		iad_sadata[DAPL_ATS_NBYTES]; /* SA format */
175*9517SBill.Taylor@Sun.COM 	uint32_t	iad_src;	/* alignment */
176*9517SBill.Taylor@Sun.COM } dapl_ia_addr_t;
177*9517SBill.Taylor@Sun.COM #define	iad_v4		iad_v4_s.iad_v4data
178*9517SBill.Taylor@Sun.COM #define	iad_v4pad	iad_v4_s.iad_pad
179*9517SBill.Taylor@Sun.COM #define	iad_v6		iad_v6data
180*9517SBill.Taylor@Sun.COM #define	iad_sa		iad_sadata
181*9517SBill.Taylor@Sun.COM 
182*9517SBill.Taylor@Sun.COM typedef struct dapl_hello_msg {
183*9517SBill.Taylor@Sun.COM 	uint16_t	hi_checksum;	/* checksum */
184*9517SBill.Taylor@Sun.COM 	uint8_t		hi_clen;	/* client private data len */
185*9517SBill.Taylor@Sun.COM 	uint8_t		hi_mid;		/* command - not use */
186*9517SBill.Taylor@Sun.COM 	uint16_t	hi_rsvd1;
187*9517SBill.Taylor@Sun.COM 	uint8_t		hi_ipv;		/* IP family ipv4 or ipv6 */
188*9517SBill.Taylor@Sun.COM 	uint8_t		hi_vers;	/* hello message version number */
189*9517SBill.Taylor@Sun.COM 	in_port_t	hi_port;	/* IP port number */
190*9517SBill.Taylor@Sun.COM 	uint16_t	hi_rsvd2;
191*9517SBill.Taylor@Sun.COM 	dapl_ia_addr_t	_hi_ipaddr;	/* IP address */
192*9517SBill.Taylor@Sun.COM } DAPL_HELLO_MSG;
193*9517SBill.Taylor@Sun.COM /* different views of the address field */
194*9517SBill.Taylor@Sun.COM #define	hi_v4ipaddr	_hi_ipaddr.iad_v4	/* IPv4 */
195*9517SBill.Taylor@Sun.COM #define	hi_v4pad	_hi_ipaddr.iad_v4pad
196*9517SBill.Taylor@Sun.COM #define	hi_v6ipaddr	_hi_ipaddr.iad_v6	/* IPv6 */
197*9517SBill.Taylor@Sun.COM #define	hi_saaddr	_hi_ipaddr.iad_sa	/* 16 bytes SA record */
198*9517SBill.Taylor@Sun.COM 
199*9517SBill.Taylor@Sun.COM #define	DAPL_CHECKSUM		0xbeef		/* use as magic number */
200*9517SBill.Taylor@Sun.COM #define	DAPL_HELLO_MSG_VERS	0x10		/* major 1 minor 0 */
201*9517SBill.Taylor@Sun.COM /* DAPL_PRIVATE used to pass private data in a connection */
202*9517SBill.Taylor@Sun.COM #define	DAPL_CONSUMER_MAX_PRIVATE_DATA_SIZE	64
203*9517SBill.Taylor@Sun.COM typedef struct dapl_private {
204*9517SBill.Taylor@Sun.COM 	unsigned char private_data[DAPL_CONSUMER_MAX_PRIVATE_DATA_SIZE];
205*9517SBill.Taylor@Sun.COM 	DAPL_HELLO_MSG hello_msg;
206*9517SBill.Taylor@Sun.COM } DAPL_PRIVATE;
207*9517SBill.Taylor@Sun.COM 
208*9517SBill.Taylor@Sun.COM /* EP ioctl interfaces */
209*9517SBill.Taylor@Sun.COM 
210*9517SBill.Taylor@Sun.COM /*
211*9517SBill.Taylor@Sun.COM  * Definitions used by DAPL for HCA specific "data out" information.  This
212*9517SBill.Taylor@Sun.COM  * data is opaque to daplt, and is consumed by HCA specific code in the
213*9517SBill.Taylor@Sun.COM  * userland library.
214*9517SBill.Taylor@Sun.COM  *
215*9517SBill.Taylor@Sun.COM  * The sizes (in units of uint64_t) need to be big enough for all HCAs
216*9517SBill.Taylor@Sun.COM  * supported.  Although 16 is large enough, since we never want to have
217*9517SBill.Taylor@Sun.COM  * to change our interface version just because we undersized this, we
218*9517SBill.Taylor@Sun.COM  * have chosen 24.
219*9517SBill.Taylor@Sun.COM  */
220*9517SBill.Taylor@Sun.COM #define	DAPL_CQ_DATA_OUT_SIZE	24
221*9517SBill.Taylor@Sun.COM #define	DAPL_QP_DATA_OUT_SIZE	24
222*9517SBill.Taylor@Sun.COM #define	DAPL_SRQ_DATA_OUT_SIZE	24
223*9517SBill.Taylor@Sun.COM 
224*9517SBill.Taylor@Sun.COM typedef uint64_t dapl_cq_data_out_t[DAPL_QP_DATA_OUT_SIZE];
225*9517SBill.Taylor@Sun.COM typedef uint64_t dapl_qp_data_out_t[DAPL_CQ_DATA_OUT_SIZE];
226*9517SBill.Taylor@Sun.COM typedef uint64_t dapl_srq_data_out_t[DAPL_SRQ_DATA_OUT_SIZE];
227*9517SBill.Taylor@Sun.COM 
228*9517SBill.Taylor@Sun.COM /*
229*9517SBill.Taylor@Sun.COM  * Channel sizes struct, copy of ibt_chan_sizes_t so that it can work
230*9517SBill.Taylor@Sun.COM  * fine for both 32/64 bit library
231*9517SBill.Taylor@Sun.COM  */
232*9517SBill.Taylor@Sun.COM typedef struct dapl_chan_sizes_s {
233*9517SBill.Taylor@Sun.COM 	uint_t	dcs_sq;		/* SendQ size. */
234*9517SBill.Taylor@Sun.COM 	uint_t	dcs_rq;		/* ReceiveQ size. */
235*9517SBill.Taylor@Sun.COM 	uint_t	dcs_sq_sgl;	/* Max SGL elements in a SQ WR. */
236*9517SBill.Taylor@Sun.COM 	uint_t	dcs_rq_sgl;	/* Max SGL elements in a RQ Wr. */
237*9517SBill.Taylor@Sun.COM } dapl_chan_sizes_t;
238*9517SBill.Taylor@Sun.COM 
239*9517SBill.Taylor@Sun.COM /*
240*9517SBill.Taylor@Sun.COM  * EP create ioctl message structure
241*9517SBill.Taylor@Sun.COM  */
242*9517SBill.Taylor@Sun.COM typedef struct dapl_ep_create_s {
243*9517SBill.Taylor@Sun.COM 	uint64_t		ep_hkey;	  /* hash key of the EP */
244*9517SBill.Taylor@Sun.COM 	uint64_t		ep_pd_hkey;	  /* PD hash key */
245*9517SBill.Taylor@Sun.COM 	uint64_t		ep_rcv_evd_hkey;  /* Recv evd hash key */
246*9517SBill.Taylor@Sun.COM 	uint64_t		ep_snd_evd_hkey;  /* Send evd hash key */
247*9517SBill.Taylor@Sun.COM 	uint64_t		ep_conn_evd_hkey; /* Conn evd hash key */
248*9517SBill.Taylor@Sun.COM 	uint64_t		ep_srq_hkey;	  /* SRQ hash key	*/
249*9517SBill.Taylor@Sun.COM 	uint32_t		ep_srq_attached;  /* EP with SRQ - 1 or 0 */
250*9517SBill.Taylor@Sun.COM 	uint64_t		ep_cookie;	  /* Userland EP pointer */
251*9517SBill.Taylor@Sun.COM 	dapl_chan_sizes_t	ep_ch_sizes;	  /* Requested RC params */
252*9517SBill.Taylor@Sun.COM 	dapl_chan_sizes_t	ep_ch_real_sizes; /* Allocated RC params */
253*9517SBill.Taylor@Sun.COM 	dapl_qp_data_out_t	ep_qp_data_out;
254*9517SBill.Taylor@Sun.COM } dapl_ep_create_t;
255*9517SBill.Taylor@Sun.COM 
256*9517SBill.Taylor@Sun.COM /*
257*9517SBill.Taylor@Sun.COM  * Modify is not yet completely implemented
258*9517SBill.Taylor@Sun.COM  */
259*9517SBill.Taylor@Sun.COM typedef struct dapl_ep_modify_s {
260*9517SBill.Taylor@Sun.COM 	uint64_t		epm_hkey;
261*9517SBill.Taylor@Sun.COM 	ibt_cep_modify_flags_t	epm_flags;
262*9517SBill.Taylor@Sun.COM 	uint8_t			epm_rdma_ra_out;
263*9517SBill.Taylor@Sun.COM 	uint8_t			epm_rdma_ra_in;
264*9517SBill.Taylor@Sun.COM } dapl_ep_modify_t;
265*9517SBill.Taylor@Sun.COM 
266*9517SBill.Taylor@Sun.COM /*
267*9517SBill.Taylor@Sun.COM  * EP Connect ioctl message
268*9517SBill.Taylor@Sun.COM  */
269*9517SBill.Taylor@Sun.COM typedef struct dapl_ep_connect_s {
270*9517SBill.Taylor@Sun.COM 	uint64_t		epc_hkey;	/* EP hash key		*/
271*9517SBill.Taylor@Sun.COM 	ib_gid_t		epc_dgid;	/* destination gid	*/
272*9517SBill.Taylor@Sun.COM 	uint64_t		epc_sid;	/* service id		*/
273*9517SBill.Taylor@Sun.COM 	uint64_t		epc_timeout;	/* timeout		*/
274*9517SBill.Taylor@Sun.COM 	uint32_t		epc_priv_sz;	/* private data size	*/
275*9517SBill.Taylor@Sun.COM 	dapl_ia_addr_t		epc_raddr_sadata; /* remote addr in SA format */
276*9517SBill.Taylor@Sun.COM 	uchar_t			epc_priv[DAPL_MAX_PRIVATE_DATA_SIZE];
277*9517SBill.Taylor@Sun.COM } dapl_ep_connect_t;
278*9517SBill.Taylor@Sun.COM 
279*9517SBill.Taylor@Sun.COM typedef struct dapl_ep_disconnect_s {
280*9517SBill.Taylor@Sun.COM 	uint64_t		epd_hkey;	/* EP hash key */
281*9517SBill.Taylor@Sun.COM } dapl_ep_disconnect_t;
282*9517SBill.Taylor@Sun.COM 
283*9517SBill.Taylor@Sun.COM /*
284*9517SBill.Taylor@Sun.COM  * EP reinit ioctl called to recycle the RC
285*9517SBill.Taylor@Sun.COM  */
286*9517SBill.Taylor@Sun.COM typedef struct dapl_ep_reinit_s {
287*9517SBill.Taylor@Sun.COM 	uint64_t		epri_hkey;	 /* EP hash key */
288*9517SBill.Taylor@Sun.COM 	uint64_t		epri_map_offset; /* Mapping offset of new QP */
289*9517SBill.Taylor@Sun.COM 	uint64_t		epri_map_len;	 /* Map len of new QP	*/
290*9517SBill.Taylor@Sun.COM 	uint32_t		epri_qpnum;	 /* QPnum of the new QP */
291*9517SBill.Taylor@Sun.COM 	uint32_t		epri_rq_offset;  /* New RecvQ offset in buf */
292*9517SBill.Taylor@Sun.COM 	uint32_t		epri_rq_desc_addr; /* New RecvQ kernel addr */
293*9517SBill.Taylor@Sun.COM 	uint32_t		epri_rq_numwqe;
294*9517SBill.Taylor@Sun.COM 	uint32_t		epri_rq_wqesz;
295*9517SBill.Taylor@Sun.COM 	uint32_t		epri_sq_offset;  /* New SendQ offset in buf */
296*9517SBill.Taylor@Sun.COM 	uint32_t		epri_sq_desc_addr; /* New SendQ kernel addr */
297*9517SBill.Taylor@Sun.COM 	uint32_t		epri_sq_numwqe;
298*9517SBill.Taylor@Sun.COM 	uint32_t		epri_sq_wqesz;
299*9517SBill.Taylor@Sun.COM } dapl_ep_reinit_t;
300*9517SBill.Taylor@Sun.COM 
301*9517SBill.Taylor@Sun.COM typedef struct dapl_ep_free_s {
302*9517SBill.Taylor@Sun.COM 	uint64_t		epf_hkey;	/* EP hash key */
303*9517SBill.Taylor@Sun.COM } dapl_ep_free_t;
304*9517SBill.Taylor@Sun.COM 
305*9517SBill.Taylor@Sun.COM /* EVD ioctl interfaces */
306*9517SBill.Taylor@Sun.COM 
307*9517SBill.Taylor@Sun.COM /*
308*9517SBill.Taylor@Sun.COM  * EVD create ioctl
309*9517SBill.Taylor@Sun.COM  */
310*9517SBill.Taylor@Sun.COM typedef struct dapl_evd_create_s {
311*9517SBill.Taylor@Sun.COM 	uint64_t		evd_hkey;	/* EVD hash key */
312*9517SBill.Taylor@Sun.COM 	DAT_EVD_FLAGS		evd_flags;	/* EVD streams flag */
313*9517SBill.Taylor@Sun.COM 	uint64_t		evd_cookie;	/* userland EVD pointer */
314*9517SBill.Taylor@Sun.COM 	uint64_t		evd_cno_hkey;	/* CNO hash key */
315*9517SBill.Taylor@Sun.COM 	uint32_t		evd_cq_size;	/* Requested CQ Size */
316*9517SBill.Taylor@Sun.COM 	uint32_t		evd_cq_real_size;  /* Allocated CQ size */
317*9517SBill.Taylor@Sun.COM 	dapl_cq_data_out_t	evd_cq_data_out;
318*9517SBill.Taylor@Sun.COM } dapl_evd_create_t;
319*9517SBill.Taylor@Sun.COM 
320*9517SBill.Taylor@Sun.COM /*
321*9517SBill.Taylor@Sun.COM  * If an EVD has a CQ this ioctl message is used to resize the CQ
322*9517SBill.Taylor@Sun.COM  */
323*9517SBill.Taylor@Sun.COM typedef struct dapl_cq_resize_s {
324*9517SBill.Taylor@Sun.COM 	uint64_t		cqr_evd_hkey;	  /* EVD hash key */
325*9517SBill.Taylor@Sun.COM 	uint32_t		cqr_cq_new_size;  /* New requested CQ size */
326*9517SBill.Taylor@Sun.COM 	uint32_t		cqr_cq_real_size; /* Allocated CQ size */
327*9517SBill.Taylor@Sun.COM 	dapl_cq_data_out_t	cqr_cq_data_out;
328*9517SBill.Taylor@Sun.COM } dapl_cq_resize_t;
329*9517SBill.Taylor@Sun.COM 
330*9517SBill.Taylor@Sun.COM /*
331*9517SBill.Taylor@Sun.COM  * Event type used while returning events from the kernel
332*9517SBill.Taylor@Sun.COM  */
333*9517SBill.Taylor@Sun.COM typedef enum {
334*9517SBill.Taylor@Sun.COM 	/* event family for the Async events */
335*9517SBill.Taylor@Sun.COM 	DAPL_ASYNC_EVENTS = 0x01,
336*9517SBill.Taylor@Sun.COM 	/* event family for events posted by the PASSIVE side cm_handler */
337*9517SBill.Taylor@Sun.COM 	DAPL_CR_EVENTS = 0x02,
338*9517SBill.Taylor@Sun.COM 	/* event family for events posted by the PASSIVE side cm_handler */
339*9517SBill.Taylor@Sun.COM 	DAPL_PASSIVE_CONNECTION_EVENTS = 0x04,
340*9517SBill.Taylor@Sun.COM 	/* event family for events posted by the ACTIVE side cm_handler */
341*9517SBill.Taylor@Sun.COM 	DAPL_ACTIVE_CONNECTION_EVENTS = 0x08
342*9517SBill.Taylor@Sun.COM } dapl_event_family_t;
343*9517SBill.Taylor@Sun.COM 
344*9517SBill.Taylor@Sun.COM /*
345*9517SBill.Taylor@Sun.COM  * Async event structure
346*9517SBill.Taylor@Sun.COM  */
347*9517SBill.Taylor@Sun.COM typedef struct dapl_ib_async_event_s {
348*9517SBill.Taylor@Sun.COM 	ibt_async_code_t	ibae_type;
349*9517SBill.Taylor@Sun.COM 	ib_guid_t		ibae_hca_guid; /* HCA node GUID */
350*9517SBill.Taylor@Sun.COM 	uint64_t		ibae_cookie; /* ep or cq pointer */
351*9517SBill.Taylor@Sun.COM 	uint8_t			ibae_port; /* HCA Port num unaffiliated evnt */
352*9517SBill.Taylor@Sun.COM } dapl_ib_async_event_t;
353*9517SBill.Taylor@Sun.COM 
354*9517SBill.Taylor@Sun.COM /*
355*9517SBill.Taylor@Sun.COM  * CM events definitions used to translate IBTF CM events to DAPL CM events
356*9517SBill.Taylor@Sun.COM  */
357*9517SBill.Taylor@Sun.COM typedef enum {
358*9517SBill.Taylor@Sun.COM 	/* IBT_CM_EVENT_CONN_EST */
359*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_CONNECTED = 1,
360*9517SBill.Taylor@Sun.COM 	/* IBT_CM_EVENT_CONN_CLOSED */
361*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_DISCONNECTED,
362*9517SBill.Taylor@Sun.COM 	/* IBT_CM_EVENT_REQ_RCV */
363*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_CONNECTION_REQUEST_PENDING,
364*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_CONNECTION_REQUEST_PENDING_PRIVATE_DATA,
365*9517SBill.Taylor@Sun.COM 	/* IBT_CM_EVENT_FAILURE */
366*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_DESTINATION_REJECT,
367*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_DESTINATION_REJECT_PRIVATE_DATA,
368*9517SBill.Taylor@Sun.COM 	/* Currently not mapped to IBTF CM events */
369*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_DESTINATION_UNREACHABLE,
370*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_TOO_MANY_CONNECTION_REQUESTS,
371*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_LOCAL_FAILURE,
372*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_TIMED_OUT,
373*9517SBill.Taylor@Sun.COM 	DAPL_IB_CME_DISCONNECTED_ON_LINK_DOWN,
374*9517SBill.Taylor@Sun.COM 	/*
375*9517SBill.Taylor@Sun.COM 	 * Not really a CM event but library uses CM events as reject reasons
376*9517SBill.Taylor@Sun.COM 	 * so to avoid any overlaps, make it part of this enum
377*9517SBill.Taylor@Sun.COM 	 */
378*9517SBill.Taylor@Sun.COM 	DAPL_IB_CM_REJ_REASON_CONSUMER_REJ
379*9517SBill.Taylor@Sun.COM } dapl_ib_cm_event_type_t;
380*9517SBill.Taylor@Sun.COM 
381*9517SBill.Taylor@Sun.COM /*
382*9517SBill.Taylor@Sun.COM  * CM event structure
383*9517SBill.Taylor@Sun.COM  */
384*9517SBill.Taylor@Sun.COM typedef struct dapl_ib_cm_event_s {
385*9517SBill.Taylor@Sun.COM 	dapl_ib_cm_event_type_t	ibce_event;
386*9517SBill.Taylor@Sun.COM 	/* Userland PSP ptr for CR, EP ptr for CONNECTION */
387*9517SBill.Taylor@Sun.COM 	uint64_t		ibce_cookie;
388*9517SBill.Taylor@Sun.COM 	/* Unique CR cookie: tmstamp + Index in the connection pending table */
389*9517SBill.Taylor@Sun.COM 	uint64_t		ibce_psep_cookie;
390*9517SBill.Taylor@Sun.COM 	uint32_t		ibce_priv_data_size;
391*9517SBill.Taylor@Sun.COM 	uchar_t			ibce_priv_data_ptr[DAPL_MAX_PRIVATE_DATA_SIZE];
392*9517SBill.Taylor@Sun.COM } dapl_ib_cm_event_t;
393*9517SBill.Taylor@Sun.COM 
394*9517SBill.Taylor@Sun.COM /*
395*9517SBill.Taylor@Sun.COM  * Kernel Events structure used for returning CM or Async events
396*9517SBill.Taylor@Sun.COM  */
397*9517SBill.Taylor@Sun.COM typedef struct dapl_ib_event_s {
398*9517SBill.Taylor@Sun.COM 	dapl_event_family_t	ibe_ev_family;
399*9517SBill.Taylor@Sun.COM 	union {
400*9517SBill.Taylor@Sun.COM 		dapl_ib_async_event_t	ibe_async; /* Async event */
401*9517SBill.Taylor@Sun.COM 		dapl_ib_cm_event_t	ibe_ce;	   /* CM event    */
402*9517SBill.Taylor@Sun.COM 	} ev_data;
403*9517SBill.Taylor@Sun.COM #define	ibe_async	ev_data.ibe_async
404*9517SBill.Taylor@Sun.COM #define	ibe_ce		ev_data.ibe_ce
405*9517SBill.Taylor@Sun.COM } dapl_ib_event_t;
406*9517SBill.Taylor@Sun.COM 
407*9517SBill.Taylor@Sun.COM /*
408*9517SBill.Taylor@Sun.COM  * Event poll ioctl message
409*9517SBill.Taylor@Sun.COM  */
410*9517SBill.Taylor@Sun.COM typedef struct dapl_event_poll_s {
411*9517SBill.Taylor@Sun.COM 	uint64_t		evp_evd_hkey;  /* EVD hash key		*/
412*9517SBill.Taylor@Sun.COM 	uint64_t		evp_timeout;   /* Timeout value		*/
413*9517SBill.Taylor@Sun.COM 	uint_t			evp_threshold; /* Threshold passed in	*/
414*9517SBill.Taylor@Sun.COM 	dapl_ib_event_t		*evp_ep;    /* array of events to be filled */
415*9517SBill.Taylor@Sun.COM 	uint_t			evp_num_ev; /* array sz, possbly > threshold */
416*9517SBill.Taylor@Sun.COM 	uint_t			evp_num_polled; /* number of elements filled */
417*9517SBill.Taylor@Sun.COM } dapl_event_poll_t;
418*9517SBill.Taylor@Sun.COM 
419*9517SBill.Taylor@Sun.COM /*
420*9517SBill.Taylor@Sun.COM  * Event poll ioctl message
421*9517SBill.Taylor@Sun.COM  */
422*9517SBill.Taylor@Sun.COM typedef struct dapl_event_poll32_s {
423*9517SBill.Taylor@Sun.COM 	uint64_t		evp_evd_hkey;  /* EVD hash key		*/
424*9517SBill.Taylor@Sun.COM 	uint64_t		evp_timeout;   /* Timeout value		*/
425*9517SBill.Taylor@Sun.COM 	uint_t			evp_threshold; /* Threshold passed in	*/
426*9517SBill.Taylor@Sun.COM 	caddr32_t		evp_ep;    /* array of events to be filled */
427*9517SBill.Taylor@Sun.COM 	uint_t			evp_num_ev; /* array sz, possbly > threshold */
428*9517SBill.Taylor@Sun.COM 	uint_t			evp_num_polled; /* number of elements filled */
429*9517SBill.Taylor@Sun.COM } dapl_event_poll32_t;
430*9517SBill.Taylor@Sun.COM 
431*9517SBill.Taylor@Sun.COM /*
432*9517SBill.Taylor@Sun.COM  * EVD hash key to wakeup
433*9517SBill.Taylor@Sun.COM  */
434*9517SBill.Taylor@Sun.COM typedef struct dapl_event_wakeup_s {
435*9517SBill.Taylor@Sun.COM 	uint64_t		evw_hkey;	/* EVD hash key */
436*9517SBill.Taylor@Sun.COM } dapl_event_wakeup_t;
437*9517SBill.Taylor@Sun.COM 
438*9517SBill.Taylor@Sun.COM /*
439*9517SBill.Taylor@Sun.COM  * modify EVD to CNO association
440*9517SBill.Taylor@Sun.COM  */
441*9517SBill.Taylor@Sun.COM typedef struct dapl_evd_modify_cno_s {
442*9517SBill.Taylor@Sun.COM 	uint64_t		evmc_hkey;	/* EVD hash key */
443*9517SBill.Taylor@Sun.COM 	uint64_t		evmc_cno_hkey;	/* new CNO hash key */
444*9517SBill.Taylor@Sun.COM } dapl_evd_modify_cno_t;
445*9517SBill.Taylor@Sun.COM 
446*9517SBill.Taylor@Sun.COM 
447*9517SBill.Taylor@Sun.COM /*
448*9517SBill.Taylor@Sun.COM  * EVD hash key to free
449*9517SBill.Taylor@Sun.COM  */
450*9517SBill.Taylor@Sun.COM typedef struct dapl_evd_free_s {
451*9517SBill.Taylor@Sun.COM 	uint64_t		evf_hkey;	/* EVD hash key */
452*9517SBill.Taylor@Sun.COM } dapl_evd_free_t;
453*9517SBill.Taylor@Sun.COM 
454*9517SBill.Taylor@Sun.COM /* MR ioctl interfaces */
455*9517SBill.Taylor@Sun.COM 
456*9517SBill.Taylor@Sun.COM /*
457*9517SBill.Taylor@Sun.COM  * MR register ioctl message
458*9517SBill.Taylor@Sun.COM  */
459*9517SBill.Taylor@Sun.COM typedef struct dapl_mr_register_s {
460*9517SBill.Taylor@Sun.COM 	uint64_t		mr_hkey;    /* MR hash key		 */
461*9517SBill.Taylor@Sun.COM 	uint64_t		mr_pd_hkey; /* PD hash key		 */
462*9517SBill.Taylor@Sun.COM 	ib_vaddr_t		mr_vaddr; /* Virtual address to register */
463*9517SBill.Taylor@Sun.COM 	ib_memlen_t		mr_len;	  /* Length of region to register */
464*9517SBill.Taylor@Sun.COM 	ibt_mr_flags_t		mr_flags;
465*9517SBill.Taylor@Sun.COM 	ibt_lkey_t		mr_lkey;  /* Lkey returned from mr_register */
466*9517SBill.Taylor@Sun.COM 	ibt_rkey_t		mr_rkey;  /* Rkey returned from mr_register */
467*9517SBill.Taylor@Sun.COM } dapl_mr_register_t;
468*9517SBill.Taylor@Sun.COM 
469*9517SBill.Taylor@Sun.COM /*
470*9517SBill.Taylor@Sun.COM  * Shared MR cookie
471*9517SBill.Taylor@Sun.COM  */
472*9517SBill.Taylor@Sun.COM typedef union dapl_mr_cookie_u {
473*9517SBill.Taylor@Sun.COM 	uint64_t		mc_uint_arr[5];
474*9517SBill.Taylor@Sun.COM 	uchar_t			mc_byte_arr[40];
475*9517SBill.Taylor@Sun.COM } dapl_mr_cookie_t;
476*9517SBill.Taylor@Sun.COM 
477*9517SBill.Taylor@Sun.COM /*
478*9517SBill.Taylor@Sun.COM  * Shared MR register ioctl message
479*9517SBill.Taylor@Sun.COM  */
480*9517SBill.Taylor@Sun.COM typedef struct dapl_mr_register_shared_s {
481*9517SBill.Taylor@Sun.COM 	uint64_t		mrs_hkey;    /* MR hash key		 */
482*9517SBill.Taylor@Sun.COM 	uint64_t		mrs_pd_hkey; /* PD hash key		 */
483*9517SBill.Taylor@Sun.COM 	ib_vaddr_t		mrs_vaddr; /* Virtual address to register */
484*9517SBill.Taylor@Sun.COM 	ib_memlen_t		mrs_len;   /* Length of region to register */
485*9517SBill.Taylor@Sun.COM 	ibt_mr_flags_t		mrs_flags;
486*9517SBill.Taylor@Sun.COM 	ibt_lkey_t		mrs_lkey;  /* Lkey returned from mr_register */
487*9517SBill.Taylor@Sun.COM 	ibt_rkey_t		mrs_rkey;  /* Rkey returned from mr_register */
488*9517SBill.Taylor@Sun.COM 	dapl_mr_cookie_t	mrs_shm_cookie; /* shared mem cookie */
489*9517SBill.Taylor@Sun.COM } dapl_mr_register_shared_t;
490*9517SBill.Taylor@Sun.COM 
491*9517SBill.Taylor@Sun.COM /*
492*9517SBill.Taylor@Sun.COM  * MR based MR register ioctl message
493*9517SBill.Taylor@Sun.COM  */
494*9517SBill.Taylor@Sun.COM typedef struct dapl_mr_register_lmr_s {
495*9517SBill.Taylor@Sun.COM 	uint64_t		mrl_hkey; /* MR hash key */
496*9517SBill.Taylor@Sun.COM 	uint64_t		mrl_orig_hkey; /* hash key of Original MR */
497*9517SBill.Taylor@Sun.COM 	ibt_mr_flags_t		mrl_flags;
498*9517SBill.Taylor@Sun.COM 	ibt_lkey_t		mrl_lkey; /* Lkey returned from mr_register */
499*9517SBill.Taylor@Sun.COM 	ibt_rkey_t		mrl_rkey; /* Rkey returned from mr_register */
500*9517SBill.Taylor@Sun.COM } dapl_mr_register_lmr_t;
501*9517SBill.Taylor@Sun.COM 
502*9517SBill.Taylor@Sun.COM /*
503*9517SBill.Taylor@Sun.COM  * MR deregister ioctl message
504*9517SBill.Taylor@Sun.COM  */
505*9517SBill.Taylor@Sun.COM typedef struct dapl_mr_deregister_s {
506*9517SBill.Taylor@Sun.COM 	uint64_t		mrd_hkey; /* MR hash key */
507*9517SBill.Taylor@Sun.COM } dapl_mr_deregister_t;
508*9517SBill.Taylor@Sun.COM 
509*9517SBill.Taylor@Sun.COM /*
510*9517SBill.Taylor@Sun.COM  * MR RDMA sync ioctl message
511*9517SBill.Taylor@Sun.COM  */
512*9517SBill.Taylor@Sun.COM 
513*9517SBill.Taylor@Sun.COM #define	DAPL_MR_PER_SYNC 16
514*9517SBill.Taylor@Sun.COM #define	DAPL_MR_SYNC_RDMA_RD 0
515*9517SBill.Taylor@Sun.COM #define	DAPL_MR_SYNC_RDMA_WR 1
516*9517SBill.Taylor@Sun.COM 
517*9517SBill.Taylor@Sun.COM typedef struct dapl_mr_sync_vec_s {
518*9517SBill.Taylor@Sun.COM 	uint64_t	mrsv_hkey;	/* MR hash key */
519*9517SBill.Taylor@Sun.COM 	uint64_t	mrsv_va;	/* MR sync virtual addr */
520*9517SBill.Taylor@Sun.COM 	uint64_t	mrsv_len;	/* MR sync length */
521*9517SBill.Taylor@Sun.COM } dapl_mr_sync_vec_t;
522*9517SBill.Taylor@Sun.COM 
523*9517SBill.Taylor@Sun.COM typedef struct dapl_mr_sync_s {
524*9517SBill.Taylor@Sun.COM 	uint32_t		mrs_flags;	/* MR sync direction */
525*9517SBill.Taylor@Sun.COM 	uint64_t		mrs_numseg;	/* number of MR's */
526*9517SBill.Taylor@Sun.COM 	dapl_mr_sync_vec_t 	mrs_vec[DAPL_MR_PER_SYNC]; /* sync elements */
527*9517SBill.Taylor@Sun.COM } dapl_mr_sync_t;
528*9517SBill.Taylor@Sun.COM 
529*9517SBill.Taylor@Sun.COM /* IA ioctl interfaces */
530*9517SBill.Taylor@Sun.COM 
531*9517SBill.Taylor@Sun.COM /*
532*9517SBill.Taylor@Sun.COM  * IA create ioctl message
533*9517SBill.Taylor@Sun.COM  */
534*9517SBill.Taylor@Sun.COM typedef struct dapl_ia_create_s {
535*9517SBill.Taylor@Sun.COM 	uint32_t		ia_version; /* ioctl interface version	*/
536*9517SBill.Taylor@Sun.COM 	ib_guid_t		ia_guid;    /* HCA guid			*/
537*9517SBill.Taylor@Sun.COM 	uint32_t		ia_port;    /* port number		*/
538*9517SBill.Taylor@Sun.COM 	uint32_t		ia_pkey;    /* pkey of the ibd instance */
539*9517SBill.Taylor@Sun.COM 	uint32_t		ia_resnum;  /* resource num in resrc table */
540*9517SBill.Taylor@Sun.COM 	uint8_t			ia_sadata[DAPL_ATS_NBYTES]; /* SA data record */
541*9517SBill.Taylor@Sun.COM } dapl_ia_create_t;
542*9517SBill.Taylor@Sun.COM 
543*9517SBill.Taylor@Sun.COM /*
544*9517SBill.Taylor@Sun.COM  * This structure is pretty much a copy of ibt_hca_attr_t but only
545*9517SBill.Taylor@Sun.COM  * relevant fields are present and the data types are such that
546*9517SBill.Taylor@Sun.COM  * its safe to use it in both in 32 and 64 bit libraries
547*9517SBill.Taylor@Sun.COM  * For detailed description refer to ibt_hca_attr_t in ibtl_types.h
548*9517SBill.Taylor@Sun.COM  */
549*9517SBill.Taylor@Sun.COM typedef struct dapl_hca_attr_s {
550*9517SBill.Taylor@Sun.COM 	uint32_t	dhca_vendor_id:24;
551*9517SBill.Taylor@Sun.COM 	uint16_t	dhca_device_id;
552*9517SBill.Taylor@Sun.COM 	uint32_t	dhca_version_id;
553*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_chans;
554*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_chan_sz;
555*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_sgl;
556*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_cq;
557*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_cq_sz;
558*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_memr;
559*9517SBill.Taylor@Sun.COM 	ib_memlen_t	dhca_max_memr_len;
560*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_mem_win;
561*9517SBill.Taylor@Sun.COM 	uint8_t		dhca_max_rdma_in_chan;
562*9517SBill.Taylor@Sun.COM 	uint8_t		dhca_max_rdma_out_chan;
563*9517SBill.Taylor@Sun.COM 	uint16_t	dhca_max_partitions;
564*9517SBill.Taylor@Sun.COM 	uint8_t		dhca_nports;
565*9517SBill.Taylor@Sun.COM 	ib_guid_t	dhca_node_guid;
566*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_pd;
567*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_srqs;
568*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_srqs_sz;
569*9517SBill.Taylor@Sun.COM 	uint_t		dhca_max_srq_sgl;
570*9517SBill.Taylor@Sun.COM } dapl_hca_attr_t;
571*9517SBill.Taylor@Sun.COM 
572*9517SBill.Taylor@Sun.COM /*
573*9517SBill.Taylor@Sun.COM  * IA query ioctl message
574*9517SBill.Taylor@Sun.COM  */
575*9517SBill.Taylor@Sun.COM typedef struct dapl_ia_query_s {
576*9517SBill.Taylor@Sun.COM 	dapl_hca_attr_t		hca_attr;
577*9517SBill.Taylor@Sun.COM } dapl_ia_query_t;
578*9517SBill.Taylor@Sun.COM 
579*9517SBill.Taylor@Sun.COM #define	DAPL_MAX_IA	64
580*9517SBill.Taylor@Sun.COM /*
581*9517SBill.Taylor@Sun.COM  * IA enum ioctl message
582*9517SBill.Taylor@Sun.COM  */
583*9517SBill.Taylor@Sun.COM typedef struct dapl_ia_enum_s {
584*9517SBill.Taylor@Sun.COM 	uint32_t		ia_count;	/* number of IAs */
585*9517SBill.Taylor@Sun.COM 	uint16_t		ia_devnum[DAPL_MAX_IA]; /* devnum of IAs */
586*9517SBill.Taylor@Sun.COM } dapl_ia_enum_t;
587*9517SBill.Taylor@Sun.COM 
588*9517SBill.Taylor@Sun.COM /* PD ioctl interfaces */
589*9517SBill.Taylor@Sun.COM 
590*9517SBill.Taylor@Sun.COM typedef struct dapl_pd_alloc_s {
591*9517SBill.Taylor@Sun.COM 	uint64_t		pda_hkey;
592*9517SBill.Taylor@Sun.COM } dapl_pd_alloc_t;
593*9517SBill.Taylor@Sun.COM 
594*9517SBill.Taylor@Sun.COM typedef struct dapl_pd_free_s {
595*9517SBill.Taylor@Sun.COM 	uint64_t		pdf_hkey;
596*9517SBill.Taylor@Sun.COM } dapl_pd_free_t;
597*9517SBill.Taylor@Sun.COM 
598*9517SBill.Taylor@Sun.COM /* MW ioctl interfaces */
599*9517SBill.Taylor@Sun.COM 
600*9517SBill.Taylor@Sun.COM typedef struct dapl_mw_alloc_s {
601*9517SBill.Taylor@Sun.COM 	uint64_t		mw_pd_hkey;
602*9517SBill.Taylor@Sun.COM 	uint64_t		mw_hkey;
603*9517SBill.Taylor@Sun.COM 	ibt_rkey_t		mw_rkey;
604*9517SBill.Taylor@Sun.COM } dapl_mw_alloc_t;
605*9517SBill.Taylor@Sun.COM 
606*9517SBill.Taylor@Sun.COM typedef struct dapl_mw_free_s {
607*9517SBill.Taylor@Sun.COM 	uint64_t		mw_hkey;
608*9517SBill.Taylor@Sun.COM } dapl_mw_free_t;
609*9517SBill.Taylor@Sun.COM 
610*9517SBill.Taylor@Sun.COM /* Passive Side ioctl interfaces */
611*9517SBill.Taylor@Sun.COM 
612*9517SBill.Taylor@Sun.COM /*
613*9517SBill.Taylor@Sun.COM  * Service register ioctl message
614*9517SBill.Taylor@Sun.COM  */
615*9517SBill.Taylor@Sun.COM typedef struct dapl_service_register_s {
616*9517SBill.Taylor@Sun.COM 	ib_svc_id_t		sr_sid;		/* Requested service id */
617*9517SBill.Taylor@Sun.COM 	uint64_t		sr_evd_hkey;	/* CR EVD hash key	*/
618*9517SBill.Taylor@Sun.COM 	uint64_t		sr_sp_hkey;	/* SP hash key		*/
619*9517SBill.Taylor@Sun.COM 	uint64_t		sr_sp_cookie;	/* Userland xSP ptr	*/
620*9517SBill.Taylor@Sun.COM 	ib_svc_id_t		sr_retsid;	/* Returned service id  */
621*9517SBill.Taylor@Sun.COM } dapl_service_register_t;
622*9517SBill.Taylor@Sun.COM 
623*9517SBill.Taylor@Sun.COM /*
624*9517SBill.Taylor@Sun.COM  * Service deregister ioctl message
625*9517SBill.Taylor@Sun.COM  */
626*9517SBill.Taylor@Sun.COM typedef struct dapl_service_deregister_s {
627*9517SBill.Taylor@Sun.COM 	uint64_t		sdr_sp_hkey;
628*9517SBill.Taylor@Sun.COM } dapl_service_deregister_t;
629*9517SBill.Taylor@Sun.COM 
630*9517SBill.Taylor@Sun.COM /*
631*9517SBill.Taylor@Sun.COM  * Connection request accept ioctl message
632*9517SBill.Taylor@Sun.COM  */
633*9517SBill.Taylor@Sun.COM typedef struct dapl_cr_accept_s {
634*9517SBill.Taylor@Sun.COM 	uint64_t	cra_sp_hkey;	/* xSP hash key */
635*9517SBill.Taylor@Sun.COM 	uint64_t	cra_ep_hkey;	/* EP hash key */
636*9517SBill.Taylor@Sun.COM 	uint64_t	cra_bkl_cookie;	/* CR timestamp + SP backlog index */
637*9517SBill.Taylor@Sun.COM 	uint32_t	cra_priv_sz;	/* private data and size */
638*9517SBill.Taylor@Sun.COM 	uchar_t		cra_priv[DAPL_MAX_PRIVATE_DATA_SIZE];
639*9517SBill.Taylor@Sun.COM } dapl_cr_accept_t;
640*9517SBill.Taylor@Sun.COM 
641*9517SBill.Taylor@Sun.COM /*
642*9517SBill.Taylor@Sun.COM  * Connection request reject ioctl message
643*9517SBill.Taylor@Sun.COM  */
644*9517SBill.Taylor@Sun.COM typedef struct dapl_cr_reject_s {
645*9517SBill.Taylor@Sun.COM 	uint64_t	crr_sp_hkey;	/* xSP hash key */
646*9517SBill.Taylor@Sun.COM 	uint64_t	crr_bkl_cookie;  /* CR timestamp + SP backlog index */
647*9517SBill.Taylor@Sun.COM 	int		crr_reason;	/* Reason for rejecting the CR */
648*9517SBill.Taylor@Sun.COM } dapl_cr_reject_t;
649*9517SBill.Taylor@Sun.COM 
650*9517SBill.Taylor@Sun.COM /*
651*9517SBill.Taylor@Sun.COM  * Connection request handoff ioctl message
652*9517SBill.Taylor@Sun.COM  */
653*9517SBill.Taylor@Sun.COM typedef struct dapl_cr_handoff_s {
654*9517SBill.Taylor@Sun.COM 	uint64_t	crh_sp_hkey;	/* xSP hash key */
655*9517SBill.Taylor@Sun.COM 	uint64_t	crh_bkl_cookie;  /* CR timestamp + SP backlog index */
656*9517SBill.Taylor@Sun.COM 	ib_svc_id_t	crh_conn_qual;  /* Service id of destination SP */
657*9517SBill.Taylor@Sun.COM } dapl_cr_handoff_t;
658*9517SBill.Taylor@Sun.COM 
659*9517SBill.Taylor@Sun.COM /* CNO ioctl interfaces */
660*9517SBill.Taylor@Sun.COM 
661*9517SBill.Taylor@Sun.COM /*
662*9517SBill.Taylor@Sun.COM  * CNO alloc ioctl message
663*9517SBill.Taylor@Sun.COM  */
664*9517SBill.Taylor@Sun.COM typedef struct dapl_cno_alloc_s {
665*9517SBill.Taylor@Sun.COM 	uint64_t	cno_hkey;	/* CNO hash key */
666*9517SBill.Taylor@Sun.COM } dapl_cno_alloc_t;
667*9517SBill.Taylor@Sun.COM 
668*9517SBill.Taylor@Sun.COM /*
669*9517SBill.Taylor@Sun.COM  * CNO free ioctl message
670*9517SBill.Taylor@Sun.COM  */
671*9517SBill.Taylor@Sun.COM typedef struct dapl_cno_free_s {
672*9517SBill.Taylor@Sun.COM 	uint64_t	cnf_hkey;	/* CNO hash key */
673*9517SBill.Taylor@Sun.COM } dapl_cno_free_t;
674*9517SBill.Taylor@Sun.COM 
675*9517SBill.Taylor@Sun.COM /*
676*9517SBill.Taylor@Sun.COM  * CNO wait ioctl message
677*9517SBill.Taylor@Sun.COM  */
678*9517SBill.Taylor@Sun.COM typedef struct dapl_cno_wait_s {
679*9517SBill.Taylor@Sun.COM 	uint64_t	cnw_hkey;	/* CNO hash key */
680*9517SBill.Taylor@Sun.COM 	uint64_t	cnw_timeout;	/* CNO timeout */
681*9517SBill.Taylor@Sun.COM 	uint64_t	cnw_evd_cookie;
682*9517SBill.Taylor@Sun.COM } dapl_cno_wait_t;
683*9517SBill.Taylor@Sun.COM 
684*9517SBill.Taylor@Sun.COM /*
685*9517SBill.Taylor@Sun.COM  * SRQ related structures
686*9517SBill.Taylor@Sun.COM  */
687*9517SBill.Taylor@Sun.COM typedef struct dapl_srq_sizes_s {
688*9517SBill.Taylor@Sun.COM 	uint_t	srqs_sz;
689*9517SBill.Taylor@Sun.COM 	uint_t	srqs_sgl;
690*9517SBill.Taylor@Sun.COM } dapl_srq_sizes_t;
691*9517SBill.Taylor@Sun.COM 
692*9517SBill.Taylor@Sun.COM /*
693*9517SBill.Taylor@Sun.COM  * SRQ create ioctl message
694*9517SBill.Taylor@Sun.COM  */
695*9517SBill.Taylor@Sun.COM typedef struct dapl_srq_create_s {
696*9517SBill.Taylor@Sun.COM 	uint64_t		srqc_pd_hkey;	/* hash key of the assoc PD */
697*9517SBill.Taylor@Sun.COM 	dapl_srq_sizes_t	srqc_sizes;	/* Requested SRQ params	*/
698*9517SBill.Taylor@Sun.COM 	uint64_t		srqc_hkey;	/* hash key of allocated SRQ */
699*9517SBill.Taylor@Sun.COM 	dapl_srq_sizes_t	srqc_real_sizes; /* Allocated SRQ params */
700*9517SBill.Taylor@Sun.COM 	dapl_srq_data_out_t	srqc_data_out;
701*9517SBill.Taylor@Sun.COM } dapl_srq_create_t;
702*9517SBill.Taylor@Sun.COM 
703*9517SBill.Taylor@Sun.COM /*
704*9517SBill.Taylor@Sun.COM  * SRQ resize ioctl message
705*9517SBill.Taylor@Sun.COM  */
706*9517SBill.Taylor@Sun.COM typedef struct dapl_srq_resize_s {
707*9517SBill.Taylor@Sun.COM 	uint64_t		srqr_hkey;	/* hash key of the SRQ */
708*9517SBill.Taylor@Sun.COM 	uint32_t		srqr_new_size;	/* New SRQ size		*/
709*9517SBill.Taylor@Sun.COM 	uint32_t		srqr_real_size; /* Actual SRQ size	*/
710*9517SBill.Taylor@Sun.COM 	dapl_srq_data_out_t	srqr_data_out;
711*9517SBill.Taylor@Sun.COM } dapl_srq_resize_t;
712*9517SBill.Taylor@Sun.COM 
713*9517SBill.Taylor@Sun.COM /*
714*9517SBill.Taylor@Sun.COM  * SRQ free ioctl message
715*9517SBill.Taylor@Sun.COM  */
716*9517SBill.Taylor@Sun.COM typedef struct dapl_srq_free_s {
717*9517SBill.Taylor@Sun.COM 	uint64_t	srqf_hkey; /* hash key of the SRQ being freed */
718*9517SBill.Taylor@Sun.COM } dapl_srq_free_t;
719*9517SBill.Taylor@Sun.COM 
720*9517SBill.Taylor@Sun.COM #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
721*9517SBill.Taylor@Sun.COM #pragma pack()
722*9517SBill.Taylor@Sun.COM #endif
723*9517SBill.Taylor@Sun.COM 
724*9517SBill.Taylor@Sun.COM #ifdef __cplusplus
725*9517SBill.Taylor@Sun.COM }
726*9517SBill.Taylor@Sun.COM #endif
727*9517SBill.Taylor@Sun.COM 
728*9517SBill.Taylor@Sun.COM #endif	/* _DAPL_IF_H_ */
729