linux/drivers/net/ethernet/ti/davinci_emac.c
/**
 * emac_dev_mcast_set - Set multicast address in the EMAC adapter
 * @ndev: The DaVinci EMAC network adapter
 *
 * Set multicast addresses in EMAC adapter
 *
 */
Set multicast address in the EMAC adapter
@ndev: The DaVinci EMAC network adapter

Set multicast addresses in EMAC adapter
Set multicast address in the EMAC adapter @ndev : The DaVinci EMAC network adapter Set multicast addresses in EMAC adapter
static void emac_dev_mcast_set(struct net_device *ndev)
{
	u32 mbp_enable;
	struct emac_priv *priv = netdev_priv(ndev);
	mbp_enable = emac_read(EMAC_RXMBPENABLE);
	if (ndev->flags & IFF_PROMISC) {
		mbp_enable &= (~EMAC_MBP_PROMISCCH(EMAC_DEF_PROM_CH));
		mbp_enable |= (EMAC_MBP_RXPROMISC);
	} else {
		mbp_enable = (mbp_enable & ~EMAC_MBP_RXPROMISC);
		if ((ndev->flags & IFF_ALLMULTI) ||
		    netdev_mc_count(ndev) > EMAC_DEF_MAX_MULTICAST_ADDRESSES) {
			mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST);
			emac_add_mcast(priv, EMAC_ALL_MULTI_SET, NULL);
		} else if (!netdev_mc_empty(ndev)) {
			struct netdev_hw_addr *ha;
			mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST);
			emac_add_mcast(priv, EMAC_ALL_MULTI_CLR, NULL);
			netdev_for_each_mc_addr(ha, ndev) {
				emac_add_mcast(priv, EMAC_MULTICAST_ADD,
					       (u8 *) ha->addr);
			}
		} else {
			mbp_enable = (mbp_enable & ~EMAC_MBP_RXMCAST);
			emac_add_mcast(priv, EMAC_ALL_MULTI_CLR, NULL);
		}
	}
	emac_write(EMAC_RXMBPENABLE, mbp_enable);
}
static void emac_dev_mcast_set ( struct net_device * ndev ) { u32 mbp_enable ; struct emac_priv * priv = netdev_priv ( ndev ) ; mbp_enable = emac_read ( EMAC_RXMBPENABLE ) ; if ( ndev -> flags & IFF_PROMISC ) { mbp_enable &= ( ~ EMAC_MBP_PROMISCCH ( EMAC_DEF_PROM_CH ) ) ; mbp_enable |= ( EMAC_MBP_RXPROMISC ) ; } else { mbp_enable = ( mbp_enable & ~ EMAC_MBP_RXPROMISC ) ; if ( ( ndev -> flags & IFF_ALLMULTI ) || netdev_mc_count ( ndev ) > EMAC_DEF_MAX_MULTICAST_ADDRESSES ) { mbp_enable = ( mbp_enable | EMAC_MBP_RXMCAST ) ; emac_add_mcast ( priv , EMAC_ALL_MULTI_SET , NULL ) ; } else if ( ! netdev_mc_empty ( ndev ) ) { struct netdev_hw_addr * ha ; mbp_enable = ( mbp_enable | EMAC_MBP_RXMCAST ) ; emac_add_mcast ( priv , EMAC_ALL_MULTI_CLR , NULL ) ; netdev_for_each_mc_addr ( ha , ndev ) { emac_add_mcast ( priv , EMAC_MULTICAST_ADD , ( u8 * ) ha -> addr ) ; } } else { mbp_enable = ( mbp_enable & ~ EMAC_MBP_RXMCAST ) ; emac_add_mcast ( priv , EMAC_ALL_MULTI_CLR , NULL ) ; } } emac_write ( EMAC_RXMBPENABLE , mbp_enable ) ; }
emac_dev_mcast_set - Set multicast address in the EMAC adapter
 @ndev: The DaVinci EMAC network adapter
emac_dev_mcast_set - Set multicast address in the EMAC adapter @ndev : The DaVinci EMAC network adapter
/* program multicast address list into EMAC hardware */ /* Set mbp config register */