From owner-svn-src-stable@FreeBSD.ORG Tue Mar 1 00:05:47 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 312DE106564A; Tue, 1 Mar 2011 00:05:47 +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 05BA48FC19; Tue, 1 Mar 2011 00:05:47 +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 p2105kMH063089; Tue, 1 Mar 2011 00:05:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2105kRh063087; Tue, 1 Mar 2011 00:05:46 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201103010005.p2105kRh063087@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 1 Mar 2011 00:05:46 +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: r219115 - stable/7/sys/dev/re 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: Tue, 01 Mar 2011 00:05:47 -0000 Author: yongari Date: Tue Mar 1 00:05:46 2011 New Revision: 219115 URL: http://svn.freebsd.org/changeset/base/219115 Log: MFC r218289: Disable TX IP checksum offloading for RTL8168C controllers. The controller in question generates frames with bad IP checksum value if packets contain IP options. For instance, packets generated by ping(8) with record route option have wrong IP checksum value. The controller correctly computes checksum for normal TCP/UDP packets though. There are two known RTL8168/8111C variants in market and the issue I observed happened on RL_HWREV_8168C_SPIN2. I'm not sure RL_HWREV_8168C also has the same issue but it would be better to assume it has the same issue since they shall share same core. RTL8102E which is supposed to be released at the time of RTL8168/8111C announcement does not have the issue. Tested by: Konstantin V. Krotov ( kkv <> insysnet dot ru ) Modified: stable/7/sys/dev/re/if_re.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/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Tue Mar 1 00:04:34 2011 (r219114) +++ stable/7/sys/dev/re/if_re.c Tue Mar 1 00:05:46 2011 (r219115) @@ -1528,7 +1528,16 @@ re_attach(device_t dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = re_ioctl; ifp->if_start = re_start; - ifp->if_hwassist = RE_CSUM_FEATURES | CSUM_TSO; + /* + * RTL8168/8111C generates wrong IP checksummed frame if the + * packet has IP options so disable TX IP checksum offloading. + */ + if (sc->rl_hwrev->rl_rev == RL_HWREV_8168C || + sc->rl_hwrev->rl_rev == RL_HWREV_8168C_SPIN2) + ifp->if_hwassist = CSUM_TCP | CSUM_UDP; + else + ifp->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP; + ifp->if_hwassist |= CSUM_TSO; ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_TSO4; ifp->if_capenable = ifp->if_capabilities; ifp->if_init = re_init; @@ -3203,6 +3212,7 @@ re_ioctl(struct ifnet *ifp, u_long comma struct rl_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; struct mii_data *mii; + uint32_t rev; int error = 0; switch (command) { @@ -3288,9 +3298,14 @@ re_ioctl(struct ifnet *ifp, u_long comma 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 |= RE_CSUM_FEATURES; - else + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) { + rev = sc->rl_hwrev->rl_rev; + if (rev == RL_HWREV_8168C || + rev == RL_HWREV_8168C_SPIN2) + ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; + else + ifp->if_hwassist |= RE_CSUM_FEATURES; + } else ifp->if_hwassist &= ~RE_CSUM_FEATURES; reinit = 1; }