hyperv/hn: Check NVS version for HASHVAL pktinfo on sending path.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8293
This commit is contained in:
sephe 2016-10-21 07:46:35 +00:00
parent 49c3662ce5
commit d10298a127
3 changed files with 17 additions and 6 deletions

View File

@ -544,8 +544,9 @@ hn_nvs_init(struct hn_softc *sc)
if (error) {
if_printf(sc->hn_ifp, "reinit NVS version 0x%x "
"failed: %d\n", sc->hn_nvs_ver, error);
return (error);
}
return (error);
goto done;
}
/*
@ -567,11 +568,16 @@ hn_nvs_init(struct hn_softc *sc)
HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver),
HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver));
}
return (0);
goto done;
}
}
if_printf(sc->hn_ifp, "no NVS available\n");
return (ENXIO);
done:
if (sc->hn_nvs_ver >= HN_NVS_VERSION_5)
sc->hn_caps |= HN_CAP_HASHVAL;
return (0);
}
int

View File

@ -269,6 +269,7 @@ struct hn_softc {
#define HN_CAP_UDP6CS 0x0040
#define HN_CAP_TSO4 0x0080
#define HN_CAP_TSO6 0x0100
#define HN_CAP_HASHVAL 0x0200
/*
* Externs

View File

@ -2233,7 +2233,8 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS)
"\006UDP4CS"
"\007UDP6CS"
"\010TSO4"
"\011TSO6");
"\011TSO6"
"\012HASHVAL");
return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req);
}
@ -3008,12 +3009,15 @@ hn_fixup_tx_data(struct hn_softc *sc)
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;
if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) {
/* Support HASHVAL pktinfo on TX path. */
if (sc->hn_caps & HN_CAP_HASHVAL) {
/*
* Support HASHVAL pktinfo on TX path.
*/
if (bootverbose)
if_printf(sc->hn_ifp, "support HASHVAL pktinfo\n");
for (i = 0; i < sc->hn_tx_ring_cnt; ++i)
sc->hn_tx_ring[i].hn_tx_flags |= HN_TX_FLAG_HASHVAL;
}