Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/xen/netfront/netfront.c
Show First 20 Lines • Show All 1,023 Lines • ▼ Show 20 Lines | setup_device(device_t dev, struct netfront_info *info, | ||||
return (0); | return (0); | ||||
out: | out: | ||||
KASSERT(error != 0, ("Error path taken without providing an error code")); | KASSERT(error != 0, ("Error path taken without providing an error code")); | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef INET | |||||
static u_int | |||||
netfront_addr_cb(void *arg, struct ifaddr *a, u_int count) | |||||
{ | |||||
arp_ifinit((if_t)arg, a); | |||||
return (1); | |||||
} | |||||
/** | /** | ||||
* If this interface has an ipv4 address, send an arp for it. This | |||||
* helps to get the network going again after migrating hosts. | |||||
*/ | |||||
static void | |||||
netfront_send_fake_arp(device_t dev, struct netfront_info *info) | |||||
{ | |||||
if_t ifp; | |||||
ifp = info->xn_ifp; | |||||
if_foreach_addr_type(ifp, AF_INET, netfront_addr_cb, ifp); | |||||
} | |||||
#endif | |||||
/** | |||||
* Callback received when the backend's state changes. | * Callback received when the backend's state changes. | ||||
*/ | */ | ||||
static void | static void | ||||
netfront_backend_changed(device_t dev, XenbusState newstate) | netfront_backend_changed(device_t dev, XenbusState newstate) | ||||
{ | { | ||||
struct netfront_info *sc = device_get_softc(dev); | struct netfront_info *sc = device_get_softc(dev); | ||||
DPRINTK("newstate=%d\n", newstate); | DPRINTK("newstate=%d\n", newstate); | ||||
Show All 23 Lines | case XenbusStateClosed: | ||||
if (sc->xn_reset) { | if (sc->xn_reset) { | ||||
netif_disconnect_backend(sc); | netif_disconnect_backend(sc); | ||||
xenbus_set_state(dev, XenbusStateInitialising); | xenbus_set_state(dev, XenbusStateInitialising); | ||||
sc->xn_reset = false; | sc->xn_reset = false; | ||||
} | } | ||||
break; | break; | ||||
case XenbusStateConnected: | case XenbusStateConnected: | ||||
#ifdef INET | #ifdef INET | ||||
netfront_send_fake_arp(dev, sc); | /* | ||||
* If this interface has an ipv4 address, send an arp for it. | |||||
* This helps to get the network going again after migrating | |||||
* hosts. | |||||
*/ | |||||
EVENTHANDLER_INVOKE(iflladdr_event, sc->xn_ifp); | |||||
royger: Would you mind dropping the extra '*' while moving the comment? It's not inline with our… | |||||
#endif | #endif | ||||
break; | break; | ||||
} | } | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 1,351 Lines • Show Last 20 Lines |
Would you mind dropping the extra '*' while moving the comment? It's not inline with our comments coding style.