xref: /titanic_41/usr/src/uts/common/sys/dlpi.h (revision 2dd2efa5a06a9befe46075cf41e16f57533c9f98)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved	*/
28 
29 
30 /*
31  * Data Link Provider Interface, Version 2.0
32  * Refer to document: "STREAMS DLPI Spec", 800-6915-01.
33  */
34 
35 #ifndef	_SYS_DLPI_H
36 #define	_SYS_DLPI_H
37 
38 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.2	*/
39 
40 #include <sys/types.h>
41 #include <sys/stream.h>
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * Sun additions.
49  */
50 #define	DLIOC		('D' << 8)
51 #define	DLIOCRAW	(DLIOC|1)	/* M_DATA "raw" mode */
52 #define	DLIOCNATIVE	(DLIOC|2)	/* Native traffic mode */
53 #define	DLIOCMARGININFO	(DLIOC|3)	/* margin size info */
54 #define	DLIOCHDRINFO	(DLIOC|10)	/* IP fast-path */
55 
56 #define	DL_IOC_HDR_INFO	DLIOCHDRINFO
57 
58 /*
59  * DLPI revision definition history
60  */
61 #define	DL_CURRENT_VERSION	0x02	/* current version of dlpi */
62 #define	DL_VERSION_2		0x02	/* version of dlpi March 12, 1991 */
63 
64 /*
65  * Primitives for Local Management Services
66  */
67 #define	DL_INFO_REQ		0x00	/* Information Req */
68 #define	DL_INFO_ACK		0x03	/* Information Ack */
69 #define	DL_ATTACH_REQ		0x0b	/* Attach a PPA */
70 #define	DL_DETACH_REQ		0x0c	/* Detach a PPA */
71 #define	DL_BIND_REQ		0x01	/* Bind dlsap address */
72 #define	DL_BIND_ACK		0x04	/* Dlsap address bound */
73 #define	DL_UNBIND_REQ		0x02	/* Unbind dlsap address */
74 #define	DL_OK_ACK		0x06	/* Success acknowledgment */
75 #define	DL_ERROR_ACK		0x05	/* Error acknowledgment */
76 #define	DL_SUBS_BIND_REQ	0x1b	/* Bind Subsequent DLSAP address */
77 #define	DL_SUBS_BIND_ACK	0x1c	/* Subsequent DLSAP address bound */
78 #define	DL_SUBS_UNBIND_REQ	0x15	/* Subsequent unbind */
79 #define	DL_ENABMULTI_REQ	0x1d	/* Enable multicast addresses */
80 #define	DL_DISABMULTI_REQ	0x1e	/* Disable multicast addresses */
81 #define	DL_PROMISCON_REQ	0x1f	/* Turn on promiscuous mode */
82 #define	DL_PROMISCOFF_REQ	0x20	/* Turn off promiscuous mode */
83 
84 /*
85  * Solaris specific local management
86  */
87 #define	DL_NOTIFY_REQ		0x100	/* Enable notifications */
88 #define	DL_NOTIFY_ACK		0x101	/* Supported notifications */
89 #define	DL_NOTIFY_IND		0x102	/* Notification from provider */
90 #define	DL_AGGR_REQ		0x103	/* Enable link aggregation */
91 #define	DL_AGGR_IND		0x104	/* Result from link aggregation */
92 #define	DL_UNAGGR_REQ		0x105	/* Disable link aggregation */
93 #define	DL_CAPABILITY_REQ	0x110	/* Capability request */
94 #define	DL_CAPABILITY_ACK	0x111	/* Capability ack */
95 #define	DL_CONTROL_REQ		0x112	/* Device specific control request */
96 #define	DL_CONTROL_ACK		0x113	/* Device specific control ack */
97 #define	DL_PASSIVE_REQ		0x114	/* Allow access to aggregated link */
98 #define	DL_INTR_MODE_REQ	0x115	/* Request Rx processing in INTR mode */
99 
100 /*
101  * Primitives used for Connectionless Service
102  */
103 #define	DL_UNITDATA_REQ		0x07	/* datagram send request */
104 #define	DL_UNITDATA_IND		0x08	/* datagram receive indication */
105 #define	DL_UDERROR_IND		0x09	/* datagram error indication */
106 #define	DL_UDQOS_REQ		0x0a	/* set QOS for subsequent datagrams */
107 
108 /*
109  * Primitives used for Connection-Oriented Service
110  */
111 #define	DL_CONNECT_REQ		0x0d	/* Connect request */
112 #define	DL_CONNECT_IND		0x0e	/* Incoming connect indication */
113 #define	DL_CONNECT_RES		0x0f	/* Accept previous connect indication */
114 #define	DL_CONNECT_CON		0x10	/* Connection established */
115 
116 #define	DL_TOKEN_REQ		0x11	/* Passoff token request */
117 #define	DL_TOKEN_ACK		0x12	/* Passoff token ack */
118 
119 #define	DL_DISCONNECT_REQ	0x13	/* Disconnect request */
120 #define	DL_DISCONNECT_IND	0x14	/* Disconnect indication */
121 
122 #define	DL_RESET_REQ		0x17	/* Reset service request */
123 #define	DL_RESET_IND		0x18	/* Incoming reset indication */
124 #define	DL_RESET_RES		0x19	/* Complete reset processing */
125 #define	DL_RESET_CON		0x1a	/* Reset processing complete */
126 
127 /*
128  *  Primitives used for Acknowledged Connectionless Service
129  */
130 
131 #define	DL_DATA_ACK_REQ		0x21	/* data unit transmission request */
132 #define	DL_DATA_ACK_IND		0x22	/* Arrival of a command PDU */
133 #define	DL_DATA_ACK_STATUS_IND	0x23	/* Status indication of DATA_ACK_REQ */
134 #define	DL_REPLY_REQ		0x24	/* Request a DLSDU from the remote */
135 #define	DL_REPLY_IND		0x25	/* Arrival of a command PDU */
136 #define	DL_REPLY_STATUS_IND	0x26	/* Status indication of REPLY_REQ */
137 #define	DL_REPLY_UPDATE_REQ	0x27	/* Hold a DLSDU for transmission */
138 #define	DL_REPLY_UPDATE_STATUS_IND	0x28 /* Status of REPLY_UPDATE req */
139 
140 /*
141  * Primitives used for XID and TEST operations
142  */
143 
144 #define	DL_XID_REQ	0x29		/* Request to send an XID PDU */
145 #define	DL_XID_IND	0x2a		/* Arrival of an XID PDU */
146 #define	DL_XID_RES	0x2b		/* request to send a response XID PDU */
147 #define	DL_XID_CON	0x2c		/* Arrival of a response XID PDU */
148 #define	DL_TEST_REQ	0x2d		/* TEST command request */
149 #define	DL_TEST_IND	0x2e		/* TEST response indication */
150 #define	DL_TEST_RES	0x2f		/* TEST response */
151 #define	DL_TEST_CON	0x30		/* TEST Confirmation */
152 
153 /*
154  * Primitives to get and set the physical address, and to get
155  * Statistics
156  */
157 
158 #define	DL_PHYS_ADDR_REQ	0x31	/* Request to get physical addr */
159 #define	DL_PHYS_ADDR_ACK	0x32	/* Return physical addr */
160 #define	DL_SET_PHYS_ADDR_REQ	0x33	/* set physical addr */
161 #define	DL_GET_STATISTICS_REQ	0x34	/* Request to get statistics */
162 #define	DL_GET_STATISTICS_ACK	0x35	/* Return statistics */
163 
164 /*
165  * Invalid primitive
166  */
167 
168 #define	DL_PRIM_INVAL		0xffff	/* Invalid DL primitive value */
169 
170 /*
171  * DLPI interface states
172  */
173 #define	DL_UNATTACHED		0x04	/* PPA not attached */
174 #define	DL_ATTACH_PENDING	0x05	/* Waiting ack of DL_ATTACH_REQ */
175 #define	DL_DETACH_PENDING	0x06	/* Waiting ack of DL_DETACH_REQ */
176 #define	DL_UNBOUND		0x00	/* PPA attached */
177 #define	DL_BIND_PENDING		0x01	/* Waiting ack of DL_BIND_REQ */
178 #define	DL_UNBIND_PENDING	0x02	/* Waiting ack of DL_UNBIND_REQ */
179 #define	DL_IDLE			0x03	/* dlsap bound, awaiting use */
180 #define	DL_UDQOS_PENDING	0x07	/* Waiting ack of DL_UDQOS_REQ */
181 #define	DL_OUTCON_PENDING	0x08	/* awaiting DL_CONN_CON */
182 #define	DL_INCON_PENDING	0x09	/* awaiting DL_CONN_RES */
183 #define	DL_CONN_RES_PENDING	0x0a	/* Waiting ack of DL_CONNECT_RES */
184 #define	DL_DATAXFER		0x0b	/* connection-oriented data transfer */
185 #define	DL_USER_RESET_PENDING	0x0c	/* awaiting DL_RESET_CON */
186 #define	DL_PROV_RESET_PENDING	0x0d	/* awaiting DL_RESET_RES */
187 #define	DL_RESET_RES_PENDING	0x0e	/* Waiting ack of DL_RESET_RES */
188 #define	DL_DISCON8_PENDING	0x0f	/* Waiting ack of DL_DISC_REQ */
189 #define	DL_DISCON9_PENDING	0x10	/* Waiting ack of DL_DISC_REQ */
190 #define	DL_DISCON11_PENDING	0x11	/* Waiting ack of DL_DISC_REQ */
191 #define	DL_DISCON12_PENDING	0x12	/* Waiting ack of DL_DISC_REQ */
192 #define	DL_DISCON13_PENDING	0x13	/* Waiting ack of DL_DISC_REQ */
193 #define	DL_SUBS_BIND_PND	0x14	/* Waiting ack of DL_SUBS_BIND_REQ */
194 #define	DL_SUBS_UNBIND_PND	0x15	/* Waiting ack of DL_SUBS_UNBIND_REQ */
195 
196 
197 /*
198  * DL_ERROR_ACK error return values
199  */
200 #define	DL_ACCESS	0x02	/* Improper permissions for request */
201 #define	DL_BADADDR	0x01	/* DLSAP addr in improper format or invalid */
202 #define	DL_BADCORR	0x05	/* Seq number not from outstand DL_CONN_IND */
203 #define	DL_BADDATA	0x06	/* User data exceeded provider limit */
204 #define	DL_BADPPA	0x08	/* Specified PPA was invalid */
205 #define	DL_BADPRIM	0x09	/* Primitive received not known by provider */
206 #define	DL_BADQOSPARAM	0x0a	/* QOS parameters contained invalid values */
207 #define	DL_BADQOSTYPE	0x0b	/* QOS structure type is unknown/unsupported */
208 #define	DL_BADSAP	0x00	/* Bad LSAP selector */
209 #define	DL_BADTOKEN	0x0c	/* Token used not an active stream */
210 #define	DL_BOUND	0x0d	/* Attempted second bind with dl_max_conind */
211 #define	DL_INITFAILED	0x0e	/* Physical Link initialization failed */
212 #define	DL_NOADDR	0x0f	/* Provider couldn't allocate alt. address */
213 #define	DL_NOTINIT	0x10	/* Physical Link not initialized */
214 #define	DL_OUTSTATE	0x03	/* Primitive issued in improper state */
215 #define	DL_SYSERR	0x04	/* UNIX system error occurred */
216 #define	DL_UNSUPPORTED	0x07	/* Requested serv. not supplied by provider */
217 #define	DL_UNDELIVERABLE 0x11	/* Previous data unit could not be delivered */
218 #define	DL_NOTSUPPORTED  0x12	/* Primitive is known but not supported */
219 #define	DL_TOOMANY	0x13	/* limit exceeded	*/
220 #define	DL_NOTENAB	0x14	/* Promiscuous mode not enabled */
221 #define	DL_BUSY		0x15	/* Other streams for PPA in post-attached */
222 
223 #define	DL_NOAUTO	0x16	/* Automatic handling XID&TEST not supported */
224 #define	DL_NOXIDAUTO	0x17    /* Automatic handling of XID not supported */
225 #define	DL_NOTESTAUTO	0x18	/* Automatic handling of TEST not supported */
226 #define	DL_XIDAUTO	0x19	/* Automatic handling of XID response */
227 #define	DL_TESTAUTO	0x1a	/* AUtomatic handling of TEST response */
228 #define	DL_PENDING	0x1b	/* pending outstanding connect indications */
229 
230 /*
231  * DLPI media types supported
232  */
233 #define	DL_CSMACD	0x0	/* IEEE 802.3 CSMA/CD network */
234 #define	DL_TPB		0x1	/* IEEE 802.4 Token Passing Bus */
235 #define	DL_TPR		0x2	/* IEEE 802.5 Token Passing Ring */
236 #define	DL_METRO	0x3	/* IEEE 802.6 Metro Net */
237 #define	DL_ETHER	0x4	/* Ethernet Bus */
238 #define	DL_HDLC		0x05	/* ISO HDLC protocol support */
239 #define	DL_CHAR		0x06	/* Character Synchronous protocol support */
240 #define	DL_CTCA		0x07	/* IBM Channel-to-Channel Adapter */
241 #define	DL_FDDI		0x08	/* Fiber Distributed data interface */
242 #define	DL_FC		0x10	/* Fibre Channel interface */
243 #define	DL_ATM		0x11	/* ATM */
244 #define	DL_IPATM	0x12	/* ATM Classical IP interface */
245 #define	DL_X25		0x13	/* X.25 LAPB interface */
246 #define	DL_ISDN		0x14	/* ISDN interface */
247 #define	DL_HIPPI	0x15	/* HIPPI interface */
248 #define	DL_100VG	0x16	/* 100 Based VG Ethernet */
249 #define	DL_100VGTPR	0x17	/* 100 Based VG Token Ring */
250 #define	DL_ETH_CSMA	0x18	/* ISO 8802/3 and Ethernet */
251 #define	DL_100BT	0x19	/* 100 Base T */
252 #define	DL_IB		0x1a	/* Infiniband */
253 #define	DL_FRAME	0x0a	/* Frame Relay LAPF */
254 #define	DL_MPFRAME	0x0b	/* Multi-protocol over Frame Relay */
255 #define	DL_ASYNC	0x0c	/* Character Asynchronous Protocol */
256 #define	DL_IPX25	0x0d	/* X.25 Classical IP interface */
257 #define	DL_LOOP		0x0e	/* software loopback */
258 #define	DL_OTHER	0x09	/* Any other medium not listed above */
259 /*
260  * Private media types.  These must be above the value 0x80000000 as
261  * stated in the DLPI specification.
262  */
263 #define	DL_IPV4		0x80000001ul	/* IPv4 Tunnel Link */
264 #define	DL_IPV6		0x80000002ul	/* IPv6 Tunnel Link */
265 #define	SUNW_DL_VNI	0x80000003ul	/* Virtual network interface */
266 #define	DL_WIFI		0x80000004ul	/* IEEE 802.11 */
267 
268 /*
269  * DLPI provider service supported.
270  * These must be allowed to be bitwise-OR for dl_service_mode in
271  * DL_INFO_ACK.
272  */
273 #define	DL_CODLS	0x01	/* support connection-oriented service */
274 #define	DL_CLDLS	0x02	/* support connectionless data link service */
275 #define	DL_ACLDLS	0x04	/* support acknowledged connectionless serv. */
276 
277 
278 /*
279  * DLPI provider style.
280  * The DLPI provider style which determines whether a provider
281  * requires a DL_ATTACH_REQ to inform the provider which PPA
282  * user messages should be sent/received on.
283  */
284 #define	DL_STYLE1	0x0500	/* PPA is implicitly bound by open(2) */
285 #define	DL_STYLE2	0x0501	/* PPA must be expl. bound via DL_ATTACH_REQ */
286 
287 
288 /*
289  * DLPI Originator for Disconnect and Resets
290  */
291 #define	DL_PROVIDER	0x0700
292 #define	DL_USER		0x0701
293 
294 /*
295  * DLPI Disconnect Reasons
296  */
297 #define	DL_CONREJ_DEST_UNKNOWN			0x0800
298 #define	DL_CONREJ_DEST_UNREACH_PERMANENT	0x0801
299 #define	DL_CONREJ_DEST_UNREACH_TRANSIENT	0x0802
300 #define	DL_CONREJ_QOS_UNAVAIL_PERMANENT		0x0803
301 #define	DL_CONREJ_QOS_UNAVAIL_TRANSIENT		0x0804
302 #define	DL_CONREJ_PERMANENT_COND		0x0805
303 #define	DL_CONREJ_TRANSIENT_COND		0x0806
304 #define	DL_DISC_ABNORMAL_CONDITION		0x0807
305 #define	DL_DISC_NORMAL_CONDITION		0x0808
306 #define	DL_DISC_PERMANENT_CONDITION		0x0809
307 #define	DL_DISC_TRANSIENT_CONDITION		0x080a
308 #define	DL_DISC_UNSPECIFIED			0x080b
309 
310 /*
311  * DLPI Reset Reasons
312  */
313 #define	DL_RESET_FLOW_CONTROL	0x0900
314 #define	DL_RESET_LINK_ERROR	0x0901
315 #define	DL_RESET_RESYNCH	0x0902
316 
317 /*
318  * DLPI status values for acknowledged connectionless data transfer
319  */
320 #define	DL_CMD_MASK	0x0f	/* mask for command portion of status */
321 #define	DL_CMD_OK	0x00	/* Command Accepted */
322 #define	DL_CMD_RS	0x01	/* Unimplemented or inactivated service */
323 #define	DL_CMD_UE	0x05	/* Data Link User interface error */
324 #define	DL_CMD_PE	0x06	/* Protocol error */
325 #define	DL_CMD_IP	0x07	/* Permanent implementation dependent error */
326 #define	DL_CMD_UN	0x09	/* Resources temporarily unavailable */
327 #define	DL_CMD_IT	0x0f	/* Temporary implementation dependent error */
328 #define	DL_RSP_MASK	0xf0	/* mask for response portion of status */
329 #define	DL_RSP_OK	0x00	/* Response DLSDU present */
330 #define	DL_RSP_RS	0x10	/* Unimplemented or inactivated service */
331 #define	DL_RSP_NE	0x30	/* Response DLSDU never submitted */
332 #define	DL_RSP_NR	0x40	/* Response DLSDU not requested */
333 #define	DL_RSP_UE	0x50	/* Data Link User interface error */
334 #define	DL_RSP_IP	0x70	/* Permanent implementation dependent error */
335 #define	DL_RSP_UN	0x90	/* Resources temporarily unavailable */
336 #define	DL_RSP_IT	0xf0	/* Temporary implementation dependent error */
337 
338 /*
339  * Service Class values for acknowledged connectionless data transfer
340  */
341 #define	DL_RQST_RSP	0x01	/* Use acknowledge capability in MAC sublayer */
342 #define	DL_RQST_NORSP	0x02	/* No acknowledgement service requested */
343 
344 /*
345  * DLPI address type definition
346  */
347 #define	DL_FACT_PHYS_ADDR	0x01	/* factory physical address */
348 #define	DL_CURR_PHYS_ADDR	0x02	/* current physical address */
349 #define	DL_IPV6_TOKEN		0x03	/* IPv6 interface token */
350 #define	DL_IPV6_LINK_LAYER_ADDR	0x04	/* Neighbor Discovery format */
351 
352 /*
353  * DLPI flag definitions
354  */
355 #define	DL_POLL_FINAL	0x01		/* indicates poll/final bit set */
356 
357 /*
358  *	XID and TEST responses supported by the provider
359  */
360 #define	DL_AUTO_XID	0x01		/* provider will respond to XID */
361 #define	DL_AUTO_TEST	0x02		/* provider will respond to TEST */
362 
363 /*
364  * Subsequent bind type
365  */
366 #define	DL_PEER_BIND	0x01		/* subsequent bind on a peer addr */
367 #define	DL_HIERARCHICAL_BIND	0x02	/* subs_bind on a hierarchical addr */
368 
369 /*
370  * DLPI promiscuous mode definitions
371  */
372 #define	DL_PROMISC_PHYS		0x01	/* promiscuous mode at phys level */
373 #define	DL_PROMISC_SAP		0x02	/* promiscous mode at sap level */
374 #define	DL_PROMISC_MULTI	0x03	/* promiscuous mode for multicast */
375 
376 /*
377  * DLPI notification codes for DL_NOTIFY primitives.
378  * Bit-wise distinct since DL_NOTIFY_REQ and DL_NOTIFY_ACK carry multiple
379  * notification codes.
380  */
381 #define	DL_NOTE_PHYS_ADDR	0x0001	/* Physical address change */
382 #define	DL_NOTE_PROMISC_ON_PHYS	0x0002	/* DL_PROMISC_PHYS set on ppa */
383 #define	DL_NOTE_PROMISC_OFF_PHYS 0x0004	/* DL_PROMISC_PHYS cleared on ppa */
384 #define	DL_NOTE_LINK_DOWN	0x0008	/* Link down */
385 #define	DL_NOTE_LINK_UP		0x0010	/* Link up */
386 #define	DL_NOTE_AGGR_AVAIL	0x0020	/* Link aggregation is available */
387 #define	DL_NOTE_AGGR_UNAVAIL	0x0040	/* Link aggregation is not available */
388 #define	DL_NOTE_SDU_SIZE	0x0080	/* New SDU size, global or per addr */
389 #define	DL_NOTE_SPEED		0x0100	/* Approximate link speed */
390 #define	DL_NOTE_FASTPATH_FLUSH	0x0200	/* Fast Path info changes */
391 #define	DL_NOTE_CAPAB_RENEG	0x0400	/* Initiate capability renegotiation */
392 
393 /*
394  * DLPI Quality Of Service definition for use in QOS structure definitions.
395  * The QOS structures are used in connection establishment, DL_INFO_ACK,
396  * and setting connectionless QOS values.
397  */
398 
399 /*
400  * Throughput
401  *
402  * This parameter is specified for both directions.
403  */
404 typedef struct {
405 	t_scalar_t	dl_target_value;	/* bits/second desired */
406 	t_scalar_t	dl_accept_value;	/* min. ok bits/second */
407 } dl_through_t;
408 
409 /*
410  * transit delay specification
411  *
412  * This parameter is specified for both directions.
413  * expressed in milliseconds assuming a DLSDU size of 128 octets.
414  * The scaling of the value to the current DLSDU size is provider dependent.
415  */
416 typedef struct {
417 	t_scalar_t	dl_target_value;	/* desired value of service */
418 	t_scalar_t	dl_accept_value;	/* min. ok value of service */
419 } dl_transdelay_t;
420 
421 /*
422  * priority specification
423  * priority range is 0-100, with 0 being highest value.
424  */
425 typedef struct {
426 	t_scalar_t	dl_min;
427 	t_scalar_t	dl_max;
428 } dl_priority_t;
429 
430 
431 /*
432  * protection specification
433  *
434  */
435 #define	DL_NONE			0x0B01	/* no protection supplied */
436 #define	DL_MONITOR		0x0B02	/* prot. from passive monit. */
437 #define	DL_MAXIMUM		0x0B03	/* prot. from modification, replay, */
438 					/* addition, or deletion */
439 
440 typedef struct {
441 	t_scalar_t	dl_min;
442 	t_scalar_t	dl_max;
443 } dl_protect_t;
444 
445 
446 /*
447  * Resilience specification
448  * probabilities are scaled by a factor of 10,000 with a time interval
449  * of 10,000 seconds.
450  */
451 typedef struct {
452 	t_scalar_t	dl_disc_prob;	/* prob. of provider init DISC */
453 	t_scalar_t	dl_reset_prob;	/* prob. of provider init RESET */
454 } dl_resilience_t;
455 
456 
457 /*
458  * QOS type definition to be used for negotiation with the
459  * remote end of a connection, or a connectionless unitdata request.
460  * There are two type definitions to handle the negotiation
461  * process at connection establishment. The typedef dl_qos_range_t
462  * is used to present a range for parameters. This is used
463  * in the DL_CONNECT_REQ and DL_CONNECT_IND messages. The typedef
464  * dl_qos_sel_t is used to select a specific value for the QOS
465  * parameters. This is used in the DL_CONNECT_RES, DL_CONNECT_CON,
466  * and DL_INFO_ACK messages to define the selected QOS parameters
467  * for a connection.
468  *
469  * NOTE
470  *	A DataLink provider which has unknown values for any of the fields
471  *	will use a value of DL_UNKNOWN for all values in the fields.
472  *
473  * NOTE
474  *	A QOS parameter value of DL_QOS_DONT_CARE informs the DLS
475  *	provider the user requesting this value doesn't care
476  *	what the QOS parameter is set to. This value becomes the
477  *	least possible value in the range of QOS parameters.
478  *	The order of the QOS parameter range is then:
479  *
480  *		DL_QOS_DONT_CARE < 0 < MAXIMUM QOS VALUE
481  */
482 #define	DL_UNKNOWN		-1
483 #define	DL_QOS_DONT_CARE	-2
484 
485 /*
486  * Every QOS structure has the first 4 bytes containing a type
487  * field, denoting the definition of the rest of the structure.
488  * This is used in the same manner has the dl_primitive variable
489  * is in messages.
490  *
491  * The following list is the defined QOS structure type values and structures.
492  */
493 #define	DL_QOS_CO_RANGE1	0x0101	/* CO QOS range struct. */
494 #define	DL_QOS_CO_SEL1		0x0102	/* CO QOS selection structure */
495 #define	DL_QOS_CL_RANGE1	0x0103	/* CL QOS range struct. */
496 #define	DL_QOS_CL_SEL1		0x0104	/* CL QOS selection */
497 
498 typedef struct {
499 	t_uscalar_t	dl_qos_type;
500 	dl_through_t	dl_rcv_throughput;	/* desired and accep. */
501 	dl_transdelay_t	dl_rcv_trans_delay;	/* desired and accep. */
502 	dl_through_t	dl_xmt_throughput;
503 	dl_transdelay_t	dl_xmt_trans_delay;
504 	dl_priority_t	dl_priority;		/* min and max values */
505 	dl_protect_t	dl_protection;		/* min and max values */
506 	t_scalar_t	dl_residual_error;
507 	dl_resilience_t	dl_resilience;
508 }	dl_qos_co_range1_t;
509 
510 typedef struct {
511 	t_uscalar_t	dl_qos_type;
512 	t_scalar_t	dl_rcv_throughput;
513 	t_scalar_t	dl_rcv_trans_delay;
514 	t_scalar_t	dl_xmt_throughput;
515 	t_scalar_t	dl_xmt_trans_delay;
516 	t_scalar_t	dl_priority;
517 	t_scalar_t	dl_protection;
518 	t_scalar_t	dl_residual_error;
519 	dl_resilience_t	dl_resilience;
520 }	dl_qos_co_sel1_t;
521 
522 typedef struct {
523 	t_uscalar_t	dl_qos_type;
524 	dl_transdelay_t	dl_trans_delay;
525 	dl_priority_t	dl_priority;
526 	dl_protect_t	dl_protection;
527 	t_scalar_t	dl_residual_error;
528 }	dl_qos_cl_range1_t;
529 
530 typedef struct {
531 	t_uscalar_t	dl_qos_type;
532 	t_scalar_t	dl_trans_delay;
533 	t_scalar_t	dl_priority;
534 	t_scalar_t	dl_protection;
535 	t_scalar_t	dl_residual_error;
536 }	dl_qos_cl_sel1_t;
537 
538 union	DL_qos_types {
539 	t_uscalar_t		dl_qos_type;
540 	dl_qos_co_range1_t	qos_co_range1;
541 	dl_qos_co_sel1_t	qos_co_sel1;
542 	dl_qos_cl_range1_t	qos_cl_range1;
543 	dl_qos_cl_sel1_t	qos_cl_sel1;
544 };
545 
546 /*
547  *    Solaris specific structures and definitions.
548  */
549 
550 /*
551  * The following are the capability types and structures used by the
552  * the DL_CAPABILITY_REQ and DL_CAPABILITY_ACK primitives.
553  *
554  * These primitives are used both to determine the set of capabilities in
555  * the DLS provider and also to turn on and off specific capabilities.
556  * The response is a DL_CAPABILITY_ACK or DL_ERROR_ACK.
557  *
558  * DL_CAPABILITY_REQ can either be empty (i.e. dl_sub_length is zero) which
559  * is a request for the driver to return all capabilities. Otherwise, the
560  * DL_CAPABILITY_REQ contains the capabilities the DLS user wants to use and
561  * their settings.
562  *
563  * DL_CAPABILITY_ACK contains the capabilities that the DLS provider can
564  * support modified based on what was listed in the request. If a
565  * capability was included in the request then the information returned
566  * in the ack might be modified based on the information in the request.
567  */
568 
569 #define	DL_CAPAB_ID_WRAPPER	0x00	/* Module ID wrapper structure */
570 					/* dl_data is dl_capab_id_t */
571 #define	DL_CAPAB_HCKSUM		0x01	/* Checksum offload */
572 					/* dl_data is dl_capab_hcksum_t */
573 #define	DL_CAPAB_IPSEC_AH	0x02	/* IPsec AH acceleration */
574 					/* dl_data is dl_capab_ipsec_t */
575 #define	DL_CAPAB_IPSEC_ESP	0x03	/* IPsec ESP acceleration */
576 					/* dl_data is dl_capab_ipsec_t */
577 #define	DL_CAPAB_MDT		0x04	/* Multidata Transmit capability */
578 					/* dl_data is dl_capab_mdt_t */
579 #define	DL_CAPAB_ZEROCOPY	0x05	/* Zero-copy capability */
580 					/* dl_data is dl_capab_zerocopy_t */
581 #define	DL_CAPAB_POLL		0x06	/* Polling capability */
582 					/* dl_data is dl_capab_dls_t */
583 #define	DL_CAPAB_SOFT_RING   	0x07	/* Soft ring capable */
584 					/* dl_data is dl_capab_dls_t */
585 #define	DL_CAPAB_LSO		0x08	/* Large Send Offload capability */
586 					/* dl_data is dl_capab_lso_t */
587 
588 typedef struct {
589 	t_uscalar_t	dl_cap;		/* capability type */
590 	t_uscalar_t	dl_length;	/* length of data following */
591 	/* Followed by zero or more bytes of dl_data */
592 } dl_capability_sub_t;
593 
594 /*
595  * Definitions and structures needed for DL_CONTROL_REQ and DL_CONTROL_ACK
596  * primitives.
597  * Extensible message to send down control information to the DLS provider.
598  * The response is a DL_CONTROL_ACK or DL_ERROR_ACK.
599  *
600  * Different types of control operations will define different format for the
601  * key and data fields. ADD requires key and data fields; if the <type, key>
602  * matches an already existing entry a DL_ERROR_ACK will be returned. DELETE
603  * requires a key field; if the <type, key> does not exist, a DL_ERROR_ACK
604  * will be returned. FLUSH requires neither a key nor data; it
605  * unconditionally removes all entries for the specified type. GET requires a
606  * key field; the get operation returns the data for the <type, key>. If
607  * <type, key> doesn't exist a DL_ERROR_ACK is returned. UPDATE requires key
608  * and data fields; if <type, key> doesn't exist a DL_ERROR_ACK is returned.
609  */
610 
611 /*
612  * Control operations
613  */
614 #define	DL_CO_ADD	0x01	/* Add new entry matching for <type,key> */
615 #define	DL_CO_DELETE	0x02	/* Delete the entry matching <type,key> */
616 #define	DL_CO_FLUSH	0x03	/* Purge all entries of <type> */
617 #define	DL_CO_GET	0x04	/* Get the data for the <type,key> */
618 #define	DL_CO_UPDATE	0x05	/* Update the data for <type,key> */
619 #define	DL_CO_SET	0x06	/* Add or update as appropriate */
620 
621 /*
622  * Control types (dl_type field of dl_control_req_t and dl_control_ack_t)
623  */
624 #define	DL_CT_IPSEC_AH	0x01	/* AH; key=spi,dest_addr; */
625 				/* data=keying material */
626 #define	DL_CT_IPSEC_ESP	0x02	/* ESP; key=spi,des_taddr; */
627 				/* data=keying material */
628 
629 /*
630  * Module ID token to be included in new sub-capability structures.
631  * Existing sub-capabilities lacking an identification token, e.g. IPSEC
632  * hardware acceleration, need to be encapsulated within the ID sub-
633  * capability.  Access to this structure must be done through
634  * dlcapab{set,check}qid().
635  */
636 typedef struct {
637 	t_uscalar_t	mid[4];		/* private fields */
638 } dl_mid_t;
639 
640 /*
641  * Module ID wrapper (follows dl_capability_sub_t)
642  */
643 typedef struct {
644 	dl_mid_t		id_mid;		/* module ID token */
645 	dl_capability_sub_t	id_subcap;	/* sub-capability */
646 } dl_capab_id_t;
647 
648 /*
649  * Multidata Transmit sub-capability (follows dl_capability_sub_t)
650  */
651 typedef struct {
652 	t_uscalar_t	mdt_version;	/* interface version */
653 	t_uscalar_t	mdt_flags;	/* flags */
654 	t_uscalar_t	mdt_hdr_head;	/* minimum leading header space */
655 	t_uscalar_t	mdt_hdr_tail;	/* minimum trailing header space */
656 	t_uscalar_t	mdt_max_pld;	/* maximum doable payload buffers */
657 	t_uscalar_t	mdt_span_limit;	/* scatter-gather descriptor limit */
658 	dl_mid_t	mdt_mid;	/* module ID token */
659 } dl_capab_mdt_t;
660 
661 /*
662  * Multidata Transmit revision definition history
663  */
664 #define	MDT_CURRENT_VERSION	0x02
665 #define	MDT_VERSION_2		0x02
666 
667 /*
668  * mdt_flags values
669  */
670 #define	DL_CAPAB_MDT_ENABLE	0x01	/* enable Multidata Transmit */
671 
672 /*
673  * DL_CAPAB_HCKSUM
674  * Used for negotiating different flavors of checksum offload
675  * capabilities.
676  */
677 typedef struct {
678 	t_uscalar_t	hcksum_version;	/* version of data following */
679 	t_uscalar_t	hcksum_txflags;	/* capabilities on transmit */
680 	dl_mid_t	hcksum_mid;		/* module ID */
681 } dl_capab_hcksum_t;
682 
683 /*
684  * DL_CAPAB_HCKSUM  revision definition history
685  */
686 #define	HCKSUM_CURRENT_VERSION	0x01
687 #define	HCKSUM_VERSION_1	0x01
688 
689 /*
690  * Values for dl_txflags
691  */
692 #define	HCKSUM_ENABLE		0x01	/* Set to enable hardware checksum */
693 					/* capability */
694 #define	HCKSUM_INET_PARTIAL	0x02	/* Partial 1's complement checksum */
695 					/* ability */
696 #define	HCKSUM_INET_FULL_V4	0x04	/* Full 1's complement checksum */
697 					/* ability for IPv4 packets. */
698 #define	HCKSUM_INET_FULL_V6	0x08	/* Full 1's complement checksum */
699 					/* ability for IPv6 packets. */
700 #define	HCKSUM_IPHDRCKSUM	0x10	/* IPv4 Header checksum offload */
701 					/* capability */
702 #ifdef _KERNEL
703 
704 /*
705  * This structure is used by DL_CAPAB_POLL and DL_CAPAB_SOFT_RING
706  * capabilities. It provides a mechanism for IP to exchange function
707  * pointers with a gldv3-based driver to enable it to bypass streams-
708  * data-paths. DL_CAPAB_POLL mechanism provides a way to blank
709  * interrupts. Note: True polling support will be added in the future.
710  * DL_CAPAB_SOFT_RING provides a mechanism to create soft ring at the
711  * dls layer.
712  */
713 typedef struct dl_capab_dls_s {
714 	t_uscalar_t		dls_version;
715 	t_uscalar_t		dls_flags;
716 
717 	/* DLD provided information */
718 	uintptr_t		dls_tx_handle;
719 	uintptr_t		dls_tx;
720 	uintptr_t		dls_ring_change_status;
721 	uintptr_t		dls_ring_bind;
722 	uintptr_t		dls_ring_unbind;
723 
724 	/* IP provided information */
725 	uintptr_t		dls_rx_handle;
726 	uintptr_t		dls_ring_assign;
727 	uintptr_t		dls_rx;
728 	uintptr_t		dls_ring_add;
729 	t_uscalar_t		dls_ring_cnt;
730 
731 	dl_mid_t		dls_mid;		/* module ID */
732 } dl_capab_dls_t;
733 
734 #define	POLL_CURRENT_VERSION	0x01
735 #define	POLL_VERSION_1		0x01
736 
737 #define	SOFT_RING_VERSION_1		0x01
738 
739 /* Values for poll_flags */
740 #define	POLL_ENABLE		0x01	/* Set to enable polling */
741 					/* capability */
742 #define	POLL_CAPABLE		0x02	/* Polling ability exists */
743 #define	POLL_DISABLE		0x03	/* Disable Polling */
744 
745 /* Values for soft_ring_flags */
746 #define	SOFT_RING_ENABLE		0x04	/* Set to enable soft_ring */
747 						/* capability */
748 #define	SOFT_RING_CAPABLE		0x05	/* Soft_Ring ability exists */
749 #define	SOFT_RING_DISABLE		0x06	/* Disable Soft_Ring */
750 
751 /* Soft_Ring fanout types (used by soft_ring_change_status) */
752 #define	SOFT_RING_NONE			0x00
753 #define	SOFT_RING_FANOUT		0x01
754 
755 #endif /* _KERNEL */
756 
757 /*
758  * Zero-copy sub-capability (follows dl_capability_sub_t)
759  */
760 typedef struct {
761 	t_uscalar_t	zerocopy_version;	/* interface version */
762 	t_uscalar_t	zerocopy_flags;		/* capability flags */
763 	t_uscalar_t	reserved[9];		/* reserved fields */
764 	dl_mid_t	zerocopy_mid;		/* module ID */
765 } dl_capab_zerocopy_t;
766 
767 /*
768  * Zero-copy revision definition history
769  */
770 #define	ZEROCOPY_CURRENT_VERSION	0x01
771 #define	ZEROCOPY_VERSION_1		0x01
772 
773 /*
774  * Currently supported values of zerocopy_flags
775  */
776 #define	DL_CAPAB_VMSAFE_MEM		0x01	/* Driver is zero-copy safe */
777 						/* wrt VM named buffers on */
778 						/* transmit */
779 
780 /*
781  * Large Send Offload sub-capability (follows dl_capability_sub_t)
782  */
783 typedef struct {
784 	t_uscalar_t	lso_version;		/* interface version */
785 	t_uscalar_t	lso_flags;		/* capability flags */
786 	t_uscalar_t	lso_max;		/* maximum payload */
787 	t_uscalar_t	reserved[1];		/* reserved fields */
788 	dl_mid_t	lso_mid;		/* module ID */
789 } dl_capab_lso_t;
790 
791 /*
792  * Large Send Offload revision definition history
793  */
794 #define	LSO_CURRENT_VERSION		0x01
795 #define	LSO_VERSION_1			0x01
796 
797 /*
798  * Currently supported values of lso_flags
799  */
800 #define	LSO_TX_ENABLE			0x01	/* to enable LSO */
801 #define	LSO_TX_BASIC_TCP_IPV4		0x02	/* TCP LSO capability */
802 
803 /*
804  * DLPI interface primitive definitions.
805  *
806  * Each primitive is sent as a stream message.  It is possible that
807  * the messages may be viewed as a sequence of bytes that have the
808  * following form without any padding. The structure definition
809  * of the following messages may have to change depending on the
810  * underlying hardware architecture and crossing of a hardware
811  * boundary with a different hardware architecture.
812  *
813  * Fields in the primitives having a name of the form
814  * dl_reserved cannot be used and have the value of
815  * binary zero, no bits turned on.
816  *
817  * Each message has the name defined followed by the
818  * stream message type (M_PROTO, M_PCPROTO, M_DATA)
819  */
820 
821 /*
822  *	LOCAL MANAGEMENT SERVICE PRIMITIVES
823  */
824 
825 /*
826  * DL_INFO_REQ, M_PCPROTO type
827  */
828 typedef struct {
829 	t_uscalar_t	dl_primitive;			/* set to DL_INFO_REQ */
830 } dl_info_req_t;
831 
832 /*
833  * DL_INFO_ACK, M_PCPROTO type
834  */
835 typedef struct {
836 	t_uscalar_t	dl_primitive;		/* set to DL_INFO_ACK */
837 	t_uscalar_t	dl_max_sdu;		/* Max bytes in a DLSDU */
838 	t_uscalar_t	dl_min_sdu;		/* Min bytes in a DLSDU */
839 	t_uscalar_t	dl_addr_length;		/* length of DLSAP address */
840 	t_uscalar_t	dl_mac_type;		/* type of medium supported */
841 	t_uscalar_t	dl_reserved;		/* value set to zero */
842 	t_uscalar_t	dl_current_state;	/* state of DLPI interface */
843 	t_scalar_t	dl_sap_length;		/* length of dlsap SAP part */
844 	t_uscalar_t	dl_service_mode;	/* CO, CL or ACL */
845 	t_uscalar_t	dl_qos_length;		/* length of qos values */
846 	t_uscalar_t	dl_qos_offset;		/* offset from start of block */
847 	t_uscalar_t	dl_qos_range_length;	/* available range of qos */
848 	t_uscalar_t	dl_qos_range_offset;	/* offset from start of block */
849 	t_uscalar_t	dl_provider_style;	/* style1 or style2 */
850 	t_uscalar_t	dl_addr_offset;		/* offset of the dlsap addr */
851 	t_uscalar_t	dl_version;		/* version number */
852 	t_uscalar_t	dl_brdcst_addr_length;	/* length of broadcast addr */
853 	t_uscalar_t	dl_brdcst_addr_offset;	/* offset from start of block */
854 	t_uscalar_t	dl_growth;		/* set to zero */
855 } dl_info_ack_t;
856 
857 /*
858  * DL_ATTACH_REQ, M_PROTO type
859  */
860 typedef struct {
861 	t_uscalar_t	dl_primitive;		/* set to DL_ATTACH_REQ */
862 	t_uscalar_t	dl_ppa;			/* id of the PPA */
863 } dl_attach_req_t;
864 
865 /*
866  * DL_DETACH_REQ, M_PROTO type
867  */
868 typedef struct {
869 	t_uscalar_t	dl_primitive;		/* set to DL_DETACH_REQ */
870 } dl_detach_req_t;
871 
872 /*
873  * DL_BIND_REQ, M_PROTO type
874  */
875 typedef struct {
876 	t_uscalar_t	dl_primitive;	/* set to DL_BIND_REQ */
877 	t_uscalar_t	dl_sap;		/* info to identify dlsap addr */
878 	t_uscalar_t	dl_max_conind;	/* max # of outstanding con_ind */
879 	uint16_t	dl_service_mode;	/* CO, CL or ACL */
880 	uint16_t	dl_conn_mgmt;	/* if non-zero, is con-mgmt stream */
881 	t_uscalar_t	dl_xidtest_flg;	/* auto init. of test and xid */
882 } dl_bind_req_t;
883 
884 /*
885  * DL_BIND_ACK, M_PCPROTO type
886  */
887 typedef struct {
888 	t_uscalar_t	dl_primitive;	/* DL_BIND_ACK */
889 	t_uscalar_t	dl_sap;		/* DLSAP addr info */
890 	t_uscalar_t	dl_addr_length;	/* length of complete DLSAP addr */
891 	t_uscalar_t	dl_addr_offset;	/* offset from start of M_PCPROTO */
892 	t_uscalar_t	dl_max_conind;	/* allowed max. # of con-ind */
893 	t_uscalar_t	dl_xidtest_flg;	/* responses supported by provider */
894 } dl_bind_ack_t;
895 
896 /*
897  * DL_SUBS_BIND_REQ, M_PROTO type
898  */
899 typedef struct {
900 	t_uscalar_t	dl_primitive;		/* DL_SUBS_BIND_REQ */
901 	t_uscalar_t	dl_subs_sap_offset;	/* offset of subs_sap */
902 	t_uscalar_t	dl_subs_sap_length;	/* length of subs_sap */
903 	t_uscalar_t	dl_subs_bind_class;	/* peer or hierarchical */
904 } dl_subs_bind_req_t;
905 
906 /*
907  * DL_SUBS_BIND_ACK, M_PCPROTO type
908  */
909 typedef struct {
910 	t_uscalar_t dl_primitive;	/* DL_SUBS_BIND_ACK */
911 	t_uscalar_t dl_subs_sap_offset;	/* offset of subs_sap */
912 	t_uscalar_t dl_subs_sap_length;	/* length of subs_sap */
913 } dl_subs_bind_ack_t;
914 
915 /*
916  * DL_UNBIND_REQ, M_PROTO type
917  */
918 typedef struct {
919 	t_uscalar_t	dl_primitive;	/* DL_UNBIND_REQ */
920 } dl_unbind_req_t;
921 
922 /*
923  * DL_SUBS_UNBIND_REQ, M_PROTO type
924  */
925 typedef struct {
926 	t_uscalar_t	dl_primitive;		/* DL_SUBS_UNBIND_REQ */
927 	t_uscalar_t	dl_subs_sap_offset;	/* offset of subs_sap */
928 	t_uscalar_t	dl_subs_sap_length;	/* length of subs_sap */
929 } dl_subs_unbind_req_t;
930 
931 /*
932  * DL_OK_ACK, M_PCPROTO type
933  */
934 typedef struct {
935 	t_uscalar_t	dl_primitive;		/* DL_OK_ACK */
936 	t_uscalar_t	dl_correct_primitive;	/* primitive acknowledged */
937 } dl_ok_ack_t;
938 
939 /*
940  * DL_ERROR_ACK, M_PCPROTO type
941  */
942 typedef struct {
943 	t_uscalar_t	dl_primitive;		/* DL_ERROR_ACK */
944 	t_uscalar_t	dl_error_primitive;	/* primitive in error */
945 	t_uscalar_t	dl_errno;		/* DLPI error code */
946 	t_uscalar_t	dl_unix_errno;		/* UNIX system error code */
947 } dl_error_ack_t;
948 
949 /*
950  * DL_ENABMULTI_REQ, M_PROTO type
951  */
952 typedef struct {
953 	t_uscalar_t	dl_primitive;	/* DL_ENABMULTI_REQ */
954 	t_uscalar_t	dl_addr_length;	/* length of multicast address */
955 	t_uscalar_t	dl_addr_offset;	/* offset from start of M_PROTO block */
956 } dl_enabmulti_req_t;
957 
958 /*
959  * DL_DISABMULTI_REQ, M_PROTO type
960  */
961 
962 typedef struct {
963 	t_uscalar_t	dl_primitive;	/* DL_DISABMULTI_REQ */
964 	t_uscalar_t	dl_addr_length;	/* length of multicast address */
965 	t_uscalar_t	dl_addr_offset;	/* offset from start of M_PROTO block */
966 } dl_disabmulti_req_t;
967 
968 /*
969  * DL_PROMISCON_REQ, M_PROTO type
970  */
971 
972 typedef struct {
973 	t_uscalar_t	dl_primitive;	/* DL_PROMISCON_REQ */
974 	t_uscalar_t	dl_level;	/* physical,SAP, or ALL multicast */
975 } dl_promiscon_req_t;
976 
977 /*
978  * DL_PROMISCOFF_REQ, M_PROTO type
979  */
980 
981 typedef struct {
982 	t_uscalar_t	dl_primitive;	/* DL_PROMISCOFF_REQ */
983 	t_uscalar_t	dl_level;	/* Physical,SAP, or ALL multicast */
984 } dl_promiscoff_req_t;
985 
986 /*
987  *	Primitives to get and set the Physical address
988  */
989 
990 /*
991  * DL_PHYS_ADDR_REQ, M_PROTO type
992  */
993 typedef	struct {
994 	t_uscalar_t	dl_primitive;	/* DL_PHYS_ADDR_REQ */
995 	t_uscalar_t	dl_addr_type;	/* factory or current physical addr */
996 } dl_phys_addr_req_t;
997 
998 /*
999  * DL_PHYS_ADDR_ACK, M_PCPROTO type
1000  */
1001 typedef struct {
1002 	t_uscalar_t	dl_primitive;	/* DL_PHYS_ADDR_ACK */
1003 	t_uscalar_t	dl_addr_length;	/* length of the physical addr */
1004 	t_uscalar_t	dl_addr_offset;	/* offset from start of block */
1005 } dl_phys_addr_ack_t;
1006 
1007 /*
1008  * DL_SET_PHYS_ADDR_REQ, M_PROTO type
1009  */
1010 typedef struct {
1011 	t_uscalar_t	dl_primitive;	/* DL_SET_PHYS_ADDR_REQ */
1012 	t_uscalar_t	dl_addr_length;	/* length of physical addr */
1013 	t_uscalar_t	dl_addr_offset;	/* offset from start of block */
1014 } dl_set_phys_addr_req_t;
1015 
1016 /*
1017  *	Primitives to get statistics
1018  */
1019 
1020 /*
1021  * DL_GET_STATISTICS_REQ, M_PROTO type
1022  */
1023 typedef struct {
1024 	t_uscalar_t	dl_primitive;		/* DL_GET_STATISTICS_REQ */
1025 } dl_get_statistics_req_t;
1026 
1027 /*
1028  * DL_GET_STATISTICS_ACK, M_PCPROTO type
1029  */
1030 typedef struct {
1031 	t_uscalar_t	dl_primitive;	/* DL_GET_STATISTICS_ACK */
1032 	t_uscalar_t	dl_stat_length;	/* length of statistics structure */
1033 	t_uscalar_t	dl_stat_offset;	/* offset from start of block */
1034 } dl_get_statistics_ack_t;
1035 
1036 /*
1037  *	Solaris specific local management service primitives
1038  */
1039 
1040 /*
1041  * DL_NOTIFY_REQ, M_PROTO type
1042  */
1043 typedef struct {
1044 	t_uscalar_t	dl_primitive;	/* set to DL_NOTIFY_REQ */
1045 	uint32_t	dl_notifications; /* Requested set of notifications */
1046 	uint32_t	dl_timelimit;	/* In milliseconds */
1047 } dl_notify_req_t;
1048 
1049 /*
1050  * DL_NOTIFY_ACK, M_PROTO type
1051  */
1052 typedef struct {
1053 	t_uscalar_t	dl_primitive;	/* set to DL_NOTIFY_ACK */
1054 	uint32_t	dl_notifications; /* Supported set of notifications */
1055 } dl_notify_ack_t;
1056 
1057 /*
1058  * DL_NOTIFY_IND, M_PROTO type
1059  */
1060 typedef struct {
1061 	t_uscalar_t	dl_primitive;	/* set to DL_NOTIFY_IND */
1062 	uint32_t	dl_notification; /* Which notification? */
1063 	uint32_t	dl_data;	/* notification specific */
1064 	t_uscalar_t	dl_addr_length;	/* length of complete DLSAP addr */
1065 	t_uscalar_t	dl_addr_offset;	/* offset from start of M_PROTO */
1066 } dl_notify_ind_t;
1067 
1068 /*
1069  * DL_AGGR_REQ, M_PROTO type
1070  */
1071 typedef struct {
1072 	t_uscalar_t	dl_primitive;	/* set to DL_AGGR_REQ */
1073 	uint32_t	dl_key;		/* Key identifying the group */
1074 	uint32_t	dl_port;	/* Identifying the NIC */
1075 	t_uscalar_t	dl_addr_length;	/* length of PHYS addr addr */
1076 	t_uscalar_t	dl_addr_offset;	/* offset from start of M_PROTO */
1077 } dl_aggr_req_t;
1078 
1079 /*
1080  * DL_AGGR_IND, M_PROTO type
1081  */
1082 typedef struct {
1083 	t_uscalar_t	dl_primitive;	/* set to DL_AGGR_IND */
1084 	uint32_t	dl_key;		/* Key identifying the group */
1085 	uint32_t	dl_port;	/* Identifying the NIC */
1086 	t_uscalar_t	dl_addr_length;	/* length of PHYS addr */
1087 	t_uscalar_t	dl_addr_offset;	/* offset from start of M_PROTO */
1088 } dl_aggr_ind_t;
1089 
1090 /*
1091  * DL_UNAGGR_REQ, M_PROTO type
1092  */
1093 typedef struct {
1094 	t_uscalar_t	dl_primitive;	/* set to DL_UNAGGR_REQ */
1095 	uint32_t	dl_key;		/* Key identifying the group */
1096 	uint32_t	dl_port;	/* Identifying the NIC */
1097 	t_uscalar_t	dl_addr_length;	/* length of PHYS addr */
1098 	t_uscalar_t	dl_addr_offset;	/* offset from start of M_PROTO */
1099 } dl_unaggr_req_t;
1100 
1101 /*
1102  * DL_CAPABILITY_REQ, M_PROTO type
1103  */
1104 typedef struct {
1105 	t_uscalar_t	dl_primitive;	/* DL_CAPABILITY_REQ */
1106 	t_uscalar_t	dl_sub_offset;	/* options offset */
1107 	t_uscalar_t	dl_sub_length;	/* options length */
1108 	/* Followed by a list of zero or more dl_capability_sub_t */
1109 } dl_capability_req_t;
1110 
1111 /*
1112  * DL_CAPABILITY_ACK, M_PROTO type
1113  */
1114 typedef struct {
1115 	t_uscalar_t	dl_primitive;	/* DL_CAPABILITY_ACK */
1116 	t_uscalar_t	dl_sub_offset;	/* options offset */
1117 	t_uscalar_t	dl_sub_length;	/* options length */
1118 	/* Followed by a list of zero or more dl_capability_sub_t */
1119 } dl_capability_ack_t;
1120 
1121 /*
1122  * DL_CONTROL_REQ, M_PROTO type
1123  */
1124 typedef struct {
1125 	t_uscalar_t	dl_primitive;	/* DL_CONTROL_REQ */
1126 	t_uscalar_t	dl_operation;	/* add/delete/purge */
1127 	t_uscalar_t	dl_type;	/* e.g. AH/ESP/ ... */
1128 	t_uscalar_t	dl_key_offset;	/* offset of key */
1129 	t_uscalar_t	dl_key_length;	/* length of key */
1130 	t_uscalar_t	dl_data_offset;	/* offset of data */
1131 	t_uscalar_t	dl_data_length;	/* length of data */
1132 } dl_control_req_t;
1133 
1134 /*
1135  * DL_CONTROL_ACK, M_PROTO type
1136  */
1137 typedef struct {
1138 	t_uscalar_t	dl_primitive;	/* DL_CONTROL_ACK */
1139 	t_uscalar_t	dl_operation;	/* add/delete/purge */
1140 	t_uscalar_t	dl_type;	/* e.g. AH/ESP/ ... */
1141 	t_uscalar_t	dl_key_offset;	/* offset of key */
1142 	t_uscalar_t	dl_key_length;	/* length of key */
1143 	t_uscalar_t	dl_data_offset;	/* offset of data */
1144 	t_uscalar_t	dl_data_length;	/* length of data */
1145 } dl_control_ack_t;
1146 
1147 /*
1148  * DL_PASSIVE_REQ, M_PROTO type
1149  */
1150 typedef struct {
1151 	t_uscalar_t	dl_primitive;
1152 } dl_passive_req_t;
1153 
1154 /*
1155  *	DL_INTR_MODE_REQ, M_PROTO type
1156  */
1157 typedef struct {
1158 	t_uscalar_t	dl_primitive;
1159 	t_uscalar_t	dl_sap;
1160 	t_uscalar_t	dl_imode;	/* intr mode: 0 off  1 on */
1161 } dl_intr_mode_req_t;
1162 
1163 /*
1164  *	CONNECTION-ORIENTED SERVICE PRIMITIVES
1165  */
1166 
1167 /*
1168  * DL_CONNECT_REQ, M_PROTO type
1169  */
1170 typedef struct {
1171 	t_uscalar_t	dl_primitive;		/* DL_CONNECT_REQ */
1172 	t_uscalar_t	dl_dest_addr_length;	/* len. of dlsap addr */
1173 	t_uscalar_t	dl_dest_addr_offset;	/* offset */
1174 	t_uscalar_t	dl_qos_length;		/* len. of QOS parm val */
1175 	t_uscalar_t	dl_qos_offset;		/* offset */
1176 	t_uscalar_t	dl_growth;		/* set to zero */
1177 } dl_connect_req_t;
1178 
1179 /*
1180  * DL_CONNECT_IND, M_PROTO type
1181  */
1182 typedef struct {
1183 	t_uscalar_t	dl_primitive;		/* DL_CONNECT_IND */
1184 	t_uscalar_t	dl_correlation;		/* provider's correl. token */
1185 	t_uscalar_t	dl_called_addr_length;  /* length of called address */
1186 	t_uscalar_t	dl_called_addr_offset;	/* offset from start of block */
1187 	t_uscalar_t	dl_calling_addr_length;	/* length of calling address */
1188 	t_uscalar_t	dl_calling_addr_offset;	/* offset from start of block */
1189 	t_uscalar_t	dl_qos_length;		/* length of qos structure */
1190 	t_uscalar_t	dl_qos_offset;		/* offset from start of block */
1191 	t_uscalar_t	dl_growth;		/* set to zero */
1192 } dl_connect_ind_t;
1193 
1194 /*
1195  * DL_CONNECT_RES, M_PROTO type
1196  */
1197 typedef struct {
1198 	t_uscalar_t	dl_primitive;	/* DL_CONNECT_RES */
1199 	t_uscalar_t	dl_correlation; /* provider's correlation token */
1200 	t_uscalar_t	dl_resp_token;	/* token of responding stream */
1201 	t_uscalar_t	dl_qos_length;  /* length of qos structure */
1202 	t_uscalar_t	dl_qos_offset;	/* offset from start of block */
1203 	t_uscalar_t	dl_growth;	/* set to zero */
1204 } dl_connect_res_t;
1205 
1206 /*
1207  * DL_CONNECT_CON, M_PROTO type
1208  */
1209 typedef struct {
1210 	t_uscalar_t	dl_primitive;		/* DL_CONNECT_CON */
1211 	t_uscalar_t	dl_resp_addr_length;	/* responder's address len */
1212 	t_uscalar_t	dl_resp_addr_offset;	/* offset from start of block */
1213 	t_uscalar_t	dl_qos_length;		/* length of qos structure */
1214 	t_uscalar_t	dl_qos_offset;		/* offset from start of block */
1215 	t_uscalar_t	dl_growth;		/* set to zero */
1216 } dl_connect_con_t;
1217 
1218 /*
1219  * DL_TOKEN_REQ, M_PCPROTO type
1220  */
1221 typedef struct {
1222 	t_uscalar_t	dl_primitive;	/* DL_TOKEN_REQ */
1223 } dl_token_req_t;
1224 
1225 /*
1226  * DL_TOKEN_ACK, M_PCPROTO type
1227  */
1228 typedef struct {
1229 	t_uscalar_t	dl_primitive;	/* DL_TOKEN_ACK */
1230 	t_uscalar_t	dl_token;	/* Connection response token */
1231 }dl_token_ack_t;
1232 
1233 /*
1234  * DL_DISCONNECT_REQ, M_PROTO type
1235  */
1236 typedef struct {
1237 	t_uscalar_t	dl_primitive;	/* DL_DISCONNECT_REQ */
1238 	t_uscalar_t	dl_reason;	/* norm., abnorm., perm. or trans. */
1239 	t_uscalar_t	dl_correlation; /* association with connect_ind */
1240 } dl_disconnect_req_t;
1241 
1242 /*
1243  * DL_DISCONNECT_IND, M_PROTO type
1244  */
1245 typedef struct {
1246 	t_uscalar_t	dl_primitive;	/* DL_DISCONNECT_IND */
1247 	t_uscalar_t	dl_originator;	/* USER or PROVIDER */
1248 	t_uscalar_t	dl_reason;	/* permanent or transient */
1249 	t_uscalar_t	dl_correlation;	/* association with connect_ind */
1250 } dl_disconnect_ind_t;
1251 
1252 /*
1253  * DL_RESET_REQ, M_PROTO type
1254  */
1255 typedef struct {
1256 	t_uscalar_t	dl_primitive;	/* DL_RESET_REQ */
1257 } dl_reset_req_t;
1258 
1259 /*
1260  * DL_RESET_IND, M_PROTO type
1261  */
1262 typedef struct {
1263 	t_uscalar_t	dl_primitive;	/* DL_RESET_IND */
1264 	t_uscalar_t	dl_originator;	/* Provider or User */
1265 	t_uscalar_t	dl_reason;	/* flow control, link error, resync */
1266 } dl_reset_ind_t;
1267 
1268 /*
1269  * DL_RESET_RES, M_PROTO type
1270  */
1271 typedef struct {
1272 	t_uscalar_t	dl_primitive;		/* DL_RESET_RES */
1273 } dl_reset_res_t;
1274 
1275 /*
1276  * DL_RESET_CON, M_PROTO type
1277  */
1278 typedef struct {
1279 	t_uscalar_t	dl_primitive;		/* DL_RESET_CON */
1280 } dl_reset_con_t;
1281 
1282 
1283 /*
1284  *	CONNECTIONLESS SERVICE PRIMITIVES
1285  */
1286 
1287 /*
1288  * DL_UNITDATA_REQ, M_PROTO type, with M_DATA block(s)
1289  */
1290 typedef struct {
1291 	t_uscalar_t	dl_primitive;		/* DL_UNITDATA_REQ */
1292 	t_uscalar_t	dl_dest_addr_length;	/* DLSAP length of dest. user */
1293 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1294 	dl_priority_t	dl_priority;	/* priority value */
1295 } dl_unitdata_req_t;
1296 
1297 /*
1298  * DL_UNITDATA_IND, M_PROTO type, with M_DATA block(s)
1299  */
1300 typedef struct {
1301 	t_uscalar_t	dl_primitive;		/* DL_UNITDATA_IND */
1302 	t_uscalar_t	dl_dest_addr_length;	/* DLSAP length of dest. user */
1303 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1304 	t_uscalar_t	dl_src_addr_length;	/* DLSAP addr length sender */
1305 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1306 	t_uscalar_t	dl_group_address;	/* one if multicast/broadcast */
1307 } dl_unitdata_ind_t;
1308 
1309 /*
1310  * DL_UDERROR_IND, M_PROTO type
1311  *	(or M_PCPROTO type if LLI-based provider)
1312  */
1313 typedef struct {
1314 	t_uscalar_t	dl_primitive;		/* DL_UDERROR_IND */
1315 	t_uscalar_t	dl_dest_addr_length;	/* Destination DLSAP */
1316 	t_uscalar_t	dl_dest_addr_offset;	/* Offset from start of block */
1317 	t_uscalar_t	dl_unix_errno;		/* unix system error code */
1318 	t_uscalar_t	dl_errno;		/* DLPI error code */
1319 } dl_uderror_ind_t;
1320 
1321 /*
1322  * DL_UDQOS_REQ, M_PROTO type
1323  */
1324 typedef struct {
1325 	t_uscalar_t	dl_primitive;	/* DL_UDQOS_REQ */
1326 	t_uscalar_t	dl_qos_length;	/* requested qos byte length */
1327 	t_uscalar_t	dl_qos_offset;	/* offset from start of block */
1328 } dl_udqos_req_t;
1329 
1330 /*
1331  *	Primitives to handle XID and TEST operations
1332  */
1333 
1334 /*
1335  * DL_TEST_REQ, M_PROTO type
1336  */
1337 typedef struct {
1338 	t_uscalar_t	dl_primitive;		/* DL_TEST_REQ */
1339 	t_uscalar_t	dl_flag;		/* poll/final */
1340 	t_uscalar_t	dl_dest_addr_length;	/* DLSAP length of dest. user */
1341 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1342 } dl_test_req_t;
1343 
1344 /*
1345  * DL_TEST_IND, M_PROTO type
1346  */
1347 typedef struct {
1348 	t_uscalar_t	dl_primitive;		/* DL_TEST_IND */
1349 	t_uscalar_t	dl_flag;		/* poll/final */
1350 	t_uscalar_t	dl_dest_addr_length;	/* dlsap length of dest. user */
1351 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1352 	t_uscalar_t	dl_src_addr_length;	/* dlsap length of source */
1353 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1354 } dl_test_ind_t;
1355 
1356 /*
1357  *	DL_TEST_RES, M_PROTO type
1358  */
1359 typedef struct {
1360 	t_uscalar_t	dl_primitive;		/* DL_TEST_RES */
1361 	t_uscalar_t	dl_flag;		/* poll/final */
1362 	t_uscalar_t	dl_dest_addr_length;	/* DLSAP length of dest. user */
1363 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1364 } dl_test_res_t;
1365 
1366 /*
1367  *	DL_TEST_CON, M_PROTO type
1368  */
1369 typedef struct {
1370 	t_uscalar_t	dl_primitive;		/* DL_TEST_CON */
1371 	t_uscalar_t	dl_flag;		/* poll/final */
1372 	t_uscalar_t	dl_dest_addr_length;	/* dlsap length of dest. user */
1373 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1374 	t_uscalar_t	dl_src_addr_length;	/* dlsap length of source */
1375 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1376 } dl_test_con_t;
1377 
1378 /*
1379  * DL_XID_REQ, M_PROTO type
1380  */
1381 typedef struct {
1382 	t_uscalar_t	dl_primitive;		/* DL_XID_REQ */
1383 	t_uscalar_t	dl_flag;		/* poll/final */
1384 	t_uscalar_t	dl_dest_addr_length;	/* dlsap length of dest. user */
1385 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1386 } dl_xid_req_t;
1387 
1388 /*
1389  * DL_XID_IND, M_PROTO type
1390  */
1391 typedef struct {
1392 	t_uscalar_t	dl_primitive;		/* DL_XID_IND */
1393 	t_uscalar_t	dl_flag;		/* poll/final */
1394 	t_uscalar_t	dl_dest_addr_length;	/* dlsap length of dest. user */
1395 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1396 	t_uscalar_t	dl_src_addr_length;	/* dlsap length of source */
1397 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1398 } dl_xid_ind_t;
1399 
1400 /*
1401  *	DL_XID_RES, M_PROTO type
1402  */
1403 typedef struct {
1404 	t_uscalar_t	dl_primitive;		/* DL_XID_RES */
1405 	t_uscalar_t	dl_flag;		/* poll/final */
1406 	t_uscalar_t	dl_dest_addr_length;	/* DLSAP length of dest. user */
1407 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1408 } dl_xid_res_t;
1409 
1410 /*
1411  *	DL_XID_CON, M_PROTO type
1412  */
1413 typedef struct {
1414 	t_uscalar_t	dl_primitive;		/* DL_XID_CON */
1415 	t_uscalar_t	dl_flag;		/* poll/final */
1416 	t_uscalar_t	dl_dest_addr_length;	/* dlsap length of dest. user */
1417 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1418 	t_uscalar_t	dl_src_addr_length;	/* dlsap length of source */
1419 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1420 } dl_xid_con_t;
1421 
1422 /*
1423  *	ACKNOWLEDGED CONNECTIONLESS SERVICE PRIMITIVES
1424  */
1425 
1426 /*
1427  * DL_DATA_ACK_REQ, M_PROTO type
1428  */
1429 typedef struct {
1430 	t_uscalar_t	dl_primitive;		/* DL_DATA_ACK_REQ */
1431 	t_uscalar_t	dl_correlation;		/* User's correlation token */
1432 	t_uscalar_t	dl_dest_addr_length;	/* length of destination addr */
1433 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1434 	t_uscalar_t	dl_src_addr_length;	/* length of source address */
1435 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1436 	t_uscalar_t	dl_priority;		/* priority */
1437 	t_uscalar_t	dl_service_class;	/* DL_RQST_RSP|DL_RQST_NORSP */
1438 } dl_data_ack_req_t;
1439 
1440 /*
1441  * DL_DATA_ACK_IND, M_PROTO type
1442  */
1443 typedef struct {
1444 	t_uscalar_t	dl_primitive;		/* DL_DATA_ACK_IND */
1445 	t_uscalar_t	dl_dest_addr_length;	/* length of destination addr */
1446 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1447 	t_uscalar_t	dl_src_addr_length;	/* length of source address */
1448 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1449 	t_uscalar_t	dl_priority;		/* pri. for data unit transm. */
1450 	t_uscalar_t	dl_service_class;	/* DL_RQST_RSP|DL_RQST_NORSP */
1451 } dl_data_ack_ind_t;
1452 
1453 /*
1454  * DL_DATA_ACK_STATUS_IND, M_PROTO type
1455  */
1456 typedef struct {
1457 	t_uscalar_t	dl_primitive;	/* DL_DATA_ACK_STATUS_IND */
1458 	t_uscalar_t	dl_correlation;	/* User's correlation token */
1459 	t_uscalar_t	dl_status;	/* success or failure of previous req */
1460 } dl_data_ack_status_ind_t;
1461 
1462 /*
1463  * DL_REPLY_REQ, M_PROTO type
1464  */
1465 typedef struct {
1466 	t_uscalar_t	dl_primitive;		/* DL_REPLY_REQ */
1467 	t_uscalar_t	dl_correlation;		/* User's correlation token */
1468 	t_uscalar_t	dl_dest_addr_length;	/* destination address length */
1469 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1470 	t_uscalar_t	dl_src_addr_length;	/* source address length */
1471 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1472 	t_uscalar_t	dl_priority;		/* pri for data unit trans. */
1473 	t_uscalar_t	dl_service_class;
1474 } dl_reply_req_t;
1475 
1476 /*
1477  * DL_REPLY_IND, M_PROTO type
1478  */
1479 typedef struct {
1480 	t_uscalar_t	dl_primitive;		/* DL_REPLY_IND */
1481 	t_uscalar_t	dl_dest_addr_length;	/* destination address length */
1482 	t_uscalar_t	dl_dest_addr_offset;	/* offset from start of block */
1483 	t_uscalar_t	dl_src_addr_length;	/* length of source address */
1484 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1485 	t_uscalar_t	dl_priority;		/* pri for data unit trans. */
1486 	t_uscalar_t	dl_service_class;	/* DL_RQST_RSP|DL_RQST_NORSP */
1487 } dl_reply_ind_t;
1488 
1489 /*
1490  * DL_REPLY_STATUS_IND, M_PROTO type
1491  */
1492 typedef struct {
1493 	t_uscalar_t	dl_primitive;	/* DL_REPLY_STATUS_IND */
1494 	t_uscalar_t	dl_correlation;	/* User's correlation token */
1495 	t_uscalar_t	dl_status;	/* success or failure of previous req */
1496 } dl_reply_status_ind_t;
1497 
1498 /*
1499  * DL_REPLY_UPDATE_REQ, M_PROTO type
1500  */
1501 typedef struct {
1502 	t_uscalar_t	dl_primitive;		/* DL_REPLY_UPDATE_REQ */
1503 	t_uscalar_t	dl_correlation;		/* user's correlation token */
1504 	t_uscalar_t	dl_src_addr_length;	/* length of source address */
1505 	t_uscalar_t	dl_src_addr_offset;	/* offset from start of block */
1506 } dl_reply_update_req_t;
1507 
1508 /*
1509  * DL_REPLY_UPDATE_STATUS_IND, M_PROTO type
1510  */
1511 typedef struct {
1512 	t_uscalar_t	dl_primitive;	/* DL_REPLY_UPDATE_STATUS_IND */
1513 	t_uscalar_t	dl_correlation;	/* User's correlation token */
1514 	t_uscalar_t	dl_status;	/* success or failure of previous req */
1515 } dl_reply_update_status_ind_t;
1516 
1517 union DL_primitives {
1518 	t_uscalar_t		dl_primitive;
1519 	dl_info_req_t		info_req;
1520 	dl_info_ack_t		info_ack;
1521 	dl_attach_req_t		attach_req;
1522 	dl_detach_req_t		detach_req;
1523 	dl_bind_req_t		bind_req;
1524 	dl_bind_ack_t		bind_ack;
1525 	dl_unbind_req_t		unbind_req;
1526 	dl_subs_bind_req_t	subs_bind_req;
1527 	dl_subs_bind_ack_t	subs_bind_ack;
1528 	dl_subs_unbind_req_t	subs_unbind_req;
1529 	dl_ok_ack_t		ok_ack;
1530 	dl_error_ack_t		error_ack;
1531 	dl_connect_req_t	connect_req;
1532 	dl_connect_ind_t	connect_ind;
1533 	dl_connect_res_t	connect_res;
1534 	dl_connect_con_t	connect_con;
1535 	dl_token_req_t		token_req;
1536 	dl_token_ack_t		token_ack;
1537 	dl_disconnect_req_t	disconnect_req;
1538 	dl_disconnect_ind_t	disconnect_ind;
1539 	dl_reset_req_t		reset_req;
1540 	dl_reset_ind_t		reset_ind;
1541 	dl_reset_res_t		reset_res;
1542 	dl_reset_con_t		reset_con;
1543 	dl_unitdata_req_t	unitdata_req;
1544 	dl_unitdata_ind_t	unitdata_ind;
1545 	dl_uderror_ind_t	uderror_ind;
1546 	dl_udqos_req_t		udqos_req;
1547 	dl_enabmulti_req_t	enabmulti_req;
1548 	dl_disabmulti_req_t	disabmulti_req;
1549 	dl_promiscon_req_t	promiscon_req;
1550 	dl_promiscoff_req_t	promiscoff_req;
1551 	dl_phys_addr_req_t	physaddr_req;
1552 	dl_phys_addr_ack_t	physaddr_ack;
1553 	dl_set_phys_addr_req_t	set_physaddr_req;
1554 	dl_get_statistics_req_t	get_statistics_req;
1555 	dl_get_statistics_ack_t	get_statistics_ack;
1556 	dl_notify_req_t		notify_req;
1557 	dl_notify_ack_t		notify_ack;
1558 	dl_notify_ind_t		notify_ind;
1559 	dl_aggr_req_t		aggr_req;
1560 	dl_aggr_ind_t		aggr_ind;
1561 	dl_unaggr_req_t		unaggr_req;
1562 	dl_test_req_t		test_req;
1563 	dl_test_ind_t		test_ind;
1564 	dl_test_res_t		test_res;
1565 	dl_test_con_t		test_con;
1566 	dl_xid_req_t		xid_req;
1567 	dl_xid_ind_t		xid_ind;
1568 	dl_xid_res_t		xid_res;
1569 	dl_xid_con_t		xid_con;
1570 	dl_data_ack_req_t	data_ack_req;
1571 	dl_data_ack_ind_t	data_ack_ind;
1572 	dl_data_ack_status_ind_t	data_ack_status_ind;
1573 	dl_reply_req_t		reply_req;
1574 	dl_reply_ind_t		reply_ind;
1575 	dl_reply_status_ind_t	reply_status_ind;
1576 	dl_reply_update_req_t	reply_update_req;
1577 	dl_reply_update_status_ind_t	reply_update_status_ind;
1578 	dl_capability_req_t	capability_req;
1579 	dl_capability_ack_t	capability_ack;
1580 	dl_control_req_t	control_req;
1581 	dl_control_ack_t	control_ack;
1582 	dl_passive_req_t	passive_req;
1583 	dl_intr_mode_req_t	intr_mode_req;
1584 };
1585 
1586 #define	DL_INFO_REQ_SIZE	sizeof (dl_info_req_t)
1587 #define	DL_INFO_ACK_SIZE	sizeof (dl_info_ack_t)
1588 #define	DL_ATTACH_REQ_SIZE	sizeof (dl_attach_req_t)
1589 #define	DL_DETACH_REQ_SIZE	sizeof (dl_detach_req_t)
1590 #define	DL_BIND_REQ_SIZE	sizeof (dl_bind_req_t)
1591 #define	DL_BIND_ACK_SIZE	sizeof (dl_bind_ack_t)
1592 #define	DL_UNBIND_REQ_SIZE	sizeof (dl_unbind_req_t)
1593 #define	DL_SUBS_BIND_REQ_SIZE	sizeof (dl_subs_bind_req_t)
1594 #define	DL_SUBS_BIND_ACK_SIZE	sizeof (dl_subs_bind_ack_t)
1595 #define	DL_SUBS_UNBIND_REQ_SIZE	sizeof (dl_subs_unbind_req_t)
1596 #define	DL_OK_ACK_SIZE		sizeof (dl_ok_ack_t)
1597 #define	DL_ERROR_ACK_SIZE	sizeof (dl_error_ack_t)
1598 #define	DL_CONNECT_REQ_SIZE	sizeof (dl_connect_req_t)
1599 #define	DL_CONNECT_IND_SIZE	sizeof (dl_connect_ind_t)
1600 #define	DL_CONNECT_RES_SIZE	sizeof (dl_connect_res_t)
1601 #define	DL_CONNECT_CON_SIZE	sizeof (dl_connect_con_t)
1602 #define	DL_TOKEN_REQ_SIZE	sizeof (dl_token_req_t)
1603 #define	DL_TOKEN_ACK_SIZE	sizeof (dl_token_ack_t)
1604 #define	DL_DISCONNECT_REQ_SIZE	sizeof (dl_disconnect_req_t)
1605 #define	DL_DISCONNECT_IND_SIZE	sizeof (dl_disconnect_ind_t)
1606 #define	DL_RESET_REQ_SIZE	sizeof (dl_reset_req_t)
1607 #define	DL_RESET_IND_SIZE	sizeof (dl_reset_ind_t)
1608 #define	DL_RESET_RES_SIZE	sizeof (dl_reset_res_t)
1609 #define	DL_RESET_CON_SIZE	sizeof (dl_reset_con_t)
1610 #define	DL_UNITDATA_REQ_SIZE	sizeof (dl_unitdata_req_t)
1611 #define	DL_UNITDATA_IND_SIZE	sizeof (dl_unitdata_ind_t)
1612 #define	DL_UDERROR_IND_SIZE	sizeof (dl_uderror_ind_t)
1613 #define	DL_UDQOS_REQ_SIZE	sizeof (dl_udqos_req_t)
1614 #define	DL_ENABMULTI_REQ_SIZE	sizeof (dl_enabmulti_req_t)
1615 #define	DL_DISABMULTI_REQ_SIZE	sizeof (dl_disabmulti_req_t)
1616 #define	DL_PROMISCON_REQ_SIZE	sizeof (dl_promiscon_req_t)
1617 #define	DL_PROMISCOFF_REQ_SIZE	sizeof (dl_promiscoff_req_t)
1618 #define	DL_PHYS_ADDR_REQ_SIZE	sizeof (dl_phys_addr_req_t)
1619 #define	DL_PHYS_ADDR_ACK_SIZE	sizeof (dl_phys_addr_ack_t)
1620 #define	DL_SET_PHYS_ADDR_REQ_SIZE	sizeof (dl_set_phys_addr_req_t)
1621 #define	DL_GET_STATISTICS_REQ_SIZE	sizeof (dl_get_statistics_req_t)
1622 #define	DL_GET_STATISTICS_ACK_SIZE	sizeof (dl_get_statistics_ack_t)
1623 #define	DL_NOTIFY_REQ_SIZE	sizeof (dl_notify_req_t)
1624 #define	DL_NOTIFY_ACK_SIZE	sizeof (dl_notify_ack_t)
1625 #define	DL_NOTIFY_IND_SIZE	sizeof (dl_notify_ind_t)
1626 #define	DL_AGGR_REQ_SIZE	sizeof (dl_aggr_req_t)
1627 #define	DL_AGGR_IND_SIZE	sizeof (dl_aggr_ind_t)
1628 #define	DL_UNAGGR_REQ_SIZE	sizeof (dl_unaggr_req_t)
1629 #define	DL_XID_REQ_SIZE		sizeof (dl_xid_req_t)
1630 #define	DL_XID_IND_SIZE		sizeof (dl_xid_ind_t)
1631 #define	DL_XID_RES_SIZE		sizeof (dl_xid_res_t)
1632 #define	DL_XID_CON_SIZE		sizeof (dl_xid_con_t)
1633 #define	DL_TEST_REQ_SIZE	sizeof (dl_test_req_t)
1634 #define	DL_TEST_IND_SIZE	sizeof (dl_test_ind_t)
1635 #define	DL_TEST_RES_SIZE	sizeof (dl_test_res_t)
1636 #define	DL_TEST_CON_SIZE	sizeof (dl_test_con_t)
1637 #define	DL_DATA_ACK_REQ_SIZE	sizeof (dl_data_ack_req_t)
1638 #define	DL_DATA_ACK_IND_SIZE	sizeof (dl_data_ack_ind_t)
1639 #define	DL_DATA_ACK_STATUS_IND_SIZE	sizeof (dl_data_ack_status_ind_t)
1640 #define	DL_REPLY_REQ_SIZE	sizeof (dl_reply_req_t)
1641 #define	DL_REPLY_IND_SIZE	sizeof (dl_reply_ind_t)
1642 #define	DL_REPLY_STATUS_IND_SIZE	sizeof (dl_reply_status_ind_t)
1643 #define	DL_REPLY_UPDATE_REQ_SIZE	sizeof (dl_reply_update_req_t)
1644 #define	DL_REPLY_UPDATE_STATUS_IND_SIZE	sizeof (dl_reply_update_status_ind_t)
1645 #define	DL_CAPABILITY_REQ_SIZE	sizeof (dl_capability_req_t)
1646 #define	DL_CAPABILITY_ACK_SIZE	sizeof (dl_capability_ack_t)
1647 #define	DL_CONTROL_REQ_SIZE	sizeof (dl_control_req_t)
1648 #define	DL_CONTROL_ACK_SIZE	sizeof (dl_control_ack_t)
1649 #define	DL_PASSIVE_REQ_SIZE	sizeof (dl_passive_req_t)
1650 #define	DL_INTR_MODE_REQ_SIZE	sizeof (dl_intr_mode_req_t)
1651 
1652 #ifdef	_KERNEL
1653 /*
1654  * The following are unstable, internal DLPI utility routines.
1655  */
1656 extern void	dlbindack(queue_t *, mblk_t *, t_scalar_t, void *, t_uscalar_t,
1657 		    t_uscalar_t, t_uscalar_t);
1658 extern void	dlokack(queue_t *, mblk_t *, t_uscalar_t);
1659 extern void	dlerrorack(queue_t *, mblk_t *, t_uscalar_t, t_uscalar_t,
1660 		    t_uscalar_t);
1661 extern void	dluderrorind(queue_t *, mblk_t *, void *, t_uscalar_t,
1662 		    t_uscalar_t, t_uscalar_t);
1663 extern void	dlphysaddrack(queue_t *, mblk_t *, void *, t_uscalar_t);
1664 extern void	dlcapabsetqid(dl_mid_t *, const queue_t *);
1665 extern boolean_t dlcapabcheckqid(const dl_mid_t *, const queue_t *);
1666 extern void	dlnotifyack(queue_t *, mblk_t *, uint32_t);
1667 
1668 /*
1669  * The ldi_handle_t typedef is in <sys/sunldi.h>, which in turn requires
1670  * <sys/sunddi.h>, which pulls in <sys/cmn_err.h>, which declares kernel
1671  * versions of the printf() functions that conflict with the libc ones.
1672  * This causes conflicts when building MDB modules like ARP that #define
1673  * _KERNEL.  So we use `struct __ldi_handle *' instead.
1674  */
1675 struct __ldi_handle;
1676 extern int dl_attach(struct __ldi_handle *, int, dl_error_ack_t *);
1677 extern int dl_bind(struct __ldi_handle *, uint_t, dl_error_ack_t *);
1678 extern int dl_phys_addr(struct __ldi_handle *, uchar_t *, size_t *,
1679     dl_error_ack_t *);
1680 extern int dl_info(struct __ldi_handle *, dl_info_ack_t *, uchar_t *, size_t *,
1681     dl_error_ack_t *);
1682 extern int dl_notify(struct __ldi_handle *, uint32_t *, dl_error_ack_t *);
1683 extern const char *dl_errstr(t_uscalar_t);
1684 extern const char *dl_primstr(t_uscalar_t);
1685 extern const char *dl_mactypestr(t_uscalar_t);
1686 
1687 #endif	/* _KERNEL */
1688 
1689 #ifdef	__cplusplus
1690 }
1691 #endif
1692 
1693 #endif /* _SYS_DLPI_H */
1694