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