release/src/linux/linux/drivers/net/tlan.c
/***************************************************************
	 *	TLan_SetMulticastList
	 *  
	 *	Returns:
	 *		Nothing
	 *	Parms:
	 *		dev	The device structure to set the
	 *			multicast list for.
	 *
	 *	This function sets the TLAN adaptor to various receive
	 *	modes.  If the IFF_PROMISC flag is set, promiscuous
	 *	mode is acitviated.  Otherwise,	promiscuous mode is
	 *	turned off.  If the IFF_ALLMULTI flag is set, then
	 *	the hash table is set to receive all group addresses.
	 *	Otherwise, the first three multicast addresses are
	 *	stored in AREG_1-3, and the rest are selected via the
	 *	hash table, as necessary.
	 *
	 **************************************************************/


Nothing
Parms:
dev     The device structure to set the
multicast list for.

This function sets the TLAN adaptor to various receive
modes.  If the IFF_PROMISC flag is set, promiscuous
mode is acitviated.  Otherwise, promiscuous mode is
turned off.  If the IFF_ALLMULTI flag is set, then
the hash table is set to receive all group addresses.
Otherwise, the first three multicast addresses are
stored in AREG_1-3, and the rest are selected via the
hash table, as necessary.
Nothing Parms : dev The device structure to set the multicast list for . This function sets the TLAN adaptor to various receive modes . If the IFF_PROMISC flag is set promiscuous mode is acitviated . Otherwise promiscuous mode is turned off . If the IFF_ALLMULTI flag is set then the hash table is set to receive all group addresses . Otherwise the first three multicast addresses are stored in AREG_1 - 3 and the rest are selected via the hash table as necessary .
static void TLan_SetMulticastList( struct net_device *dev )
{	
	struct dev_mc_list	*dmi = dev->mc_list;
	u32			hash1 = 0;
	u32			hash2 = 0;
	int			i;
	u32			offset;
	u8			tmp;
	if ( dev->flags & IFF_PROMISC ) {
		tmp = TLan_DioRead8( dev->base_addr, TLAN_NET_CMD );
		TLan_DioWrite8( dev->base_addr, TLAN_NET_CMD, tmp | TLAN_NET_CMD_CAF );
	} else {
		tmp = TLan_DioRead8( dev->base_addr, TLAN_NET_CMD );
		TLan_DioWrite8( dev->base_addr, TLAN_NET_CMD, tmp & ~TLAN_NET_CMD_CAF );
		if ( dev->flags & IFF_ALLMULTI ) {
			for ( i = 0; i < 3; i++ ) 
				TLan_SetMac( dev, i + 1, NULL );
			TLan_DioWrite32( dev->base_addr, TLAN_HASH_1, 0xFFFFFFFF );
			TLan_DioWrite32( dev->base_addr, TLAN_HASH_2, 0xFFFFFFFF );
		} else {
			for ( i = 0; i < dev->mc_count; i++ ) {
				if ( i < 3 ) {
					TLan_SetMac( dev, i + 1, (char *) &dmi->dmi_addr );
				} else {
					offset = TLan_HashFunc( (u8 *) &dmi->dmi_addr );
					if ( offset < 32 ) 
						hash1 |= ( 1 << offset );
					else
						hash2 |= ( 1 << ( offset - 32 ) );
				}
				dmi = dmi->next;
			}
			for ( ; i < 3; i++ ) 
				TLan_SetMac( dev, i + 1, NULL );
			TLan_DioWrite32( dev->base_addr, TLAN_HASH_1, hash1 );
			TLan_DioWrite32( dev->base_addr, TLAN_HASH_2, hash2 );
		}
	}
}
static void TLan_SetMulticastList ( struct net_device * dev ) { struct dev_mc_list * dmi = dev -> mc_list ; u32 hash1 = 0 ; u32 hash2 = 0 ; int i ; u32 offset ; u8 tmp ; if ( dev -> flags & IFF_PROMISC ) { tmp = TLan_DioRead8 ( dev -> base_addr , TLAN_NET_CMD ) ; TLan_DioWrite8 ( dev -> base_addr , TLAN_NET_CMD , tmp | TLAN_NET_CMD_CAF ) ; } else { tmp = TLan_DioRead8 ( dev -> base_addr , TLAN_NET_CMD ) ; TLan_DioWrite8 ( dev -> base_addr , TLAN_NET_CMD , tmp & ~ TLAN_NET_CMD_CAF ) ; if ( dev -> flags & IFF_ALLMULTI ) { for ( i = 0 ; i < 3 ; i ++ ) TLan_SetMac ( dev , i + 1 , NULL ) ; TLan_DioWrite32 ( dev -> base_addr , TLAN_HASH_1 , 0xFFFFFFFF ) ; TLan_DioWrite32 ( dev -> base_addr , TLAN_HASH_2 , 0xFFFFFFFF ) ; } else { for ( i = 0 ; i < dev -> mc_count ; i ++ ) { if ( i < 3 ) { TLan_SetMac ( dev , i + 1 , ( char * ) & dmi -> dmi_addr ) ; } else { offset = TLan_HashFunc ( ( u8 * ) & dmi -> dmi_addr ) ; if ( offset < 32 ) hash1 |= ( 1 << offset ) ; else hash2 |= ( 1 << ( offset - 32 ) ) ; } dmi = dmi -> next ; } for ( ; i < 3 ; i ++ ) TLan_SetMac ( dev , i + 1 , NULL ) ; TLan_DioWrite32 ( dev -> base_addr , TLAN_HASH_1 , hash1 ) ; TLan_DioWrite32 ( dev -> base_addr , TLAN_HASH_2 , hash2 ) ; } } }
TLan_SetMulticastList
TLan_SetMulticastList