From owner-svn-src-head@FreeBSD.ORG Mon Jun 16 04:32:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3FC52665; Mon, 16 Jun 2014 04:32:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 1361B231F; Mon, 16 Jun 2014 04:32:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5G4WR0H059997; Mon, 16 Jun 2014 04:32:27 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5G4WRkR059996; Mon, 16 Jun 2014 04:32:27 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201406160432.s5G4WRkR059996@svn.freebsd.org> From: Bryan Venteicher Date: Mon, 16 Jun 2014 04:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267524 - head/sys/dev/virtio/network 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.18 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: Mon, 16 Jun 2014 04:32:28 -0000 Author: bryanv Date: Mon Jun 16 04:32:27 2014 New Revision: 267524 URL: http://svnweb.freebsd.org/changeset/base/267524 Log: Force two byte alignment for all control message headers The header structure consists of two 1-byte elements, but it must always be describable by a single SG entry. Note for consistency, specify the alignment everywhere, even if the structure has the appropriate natural alignment since it contains a uint16_t. Obtained from: DragonFlyBSD MFC after: 1 week Modified: head/sys/dev/virtio/network/if_vtnet.c Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Mon Jun 16 04:29:28 2014 (r267523) +++ head/sys/dev/virtio/network/if_vtnet.c Mon Jun 16 04:32:27 2014 (r267524) @@ -3068,7 +3068,7 @@ vtnet_exec_ctrl_cmd(struct vtnet_softc * static int vtnet_ctrl_mac_cmd(struct vtnet_softc *sc, uint8_t *hwaddr) { - struct virtio_net_ctrl_hdr hdr; + struct virtio_net_ctrl_hdr hdr __aligned(2); struct sglist_seg segs[3]; struct sglist sg; uint8_t ack; @@ -3102,7 +3102,7 @@ vtnet_ctrl_mq_cmd(struct vtnet_softc *sc struct virtio_net_ctrl_mq mq; uint8_t pad2; uint8_t ack; - } s; + } s __aligned(2); int error; s.hdr.class = VIRTIO_NET_CTRL_MQ; @@ -3134,7 +3134,7 @@ vtnet_ctrl_rx_cmd(struct vtnet_softc *sc uint8_t onoff; uint8_t pad2; uint8_t ack; - } s; + } s __aligned(2); int error; KASSERT(sc->vtnet_flags & VTNET_FLAG_CTRL_RX, @@ -3217,7 +3217,7 @@ vtnet_rx_filter(struct vtnet_softc *sc) static void vtnet_rx_filter_mac(struct vtnet_softc *sc) { - struct virtio_net_ctrl_hdr hdr; + struct virtio_net_ctrl_hdr hdr __aligned(2); struct vtnet_mac_filter *filter; struct sglist_seg segs[4]; struct sglist sg; @@ -3330,7 +3330,7 @@ vtnet_exec_vlan_filter(struct vtnet_soft uint16_t tag; uint8_t pad2; uint8_t ack; - } s; + } s __aligned(2); int error; s.hdr.class = VIRTIO_NET_CTRL_VLAN;