FreeBSD/sys/dev/xen/netfront/netfront.c
/* START of Xenolinux helper functions adapted to FreeBSD */
START of Xenolinux helper functions adapted to FreeBSD
START of Xenolinux helper functions adapted to FreeBSD
static int
xn_connect(struct netfront_info *np)
{
	int i, error;
	u_int feature_rx_copy;
	struct netfront_rxq *rxq;
	struct netfront_txq *txq;
	error = xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev),
	    "feature-rx-copy", NULL, "%u", &feature_rx_copy);
	if (error != 0)
		feature_rx_copy = 0;
	if (!feature_rx_copy)
		return (EPROTONOSUPPORT);
	error = talk_to_backend(np->xbdev, np);
	if (error != 0)
		return (error);
	xn_query_features(np);
	xn_configure_features(np);
	for (i = 0; i < np->num_queues; i++) {
		txq = &np->txq[i];
		xn_release_tx_bufs(txq);
	}
	for (i = 0; i < np->num_queues; i++) {
		rxq = &np->rxq[i];
		xn_rebuild_rx_bufs(rxq);
	}
	netfront_carrier_on(np);
	wakeup(np);
	return (0);
}
static int xn_connect ( struct netfront_info * np ) { int i , error ; u_int feature_rx_copy ; struct netfront_rxq * rxq ; struct netfront_txq * txq ; error = xs_scanf ( XST_NIL , xenbus_get_otherend_path ( np -> xbdev ) , " " , NULL , " " , & feature_rx_copy ) ; if ( error != 0 ) feature_rx_copy = 0 ; if ( ! feature_rx_copy ) return ( EPROTONOSUPPORT ) ; error = talk_to_backend ( np -> xbdev , np ) ; if ( error != 0 ) return ( error ) ; xn_query_features ( np ) ; xn_configure_features ( np ) ; for ( i = 0 ; i < np -> num_queues ; i ++ ) { txq = & np -> txq [ i ] ; xn_release_tx_bufs ( txq ) ; } for ( i = 0 ; i < np -> num_queues ; i ++ ) { rxq = & np -> rxq [ i ] ; xn_rebuild_rx_bufs ( rxq ) ; } netfront_carrier_on ( np ) ; wakeup ( np ) ; return ( 0 ) ; }
START of Xenolinux helper functions adapted to FreeBSD
START of Xenolinux helper functions adapted to FreeBSD
/* We only support rx copy. */ /* Recovery procedure: */ /* Step 1: Reinitialise variables. */ /* Step 2: Release TX buffer */ /* Step 3: Rebuild the RX buffer freelist and the RX ring itself. */ /* Step 4: All public and private state should now be sane.  Get
	 * ready to start sending and receiving packets and give the driver
	 * domain a kick because we've probably just requeued some
	 * packets.
	 */