FreeBSD/sys/dev/e1000/if_igb.c
/*********************************************************************
 *  Multicast Update
 *
 *  This routine is called whenever multicast address list is updated.
 *
 **********************************************************************/
Multicast Update
This routine is called whenever multicast address list is updated.
Multicast Update This routine is called whenever multicast address list is updated .
static void
igb_set_multi(struct adapter *adapter)
{
	struct ifnet	*ifp = adapter->ifp;
	struct ifmultiaddr *ifma;
	u32 reg_rctl = 0;
	u8  *mta;
	int mcnt = 0;
	IOCTL_DEBUGOUT("igb_set_multi: begin");
	mta = adapter->mta;
	bzero(mta, sizeof(uint8_t) * ETH_ADDR_LEN *
	    MAX_NUM_MULTICAST_ADDRESSES);
#if __FreeBSD_version < 800000
	IF_ADDR_LOCK(ifp);
#else
	if_maddr_rlock(ifp);
#endif
	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
		if (ifma->ifma_addr->sa_family != AF_LINK)
			continue;
		if (mcnt == MAX_NUM_MULTICAST_ADDRESSES)
			break;
		bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
		    &mta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN);
		mcnt++;
	}
#if __FreeBSD_version < 800000
	IF_ADDR_UNLOCK(ifp);
#else
	if_maddr_runlock(ifp);
#endif
	if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) {
		reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL);
		reg_rctl |= E1000_RCTL_MPE;
		E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl);
	} else
		e1000_update_mc_addr_list(&adapter->hw, mta, mcnt);
}
static void igb_set_multi ( struct adapter * adapter ) { struct ifnet * ifp = adapter -> ifp ; struct ifmultiaddr * ifma ; u32 reg_rctl = 0 ; u8 * mta ; int mcnt = 0 ; IOCTL_DEBUGOUT ( " " ) ; mta = adapter -> mta ; bzero ( mta , sizeof ( uint8_t ) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES ) ; #if __FreeBSD_version < 800000 IF_ADDR_LOCK ( ifp ) ; #else if_maddr_rlock ( ifp ) ; #endif TAILQ_FOREACH ( ifma , & ifp -> if_multiaddrs , ifma_link ) { if ( ifma -> ifma_addr -> sa_family != AF_LINK ) continue ; if ( mcnt == MAX_NUM_MULTICAST_ADDRESSES ) break ; bcopy ( LLADDR ( ( struct sockaddr_dl * ) ifma -> ifma_addr ) , & mta [ mcnt * ETH_ADDR_LEN ] , ETH_ADDR_LEN ) ; mcnt ++ ; } #if __FreeBSD_version < 800000 IF_ADDR_UNLOCK ( ifp ) ; #else if_maddr_runlock ( ifp ) ; #endif if ( mcnt >= MAX_NUM_MULTICAST_ADDRESSES ) { reg_rctl = E1000_READ_REG ( & adapter -> hw , E1000_RCTL ) ; reg_rctl |= E1000_RCTL_MPE ; E1000_WRITE_REG ( & adapter -> hw , E1000_RCTL , reg_rctl ) ; } else e1000_update_mc_addr_list ( & adapter -> hw , mta , mcnt ) ; }
Multicast Update
  This routine is called whenever multicast address list is updated.
Multicast Update This routine is called whenever multicast address list is updated .