Digi NS9215 User Manual

Page 335

Advertising
background image

. . . . .

E T H E R N E T C O M M U N I C A T I O N M O D U L E

Sample hash table code

www.digiembedded.com

335

(*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*/

{

set_hash_bit ((BYTE *) hash_table, calculate_hash_bit (mca_address

[index]));

}

}

Advertising