Hard Processor System Technical Reference Manual: Agilex™ 5 SoCs

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

5.1.6.6.3. Extended VLAN Filtering

This IP supports up to 32 VLAN filters. When 32 VLAN filters are selected, the IP enables extended VLAN filtering and routing. Perfect filtering is done for the VLAN tag filters. For each VLAN tag filter, the VLAN tag ID is compared.

The combined result of all the enabled VLAN tag filters determines the overall VLAN tag filter result. The filter result is passed to the application as part of the status bits. When the VLAN tag filter gives a pass result, the frame is considered to have passed the VLAN tag filters. If the frame fails all the filters, the frame is considered to have failed the VLAN filter.

In addition to perfect filtering, hash filtering can also be enabled. In hash filtering, the overall VLAN filter result is determined by the hash filter result and the perfect filter result. The overall filter result determines if the frame is dropped or forwarded to the application based on the programming on the VTFE and RA bits of the MAC_Packet_Filter register.

Comparison Modes of Extended Receive VLAN Filtering

For each VLAN Tag filter, the application has the following comparison modes:
  • Program the MAC to compare an outer VLAN tag or an inner VLAN tag with the programmed VID.
  • Choose the width of the VID field, 12 or 16 bits, for the comparison.
  • Enable or disable type check for each filter. When type check is enabled, the application can choose if the VID comparison must be only for the SVLAN or CVLAN types of frames. For example, when a filter is enabled for 16 bit comparison, type is SVLAN, and outer VLAN tag, any single or double VLAN tagged frames with outer SVLAN tags are compared with this filter, and result is obtained.

Filtering

When extended RX VLAN filtering and routing feature is enabled, the application can enable both perfect and hash Filtering. The overall VLAN filter result is based on the perfect filter result and the hash Filter result (if enabled). The filter result is passed to the application as part of the status bits.

Perfect filtering is done based on the MAC_VLAN_Tag_Filter registers. For each VLAN tag filter, the MAC compares the relevant VLAN tag ID and gives a result. If any one of the VLAN tag filters gives a match then the frame is considered to have passed the VLAN tag filters. If the frame mismatches all the filters, then the frame is considered to have failed the VLAN filter. This behavior is applicable only when the inverse filtering is not enabled in MAC_VLAN_Tag_Ctrl register.

If inverse filtering is enabled and the frame has mismatched all the relevant filters then it is considered to have passed the VLAN filter. If the frame matches any one of the relevant filters then it is considered as a fail. If none of the enabled filters can perform a comparison or if none of the filters are enabled, then the frame is bypassed by the application.

The overall filter result and the programming on the VTFE and RA fields of the MAC_Packet_Filter register determines if the frame is dropped or forwarded to the application.

  • RA = 1: Frame is always forwarded; irrespective of the filter result.
  • RA = 0 and VTFE = 1: Only if the VLAN tag filter result is a pass, MAC forwards the frame.
  • RA = 0 and VTFE = 0: Frame is always forwarded; irrespective of the filter result.
If the frame is forwarded to the application, the relevant filter result is indicated through the status bits

Filter Status

The MAC indicates the VLAN filter status through one bit in the status - VF in RDES2. When extended RX VLAN filtering and routing is enabled, two status bits are used to indicate the comparison result of VLAN tags. The outer VLAN tag filter pass and inner VLAN tag filter pass bits are defined in the following positions. The status indicated through these bits is dependent on the programming:

In RDES2
  • Bit 15 - Outer VLAN tag filter status
  • Bit 13 - Inner VLAN Tag filter status

In ARI status: MAC_Packet_Filter status

  • Bit 15 - Outer VLAN tag filter status
  • Bit 13 - Inner VLAN Tag filter status

MRI status:

  • Bit 47 - Outer VLAN tag filter status
  • Bit 45 - Inner VLAN tag filter status

Outer VLAN tag filter status (OTS)

  • This bit is valid for both single and double VLAN tagged frames.
  • When this field is 1,
    • In perfect filtering, with inverse filtering disabled, indicates that the outer VLAN tag of the frame has matched one of the VLAN tag filters.
    • In inverse filtering, indicates that the VLAN tag of the frame has passed all the relevant VLAN tag filters.
  • When this field is 0, it indicates one of the following:
    • The outer VLAN tag of the frame has either failed the relevant outer VLAN tag filters or bypassed them.
    • None of the filters are enabled for outer VLAN tag comparison.
    • In inverse filtering, indicates that it has failed at least one of the filters or bypassed all the filters programmed for outer VLAN tag comparison.

