FreeBSD/sys/dev/xen/netfront/netfront.c
/* equivalent of network_open() in Linux */
equivalent of network_open() in Linux
equivalent of network_open () in Linux
static void
xn_ifinit_locked(struct netfront_info *np)
{
	struct ifnet *ifp;
	int i;
	struct netfront_rxq *rxq;
	XN_LOCK_ASSERT(np);
	ifp = np->xn_ifp;
	if (ifp->if_drv_flags & IFF_DRV_RUNNING || !netfront_carrier_ok(np))
		return;
	xn_stop(np);
	for (i = 0; i < np->num_queues; i++) {
		rxq = &np->rxq[i];
		XN_RX_LOCK(rxq);
		xn_alloc_rx_buffers(rxq);
		rxq->ring.sring->rsp_event = rxq->ring.rsp_cons + 1;
		if (RING_HAS_UNCONSUMED_RESPONSES(&rxq->ring))
			xn_rxeof(rxq);
		XN_RX_UNLOCK(rxq);
	}
	ifp->if_drv_flags |= IFF_DRV_RUNNING;
	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
	if_link_state_change(ifp, LINK_STATE_UP);
}
static void xn_ifinit_locked ( struct netfront_info * np ) { struct ifnet * ifp ; int i ; struct netfront_rxq * rxq ; XN_LOCK_ASSERT ( np ) ; ifp = np -> xn_ifp ; if ( ifp -> if_drv_flags & IFF_DRV_RUNNING || ! netfront_carrier_ok ( np ) ) return ; xn_stop ( np ) ; for ( i = 0 ; i < np -> num_queues ; i ++ ) { rxq = & np -> rxq [ i ] ; XN_RX_LOCK ( rxq ) ; xn_alloc_rx_buffers ( rxq ) ; rxq -> ring . sring -> rsp_event = rxq -> ring . rsp_cons + 1 ; if ( RING_HAS_UNCONSUMED_RESPONSES ( & rxq -> ring ) ) xn_rxeof ( rxq ) ; XN_RX_UNLOCK ( rxq ) ; } ifp -> if_drv_flags |= IFF_DRV_RUNNING ; ifp -> if_drv_flags &= ~ IFF_DRV_OACTIVE ; if_link_state_change ( ifp , LINK_STATE_UP ) ; }
equivalent of network_open() in Linux
equivalent of network_open () in Linux