Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/netvsc/if_hn.c
Show First 20 Lines • Show All 4,932 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
#endif /* INET || INET6 */ | #endif /* INET || INET6 */ | ||||
ctx = device_get_sysctl_ctx(dev); | ctx = device_get_sysctl_ctx(dev); | ||||
child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); | child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); | ||||
/* Create dev.hn.UNIT.rx sysctl tree */ | /* Create dev.hn.UNIT.rx sysctl tree */ | ||||
sc->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "rx", | sc->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "rx", | ||||
CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"Receive parameters"); | |||||
for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { | for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { | ||||
struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; | struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; | ||||
rxr->hn_br = hyperv_dmamem_alloc(bus_get_dma_tag(dev), | rxr->hn_br = hyperv_dmamem_alloc(bus_get_dma_tag(dev), | ||||
PAGE_SIZE, 0, HN_TXBR_SIZE + HN_RXBR_SIZE, | PAGE_SIZE, 0, HN_TXBR_SIZE + HN_RXBR_SIZE, | ||||
&rxr->hn_br_dma, BUS_DMA_WAITOK); | &rxr->hn_br_dma, BUS_DMA_WAITOK); | ||||
if (rxr->hn_br == NULL) { | if (rxr->hn_br == NULL) { | ||||
Show All 38 Lines | if (sc->hn_rx_sysctl_tree != NULL) { | ||||
/* | /* | ||||
* Create per RX ring sysctl tree: | * Create per RX ring sysctl tree: | ||||
* dev.hn.UNIT.rx.RINGID | * dev.hn.UNIT.rx.RINGID | ||||
*/ | */ | ||||
snprintf(name, sizeof(name), "%d", i); | snprintf(name, sizeof(name), "%d", i); | ||||
rxr->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, | rxr->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, | ||||
SYSCTL_CHILDREN(sc->hn_rx_sysctl_tree), | SYSCTL_CHILDREN(sc->hn_rx_sysctl_tree), | ||||
OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); | OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"Ring parameters"); | |||||
if (rxr->hn_rx_sysctl_tree != NULL) { | if (rxr->hn_rx_sysctl_tree != NULL) { | ||||
SYSCTL_ADD_ULONG(ctx, | SYSCTL_ADD_ULONG(ctx, | ||||
SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), | SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), | ||||
OID_AUTO, "packets", CTLFLAG_RW, | OID_AUTO, "packets", CTLFLAG_RW, | ||||
&rxr->hn_pkts, "# of packets received"); | &rxr->hn_pkts, "# of packets received"); | ||||
SYSCTL_ADD_ULONG(ctx, | SYSCTL_ADD_ULONG(ctx, | ||||
SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), | SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), | ||||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | if (sc->hn_tx_sysctl_tree != NULL) { | ||||
* Create per TX ring sysctl tree: | * Create per TX ring sysctl tree: | ||||
* dev.hn.UNIT.tx.RINGID | * dev.hn.UNIT.tx.RINGID | ||||
*/ | */ | ||||
ctx = device_get_sysctl_ctx(dev); | ctx = device_get_sysctl_ctx(dev); | ||||
child = SYSCTL_CHILDREN(sc->hn_tx_sysctl_tree); | child = SYSCTL_CHILDREN(sc->hn_tx_sysctl_tree); | ||||
snprintf(name, sizeof(name), "%d", id); | snprintf(name, sizeof(name), "%d", id); | ||||
txr->hn_tx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, | txr->hn_tx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, | ||||
name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); | name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"Ring parameters"); | |||||
if (txr->hn_tx_sysctl_tree != NULL) { | if (txr->hn_tx_sysctl_tree != NULL) { | ||||
child = SYSCTL_CHILDREN(txr->hn_tx_sysctl_tree); | child = SYSCTL_CHILDREN(txr->hn_tx_sysctl_tree); | ||||
#ifdef HN_DEBUG | #ifdef HN_DEBUG | ||||
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "txdesc_avail", | SYSCTL_ADD_INT(ctx, child, OID_AUTO, "txdesc_avail", | ||||
CTLFLAG_RD, &txr->hn_txdesc_avail, 0, | CTLFLAG_RD, &txr->hn_txdesc_avail, 0, | ||||
"# of available TX descs"); | "# of available TX descs"); | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | hn_create_tx_data(struct hn_softc *sc, int 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)); | ||||
/* Create dev.hn.UNIT.tx sysctl tree */ | /* Create dev.hn.UNIT.tx sysctl tree */ | ||||
sc->hn_tx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "tx", | sc->hn_tx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "tx", | ||||
CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"Transmit parameters"); | |||||
for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { | for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { | ||||
int error; | int error; | ||||
error = hn_tx_ring_create(sc, i); | error = hn_tx_ring_create(sc, i); | ||||
if (error) | if (error) | ||||
return error; | return error; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,085 Lines • Show Last 20 Lines |