Hard Processor System Technical Reference Manual: Agilex™ 5 SoCs

ID 814346
Date 4/01/2024
Public
Document Table of Contents

5.1.6.6.2. VLAN Filtering

The EMAC supports the following types of VLAN filtering:
  • VLAN tag perfect filtering
  • VLAN tag hash filtering

VLAN Tag Perfect Filtering

In VLAN tag perfect filtering, the MAC compares the VLAN tag of received packet and provides the VLAN packet status to the application. Based on the programmed mode, the MAC compares the lower 12 bits or all 16 bits of received VLAN tag to determine the perfect match.

If VLAN tag perfect filtering is enabled, the MAC forwards the VLAN-tagged packets along with VLAN tag match status and drops the VLAN packets that do not match. You can also enable the inverse matching for VLAN packets by setting the VTIM bit of the MAC_VLAN_Tag register. In addition, you can enable matching of S-VLAN tagged packets along with the default C-VLAN tagged packets by setting the ESVL bit of the MAC_VLAN_Tag register. The VLAN packet status bit (bit 15 RDES2) indicates the VLAN tag match status for the matched packets.
Note: The source or destination address (if enabled) has precedence over the VLAN tag filters. This means that a packet that fails the source or destination address filter is dropped irrespective of the VLAN tag filter results. By default, the VLAN tag-based perfect filter is available in all configurations.

VLAN Tag Hash Filtering

The MAC provides VLAN tag hash filtering with a 16-bit hash table. The MAC performs the VLAN hash matching based on the VTHM field of the MAC_VLAN_Tag register. If the VTHM field is 1, the most significant 4 bits of CRC-32 of VLAN tag are used to index the content of the VLAN Hash Table register. A value of 1 in the VLAN hash table register, corresponding to the index, indicates that the VLAN tag of the packet matched and the packet must be forwarded. A value of 0 indicates that VLAN-tagged packet must be dropped.
Note:
  • The 16 or 12 bits of VLAN tag are considered for CRC-32 computation based on the ETV bit in MAC_VLAN_Tag register.
  • When ETV bit is reset, most significant four bits of CRC-32 of VLAN tag are inverted and used to index the content of MAC_VLAN_Hash_Table register in the MAC.
  • When ETV bit is set, most significant four bits of CRC-32 of VLAN tag are directly used to index the content of MAC_VLAN_Hash_Table register in the MAC.

The MAC also supports the inverse matching for VLAN packets. In the inverse matching mode, when the VLAN tag of a packet matches the perfect or hash filter, the packet must be dropped. If the VLAN perfect and VLAN hash match are enabled, a packet is considered as matched if either the VLAN hash or the VLAN perfect filter matches. When inverse match is set, a packet is forwarded only when both perfect and hash filters indicate mismatch.

The table below shows the various possibilities for VLAN matching and the final VLAN match status. When the RA field of the MAC_Packet_Filter register is set, all packets are received and the VLAN match status is indicated in the VF bit of the receive normal descriptor (write-back format). When the RA bit is not set and the VTFE field is 1 in the MAC_Packet_Filter register, the packet is dropped if the final VLAN match status fails.

When VLAN VID is programmed to 0 in the VL field of the MAC_VLAN_Tag register, all VLAN-tagged packets are considered as perfect matched but the status of the VLAN hash match depends on the VTHM and VTIM fields of the MAC_VLAN_Tag register.
Table 149.  VLAN Match Status
VID VLAN Perfect Filter Match Result VTHM Bit VLAN Hash Filter Match Result VTIM Bit Final VLAN Match Status
VID = 0 Pass 0 Xa X Pass
Pass 1 X 0 Pass
Pass 1 Fail 1 Pass
Pass 1 Pass 1 Fail
VID != 0 Pass X X 0 Pass
Fail 0 X 0 Fail
Fail 1 Fail 0 Fail
Fail 1 Pass 0 Pass
Fail 0 X 1 Pass
Pass X X 1 Fail
Fail 1 Pass 1 Fail
Fail 1 Fail 1 Pass
Note: The value X implies that this column can have any value.