Sample hash table code
398
NS9750 Hardware Reference
// create hash table for MAC address
eth_make_hash_table (hash_table);
(*MERCURY_EFE) .ht2.bits.data = SWAP32(hash_table[1]);
(*MERCURY_EFE) .ht1.bits.data = SWAP32(hash_table[0]);
}
/*
*
* Function: void eth_make_hash_table (WORD32 *hash_table)
*
* Description:
*
* This routine creates a hash table based on the CRC values of
* the MAC addresses setup by set_hash_bit(). The CRC value of
* each MAC address is calculated and the lower six bits are used
* to generate a value between 0 and 64. The corresponding bit in
* the 64-bit hash table is then set.
*
* Parameters:
*
* hash_table pointer to buffer to store hash table in.
*
* Return Values:
*
* none
*
*/
static void eth_make_hash_table (WORD32 *hash_table)
{
int index;
memset (hash_table, 0, 8); /* clear hash table*/
for (index = 0; index < mca_count; index++) /*for each mca address*/