summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/dld.h
blob: 71555d364bc59a3e3d61117ca692e7b793d0dde6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_SYS_DLD_H
#define	_SYS_DLD_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/*
 * Data-Link Driver (public header).
 */

#include <sys/types.h>
#include <sys/stream.h>
#include <sys/mac.h>
#include <sys/dls.h>
#include <net/if.h>

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * Data-Link Driver Information (text emitted by modinfo(1m))
 */
#define	DLD_INFO	"Data-Link Driver v%I%"

#define	DLD_MAX_PPA	999
#define	DLD_MAX_MINOR	(DLD_MAX_PPA + 1)

/*
 * Options: To enable an option set the property name to a non-zero value
 *	    in kernel/drv/dld.conf.
 */

/*
 * Prevent use of the IP fast-path (direct M_DATA transmit).
 */
#define	DLD_PROP_NO_FASTPATH	"no-fastpath"

/*
 * Prevent advertising of the DL_CAPAB_POLL capability.
 */
#define	DLD_PROP_NO_POLL	"no-poll"

/*
 * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
 */
#define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"

/*
 * Prevent advertising of the DL_CAPAB_SOFTRING capability.
 */
#define	DLD_PROP_NO_SOFTRING	"no-softring"

/*
 * The name of the driver.
 */
#define	DLD_DRIVER_NAME		"dld"

/*
 * The name of the control minor node of dld.
 */
#define	DLD_CONTROL_MINOR_NAME	"ctl"
#define	DLD_CONTROL_MINOR	0
#define	DLD_CONTROL_DEV		"/devices/pseudo/" DLD_DRIVER_NAME "@0:" \
				DLD_CONTROL_MINOR_NAME

/*
 * IOCTL codes and data structures.
 */
#define	DLDIOC		('D' << 24 | 'L' << 16 | 'D' << 8)

#define	DLDIOCATTR	(DLDIOC | 0x03)

typedef struct dld_ioc_attr {
	char		dia_name[IFNAMSIZ];
	char		dia_dev[MAXNAMELEN];
	uint_t		dia_max_sdu;
	uint16_t	dia_vid;
} dld_ioc_attr_t;

#define	DLDIOCVLAN	(DLDIOC | 0x04)

typedef struct dld_ioc_vlan {
	char		div_name[IFNAMSIZ];
	uint_t		div_count;
} dld_ioc_vlan_t;

typedef struct dld_vlan_info {
	char		dvi_name[IFNAMSIZ];
} dld_vlan_info_t;

typedef struct dld_hold_vlan {
	char		dhv_name[IFNAMSIZ];
	zoneid_t	dhv_zid;
	boolean_t	dhv_docheck;
} dld_hold_vlan_t;

/*
 * Secure objects ioctls
 */
typedef enum {
	DLD_SECOBJ_CLASS_WEP = 1,
	DLD_SECOBJ_CLASS_WPA
} dld_secobj_class_t;

#define	DLD_SECOBJ_OPT_CREATE	0x00000001
#define	DLD_SECOBJ_NAME_MAX	32
#define	DLD_SECOBJ_VAL_MAX	256
typedef struct dld_secobj {
	char			so_name[DLD_SECOBJ_NAME_MAX];
	dld_secobj_class_t	so_class;
	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
	uint_t			so_len;
} dld_secobj_t;

#define	DLDIOCSECOBJSET		(DLDIOC | 0x05)
typedef struct dld_ioc_secobj_set {
	dld_secobj_t		ss_obj;
	uint_t			ss_flags;
} dld_ioc_secobj_set_t;

#define	DLDIOCSECOBJGET		(DLDIOC | 0x06)
typedef struct dld_ioc_secobj_get {
	dld_secobj_t		sg_obj;
	uint_t			sg_count;
} dld_ioc_secobj_get_t;

#define	DLDIOCSECOBJUNSET	(DLDIOC | 0x07)
typedef struct dld_ioc_secobj_unset {
	char			su_name[DLD_SECOBJ_NAME_MAX];
} dld_ioc_secobj_unset_t;

/*
 * DLDIOCHOLDVLAN/DLDIOCRELEVLAN are added to support a "hold/release"
 * operation on a VLAN. A hold will cause a VLAN to be created or the
 * reference count will be increased, release will do the reverse.
 */
#define	DLDIOCHOLDVLAN  (DLDIOC | 0x08)

#define	DLDIOCRELEVLAN  (DLDIOC | 0x09)

#define	DLDIOCZIDGET	(DLDIOC | 0x0a)

#ifdef _KERNEL
int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
int	dld_close(queue_t *);
void	dld_wput(queue_t *, mblk_t *);
void	dld_wsrv(queue_t *);
void	dld_init_ops(struct dev_ops *, const char *);
void	dld_fini_ops(struct dev_ops *);
#endif

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_DLD_H */