s2e/source/s2e-linux-kernel/linux-4.9.3/drivers/net/ethernet/ti/davinci_emac.c
/**
 * emac_add_mcast - Set multicast address in the EMAC adapter (Internal)
 * @priv: The DaVinci EMAC private adapter structure
 * @action: multicast operation to perform
 * mac_addr: mac address to set
 *
 * Set multicast addresses in EMAC adapter - internal function
 *
 */
Set multicast address in the EMAC adapter (Internal)
@priv: The DaVinci EMAC private adapter structure
@action: multicast operation to perform
mac_addr: mac address to set

Set multicast addresses in EMAC adapter - internal function
Set multicast address in the EMAC adapter ( Internal ) @priv : The DaVinci EMAC private adapter structure @action : multicast operation to perform mac_addr : mac address to set Set multicast addresses in EMAC adapter - internal function
static void emac_add_mcast(struct emac_priv *priv, u32 action, u8 *mac_addr)
{
	struct device *emac_dev = &priv->ndev->dev;
	int update = -1;
	switch (action) {
	case EMAC_MULTICAST_ADD:
		update = emac_hash_add(priv, mac_addr);
		break;
	case EMAC_MULTICAST_DEL:
		update = emac_hash_del(priv, mac_addr);
		break;
	case EMAC_ALL_MULTI_SET:
		update = 1;
		priv->mac_hash1 = EMAC_ALL_MULTI_REG_VALUE;
		priv->mac_hash2 = EMAC_ALL_MULTI_REG_VALUE;
		break;
	case EMAC_ALL_MULTI_CLR:
		update = 1;
		priv->mac_hash1 = 0;
		priv->mac_hash2 = 0;
		memset(&(priv->multicast_hash_cnt[0]), 0,
		sizeof(priv->multicast_hash_cnt[0]) *
		       EMAC_NUM_MULTICAST_BITS);
		break;
	default:
		if (netif_msg_drv(priv))
			dev_err(emac_dev, "DaVinci EMAC: add_mcast"\
				": bad operation %d", action);
		break;
	}
	if (update > 0) {
		emac_write(EMAC_MACHASH1, priv->mac_hash1);
		emac_write(EMAC_MACHASH2, priv->mac_hash2);
	}
}
static void emac_add_mcast ( struct emac_priv * priv , u32 action , u8 * mac_addr ) { struct device * emac_dev = & priv -> ndev -> dev ; int update = -1 ; switch ( action ) { case EMAC_MULTICAST_ADD : update = emac_hash_add ( priv , mac_addr ) ; break ; case EMAC_MULTICAST_DEL : update = emac_hash_del ( priv , mac_addr ) ; break ; case EMAC_ALL_MULTI_SET : update = 1 ; priv -> mac_hash1 = EMAC_ALL_MULTI_REG_VALUE ; priv -> mac_hash2 = EMAC_ALL_MULTI_REG_VALUE ; break ; case EMAC_ALL_MULTI_CLR : update = 1 ; priv -> mac_hash1 = 0 ; priv -> mac_hash2 = 0 ; memset ( & ( priv -> multicast_hash_cnt [ 0 ] ) , 0 , sizeof ( priv -> multicast_hash_cnt [ 0 ] ) * EMAC_NUM_MULTICAST_BITS ) ; break ; default : if ( netif_msg_drv ( priv ) ) dev_err ( emac_dev , " " " " , action ) ; break ; } if ( update > 0 ) { emac_write ( EMAC_MACHASH1 , priv -> mac_hash1 ) ; emac_write ( EMAC_MACHASH2 , priv -> mac_hash2 ) ; } }
emac_add_mcast - Set multicast address in the EMAC adapter (Internal)
 @priv: The DaVinci EMAC private adapter structure
 @action: multicast operation to perform
 mac_addr: mac address to set
emac_add_mcast - Set multicast address in the EMAC adapter ( Internal ) @priv : The DaVinci EMAC private adapter structure @action : multicast operation to perform mac_addr : mac address to set
/* write to the hardware only if the register status chances */