summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2017-01-05 03:42:29 +0000
committersephe <sephe@FreeBSD.org>2017-01-05 03:42:29 +0000
commita4d88ebd0cb61ee1e644f2ed37c8e93b8231f4cf (patch)
treeb196fbf50a4e7f6fd9eaa16a980c97cc6a9f72eb
parent3560073bb1bf15dae5f1dcff925e01dfa3a6417c (diff)
downloadFreeBSD-src-a4d88ebd0cb61ee1e644f2ed37c8e93b8231f4cf.zip
FreeBSD-src-a4d88ebd0cb61ee1e644f2ed37c8e93b8231f4cf.tar.gz
MFC 308908,308909
308908 hyperv/hn: Allow enabling IPv6 TX checksum offloading and IPv6 TSO. They are still disabled by default. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8490 308909 hyperv/hn: Don't abuse hn_{tx,rx}_ring_inuse. Just in case, the # of TX/RX rings is changed upon synthetic parts re-attach. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8520
-rw-r--r--sys/dev/hyperv/netvsc/hn_rndis.c2
-rw-r--r--sys/dev/hyperv/netvsc/if_hn.c31
2 files changed, 18 insertions, 15 deletions
diff --git a/sys/dev/hyperv/netvsc/hn_rndis.c b/sys/dev/hyperv/netvsc/hn_rndis.c
index 1c140f9..fa749d3 100644
--- a/sys/dev/hyperv/netvsc/hn_rndis.c
+++ b/sys/dev/hyperv/netvsc/hn_rndis.c
@@ -602,7 +602,6 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu)
if ((hwcaps.ndis_lsov2.ndis_ip6_encap & NDIS_OFFLOAD_ENCAP_8023) &&
(hwcaps.ndis_lsov2.ndis_ip6_opts & HN_NDIS_LSOV2_CAP_IP6) ==
HN_NDIS_LSOV2_CAP_IP6) {
-#ifdef notyet
caps |= HN_CAP_TSO6;
params.ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_ON;
@@ -610,7 +609,6 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu)
tso_maxsz = hwcaps.ndis_lsov2.ndis_ip6_maxsz;
if (hwcaps.ndis_lsov2.ndis_ip6_minsg > tso_minsg)
tso_minsg = hwcaps.ndis_lsov2.ndis_ip6_minsg;
-#endif
}
sc->hn_ndis_tso_szmax = 0;
sc->hn_ndis_tso_sgmin = 0;
diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c
index be5aafa..d56657a 100644
--- a/sys/dev/hyperv/netvsc/if_hn.c
+++ b/sys/dev/hyperv/netvsc/if_hn.c
@@ -504,7 +504,7 @@ hn_set_lro_lenlim(struct hn_softc *sc, int lenlim)
{
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;
}
#endif
@@ -1127,6 +1127,13 @@ hn_attach(device_t dev)
/* Enable all available capabilities by default. */
ifp->if_capenable = ifp->if_capabilities;
+ /*
+ * Disable IPv6 TSO and TXCSUM by default, they still can
+ * be enabled through SIOCSIFCAP.
+ */
+ ifp->if_capenable &= ~(IFCAP_TXCSUM_IPV6 | IFCAP_TSO6);
+ ifp->if_hwassist &= ~(HN_CSUM_IP6_MASK | CSUM_IP6_TSO);
+
if (ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) {
hn_set_tso_maxsize(sc, hn_tso_maxlen, ETHERMTU);
ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX;
@@ -2547,7 +2554,7 @@ hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS)
*/
--ackcnt;
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;
HN_UNLOCK(sc);
return 0;
@@ -2571,7 +2578,7 @@ hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS)
return error;
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];
if (on)
@@ -2639,7 +2646,7 @@ hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS)
uint64_t stat;
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];
stat += *((uint64_t *)((uint8_t *)rxr + ofs));
}
@@ -2649,7 +2656,7 @@ hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS)
return error;
/* 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];
*((uint64_t *)((uint8_t *)rxr + ofs)) = 0;
}
@@ -2667,7 +2674,7 @@ hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
u_long stat;
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];
stat += *((u_long *)((uint8_t *)rxr + ofs));
}
@@ -2677,7 +2684,7 @@ hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
return error;
/* 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];
*((u_long *)((uint8_t *)rxr + ofs)) = 0;
}
@@ -2693,7 +2700,7 @@ hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
u_long stat;
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];
stat += *((u_long *)((uint8_t *)txr + ofs));
}
@@ -2703,7 +2710,7 @@ hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS)
return error;
/* 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];
*((u_long *)((uint8_t *)txr + ofs)) = 0;
}
@@ -2725,7 +2732,7 @@ hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS)
return error;
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];
*((int *)((uint8_t *)txr + ofs)) = conf;
}
@@ -3596,7 +3603,7 @@ hn_set_chim_size(struct hn_softc *sc, int chim_size)
{
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;
}
@@ -3646,12 +3653,10 @@ hn_fixup_tx_data(struct hn_softc *sc)
csum_assist |= CSUM_IP_TCP;
if (sc->hn_caps & HN_CAP_UDP4CS)
csum_assist |= CSUM_IP_UDP;
-#ifdef notyet
if (sc->hn_caps & HN_CAP_TCP6CS)
csum_assist |= CSUM_IP6_TCP;
if (sc->hn_caps & HN_CAP_UDP6CS)
csum_assist |= CSUM_IP6_UDP;
-#endif
for (i = 0; i < sc->hn_tx_ring_cnt; ++i)
sc->hn_tx_ring[i].hn_csum_assist = csum_assist;
OpenPOWER on IntegriCloud