Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/hv_net_vsc.c
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
static inline netvsc_dev * | static inline netvsc_dev * | ||||
hv_nv_alloc_net_device(struct hn_softc *sc) | hv_nv_alloc_net_device(struct hn_softc *sc) | ||||
{ | { | ||||
netvsc_dev *net_dev; | netvsc_dev *net_dev; | ||||
net_dev = malloc(sizeof(netvsc_dev), M_NETVSC, M_WAITOK | M_ZERO); | net_dev = malloc(sizeof(netvsc_dev), M_NETVSC, M_WAITOK | M_ZERO); | ||||
net_dev->sc = sc; | net_dev->sc = sc; | ||||
net_dev->destroy = FALSE; | |||||
sc->net_dev = net_dev; | sc->net_dev = net_dev; | ||||
return (net_dev); | return (net_dev); | ||||
} | } | ||||
/* | /* | ||||
* XXX unnecessary; nuke it. | * XXX unnecessary; nuke it. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 628 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Net VSC on device remove | * Net VSC on device remove | ||||
*/ | */ | ||||
int | int | ||||
hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) | hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) | ||||
{ | { | ||||
netvsc_dev *net_dev = sc->net_dev;; | netvsc_dev *net_dev = sc->net_dev;; | ||||
/* Stop outbound traffic ie sends and receives completions */ | |||||
net_dev->destroy = TRUE; | |||||
hv_nv_disconnect_from_vsp(net_dev); | hv_nv_disconnect_from_vsp(net_dev); | ||||
/* At this point, no one should be accessing net_dev except in here */ | /* At this point, no one should be accessing net_dev except in here */ | ||||
/* Now, we can close the channel safely */ | /* Now, we can close the channel safely */ | ||||
vmbus_chan_close(sc->hn_prichan); | vmbus_chan_close(sc->hn_prichan); | ||||
▲ Show 20 Lines • Show All 254 Lines • Show Last 20 Lines |