From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 21:07:13 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92B77106566C; Sun, 24 Oct 2010 21:07:13 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65EEA8FC08; Sun, 24 Oct 2010 21:07:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OL7DMQ039959; Sun, 24 Oct 2010 21:07:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OL7Dma039957; Sun, 24 Oct 2010 21:07:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242107.o9OL7Dma039957@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214293 - stable/8/sys/dev/alc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:07:13 -0000 Author: yongari Date: Sun Oct 24 21:07:13 2010 New Revision: 214293 URL: http://svn.freebsd.org/changeset/base/214293 Log: MFC r213842: Backout r204230. TX mbuf parser for VLAN is still required to enable TX checksum offloading if VLAN hardware tagging is disabled. Modified: stable/8/sys/dev/alc/if_alc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Sun Oct 24 20:54:46 2010 (r214292) +++ stable/8/sys/dev/alc/if_alc.c Sun Oct 24 21:07:13 2010 (r214293) @@ -2019,7 +2019,7 @@ alc_encap(struct alc_softc *sc, struct m struct tcphdr *tcp; bus_dma_segment_t txsegs[ALC_MAXTXSEGS]; bus_dmamap_t map; - uint32_t cflags, hdrlen, poff, vtag; + uint32_t cflags, hdrlen, ip_off, poff, vtag; int error, idx, nsegs, prod; ALC_LOCK_ASSERT(sc); @@ -2029,7 +2029,7 @@ alc_encap(struct alc_softc *sc, struct m m = *m_head; ip = NULL; tcp = NULL; - poff = 0; + ip_off = poff = 0; if ((m->m_pkthdr.csum_flags & (ALC_CSUM_FEATURES | CSUM_TSO)) != 0) { /* * AR813x/AR815x requires offset of TCP/UDP header in its @@ -2039,6 +2039,7 @@ alc_encap(struct alc_softc *sc, struct m * cycles on FreeBSD so fast host CPU is required to get * smooth TSO performance. */ + struct ether_header *eh; if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ @@ -2052,15 +2053,32 @@ alc_encap(struct alc_softc *sc, struct m *m_head = m; } - m = m_pullup(m, sizeof(struct ether_header) + - sizeof(struct ip)); + ip_off = sizeof(struct ether_header); + m = m_pullup(m, ip_off); if (m == NULL) { *m_head = NULL; return (ENOBUFS); } - ip = (struct ip *)(mtod(m, char *) + - sizeof(struct ether_header)); - poff = sizeof(struct ether_header) + (ip->ip_hl << 2); + eh = mtod(m, struct ether_header *); + /* + * Check if hardware VLAN insertion is off. + * Additional check for LLC/SNAP frame? + */ + if (eh->ether_type == htons(ETHERTYPE_VLAN)) { + ip_off = sizeof(struct ether_vlan_header); + m = m_pullup(m, ip_off); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + } + m = m_pullup(m, ip_off + sizeof(struct ip)); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m, char *) + ip_off); + poff = ip_off + (ip->ip_hl << 2); if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { m = m_pullup(m, poff + sizeof(struct tcphdr)); if (m == NULL) {