FreeBSD/sys/dev/netmap/netmap_vale.c
/* remove a persistent VALE port from the system */
remove a persistent VALE port from the system
remove a persistent VALE port from the system
static int
nm_vi_destroy(const char *name)
{
	struct ifnet *ifp;
	int error;
	ifp = ifunit_ref(name);
	if (!ifp)
		return ENXIO;
	NMG_LOCK();
	if (!NETMAP_CAPABLE(ifp) || NA(ifp)->nm_register != netmap_vp_reg) {
		error = EINVAL;
		goto err;
	}
	if (NA(ifp)->na_refcount > 1) {
		error = EBUSY;
		goto err;
	}
	NMG_UNLOCK();
	D("destroying a persistent vale interface %s", ifp->if_xname);
	if_rele(ifp);
	netmap_detach(ifp);
	nm_vi_detach(ifp);
	return 0;
err:
	NMG_UNLOCK();
	if_rele(ifp);
	return error;
}
static int nm_vi_destroy ( const char * name ) { struct ifnet * ifp ; int error ; ifp = ifunit_ref ( name ) ; if ( ! ifp ) return ENXIO ; NMG_LOCK ( ) ; if ( ! NETMAP_CAPABLE ( ifp ) || NA ( ifp ) -> nm_register != netmap_vp_reg ) { error = EINVAL ; goto err ; } if ( NA ( ifp ) -> na_refcount > 1 ) { error = EBUSY ; goto err ; } NMG_UNLOCK ( ) ; D ( " " , ifp -> if_xname ) ; if_rele ( ifp ) ; netmap_detach ( ifp ) ; nm_vi_detach ( ifp ) ; return 0 ; err : NMG_UNLOCK ( ) ; if_rele ( ifp ) ; return error ; }
remove a persistent VALE port from the system
remove a persistent VALE port from the system
/* make sure this is actually a VALE port */ /* Linux requires all the references are released
	 * before unregister
	 */