Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/netvsc/if_hn.c
Show First 20 Lines • Show All 3,503 Lines • ▼ Show 20 Lines | hn_create_tx_data(struct hn_softc *sc, int ring_cnt) | ||||
sc->hn_chim = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), | sc->hn_chim = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), | ||||
PAGE_SIZE, 0, HN_CHIM_SIZE, &sc->hn_chim_dma, | PAGE_SIZE, 0, HN_CHIM_SIZE, &sc->hn_chim_dma, | ||||
BUS_DMA_WAITOK | BUS_DMA_ZERO); | BUS_DMA_WAITOK | BUS_DMA_ZERO); | ||||
if (sc->hn_chim == NULL) { | if (sc->hn_chim == NULL) { | ||||
device_printf(sc->hn_dev, "allocate txbuf failed\n"); | device_printf(sc->hn_dev, "allocate txbuf failed\n"); | ||||
return (ENOMEM); | return (ENOMEM); | ||||
} | } | ||||
#if __FreeBSD_version >= 1100000 | |||||
sc->hn_tx_ehash_key = m_ether_tcpip_hash_init(); | |||||
#endif | |||||
sc->hn_tx_ring_cnt = ring_cnt; | sc->hn_tx_ring_cnt = ring_cnt; | ||||
sc->hn_tx_ring_inuse = sc->hn_tx_ring_cnt; | sc->hn_tx_ring_inuse = sc->hn_tx_ring_cnt; | ||||
sc->hn_tx_ring = malloc(sizeof(struct hn_tx_ring) * sc->hn_tx_ring_cnt, | sc->hn_tx_ring = malloc(sizeof(struct hn_tx_ring) * sc->hn_tx_ring_cnt, | ||||
M_DEVBUF, M_WAITOK | M_ZERO); | M_DEVBUF, M_WAITOK | M_ZERO); | ||||
ctx = device_get_sysctl_ctx(sc->hn_dev); | ctx = device_get_sysctl_ctx(sc->hn_dev); | ||||
child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->hn_dev)); | child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->hn_dev)); | ||||
▲ Show 20 Lines • Show All 468 Lines • ▼ Show 20 Lines | if (m->m_pkthdr.csum_flags & CSUM_TSO) { | ||||
if (__predict_false(m == NULL)) { | if (__predict_false(m == NULL)) { | ||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); | if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); | ||||
return EIO; | return EIO; | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
/* | /* | ||||
* Select the TX ring based on flowid | * Select the TX ring. | ||||
*/ | */ | ||||
if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) | if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { | ||||
idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse; | idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse; | ||||
} | |||||
#if __FreeBSD_version >= 1100000 | |||||
else { | |||||
idx = m_ether_tcpip_hash(MBUF_HASHFLAG_L3 | MBUF_HASHFLAG_L4, | |||||
m, sc->hn_tx_ehash_key) % sc->hn_tx_ring_inuse; | |||||
} | |||||
#endif | |||||
txr = &sc->hn_tx_ring[idx]; | txr = &sc->hn_tx_ring[idx]; | ||||
error = drbr_enqueue(ifp, txr->hn_mbuf_br, m); | error = drbr_enqueue(ifp, txr->hn_mbuf_br, m); | ||||
if (error) { | if (error) { | ||||
if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1); | if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1); | ||||
return error; | return error; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,234 Lines • Show Last 20 Lines |