FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*
** This routine takes additions to the vsi filter
** table and creates an Admin Queue call to create
** the filters in the hardware.
*/
This routine takes additions to the vsi filter
table and creates an Admin Queue call to create
the filters in the hardware.
This routine takes additions to the vsi filter table and creates an Admin Queue call to create the filters in the hardware .
void
ixl_add_hw_filters(struct ixl_vsi *vsi, int flags, int cnt)
{
	struct i40e_aqc_add_macvlan_element_data *a, *b;
	struct ixl_mac_filter	*f;
	struct ixl_pf		*pf;
	struct i40e_hw		*hw;
	device_t		dev;
	int			err, j = 0;
	pf = vsi->back;
	dev = pf->dev;
	hw = &pf->hw;
	IXL_PF_LOCK_ASSERT(pf);
	a = malloc(sizeof(struct i40e_aqc_add_macvlan_element_data) * cnt,
	    M_DEVBUF, M_NOWAIT | M_ZERO);
	if (a == NULL) {
		device_printf(dev, "add_hw_filters failed to get memory\n");
		return;
	}
	SLIST_FOREACH(f, &vsi->ftl, next) {
		if (f->flags == flags) {
			b = &a[j]; 
			bcopy(f->macaddr, b->mac_addr, ETHER_ADDR_LEN);
			if (f->vlan == IXL_VLAN_ANY) {
				b->vlan_tag = 0;
				b->flags = I40E_AQC_MACVLAN_ADD_IGNORE_VLAN;
			} else {
				b->vlan_tag = f->vlan;
				b->flags = 0;
			}
			b->flags |= I40E_AQC_MACVLAN_ADD_PERFECT_MATCH;
			f->flags &= ~IXL_FILTER_ADD;
			j++;
		}
		if (j == cnt)
			break;
	}
	if (j > 0) {
		err = i40e_aq_add_macvlan(hw, vsi->seid, a, j, NULL);
		if (err) 
			device_printf(dev, "aq_add_macvlan err %d, "
			    "aq_error %d\n", err, hw->aq.asq_last_status);
		else
			vsi->hw_filters_add += j;
	}
	free(a, M_DEVBUF);
	return;
}
void ixl_add_hw_filters ( struct ixl_vsi * vsi , int flags , int cnt ) { struct i40e_aqc_add_macvlan_element_data * a , * b ; struct ixl_mac_filter * f ; struct ixl_pf * pf ; struct i40e_hw * hw ; device_t dev ; int err , j = 0 ; pf = vsi -> back ; dev = pf -> dev ; hw = & pf -> hw ; IXL_PF_LOCK_ASSERT ( pf ) ; a = malloc ( sizeof ( struct i40e_aqc_add_macvlan_element_data ) * cnt , M_DEVBUF , M_NOWAIT | M_ZERO ) ; if ( a == NULL ) { device_printf ( dev , " \n " ) ; return ; } SLIST_FOREACH ( f , & vsi -> ftl , next ) { if ( f -> flags == flags ) { b = & a [ j ] ; bcopy ( f -> macaddr , b -> mac_addr , ETHER_ADDR_LEN ) ; if ( f -> vlan == IXL_VLAN_ANY ) { b -> vlan_tag = 0 ; b -> flags = I40E_AQC_MACVLAN_ADD_IGNORE_VLAN ; } else { b -> vlan_tag = f -> vlan ; b -> flags = 0 ; } b -> flags |= I40E_AQC_MACVLAN_ADD_PERFECT_MATCH ; f -> flags &= ~ IXL_FILTER_ADD ; j ++ ; } if ( j == cnt ) break ; } if ( j > 0 ) { err = i40e_aq_add_macvlan ( hw , vsi -> seid , a , j , NULL ) ; if ( err ) device_printf ( dev , " " " \n " , err , hw -> aq . asq_last_status ) ; else vsi -> hw_filters_add += j ; } free ( a , M_DEVBUF ) ; return ; }
This routine takes additions to the vsi filter
table and creates an Admin Queue call to create
the filters in the hardware.
This routine takes additions to the vsi filter table and creates an Admin Queue call to create the filters in the hardware .
/*
	** Scan the filter list, each time we find one
	** we add it to the admin queue array and turn off
	** the add bit.
	*/ // a pox on fvl long names :)