svn commit: r306939 - head/sys/dev/hyperv/netvsc
Sepherosa Ziehau
sephe at FreeBSD.org
Mon Oct 10 06:14:40 UTC 2016
Author: sephe
Date: Mon Oct 10 06:14:38 2016
New Revision: 306939
URL: https://svnweb.freebsd.org/changeset/base/306939
Log:
hyperv/hn: Suffix NDIS offload size with NDIS version.
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8091
Modified:
head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
head/sys/dev/hyperv/netvsc/ndis.h
Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 10 05:59:30 2016 (r306938)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 10 06:14:38 2016 (r306939)
@@ -1179,16 +1179,16 @@ hn_rndis_query_hwcaps(struct hn_softc *s
size = NDIS_OFFLOAD_SIZE;
} else if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_1) {
in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_2;
- size = NDIS_OFFLOAD_SIZE_2;
+ size = NDIS_OFFLOAD_SIZE_6_1;
} else {
in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_1;
- size = NDIS_OFFLOAD_SIZE_1;
+ size = NDIS_OFFLOAD_SIZE_6_0;
}
in.ndis_hdr.ndis_size = size;
caps_len = NDIS_OFFLOAD_SIZE;
error = hn_rndis_query2(sc, OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES,
- &in, size, caps, &caps_len, NDIS_OFFLOAD_SIZE_1);
+ &in, size, caps, &caps_len, NDIS_OFFLOAD_SIZE_6_0);
if (error)
return (error);
@@ -1209,7 +1209,7 @@ hn_rndis_query_hwcaps(struct hn_softc *s
if_printf(sc->hn_ifp, "invalid NDIS objsize %u, "
"data size %zu\n", caps->ndis_hdr.ndis_size, caps_len);
return (EINVAL);
- } else if (caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE_1) {
+ } else if (caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE_6_0) {
if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n",
caps->ndis_hdr.ndis_size);
return (EINVAL);
@@ -1217,7 +1217,9 @@ hn_rndis_query_hwcaps(struct hn_softc *s
if (bootverbose) {
/*
- * Fields for NDIS 6.0 are accessable.
+ * NOTE:
+ * caps->ndis_hdr.ndis_size MUST be checked before accessing
+ * NDIS 6.1+ specific fields.
*/
if_printf(sc->hn_ifp, "hwcaps rev %u\n",
caps->ndis_hdr.ndis_rev);
Modified: head/sys/dev/hyperv/netvsc/ndis.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/ndis.h Mon Oct 10 05:59:30 2016 (r306938)
+++ head/sys/dev/hyperv/netvsc/ndis.h Mon Oct 10 06:14:38 2016 (r306939)
@@ -319,9 +319,9 @@ struct ndis_offload {
};
#define NDIS_OFFLOAD_SIZE sizeof(struct ndis_offload)
-#define NDIS_OFFLOAD_SIZE_1 \
+#define NDIS_OFFLOAD_SIZE_6_0 \
__offsetof(struct ndis_offload, ndis_ipsecv2)
-#define NDIS_OFFLOAD_SIZE_2 \
+#define NDIS_OFFLOAD_SIZE_6_1 \
__offsetof(struct ndis_offload, ndis_rsc)
#define NDIS_OFFLOAD_REV_1 1 /* NDIS 6.0 */
More information about the svn-src-all
mailing list