Hard Processor System Technical Reference Manual: Agilex™ 5 SoCs

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

5.1.6.6.1. Source Address or Destination Address Filtering

The address filtering module of the MAC checks the source address (SA) and destination address (DA) fields of each incoming packet. The destination address hash filtering uses internal 64-bit hash table.

Unicast Destination Address Filtering

The MAC supports up to 32 MAC addresses for unicast perfect filtering. If perfect filtering is selected (HUC field of the MAC_Packet_Filter register is reset), the MAC compares all 48 bits of received unicast address with the programmed MAC address for any match. The default MacAddr0 is always enabled. The MacAddr1 to MacAddr31 addresses are selected with an individual enable bit. For MacAddr1 to MacAddr31 addresses, you can mask each byte during comparison with the corresponding received DA byte by setting the corresponding mask byte control bit in the register. This enables group address filtering for the DA.

In hash filtering mode (when HUC field is 1), the MAC performs imperfect filtering for unicast addresses using a hash table. EMAC uses the internal 64-bit hash table based filtering.

For internal hash table based filtering, the MAC uses the upper 6 bits (based on hash table size) CRC of the received destination address to index the content of the hash table. For example, for 64-bit sized hash table, a value of 6’b000000 selects bit 0 of internal hash table register, and a value of 6’b111111 selects bit 63 of the internal hash table register (MAC_Hash_Table_Reg). If the corresponding bit (indicated by the 6-bit CRC) is set to 1, the unicast packet is considered to have passed the hash filter; otherwise, the packet is considered to have failed the hash filter.

Multicast Destination Address Filtering

To program the MAC to pass all multicast packets, set the PM bit in the MAC_Packet_Filter register. If the PM bit is reset, the MAC performs the filtering for multicast addresses based on the HMC field of the MAC_Packet_Filter register. In perfect filtering mode, the multicast address is compared with the programmed MAC destination address registers (1-31). Group address filtering is also supported.

In hash filtering mode (when HMC field is 1), the MAC performs imperfect filtering for multicast addresses using the hash table. EMAC uses internal 64-bit hash table based filtering, when the hash table size is less than or equal to 256. In hash filtering mode, the MAC performs imperfect internal hash table based filtering.

Hash or Perfect Address Filtering

To configure the DA filter to pass a packet when its DA matches either the hash filter or the perfect filter, set the HPF bit and the corresponding HUC or HMC bits in the MAC_Packet_Filter register. This is applicable to both unicast and multicast packets. If the HPF bit is reset, only one of the filters (hash or perfect) is applied to received packet.

Unicast Source Address Filtering

The MAC can perform perfect filtering based on the source address field of received packets. By default, the MAC compares the SA field with the values programmed in the SA registers. You can configure the MAC address registers [1-31] to use SA instead of DA for comparison by setting bit 30 of the corresponding register.

The MAC also supports group filtering with SA. You can filter a group of addresses by masking one or more bytes of the address. The MAC drops the packets that fail the SA filter if the SAF bit is set in the MAC_Packet_Filter register. Otherwise, the result of the SA filter is given as a status bit in the receive status word. When the SAF bit is set, the SA filter and DA filter result is ANDed to decide whether the packet needs to be forwarded. This means that the packet is dropped if either filter fails. The packet is forwarded to the application only if the packet passes both filters in-order.

Inverse Filtering

For DA and SA filtering, setting the DAIF and SAIF fields of the MAC_Packet_Filter register inverts the filter-match result at the final output. The DAIF field is applicable for both unicast and multicast DA packets. The result of the unicast or multicast destination address filter is inverted in this mode. Similarly, when the SAIF field is set, the result of unicast SA filter is reversed.
Note: When the RA bit of the MAC_Packet_Filter register is set, all packets are forwarded to the system along with the correct result of the address filtering in the RX Status.
Table 147.  Destination Address Filtering
Packet Type PR HPF HUC DAIF HMC PM DBF DA Filter Operation
Broadcast 1 X X X X X X Pass
0 X X X X X 0 Pass
0 X X X X X 1 Fail
Unicast 1 X X X X X X Pass all packets
0 X 0 0 X X X Pass on perfect/group filter match
0 X 0 1 X X X Fail on perfect/group filter match
0 0 1 0 X X X Pass on hash filter match
0 0 1 1 X X X Fail on hash filter match
0 1 1 0 X X X

Pass on hash or perfect/group filter match

0 1 1 1 X X X

Fail on hash or perfect/group filter match

Multicast 1 X X X X X X Pass all packets
X X X X X 1 X Pass all packets
0 X X 0 0 0 X

Pass on perfect/group filter match and drop pause packets if PCF = 0x

0 0 X 0 1 0 X

Pass on hash filter match and drop pause packets if PCF = 0x

0 1 X 0 1 0 X Pass on hash or perfect/group filter match and drop pause packets if PCF = 0x
0 X X 1 0 0 X Fail on perfect/group filter match and drop pause packets if PCF = 0x
0 0 X 1 1 0 X Fail on hash filter match and drop pause packets if PCF = 0x
0 1 X 1 1 0 X

Fail on hash or perfect/group filter match and drop pause packets if PCF = 0x

Table 148.  Source Address Filtering
Packet Type PR SAIF SAF SA Filter Operation
Unicast 1 X X Pass all packets.
0 0 0 Pass status on perfect or group filter match but do not drop packets that fail.  
0 1 0 Fail status on perfect or group filter match but do not drop packets.  
0 0 1 Pass on perfect or group filter match and drop packets that fail.  
0 1 1 Fail on perfect or group filter match and drop packets that fail.