Inner VLAN Tag Filter Status (ITS)

  • In perfect filtering, without inverse filtering enabled,
    • If this bit is set, it indicates that the frame’s inner VLAN tag has matched one of the VLAN tag filters.
    • If this bit is reset, it indicates that the frame’s inner VLAN tag has either failed the relevant inner VLAN tag filters or bypassed them.
  • If none of the filters are enabled for inner VLAN tag comparison, then this bit is reset.
The application must look at the status bits and the programming to determine if the frame has passed or failed the VLAN filter. The following table shows the possible values of status bits (OTS and ITS) when at least one perfect filter is enabled.
Table 150.  OTS and ITS Bit Values with At Least 1 Perfect Filter Enabled
VTIM HFO HFI PFO PFI OTS ITS
0 0 0 0 1 0 1/0
0 0 0 1 0 1/0 0
0 0 0 1 1 1/0 1/0
0 1 0 1 1 1/0 1/0
0 1 0 1 0 1/0 0
0 1 0 0 1 1/0 1/0
0 0 1 1 1 1/0 1/0
0 0 1 1 0 1/0 1/0
0 0 1 0 1 0 1/0
1 0 0 0 1 0 1/0
1 0 0 1 0 1/0 0
1 0 0 1 1 1/0 1/0
1 1 0 1 1 1/0 1/0
1 1 0 1 0 1/0 0
1 1 0 0 1 1/0 1/0
1 0 1 1 1 1/0 1/0
1 0 1 1 0 1/0 1/0
1 0 1 0 1 0 1/0
The following table shows the possible values of status bits (OTS and ITS) when none of the perfect filters are enabled and only the VLAN hash filter is enabled.
Table 151.  OTS and ITS Bit Values with Only VLAN Hash Filter Enabled
VTIM HFO HFI OTS ITS
0 0 0 0 0
0 1 0 1/0 0
0 0 1 0 1/0
1 0 0 0 0
1 1 0 1/0 0
1 0 1 0 1/0
Note:
  • VTIM: VLAN tag inverse match enable, bit 17 in VLAN_Tag_Ctrl register.
  • HFO: Hash filter enabled for outer VLAN tag comparison, bit 25 and bit 27 in VLAN_Tag_Ctrl register.
  • HFI: Hash filter enabled for inner VLAN tag comparison, bit 25 and bit 27 in VLAN_Tag_Ctrl register.
  • PFO: Perfect filter comparison enabled for outer VLAN tag. Any of the MAC_VLAN_Tag_Filter registers is enabled (bit 16 == 1) and programmed for outer VLAN tag comparison (bit 20 == 0).
  • PFI: Perfect filter comparison enabled for inner VLAN tag. Any of the MAC_VLAN_Tag_Filter registers is enabled (bit 16 == 1) and programmed for inner VLAN tag comparison (bit 20 == 1).
  • OTS: Outer VLAN tag filter status
  • ITS: Inner VLAN tag filter status

When no perfect filters are enabled, any VLAN packet is considered to have bypassed the perfect filter. If hash filter is enabled for one of the tags, then the respective status bit depends on the filter's result. The status bits are set to 0 if VLAN hash filter is also not enabled. If the value of ITS/OTS is shown as 1/0; it indicates that the final result is dependent on the enabled relevant filter's result.

Stripping

Each of the VLAN tags has individual control over stripping. The programming options of always strip, never strip, strip on pass and strip on fail are available. Inner or outer VLAN tag stripping is based on the individual tag's pass or fail results. If a tag is bypassed by all the relevant filters then stripping is not applicable for it. The following rules apply for VLAN tag stripping:
  • If strip on pass is enabled for the outer VLAN tag, then the stripping occurs only if the outer VLAN tag has passed the relevant filters. The outer VLAN tag filter result bit is set.
  • If strip on fail is enabled for the outer VLAN tag, then stripping occurs only if the outer VLAN tag has failed relevant filters. The outer VLAN tag filter result bit is reset.
  • If the outer VLAN tag of the received frame is bypassed by the entire filter (no comparison has been made), then the tag is not stripped, though the status bit is still 0.
  • If multiple filters are enabled, it is possible that the received VLAN frame can match any one or more of the filters. The VLAN tag’s value is not always deterministic from the filter status bits.
  • If the application strips the VLAN tag based on the filter result, it may lose the VID. The suggested use case is that if stripping is enabled for any of the tags, then the tag can be put in the status. The application must enable the respective VLAN tag in status bit 24 or 31 in the MAC_VLAN_Tag_Ctrl_register.