FreeBSD/sys/dev/xen/netfront/netfront.c
/**
 * Callback received when the backend's state changes.
 */
Callback received when the backend's state changes.
Callback received when the backend ' s state changes .
static void
netfront_backend_changed(device_t dev, XenbusState newstate)
{
	struct netfront_info *sc = device_get_softc(dev);
	DPRINTK("newstate=%d\n", newstate);
	switch (newstate) {
	case XenbusStateInitialising:
	case XenbusStateInitialised:
	case XenbusStateUnknown:
	case XenbusStateReconfigured:
	case XenbusStateReconfiguring:
		break;
	case XenbusStateInitWait:
		if (xenbus_get_state(dev) != XenbusStateInitialising)
			break;
		if (xn_connect(sc) != 0)
			break;
		xenbus_set_state(sc->xbdev, XenbusStateConnected);
		xn_kick_rings(sc);
		break;
	case XenbusStateClosing:
		xenbus_set_state(dev, XenbusStateClosed);
		break;
	case XenbusStateClosed:
		if (sc->xn_reset) {
			netif_disconnect_backend(sc);
			xenbus_set_state(dev, XenbusStateInitialising);
			sc->xn_reset = false;
		}
		break;
	case XenbusStateConnected:
#ifdef INET
		netfront_send_fake_arp(dev, sc);
#endif
		break;
	}
}
static void netfront_backend_changed ( device_t dev , XenbusState newstate ) { struct netfront_info * sc = device_get_softc ( dev ) ; DPRINTK ( " \n " , newstate ) ; switch ( newstate ) { case XenbusStateInitialising : case XenbusStateInitialised : case XenbusStateUnknown : case XenbusStateReconfigured : case XenbusStateReconfiguring : break ; case XenbusStateInitWait : if ( xenbus_get_state ( dev ) != XenbusStateInitialising ) break ; if ( xn_connect ( sc ) != 0 ) break ; xenbus_set_state ( sc -> xbdev , XenbusStateConnected ) ; xn_kick_rings ( sc ) ; break ; case XenbusStateClosing : xenbus_set_state ( dev , XenbusStateClosed ) ; break ; case XenbusStateClosed : if ( sc -> xn_reset ) { netif_disconnect_backend ( sc ) ; xenbus_set_state ( dev , XenbusStateInitialising ) ; sc -> xn_reset = false ; } break ; case XenbusStateConnected : #ifdef INET netfront_send_fake_arp ( dev , sc ) ; #endif break ; } }
Callback received when the backend's state changes.
Callback received when the backend ' s state changes .
/* Switch to connected state before kicking the rings. */