xref: /illumos-gate/usr/src/uts/common/sys/netlb.h (revision 2d6eb4a5)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1992-2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_NETLB_H
28*7c478bd9Sstevel@tonic-gate #define	_NETLB_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
31*7c478bd9Sstevel@tonic-gate extern "C" {
32*7c478bd9Sstevel@tonic-gate #endif
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate /*
35*7c478bd9Sstevel@tonic-gate  * The following ioctls may be implemented by any network driver
36*7c478bd9Sstevel@tonic-gate  * that provides loopback functionality.
37*7c478bd9Sstevel@tonic-gate  */
38*7c478bd9Sstevel@tonic-gate #define	LB_IOC			('U' << 8)
39*7c478bd9Sstevel@tonic-gate #define	LB_GET_INFO_SIZE	(LB_IOC|0)	/* Get size of loopback info */
40*7c478bd9Sstevel@tonic-gate #define	LB_GET_INFO		(LB_IOC|1)	/* Get loopback info table   */
41*7c478bd9Sstevel@tonic-gate #define	LB_GET_MODE		(LB_IOC|2)	/* Get current loopback mode */
42*7c478bd9Sstevel@tonic-gate #define	LB_SET_MODE		(LB_IOC|3)	/* Set current loopback mode */
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate /*
45*7c478bd9Sstevel@tonic-gate  * The 'loopback info' is a table (array) of available loopback modes.
46*7c478bd9Sstevel@tonic-gate  * Each has a generic type (normal/external/internal), a name (e.g. the
47*7c478bd9Sstevel@tonic-gate  * speed or style of loopback implemented), and a key value, used in the
48*7c478bd9Sstevel@tonic-gate  * GET_MODE and SET_MODE commands.
49*7c478bd9Sstevel@tonic-gate  *
50*7c478bd9Sstevel@tonic-gate  * So, a loopback-test program could:
51*7c478bd9Sstevel@tonic-gate  *	open the network device
52*7c478bd9Sstevel@tonic-gate  *	use the LB_GET_INFO_SIZE ioctl (parameter: &size)
53*7c478bd9Sstevel@tonic-gate  *		to find the size of the info array
54*7c478bd9Sstevel@tonic-gate  *	allocate some space for the info array
55*7c478bd9Sstevel@tonic-gate  *	use the LB_GET_INFO ioctl (parameter: infoptr)
56*7c478bd9Sstevel@tonic-gate  *		to get the whole info array
57*7c478bd9Sstevel@tonic-gate  *	search the array for a particular type of loopback (e.g. internal),
58*7c478bd9Sstevel@tonic-gate  *	or display all the available modes for the user to select one
59*7c478bd9Sstevel@tonic-gate  *	use the LB_GET_MODE ioctl (parameter: &oldmode)
60*7c478bd9Sstevel@tonic-gate  *		to get the current mode
61*7c478bd9Sstevel@tonic-gate  *	use the LB_SET_MODE ioctl (parameter: &newmode)
62*7c478bd9Sstevel@tonic-gate  *		to set the new mode
63*7c478bd9Sstevel@tonic-gate  *	perform the test(s)
64*7c478bd9Sstevel@tonic-gate  *	use the LB_SET_MODE ioctl (parameter: &oldmode)
65*7c478bd9Sstevel@tonic-gate  *		to restore the new mode
66*7c478bd9Sstevel@tonic-gate  */
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate typedef uint32_t lb_info_sz_t;
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate typedef enum {
71*7c478bd9Sstevel@tonic-gate 	normal,
72*7c478bd9Sstevel@tonic-gate 	external,
73*7c478bd9Sstevel@tonic-gate 	internal
74*7c478bd9Sstevel@tonic-gate } lb_type_t;
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate typedef struct _lb_property_t {
77*7c478bd9Sstevel@tonic-gate 	lb_type_t	lb_type;
78*7c478bd9Sstevel@tonic-gate 	char		key[16];
79*7c478bd9Sstevel@tonic-gate 	uint32_t	value;
80*7c478bd9Sstevel@tonic-gate } lb_property_t, *p_lb_property_t;
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
83*7c478bd9Sstevel@tonic-gate }
84*7c478bd9Sstevel@tonic-gate #endif
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate #endif /* _NETLB_H */
87