FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*********************************************************************
 * 	Filter Routines
 *
 *	Routines for multicast and vlan filter management.
 *
 *********************************************************************/
Filter Routines
Routines for multicast and vlan filter management.
Filter Routines Routines for multicast and vlan filter management .
void
ixl_add_multi(struct ixl_vsi *vsi)
{
	struct	ifmultiaddr	*ifma;
	struct ifnet		*ifp = vsi->ifp;
	struct i40e_hw		*hw = vsi->hw;
	int			mcnt = 0, flags;
	IOCTL_DEBUGOUT("ixl_add_multi: begin");
	if_maddr_rlock(ifp);
	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
		if (ifma->ifma_addr->sa_family != AF_LINK)
			continue;
		mcnt++;
	}
	if_maddr_runlock(ifp);
	if (__predict_false(mcnt >= MAX_MULTICAST_ADDR)) {
		ixl_del_hw_filters(vsi, mcnt);
		i40e_aq_set_vsi_multicast_promiscuous(hw,
		    vsi->seid, TRUE, NULL);
		return;
	}
	mcnt = 0;
	if_maddr_rlock(ifp);
	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
		if (ifma->ifma_addr->sa_family != AF_LINK)
			continue;
		ixl_add_mc_filter(vsi,
		    (u8*)LLADDR((struct sockaddr_dl *) ifma->ifma_addr));
		mcnt++;
	}
	if_maddr_runlock(ifp);
	if (mcnt > 0) {
		flags = (IXL_FILTER_ADD | IXL_FILTER_USED | IXL_FILTER_MC);
		ixl_add_hw_filters(vsi, flags, mcnt);
	}
	IOCTL_DEBUGOUT("ixl_add_multi: end");
	return;
}
void ixl_add_multi ( struct ixl_vsi * vsi ) { struct ifmultiaddr * ifma ; struct ifnet * ifp = vsi -> ifp ; struct i40e_hw * hw = vsi -> hw ; int mcnt = 0 , flags ; IOCTL_DEBUGOUT ( " " ) ; if_maddr_rlock ( ifp ) ; TAILQ_FOREACH ( ifma , & ifp -> if_multiaddrs , ifma_link ) { if ( ifma -> ifma_addr -> sa_family != AF_LINK ) continue ; mcnt ++ ; } if_maddr_runlock ( ifp ) ; if ( __predict_false ( mcnt >= MAX_MULTICAST_ADDR ) ) { ixl_del_hw_filters ( vsi , mcnt ) ; i40e_aq_set_vsi_multicast_promiscuous ( hw , vsi -> seid , TRUE , NULL ) ; return ; } mcnt = 0 ; if_maddr_rlock ( ifp ) ; TAILQ_FOREACH ( ifma , & ifp -> if_multiaddrs , ifma_link ) { if ( ifma -> ifma_addr -> sa_family != AF_LINK ) continue ; ixl_add_mc_filter ( vsi , ( u8 * ) LLADDR ( ( struct sockaddr_dl * ) ifma -> ifma_addr ) ) ; mcnt ++ ; } if_maddr_runlock ( ifp ) ; if ( mcnt > 0 ) { flags = ( IXL_FILTER_ADD | IXL_FILTER_USED | IXL_FILTER_MC ) ; ixl_add_hw_filters ( vsi , flags , mcnt ) ; } IOCTL_DEBUGOUT ( " " ) ; return ; }
Filter Routines
      Routines for multicast and vlan filter management.
Filter Routines Routines for multicast and vlan filter management .
/*
	** First just get a count, to decide if we
	** we simply use multicast promiscuous.
	*/ /* delete existing MC filters */