Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | |||||
#if defined(INET) || defined(INET6) | #if defined(INET) || defined(INET6) | ||||
#if __FreeBSD_version >= 1100095 | #if __FreeBSD_version >= 1100095 | ||||
static int hn_lro_entry_count = HN_LROENT_CNT_DEF; | static int hn_lro_entry_count = HN_LROENT_CNT_DEF; | ||||
TUNABLE_INT("dev.hn.lro_entry_count", &hn_lro_entry_count); | TUNABLE_INT("dev.hn.lro_entry_count", &hn_lro_entry_count); | ||||
#endif | #endif | ||||
#endif | #endif | ||||
static int hn_share_tx_taskq = 0; | |||||
TUNABLE_INT("hw.hn.share_tx_taskq", &hn_share_tx_taskq); | |||||
static struct taskqueue *hn_tx_taskq; | |||||
/* | /* | ||||
* Forward declarations | * Forward declarations | ||||
*/ | */ | ||||
static void hn_stop(hn_softc_t *sc); | static void hn_stop(hn_softc_t *sc); | ||||
static void hn_ifinit_locked(hn_softc_t *sc); | static void hn_ifinit_locked(hn_softc_t *sc); | ||||
static void hn_ifinit(void *xsc); | static void hn_ifinit(void *xsc); | ||||
static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); | static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); | ||||
static int hn_start_locked(struct ifnet *ifp, int len); | static int hn_start_locked(struct ifnet *ifp, int len); | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | #endif | ||||
sc->hn_direct_tx_size = hn_direct_tx_size; | sc->hn_direct_tx_size = hn_direct_tx_size; | ||||
if (hn_trust_hosttcp) | if (hn_trust_hosttcp) | ||||
sc->hn_trust_hcsum |= HN_TRUST_HCSUM_TCP; | sc->hn_trust_hcsum |= HN_TRUST_HCSUM_TCP; | ||||
if (hn_trust_hostudp) | if (hn_trust_hostudp) | ||||
sc->hn_trust_hcsum |= HN_TRUST_HCSUM_UDP; | sc->hn_trust_hcsum |= HN_TRUST_HCSUM_UDP; | ||||
if (hn_trust_hostip) | if (hn_trust_hostip) | ||||
sc->hn_trust_hcsum |= HN_TRUST_HCSUM_IP; | sc->hn_trust_hcsum |= HN_TRUST_HCSUM_IP; | ||||
if (hn_tx_taskq == NULL) { | |||||
sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK, | sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK, | ||||
taskqueue_thread_enqueue, &sc->hn_tx_taskq); | taskqueue_thread_enqueue, &sc->hn_tx_taskq); | ||||
taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx", | taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx", | ||||
device_get_nameunit(dev)); | device_get_nameunit(dev)); | ||||
} else { | |||||
sc->hn_tx_taskq = hn_tx_taskq; | |||||
} | |||||
TASK_INIT(&sc->hn_start_task, 0, hn_start_taskfunc, sc); | TASK_INIT(&sc->hn_start_task, 0, hn_start_taskfunc, sc); | ||||
TASK_INIT(&sc->hn_txeof_task, 0, hn_txeof_taskfunc, sc); | TASK_INIT(&sc->hn_txeof_task, 0, hn_txeof_taskfunc, sc); | ||||
error = hn_create_tx_ring(sc); | error = hn_create_tx_ring(sc); | ||||
if (error) | if (error) | ||||
goto failed; | goto failed; | ||||
NV_LOCK_INIT(sc, "NetVSCLock"); | NV_LOCK_INIT(sc, "NetVSCLock"); | ||||
▲ Show 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | netvsc_detach(device_t dev) | ||||
* XXXKYS: Need to stop outgoing traffic and unregister | * XXXKYS: Need to stop outgoing traffic and unregister | ||||
* the netdevice. | * the netdevice. | ||||
*/ | */ | ||||
hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL); | hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL); | ||||
taskqueue_drain(sc->hn_tx_taskq, &sc->hn_start_task); | taskqueue_drain(sc->hn_tx_taskq, &sc->hn_start_task); | ||||
taskqueue_drain(sc->hn_tx_taskq, &sc->hn_txeof_task); | taskqueue_drain(sc->hn_tx_taskq, &sc->hn_txeof_task); | ||||
if (sc->hn_tx_taskq != hn_tx_taskq) | |||||
taskqueue_free(sc->hn_tx_taskq); | taskqueue_free(sc->hn_tx_taskq); | ||||
ifmedia_removeall(&sc->hn_media); | ifmedia_removeall(&sc->hn_media); | ||||
#if defined(INET) || defined(INET6) | #if defined(INET) || defined(INET6) | ||||
tcp_lro_free(&sc->hn_lro); | tcp_lro_free(&sc->hn_lro); | ||||
#endif | #endif | ||||
hn_destroy_tx_ring(sc); | hn_destroy_tx_ring(sc); | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 1,419 Lines • ▼ Show 20 Lines | hn_txeof_taskfunc(void *xsc, int pending __unused) | ||||
struct hn_softc *sc = xsc; | struct hn_softc *sc = xsc; | ||||
struct ifnet *ifp = sc->hn_ifp; | struct ifnet *ifp = sc->hn_ifp; | ||||
NV_LOCK(sc); | NV_LOCK(sc); | ||||
atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); | atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); | ||||
hn_start_locked(ifp, 0); | hn_start_locked(ifp, 0); | ||||
NV_UNLOCK(sc); | NV_UNLOCK(sc); | ||||
} | } | ||||
static void | |||||
hn_tx_taskq_create(void *arg __unused) | |||||
{ | |||||
if (!hn_share_tx_taskq) | |||||
return; | |||||
hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK, | |||||
taskqueue_thread_enqueue, &hn_tx_taskq); | |||||
taskqueue_start_threads(&hn_tx_taskq, 1, PI_NET, "hn tx"); | |||||
} | |||||
SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_FIRST, | |||||
hn_tx_taskq_create, NULL); | |||||
static void | |||||
hn_tx_taskq_destroy(void *arg __unused) | |||||
{ | |||||
if (hn_tx_taskq != NULL) | |||||
taskqueue_free(hn_tx_taskq); | |||||
} | |||||
SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_FIRST, | |||||
hn_tx_taskq_destroy, NULL); | |||||
static device_method_t netvsc_methods[] = { | static device_method_t netvsc_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, netvsc_probe), | DEVMETHOD(device_probe, netvsc_probe), | ||||
DEVMETHOD(device_attach, netvsc_attach), | DEVMETHOD(device_attach, netvsc_attach), | ||||
DEVMETHOD(device_detach, netvsc_detach), | DEVMETHOD(device_detach, netvsc_detach), | ||||
DEVMETHOD(device_shutdown, netvsc_shutdown), | DEVMETHOD(device_shutdown, netvsc_shutdown), | ||||
Show All 14 Lines |