Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Show First 20 Lines • Show All 522 Lines • ▼ Show 20 Lines | #endif | ||||
*/ | */ | ||||
error = hn_chan_attach(sc, sc->hn_prichan); | error = hn_chan_attach(sc, sc->hn_prichan); | ||||
if (error) | if (error) | ||||
goto failed; | goto failed; | ||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; | ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; | ||||
ifp->if_ioctl = hn_ioctl; | ifp->if_ioctl = hn_ioctl; | ||||
ifp->if_init = hn_ifinit; | ifp->if_init = hn_ifinit; | ||||
/* needed by hv_rf_on_device_add() code */ | |||||
ifp->if_mtu = ETHERMTU; | ifp->if_mtu = ETHERMTU; | ||||
if (hn_use_if_start) { | if (hn_use_if_start) { | ||||
int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); | int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); | ||||
ifp->if_start = hn_start; | ifp->if_start = hn_start; | ||||
IFQ_SET_MAXLEN(&ifp->if_snd, qdepth); | IFQ_SET_MAXLEN(&ifp->if_snd, qdepth); | ||||
ifp->if_snd.ifq_drv_maxlen = qdepth - 1; | ifp->if_snd.ifq_drv_maxlen = qdepth - 1; | ||||
IFQ_SET_READY(&ifp->if_snd); | IFQ_SET_READY(&ifp->if_snd); | ||||
Show All 20 Lines | ifp->if_capenable |= | ||||
IFCAP_LRO; | IFCAP_LRO; | ||||
ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; | ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; | ||||
sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev), | sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev), | ||||
HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0); | HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0); | ||||
if (sc->hn_xact == NULL) | if (sc->hn_xact == NULL) | ||||
goto failed; | goto failed; | ||||
error = hv_rf_on_device_add(sc, &device_info, &ring_cnt); | error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, ETHERMTU); | ||||
if (error) | if (error) | ||||
goto failed; | goto failed; | ||||
KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse, | KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse, | ||||
("invalid channel count %d, should be less than %d", | ("invalid channel count %d, should be less than %d", | ||||
ring_cnt, sc->hn_rx_ring_inuse)); | ring_cnt, sc->hn_rx_ring_inuse)); | ||||
/* | /* | ||||
* Set the # of TX/RX rings that could be used according to | * Set the # of TX/RX rings that could be used according to | ||||
▲ Show 20 Lines • Show All 1,002 Lines • ▼ Show 20 Lines | #endif | ||||
/* Wait for subchannels to be destroyed */ | /* Wait for subchannels to be destroyed */ | ||||
vmbus_subchan_drain(sc->hn_prichan); | vmbus_subchan_drain(sc->hn_prichan); | ||||
sc->hn_rx_ring[0].hn_rx_flags &= ~HN_RX_FLAG_ATTACHED; | sc->hn_rx_ring[0].hn_rx_flags &= ~HN_RX_FLAG_ATTACHED; | ||||
sc->hn_tx_ring[0].hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; | sc->hn_tx_ring[0].hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; | ||||
hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */ | hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */ | ||||
ring_cnt = sc->hn_rx_ring_inuse; | ring_cnt = sc->hn_rx_ring_inuse; | ||||
error = hv_rf_on_device_add(sc, &device_info, &ring_cnt); | error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, | ||||
ifr->ifr_mtu); | |||||
if (error) { | if (error) { | ||||
NV_LOCK(sc); | NV_LOCK(sc); | ||||
sc->temp_unusable = FALSE; | sc->temp_unusable = FALSE; | ||||
NV_UNLOCK(sc); | NV_UNLOCK(sc); | ||||
break; | break; | ||||
} | } | ||||
/* # of channels can _not_ be changed */ | /* # of channels can _not_ be changed */ | ||||
KASSERT(sc->hn_rx_ring_inuse == ring_cnt, | KASSERT(sc->hn_rx_ring_inuse == ring_cnt, | ||||
▲ Show 20 Lines • Show All 1,702 Lines • Show Last 20 Lines |