Jump to main content

##

# 1.2.5.2.50 TCPIP_MAC_RxFilterHashTableEntrySet Function

## C

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

## 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.

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

## Precondtions

TCPIP_MAC_Initialize() should have been called. TCPIP_MAC_Open() should have been called to obtain a valid handle.

## Parameters

Parameters | Description
--- | ---
hMac | Handle identifying the MAC driver client.
DestMACAddr | Destination MAC address (6 bytes) to allow 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.

## Returns

- TCPIP_MAC_RES_OK - If all processing went on OK.
- TCPIP_MAC_RES error code - If function failed for some reason.

## Remarks

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 TCPIP_MAC_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.