From owner-svn-src-stable@FreeBSD.ORG Sun Feb 20 01:25:00 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37AC9106564A; Sun, 20 Feb 2011 01:25:00 +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 2416A8FC0A; Sun, 20 Feb 2011 01:25:00 +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 p1K1P0lm015375; Sun, 20 Feb 2011 01:25:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1K1P03R015373; Sun, 20 Feb 2011 01:25:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201102200125.p1K1P03R015373@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 20 Feb 2011 01:25:00 +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: r218874 - stable/8/sys/dev/nfe X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Feb 2011 01:25:00 -0000 Author: yongari Date: Sun Feb 20 01:24:59 2011 New Revision: 218874 URL: http://svn.freebsd.org/changeset/base/218874 Log: MFC r215432: MCP55 is the only NVIDIA controller that supports VLAN tag insertion/stripping and it also supports TSO over VLAN. Implement TSO over VLAN support for MCP55 controller. While I'm here clean up SIOCSIFCAP ioctl handler. Since nfe(4) sets ifp capabilities based on various hardware flags in device attach, there is no need to check hardware flags again in SIOCSIFCAP ioctl handler. Also fix a bug which toggled both TX and RX checksum offloading even if user requested either TX or RX checksum configuration change. Tested by: Rob Farmer ( rfarmer <> predatorlabs dot net ) Modified: stable/8/sys/dev/nfe/if_nfe.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) Modified: stable/8/sys/dev/nfe/if_nfe.c ============================================================================== --- stable/8/sys/dev/nfe/if_nfe.c Sun Feb 20 01:22:48 2011 (r218873) +++ stable/8/sys/dev/nfe/if_nfe.c Sun Feb 20 01:24:59 2011 (r218874) @@ -592,7 +592,8 @@ nfe_attach(device_t dev) if ((sc->nfe_flags & NFE_HW_VLAN) != 0) { ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; if ((ifp->if_capabilities & IFCAP_HWCSUM) != 0) - ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; + ifp->if_capabilities |= IFCAP_VLAN_HWCSUM | + IFCAP_VLAN_HWTSO; } if (pci_find_extcap(dev, PCIY_PMG, ®) == 0) @@ -1777,20 +1778,35 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, if ((mask & IFCAP_WOL_MAGIC) != 0 && (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) ifp->if_capenable ^= IFCAP_WOL_MAGIC; - - if ((sc->nfe_flags & NFE_HW_CSUM) != 0 && - (mask & IFCAP_HWCSUM) != 0) { - ifp->if_capenable ^= IFCAP_HWCSUM; - if ((IFCAP_TXCSUM & ifp->if_capenable) != 0 && - (IFCAP_TXCSUM & ifp->if_capabilities) != 0) + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) ifp->if_hwassist |= NFE_CSUM_FEATURES; else ifp->if_hwassist &= ~NFE_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_RXCSUM; init++; } - if ((sc->nfe_flags & NFE_HW_VLAN) != 0 && - (mask & IFCAP_VLAN_HWTAGGING) != 0) { + if ((mask & IFCAP_TSO4) != 0 && + (ifp->if_capabilities & IFCAP_TSO4) != 0) { + ifp->if_capenable ^= IFCAP_TSO4; + if ((IFCAP_TSO4 & ifp->if_capenable) != 0) + ifp->if_hwassist |= CSUM_TSO; + else + ifp->if_hwassist &= ~CSUM_TSO; + } + 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; init++; } /* @@ -1800,28 +1816,17 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, * VLAN stripping. So when we know Rx checksum offload is * disabled turn entire hardware VLAN assist off. */ - if ((sc->nfe_flags & (NFE_HW_CSUM | NFE_HW_VLAN)) == - (NFE_HW_CSUM | NFE_HW_VLAN)) { - if ((ifp->if_capenable & IFCAP_RXCSUM) == 0) - ifp->if_capenable &= ~IFCAP_VLAN_HWTAGGING; + if ((ifp->if_capenable & IFCAP_RXCSUM) == 0) { + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) + init++; + ifp->if_capenable &= ~(IFCAP_VLAN_HWTAGGING | + IFCAP_VLAN_HWTSO); } - - if ((sc->nfe_flags & NFE_HW_CSUM) != 0 && - (mask & IFCAP_TSO4) != 0) { - ifp->if_capenable ^= IFCAP_TSO4; - if ((IFCAP_TSO4 & ifp->if_capenable) != 0 && - (IFCAP_TSO4 & ifp->if_capabilities) != 0) - ifp->if_hwassist |= CSUM_TSO; - else - ifp->if_hwassist &= ~CSUM_TSO; - } - if (init > 0 && (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; nfe_init(sc); } - if ((sc->nfe_flags & NFE_HW_VLAN) != 0) - VLAN_CAPABILITIES(ifp); + VLAN_CAPABILITIES(ifp); break; default: error = ether_ioctl(ifp, cmd, data);