Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/if_hn.c
Show First 20 Lines • Show All 498 Lines • ▼ Show 20 Lines | |||||
MODULE_DEPEND(hn, vmbus, 1, 1, 1); | MODULE_DEPEND(hn, vmbus, 1, 1, 1); | ||||
#if __FreeBSD_version >= 1100099 | #if __FreeBSD_version >= 1100099 | ||||
static void | static void | ||||
hn_set_lro_lenlim(struct hn_softc *sc, int lenlim) | hn_set_lro_lenlim(struct hn_softc *sc, int lenlim) | ||||
{ | { | ||||
int i; | int i; | ||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) | for (i = 0; i < sc->hn_rx_ring_cnt; ++i) | ||||
sc->hn_rx_ring[i].hn_lro.lro_length_lim = lenlim; | sc->hn_rx_ring[i].hn_lro.lro_length_lim = lenlim; | ||||
} | } | ||||
#endif | #endif | ||||
static int | static int | ||||
hn_txpkt_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) | hn_txpkt_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 2,033 Lines • ▼ Show 20 Lines | if (ackcnt < 2 || ackcnt > (TCP_LRO_ACKCNT_MAX + 1)) | ||||
return EINVAL; | return EINVAL; | ||||
/* | /* | ||||
* Convert aggregation limit back to append | * Convert aggregation limit back to append | ||||
* count limit. | * count limit. | ||||
*/ | */ | ||||
--ackcnt; | --ackcnt; | ||||
HN_LOCK(sc); | HN_LOCK(sc); | ||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) | for (i = 0; i < sc->hn_rx_ring_cnt; ++i) | ||||
sc->hn_rx_ring[i].hn_lro.lro_ackcnt_lim = ackcnt; | sc->hn_rx_ring[i].hn_lro.lro_ackcnt_lim = ackcnt; | ||||
HN_UNLOCK(sc); | HN_UNLOCK(sc); | ||||
return 0; | return 0; | ||||
} | } | ||||
#endif | #endif | ||||
static int | static int | ||||
hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS) | hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct hn_softc *sc = arg1; | struct hn_softc *sc = arg1; | ||||
int hcsum = arg2; | int hcsum = arg2; | ||||
int on, error, i; | int on, error, i; | ||||
on = 0; | on = 0; | ||||
if (sc->hn_rx_ring[0].hn_trust_hcsum & hcsum) | if (sc->hn_rx_ring[0].hn_trust_hcsum & hcsum) | ||||
on = 1; | on = 1; | ||||
error = sysctl_handle_int(oidp, &on, 0, req); | error = sysctl_handle_int(oidp, &on, 0, req); | ||||
if (error || req->newptr == NULL) | if (error || req->newptr == NULL) | ||||
return error; | return error; | ||||
HN_LOCK(sc); | HN_LOCK(sc); | ||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++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]; | ||||
if (on) | if (on) | ||||
rxr->hn_trust_hcsum |= hcsum; | rxr->hn_trust_hcsum |= hcsum; | ||||
else | else | ||||
rxr->hn_trust_hcsum &= ~hcsum; | rxr->hn_trust_hcsum &= ~hcsum; | ||||
} | } | ||||
HN_UNLOCK(sc); | HN_UNLOCK(sc); | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS) | hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct hn_softc *sc = arg1; | struct hn_softc *sc = arg1; | ||||
int ofs = arg2, i, error; | int ofs = arg2, i, error; | ||||
struct hn_rx_ring *rxr; | struct hn_rx_ring *rxr; | ||||
uint64_t stat; | uint64_t stat; | ||||
stat = 0; | stat = 0; | ||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { | for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { | ||||
rxr = &sc->hn_rx_ring[i]; | rxr = &sc->hn_rx_ring[i]; | ||||
stat += *((uint64_t *)((uint8_t *)rxr + ofs)); | stat += *((uint64_t *)((uint8_t *)rxr + ofs)); | ||||
} | } | ||||
error = sysctl_handle_64(oidp, &stat, 0, req); | error = sysctl_handle_64(oidp, &stat, 0, req); | ||||
if (error || req->newptr == NULL) | if (error || req->newptr == NULL) | ||||
return error; | return error; | ||||
/* Zero out this stat. */ | /* Zero out this stat. */ | ||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { | for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { | ||||
rxr = &sc->hn_rx_ring[i]; | rxr = &sc->hn_rx_ring[i]; | ||||
*((uint64_t *)((uint8_t *)rxr + ofs)) = 0; | *((uint64_t *)((uint8_t *)rxr + ofs)) = 0; | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
#endif | #endif | ||||
static int | static int | ||||
hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS) | hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct hn_softc *sc = arg1; | struct hn_softc *sc = arg1; | ||||
int ofs = arg2, i, error; | int ofs = arg2, i, error; | ||||
struct hn_rx_ring *rxr; | struct hn_rx_ring *rxr; | ||||
u_long stat; | u_long stat; | ||||
stat = 0; | stat = 0; | ||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { | for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { | ||||
rxr = &sc->hn_rx_ring[i]; | rxr = &sc->hn_rx_ring[i]; | ||||
stat += *((u_long *)((uint8_t *)rxr + ofs)); | stat += *((u_long *)((uint8_t *)rxr + ofs)); | ||||
} | } | ||||
error = sysctl_handle_long(oidp, &stat, 0, req); | error = sysctl_handle_long(oidp, &stat, 0, req); | ||||
if (error || req->newptr == NULL) | if (error || req->newptr == NULL) | ||||
return error; | return error; | ||||
/* Zero out this stat. */ | /* Zero out this stat. */ | ||||
for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { | for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { | ||||
rxr = &sc->hn_rx_ring[i]; | rxr = &sc->hn_rx_ring[i]; | ||||
*((u_long *)((uint8_t *)rxr + ofs)) = 0; | *((u_long *)((uint8_t *)rxr + ofs)) = 0; | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
static int | static int | ||||
hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS) | hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct hn_softc *sc = arg1; | struct hn_softc *sc = arg1; | ||||
int ofs = arg2, i, error; | int ofs = arg2, i, error; | ||||
struct hn_tx_ring *txr; | struct hn_tx_ring *txr; | ||||
u_long stat; | u_long stat; | ||||
stat = 0; | stat = 0; | ||||
for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { | for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { | ||||
txr = &sc->hn_tx_ring[i]; | txr = &sc->hn_tx_ring[i]; | ||||
stat += *((u_long *)((uint8_t *)txr + ofs)); | stat += *((u_long *)((uint8_t *)txr + ofs)); | ||||
} | } | ||||
error = sysctl_handle_long(oidp, &stat, 0, req); | error = sysctl_handle_long(oidp, &stat, 0, req); | ||||
if (error || req->newptr == NULL) | if (error || req->newptr == NULL) | ||||
return error; | return error; | ||||
/* Zero out this stat. */ | /* Zero out this stat. */ | ||||
for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { | for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { | ||||
txr = &sc->hn_tx_ring[i]; | txr = &sc->hn_tx_ring[i]; | ||||
*((u_long *)((uint8_t *)txr + ofs)) = 0; | *((u_long *)((uint8_t *)txr + ofs)) = 0; | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
static int | static int | ||||
hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS) | hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct hn_softc *sc = arg1; | struct hn_softc *sc = arg1; | ||||
int ofs = arg2, i, error, conf; | int ofs = arg2, i, error, conf; | ||||
struct hn_tx_ring *txr; | struct hn_tx_ring *txr; | ||||
txr = &sc->hn_tx_ring[0]; | txr = &sc->hn_tx_ring[0]; | ||||
conf = *((int *)((uint8_t *)txr + ofs)); | conf = *((int *)((uint8_t *)txr + ofs)); | ||||
error = sysctl_handle_int(oidp, &conf, 0, req); | error = sysctl_handle_int(oidp, &conf, 0, req); | ||||
if (error || req->newptr == NULL) | if (error || req->newptr == NULL) | ||||
return error; | return error; | ||||
HN_LOCK(sc); | HN_LOCK(sc); | ||||
for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { | for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { | ||||
txr = &sc->hn_tx_ring[i]; | txr = &sc->hn_tx_ring[i]; | ||||
*((int *)((uint8_t *)txr + ofs)) = conf; | *((int *)((uint8_t *)txr + ofs)) = conf; | ||||
} | } | ||||
HN_UNLOCK(sc); | HN_UNLOCK(sc); | ||||
return 0; | return 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 854 Lines • ▼ Show 20 Lines | hn_create_tx_data(struct hn_softc *sc, int ring_cnt) | ||||
return 0; | return 0; | ||||
} | } | ||||
static void | static void | ||||
hn_set_chim_size(struct hn_softc *sc, int chim_size) | hn_set_chim_size(struct hn_softc *sc, int chim_size) | ||||
{ | { | ||||
int i; | int i; | ||||
for (i = 0; i < sc->hn_tx_ring_inuse; ++i) | for (i = 0; i < sc->hn_tx_ring_cnt; ++i) | ||||
sc->hn_tx_ring[i].hn_chim_size = chim_size; | sc->hn_tx_ring[i].hn_chim_size = chim_size; | ||||
} | } | ||||
static void | static void | ||||
hn_set_tso_maxsize(struct hn_softc *sc, int tso_maxlen, int mtu) | hn_set_tso_maxsize(struct hn_softc *sc, int tso_maxlen, int mtu) | ||||
{ | { | ||||
struct ifnet *ifp = sc->hn_ifp; | struct ifnet *ifp = sc->hn_ifp; | ||||
int tso_minlen; | int tso_minlen; | ||||
▲ Show 20 Lines • Show All 1,627 Lines • Show Last 20 Lines |