Information
Enhanced Three-Speed Ethernet Controllers
MPC8308 PowerQUICC II Pro Processor Reference Manual, Rev. 1
16-132 Freescale Semiconductor
promiscuous mode it remains possible to program the filer to reject frames based on their higher-layer
header contents.
In the case of an individual address, the DA field of the received frame is compared with the physical
address that the user programs in the station address registers (MACSTNADDR1 and MACSTNADDR2).
If the DA does not match the station address, and exact MAC address matching is enabled through
RCTRL[EMEN], the controller performs address recognition on the multiple MAC addresses written to
the MACxADDR1 and MACxADDR2 registers. These virtual addresses give a particular eTSEC the
ability to mirror other MACs on the network, which caters for router redundancy protocols, such as HSRP
and VRRP.
If exact MAC address matching is not enabled, the eTSEC determines whether DA is a group or individual
address. If DA is the standard broadcast address, and broadcast addresses are not rejected, the frame is
accepted. If any other group address is received, the eTSEC looks-up the DA by means of the group hash
table. The group hash table may be extended to 512 entries if RCTRL[GHTX] = 1. Otherwise, an
individual address is hashed into the 256-entry individual hash table when RCTRL[GHTX] = 0.
16.6.2.7.2 Hash Table Algorithm
The hash table process used in the group hash filtering operates as follows. By default, the Ethernet
controller maps any 48-bit destination address into one of 256 bins, represented by the 256 bits in
IGADDR0–IGADDR7 for individual addresses, and the 256 bits in GADDR0–GADDR7 for group
addresses. But in the case where RCTRL[GHTX] is set, both sets of registers are combined into an
extended group-only hash table of 512 bits, where IGADDR0–IGADDR7 contain the first 256 bits and
GADDR0–GADDR7 contain the last 256 bits. No individual-address table exists in extended mode.
The 48-bit destination address received by the MAC is passed through the Ethernet CRC-32 algorithm to
produce a hash value. The CRC polynomial used is:
x
32
+ x
26
+ x
23
+ x
22
+ x
16
+ x
12
+ x
11
+ x
10
+ x
8
+ x
7
+ x
5
+ x
4
+ x
2
+ x + 1
The MAC initializes its CRC register to 0xFFFF_FFFF before computing a CRC on the 6 bit-reversed
octets of the DA. A non-optimized sample of C code for computing the DA hash is shown below. The 9
most significant bits of the raw, uninverted CRC are used as the hash table index, H[8–0]. If
RCTRL[GHTX] = 0, bits H[8–6] select one of the 8 IGADDR or GADDR registers, while bits H[5–1]
select a bit within the 32-bit register. If RCTRL[GHTX] = 1, bits H[8–5] select one of the 16 registers in
the {IGADDR, GADDR} set, while bits H[4–0] select a bit within the 32-bit register. For example, if
H[8–5] = 7, IGADDR7 is selected, whereas H[8–5] = 9 selects GADDR1.
The following code snippet shows sample C code for computing eTSEC hash table indices.
/* Wrapper macros for 256-bucket and 512-bucket hash tables:
Pass 6-byte Ethernet MAC address as parameter. */
#define TSEC_HASH256(macaddr) ((crc32(macaddr) >> 24) & 0xff)
#define TSEC_HASH512(macaddr) ((crc32(macaddr) >> 23) & 0x1ff)
/* CRC constants. Note: CRC-32 polynomial is bit-reversed. */
#define CRC_POLYNOMIAL 0xedb88320
#define CRC_INITIAL 0xffffffff
#define MAC_ADDRLEN 6