VLAN tagging, also referred to as stacking, allows the TEMAC core to insert a predefined VLAN tag in select Ethernet frames as they pass through in either the transmit or receive direction.
One VLAN tag is added depending on the mode of operation:
- Non-VLAN frames get one VLAN tag added to become single VLAN tagged frames.
- VLAN tagged frames receive an extra VLAN tag and no checking is performed to see how many VLAN tags the frame already has (if there were three tags, it now has four).
Therefore, in cases that require adding a VLAN tag, one VLAN tag is added to the existing frame.
The TEMAC core basic VLAN mode extends the maximum normal frame size validation by 4 bytes. This mode does not extend to multiple VLAN tagging. Multiple VLAN frames that exceed 1,522 bytes are discarded as being too long. As mentioned previously, this requires the use of jumbo frame mode which eliminates the automatic invalidation of frames that normally would be too large for normal frame sizes.
When VLAN tagging is enabled at build time with the appropriate parameter, a field in the Reset and Address Filter Register is used to select one of four VLAN tagging modes and the Transmit VLAN Tag Register and Receive VLAN Tag Register is used to hold the VLAN tag value that is inserted. The four VLAN tagging modes which are selectable at runtime are:
- Do not add tags to any frames.
- Add one tag to all frames.
- Add one tag only to frames that are already VLAN tagged.
- Add one tag only to select frames that are already VLAN tagged based on VID value.
The fourth mode requires a method for specifying which tagged frames should receive an additional VLAN tag. TheTEMAC Receive Configuration Word 0 Register and Receive VLAN Data Table are used for this purpose. A value of 1 in the tag enable field for a TPID value indicates that frame should receive an additional tag. Again, transmit In-Band FCS mode is not allowed and receive FCS stripping is required when using VLAN tagging because the FCS field value is not correct for the frame with the additional VLAN tag. Although receive stripping is enabled, any padding, if present, is not stripped because the TYPE/LENGTH field of the receive frame contains a VLAN tag rather than a length value. However, the length field is still present.