Digi NS9750 User Manual
Page 422

S a m p l e h a s h t a b l e c o d e
3 9 8
N S 9 7 5 0 H a r d w a r e R e f e r e n c e
// 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*/