FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*
** This routine takes removals in the vsi filter
** table and creates an Admin Queue call to delete
** the filters in the hardware.
*/
This routine takes removals in the vsi filter
table and creates an Admin Queue call to delete
the filters in the hardware.
This routine takes removals in the vsi filter table and creates an Admin Queue call to delete the filters in the hardware .
void
ixl_del_hw_filters(struct ixl_vsi *vsi, int cnt)
{
	struct i40e_aqc_remove_macvlan_element_data *d, *e;
	struct ixl_pf		*pf;
	struct i40e_hw		*hw;
	device_t		dev;
	struct ixl_mac_filter	*f, *f_temp;
	int			err, j = 0;
	DEBUGOUT("ixl_del_hw_filters: begin\n");
	pf = vsi->back;
	hw = &pf->hw;
	dev = pf->dev;
	d = malloc(sizeof(struct i40e_aqc_remove_macvlan_element_data) * cnt,
	    M_DEVBUF, M_NOWAIT | M_ZERO);
	if (d == NULL) {
		printf("del hw filter failed to get memory\n");
		return;
	}
	SLIST_FOREACH_SAFE(f, &vsi->ftl, next, f_temp) {
		if (f->flags & IXL_FILTER_DEL) {
			e = &d[j]; 
			bcopy(f->macaddr, e->mac_addr, ETHER_ADDR_LEN);
			e->vlan_tag = (f->vlan == IXL_VLAN_ANY ? 0 : f->vlan);
			e->flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH;
			SLIST_REMOVE(&vsi->ftl, f, ixl_mac_filter, next);
			free(f, M_DEVBUF);
			j++;
		}
		if (j == cnt)
			break;
	}
	if (j > 0) {
		err = i40e_aq_remove_macvlan(hw, vsi->seid, d, j, NULL);
		if (err && hw->aq.asq_last_status != I40E_AQ_RC_ENOENT) {
			int sc = 0;
			for (int i = 0; i < j; i++)
				sc += (!d[i].error_code);
			vsi->hw_filters_del += sc;
			device_printf(dev,
			    "Failed to remove %d/%d filters, aq error %d\n",
			    j - sc, j, hw->aq.asq_last_status);
		} else
			vsi->hw_filters_del += j;
	}
	free(d, M_DEVBUF);
	DEBUGOUT("ixl_del_hw_filters: end\n");
	return;
}
void ixl_del_hw_filters ( struct ixl_vsi * vsi , int cnt ) { struct i40e_aqc_remove_macvlan_element_data * d , * e ; struct ixl_pf * pf ; struct i40e_hw * hw ; device_t dev ; struct ixl_mac_filter * f , * f_temp ; int err , j = 0 ; DEBUGOUT ( " \n " ) ; pf = vsi -> back ; hw = & pf -> hw ; dev = pf -> dev ; d = malloc ( sizeof ( struct i40e_aqc_remove_macvlan_element_data ) * cnt , M_DEVBUF , M_NOWAIT | M_ZERO ) ; if ( d == NULL ) { printf ( " \n " ) ; return ; } SLIST_FOREACH_SAFE ( f , & vsi -> ftl , next , f_temp ) { if ( f -> flags & IXL_FILTER_DEL ) { e = & d [ j ] ; bcopy ( f -> macaddr , e -> mac_addr , ETHER_ADDR_LEN ) ; e -> vlan_tag = ( f -> vlan == IXL_VLAN_ANY ? 0 : f -> vlan ) ; e -> flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH ; SLIST_REMOVE ( & vsi -> ftl , f , ixl_mac_filter , next ) ; free ( f , M_DEVBUF ) ; j ++ ; } if ( j == cnt ) break ; } if ( j > 0 ) { err = i40e_aq_remove_macvlan ( hw , vsi -> seid , d , j , NULL ) ; if ( err && hw -> aq . asq_last_status != I40E_AQ_RC_ENOENT ) { int sc = 0 ; for ( int i = 0 ; i < j ; i ++ ) sc += ( ! d [ i ] . error_code ) ; vsi -> hw_filters_del += sc ; device_printf ( dev , " \n " , j - sc , j , hw -> aq . asq_last_status ) ; } else vsi -> hw_filters_del += j ; } free ( d , M_DEVBUF ) ; DEBUGOUT ( " \n " ) ; return ; }
This routine takes removals in the vsi filter
table and creates an Admin Queue call to delete
the filters in the hardware.
This routine takes removals in the vsi filter table and creates an Admin Queue call to delete the filters in the hardware .
// a pox on fvl long names :) /* delete entry from vsi list */