Title: Virtual Local Area Networks
1Virtual Local Area Networks
- A look at how the Intel 82573L nic supports IEEE
standard 802.1q for ethernet VLANs
2What is a LAN?
switched hub
All the workstations and servers which are
physically connected via switches and hubs
would comprise the Local Area Network When a
broadcast-packet gets transmitted by ANY station
on the LAN, it gets received by ALL of the
other stations on that LAN
3Dividing the network traffic
switched hub
switched hub
In order to physically segregate the network
traffic -- and reduce the congestion caused by
broadcast-packets going to all the stations --
the network manager needs to purchase a separate
switched hub.
4What is a Virtual LAN?
switched hub
Different subsets of the stations belonging to
the same physical LAN can remain logically
interconnected, while at the same time being
kept logically separate from stations which do
not share membership in a designated subset
all without the need to buy another switch
5IEEE 802.1q
- A standard way for implementing VLANs was
promulgated by the IEEE in 1997, so nowadays most
network controllers would provide optional
built-in hardware support for VLAN controls based
on this standard - The mechanism involves tagging packets with a
small amount of extra information, then using
that information to do filtering of tagged
packets as they are received
6Ethernet-frame tagging
Standard IEEE 802.3 Ethernet Frame format
preamble
SFD
DA
SA
T/L
data
CRC
delay
SFD (Start-of-Frame Deliniter)
Extra information is inserted
preamble
SFD
DA
SA
T/L
data
CRC
TPID
TAG
delay
TPID (Tag Protocol Identifier) 0x8100
User priority
CFI
VLAN identifier
CFI (Canonical Format Indicator) 0 (for
ethernet)
7User priority values (802.1p)
User priority
Traffic Type
7 (highest)
Network Management
6
Voice (delay lt 10ms)
5
Video (delay lt 100ms)
4
Controlled Load
3
Excellent Effort
2
Undefined
1 (lowest)
Background
0
Best Effort
8Elements for VLAN support
- Device Control register bit 30 (VME)
- Receive Control register bit 18 (VFE)
- VLAN Ether Type register bits 15..0 (VET)
- VLAN Filter-Table Array 0x5600 0x57FF
- Fields within the Tx Descriptors
- Fields within the Rx Descriptors
9Device Control (0x0000)
31 30 29 28 27 26
25 24 23 22 21
20 19 18 17 16
PHY RST
VME
R 0
TFCE
RFCE
RST
R 0
R 0
R 0
R 0
R 0
ADV D3 WUC
R 0
D/UD status
R 0
R 0
15 14 13 12 11
10 9 8 7 6 5
4 3 2 1 0
R 0
R 0
R 0
FRC DPLX
FRC SPD
R 0
SPEED
R 0
S L U
R 0
R 0
R 1
0 0
F D
GIO M D
R 0
FD Full-Duplex SPEED (0010Mbps, 01100Mbps,
101000Mbps, 11reserved) GIOMD GIO Master
Disable ADVD3WUP Advertise Cold Wake Up
Capability SLU Set Link Up D/UD Dock/Undock
status RFCE Rx Flow-Control Enable FRCSPD
Force Speed RST Device Reset TFCE Tx
Flow-Control Enable FRCDPLX Force Duplex PHYRST
Phy Reset VME VLAN Mode Enable
82573L
We must set bit 30 to enable our NICs VLAN
mode operation
10VLAN Ether Type (0x0038)
31
0
0 0 0 0 8 1 0 0
This lower 16-bits of this register specifies
the value that our network controller will
insert as the 2-byte Tag Protocol Identifier
(TPID) field. (This standard value of 0x8100
will be recognized by other hardware as
signifiying that an ethernet packet is tagged
for VLAN delivery.)
11Legacy Tx Descriptors
BASE_ADDRESS
LENGTH
SPECIAL
STATUS
CMD
CKSUM OFFSET
CKSUM START
7 6 5 4 3 2 1 0
The VLAN Tag goes here
I D E
V L E
D E X T
0
R S
I C
I F C S
E O P
And the VLE-bit (VLAN Packet Enable) is set in
the descriptors command-field
12Receive Control (0x0100)
31 30 29 28 27 26
25 24 23 22 21
20 19 18 17 16
R 0
0
0
FLXBUF
SE CRC
BSEX
R 0
PMCF
DPF
R 0
CFI
CFI EN
VFE
BSIZE
15 14 13 12 11
10 9 8 7 6 5
4 3 2 1 0
B A M
R 0
MO
DTYP
RDMTS
I L O S
S L U
LPE
UPE
0 0
R 0
SBP
E N
LBM
MPE
EN Receive Enable DTYP Descriptor
Type DPF Discard Pause Frames SBP Store Bad
Packets MO Multicast Offset PMCF Pass MAC
Control Frames UPE Unicast Promiscuous Enable
BAM Broadcast Accept Mode BSEX Buffer Size
Extension MPE Multicast Promiscuous Enable
BSIZE Receive Buffer Size SECRC Strip
Ethernet CRC LPE Long Packet reception Enable
VFE VLAN Filter Enable FLXBUF Flexible
Buffer size LBM Loopback Mode CFIEN
Canonical Form Indicator Enable RDMTS
Rx-Descriptor Minimum Threshold Size CFI
Canonical Form Indicator bit-value
We must set bit 18 to enable the receive-engines
VLAN Filtering operation
13Legacy Rx Descriptors
BASE_ADDRESS
LENGTH
VLAN Tag
STATUS
CHECKSUM
ERRORS
7 6 5 4 3 2 1 0
P I F
I P C S
T T P C S
U D P C S
V P
I X S M
E O P
D D
The VP-bit (VLAN Packet) will be set in the
descriptor status byte if the received packets
Type matched the VET register-value
And the VLAN Tag will be placed here
14VLAN Filter-Table Array (0x5600)
- The VLAN Filter-Table Array is a series of 128
consecutive 32-bit registers within the NICs
i/o-memory address-space which is used to define
a packet-filtering bitmap
The VLAN-Identifier value selects a bit within
this bitmap
4095
0
0000010000000000000000000000000000000000010000000
1000000
1 means that a tagged packet will be
accepted 0 means that a tagged packet will be
dropped
15The Filter-Table arithmetic
- The 12-bit VLAN Identifier in a packets
receive-descriptor functions as a table-lookup
index into this 4096-bit bitmap - register_offset ( vlan_id / 32 ) 4
- bit_selection ( vlan_id 32 )
16Our tryvlan.c module
- Heres a drop in replacement for our prior
nic.c character-mode Linux device-driver - It enables the controllers VLAN mode for
automatic tagging and filtering of all the
packets being transmitted and/or received - Most of the previous code is unmodified
- The relatively few lines that have changed or
been added are marked by an askerick
17In-class exercise 1
- Adjust the values stored in the special field
of the Transmit Descriptors so that successive
descriptors use two different 12-bit values
alternately
0x0234
0 1 2 3 4
0x0567
0x0234
0x0567
0x0234
. . .
18Two tryvlan.c versions
- Create two versions of our demo-module, using
your two different special values to setup the
VFTA bitmaps, and install these distinct versions
on four different anchor machines, like this
The red VLAN
The blue VLAN
anchor01
anchor02
anchor11
anchor12
Version with 0x0234 as tag
Version with 0x0567 as tag
19In-class exercise 1 (continued)
- Use the Linux echo and cat commands to send a
succession of broadcast-packets on the red VLAN
and on the blue VLAN by writing to the
/dev/nic device-file with echo on the
odd-numbed anchor-stations and simultaneously
reading from /dev/nic with cat on the
even-numbered stations - Which machines receive your broadcasts?
20In-class exercise 2
- What happens if you modify your code for the two
tryvlan.c revised versions so that in some of
the Transmit Descriptors the command-bytes
VLE-bit (bit 6) is clear rather than being
set?
21In-class exercise 3
- What happens if you program the nics VET
register with a value other than the standard
VLAN Ether Type of 0x8100?