summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/netvsc/hn_rndis.c
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2017-03-17 02:48:29 +0000
committersephe <sephe@FreeBSD.org>2017-03-17 02:48:29 +0000
commit825dbb48235cc4b9421bff30c3e2b8e7bfb8f9e0 (patch)
tree11f1725e31f443aa92fbcfd263cad1fb8795d92c /sys/dev/hyperv/netvsc/hn_rndis.c
parent99a56fe1b3244c4c0893cbde134f95240c2cb300 (diff)
downloadFreeBSD-src-825dbb48235cc4b9421bff30c3e2b8e7bfb8f9e0.zip
FreeBSD-src-825dbb48235cc4b9421bff30c3e2b8e7bfb8f9e0.tar.gz
MFC: 314382-314485
314382 hyperv/hn: Simplify RNDIS packet data offset calculation. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9699 314483 hyperv/hn: Simplify RNDIS packet total length calculation. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9712 314484 hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9713 314485 hyperv/hn: Misaligned chimney sending buffers should not be used Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9714
Diffstat (limited to 'sys/dev/hyperv/netvsc/hn_rndis.c')
-rw-r--r--sys/dev/hyperv/netvsc/hn_rndis.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/dev/hyperv/netvsc/hn_rndis.c b/sys/dev/hyperv/netvsc/hn_rndis.c
index 198cc27..596fa9a 100644
--- a/sys/dev/hyperv/netvsc/hn_rndis.c
+++ b/sys/dev/hyperv/netvsc/hn_rndis.c
@@ -841,9 +841,22 @@ hn_rndis_init(struct hn_softc *sc)
sc->hn_rndis_agg_pkts = comp->rm_pktmaxcnt;
sc->hn_rndis_agg_align = 1U << comp->rm_align;
+ if (sc->hn_rndis_agg_align < sizeof(uint32_t)) {
+ /*
+ * The RNDIS packet messsage encap assumes that the RNDIS
+ * packet message is at least 4 bytes aligned. Fix up the
+ * alignment here, if the remote side sets the alignment
+ * too low.
+ */
+ if_printf(sc->hn_ifp, "fixup RNDIS aggpkt align: %u -> %zu\n",
+ sc->hn_rndis_agg_align, sizeof(uint32_t));
+ sc->hn_rndis_agg_align = sizeof(uint32_t);
+ }
+
if (bootverbose) {
- if_printf(sc->hn_ifp, "RNDIS ver %u.%u, pktsz %u, pktcnt %u, "
- "align %u\n", comp->rm_ver_major, comp->rm_ver_minor,
+ if_printf(sc->hn_ifp, "RNDIS ver %u.%u, "
+ "aggpkt size %u, aggpkt cnt %u, aggpkt align %u\n",
+ comp->rm_ver_major, comp->rm_ver_minor,
sc->hn_rndis_agg_size, sc->hn_rndis_agg_pkts,
sc->hn_rndis_agg_align);
}
OpenPOWER on IntegriCloud