Jump to main content

##

# MAC_DRVR_RxFilterHashTableEntrySet Function

## C

    TCPIP_MAC_RES MAC_DRVR_RxFilterHashTableEntrySet(
        DRV_HANDLE              hMac,
        const TCPIP_MAC_ADDR *  DestMACAddr
        );

## Returns

- TCPIP_MAC_RES_OK if success
- a TCPIP_MAC_RES error value if failed

## Description

This function sets the MAC hash table filtering to allow packets sent to DestMACAddr to be received. It calculates a CRC-32 using polynomial 0x4C11DB7 over the 6 byte MAC address and then, using bits 28:23 of the CRC, will set the appropriate bits in the hash table filter registers ( ETHHT0-ETHHT1).

The function will enable/disable the Hash Table receive filter if needed.

## Remarks

- Sets the appropriate bit in the ETHHT0/1 registers to allow packets sent to DestMACAddr to be received and enabled the Hash Table receive filter.
- There is no way to individually remove destination MAC addresses from the hash table since it is possible to have a hash collision and therefore multiple MAC addresses relying on the same hash table bit.
- A workaround is to have the stack store each enabled MAC address and to perform the comparison at run time.
- A call to MAC_DRVR_RxFilterHashTableEntrySet() using a 00-00-00-00-00-00 destination MAC address, which will clear the entire hash table and disable the hash table filter.
  This will allow the receive of all packets, regardless of their destination.

## Preconditions

- MAC_DRVR_Initialize() should have been called.
- MAC_DRVR_Open() should have been called to obtain a valid handle.

## Parameters

Parameters | Description
--- | ---
hMac | Ethernet MAC client handle
DestMACAddr | Destination, 6 byte, MAC addresses to be allowed through the Hash Table Filter. If DestMACAddr is set to 00-00-00-00-00-00, then the hash table will be cleared of all entries and the filter will be disabled.