From owner-svn-src-stable-7@FreeBSD.ORG Tue Mar 23 19:24:17 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3263106564A; Tue, 23 Mar 2010 19:24:17 +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 C19BE8FC08; Tue, 23 Mar 2010 19:24:17 +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 o2NJOHeb064396; Tue, 23 Mar 2010 19:24:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2NJOHYI064394; Tue, 23 Mar 2010 19:24:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003231924.o2NJOHYI064394@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 23 Mar 2010 19:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205524 - stable/7/sys/dev/bge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Mar 2010 19:24:18 -0000 Author: yongari Date: Tue Mar 23 19:24:17 2010 New Revision: 205524 URL: http://svn.freebsd.org/changeset/base/205524 Log: MFC r204151,204223: r204151: Add TSO support on VLAN. Controller requires VLAN hardware tagging to make TSO work on VLAN. So if VLAN hardware tagging is disabled explicitly clear TSO on VLAN. While I'm here remove duplicated VLAN_CAPABILITIES call. r204223: Remove Tx mbuf parsing code for VLAN in TSO path. Controller does not support TSO over VLAN if VLAN hardware tagging is disabled so there is no need to check VLAN here. While I'm here make sure to pullup IP/TCP headers in the first buffer. Modified: stable/7/sys/dev/bge/if_bge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Mar 23 19:16:35 2010 (r205523) +++ stable/7/sys/dev/bge/if_bge.c Tue Mar 23 19:24:17 2010 (r205524) @@ -2816,7 +2816,7 @@ bge_attach(device_t dev) IFCAP_VLAN_MTU; if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { ifp->if_hwassist |= CSUM_TSO; - ifp->if_capabilities |= IFCAP_TSO4; + ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; } #ifdef IFCAP_VLAN_HWCSUM ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; @@ -3831,12 +3831,11 @@ bge_cksum_pad(struct mbuf *m) static struct mbuf * bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) { - struct ether_header *eh; struct ip *ip; struct tcphdr *tcp; struct mbuf *n; uint16_t hlen; - uint32_t ip_off, poff; + uint32_t poff; if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ @@ -3846,28 +3845,16 @@ bge_setup_tso(struct bge_softc *sc, stru return (NULL); m = n; } - ip_off = sizeof(struct ether_header); - m = m_pullup(m, ip_off); + m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip)); if (m == NULL) return (NULL); - eh = mtod(m, struct ether_header *); - /* Check the existence of VLAN tag. */ - if (eh->ether_type == htons(ETHERTYPE_VLAN)) { - ip_off = sizeof(struct ether_vlan_header); - m = m_pullup(m, ip_off); - if (m == NULL) - return (NULL); - } - m = m_pullup(m, ip_off + sizeof(struct ip)); - if (m == NULL) - return (NULL); - ip = (struct ip *)(mtod(m, char *) + ip_off); - poff = ip_off + (ip->ip_hl << 2); + ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); + poff = sizeof(struct ether_header) + (ip->ip_hl << 2); m = m_pullup(m, poff + sizeof(struct tcphdr)); if (m == NULL) return (NULL); tcp = (struct tcphdr *)(mtod(m, char *) + poff); - m = m_pullup(m, poff + sizeof(struct tcphdr) + tcp->th_off); + m = m_pullup(m, poff + (tcp->th_off << 2)); if (m == NULL) return (NULL); /* @@ -4522,9 +4509,6 @@ bge_ioctl(struct ifnet *ifp, u_long comm ifp->if_hwassist |= BGE_CSUM_FEATURES; else ifp->if_hwassist &= ~BGE_CSUM_FEATURES; -#ifdef VLAN_CAPABILITIES - VLAN_CAPABILITIES(ifp); -#endif } if ((mask & IFCAP_TSO4) != 0 && @@ -4542,16 +4526,21 @@ bge_ioctl(struct ifnet *ifp, u_long comm bge_init(sc); } - if (mask & IFCAP_VLAN_HWTAGGING) { + if ((mask & IFCAP_VLAN_HWTSO) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) + ifp->if_capenable &= ~IFCAP_VLAN_HWTSO; BGE_LOCK(sc); bge_setvlan(sc); BGE_UNLOCK(sc); + } #ifdef VLAN_CAPABILITIES - VLAN_CAPABILITIES(ifp); + VLAN_CAPABILITIES(ifp); #endif - } - break; default: error = ether_ioctl(ifp, command, data);