xref: /freebsd/share/man/man4/vlan.4 (revision 2b743a9e9ddc6736208dc8ca1ce06ce64ad20a19)
1.\"
2.\" Copyright (c) 2001 Yar Tikhiy
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd December 13, 2006
29.Dt VLAN 4
30.Os
31.Sh NAME
32.Nm vlan
33.Nd "IEEE 802.1Q VLAN network interface"
34.Sh SYNOPSIS
35To compile this driver into the kernel,
36place the following lines in your
37kernel configuration file:
38.Bd -ragged -offset indent
39.Cd "device miibus"
40.Cd "device vlan"
41.Ed
42.Pp
43Alternatively, to load the driver as a
44module at boot time, place the following line in
45.Xr loader.conf 5 :
46.Bd -literal -offset indent
47if_vlan_load="YES"
48.Ed
49.Sh DESCRIPTION
50The
51.Nm
52driver demultiplexes frames tagged according to
53the IEEE 802.1Q standard into logical
54.Nm
55network interfaces, which allows routing/bridging between
56multiple VLANs through a single switch trunk port.
57.Pp
58Each
59.Nm
60interface is created at runtime using interface cloning.
61This is
62most easily done with the
63.Xr ifconfig 8
64.Cm create
65command or using the
66.Va cloned_interfaces
67variable in
68.Xr rc.conf 5 .
69.Pp
70To function, a
71.Nm
72interface must be assigned a parent interface and
73numeric VLAN tag using
74.Xr ifconfig 8 .
75A single parent can be assigned to multiple
76.Nm
77interfaces provided they have different tags.
78The parent interface is likely to be an Ethernet card connected
79to a properly configured switch port.
80The VLAN tag should match one of those set up in the switched
81network.
82.Pp
83Initially
84.Nm
85assumes the same minimum length for tagged and untagged frames.
86This mode is selected by the
87.Xr sysctl 8
88variable
89.Va net.link.vlan.soft_pad
90set to 0 (default).
91However, there are network devices that fail to adjust frame length,
92should it fall below the allowed minimum due to untagging.
93Such devices should be able to interoperate with
94.Nm
95after changing the value of
96.Va net.link.vlan.soft_pad
97to 1.
98In the latter mode,
99.Nm
100will pad short frames before tagging them
101so that their length stays not less than the minimum value
102after untagging by the non-compliant devices.
103.Sh HARDWARE
104The
105.Nm
106driver supports efficient operation over parent interfaces that can provide
107help in processing VLANs.
108Such interfaces are automatically recognized by their capabilities.
109Depending on the level of sophistication found in a physical
110interface, it may do full VLAN processing or just be able to
111receive and transmit frames exceeding the maximum Ethernet frame size
112by the length of a 802.1Q header.
113The capabilities may be user-controlled by the respective parameters to
114.Xr ifconfig 8 ,
115.Cm vlanhwtag
116and
117.Cm vlanmtu .
118However, a physical interface is not obliged to react to them:
119It may have either capability enabled permanently without
120a way to turn it off.
121The whole issue is very specific to a particular device and its driver.
122.Pp
123By now, the list of physical interfaces able of full VLAN processing
124in the hardware is limited to the following devices:
125.Xr bge 4 ,
126.Xr em 4 ,
127.Xr ixgb 4 ,
128.Xr msk 4 ,
129.Xr nge 4 ,
130.Xr re 4 ,
131.Xr stge 4 ,
132.Xr ti 4 ,
133.Xr txp 4 ,
134and
135.Xr vge 4 .
136.Pp
137The rest of the Ethernet interfaces can run
138VLANs using software emulation in the
139.Nm
140driver.
141However, most of them lack the capability
142of transmitting and receiving oversized frames.
143Assigning such an interface as the parent to
144.Nm
145will result in a reduced MTU on the corresponding
146.Nm
147interfaces.
148In the modern Internet, this is likely to cause
149.Xr tcp 4
150connectivity problems due to massive, inadequate
151.Xr icmp 4
152filtering that breaks the Path MTU Discovery mechanism.
153.Pp
154The interfaces that support oversized frames are as follows:
155.Bl -tag -width ".Xr fxp 4 " -offset indent
156.It Xr bfe 4
157supports long frames for
158.Nm
159natively.
160.It Xr dc 4
161supports long frames for
162.Nm
163natively.
164.It Xr de 4
165requires defining
166.Dv BIG_PACKET
167in the
168.Pa /usr/src/sys/pci/if_de.c
169source file and rebuilding the kernel
170or module.
171The hack works only for the 21041, 21140, and 21140A chips.
172.It Xr fxp 4
173supports long frames for
174.Nm
175natively.
176.It Xr gem 4
177supports long frames for
178.Nm
179natively.
180.It Xr hme 4
181supports long frames for
182.Nm
183natively.
184.It Xr le 4
185supports long frames for
186.Nm
187natively.
188.It Xr rl 4
189supports long frames for
190.Nm
191natively.
192.It Xr sis 4
193supports long frames for
194.Nm
195natively.
196.It Xr sk 4
197supports long frames for
198.Nm
199natively.
200.It Xr ste 4
201supports long frames for
202.Nm
203natively.
204.It Xr tl 4
205has support for long frames.
206.It Xr tx 4
207supports long frames for
208.Nm
209natively.
210.It Xr xl 4
211supports long frames only if the card is built on a newer chip
212(Cyclone and above).
213.El
214.Pp
215The
216.Nm
217driver automatically recognizes devices that natively support oversized frames
218for
219.Nm
220use and calculates the appropriate frame MTU based on the
221capabilities of the parent interface.
222The other interfaces listed above can handle oversized frames,
223but they do not advertise this ability of theirs.
224The MTU setting on
225.Nm
226can be corrected manually if used in conjunction with such parent interface.
227.Sh SEE ALSO
228.Xr kqueue 2 ,
229.Xr miibus 4 ,
230.Xr ifconfig 8 ,
231.Xr sysctl 8
232.Sh BUGS
233No 802.1Q features except VLAN tagging are implemented.
234.Pp
235.Dv EVFILT_NETDEV
236events on a
237.Nm
238interface will be sent through
239.Xr kqueue 2
240only if the parent interface uses
241.Xr miibus 4
242for link state notification.
243