From owner-svn-src-head@freebsd.org Wed Mar 1 08:50:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AE47CF1A10; Wed, 1 Mar 2017 08:50:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A68E6EB; Wed, 1 Mar 2017 08:50:42 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v218ogUq020758; Wed, 1 Mar 2017 08:50:42 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v218og56020757; Wed, 1 Mar 2017 08:50:42 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201703010850.v218og56020757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 1 Mar 2017 08:50:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314484 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Mar 2017 08:50:43 -0000 Author: sephe Date: Wed Mar 1 08:50:41 2017 New Revision: 314484 URL: https://svnweb.freebsd.org/changeset/base/314484 Log: hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9713 Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_rndis.c Wed Mar 1 08:24:17 2017 (r314483) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Wed Mar 1 08:50:41 2017 (r314484) @@ -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); }