FreeBSD/sys/dev/cxgb/common/cxgb_xgmac.c
/* Calculate the RX hash filter index of an Ethernet address */
Calculate the RX hash filter index of an Ethernet address
Calculate the RX hash filter index of an Ethernet address
static int hash_hw_addr(const u8 *addr)
{
	int hash = 0, octet, bit, i = 0, c;
	for (octet = 0; octet < 6; ++octet)
		for (c = addr[octet], bit = 0; bit < 8; c >>= 1, ++bit) {
			hash ^= (c & 1) << i;
			if (++i == 6)
				i = 0;
		}
	return hash;
}
static int hash_hw_addr ( const u8 * addr ) { int hash = 0 , octet , bit , i = 0 , c ; for ( octet = 0 ; octet < 6 ; ++ octet ) for ( c = addr [ octet ] , bit = 0 ; bit < 8 ; c >>= 1 , ++ bit ) { hash ^= ( c & 1 ) << i ; if ( ++ i == 6 ) i = 0 ; } return hash ; }
Calculate the RX hash filter index of an Ethernet address
Calculate the RX hash filter index of an Ethernet address