From owner-svn-src-head@FreeBSD.ORG Fri Feb 26 20:39:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17D0A106566C; Fri, 26 Feb 2010 20:39:08 +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 0708B8FC15; Fri, 26 Feb 2010 20:39:08 +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 o1QKd70I047579; Fri, 26 Feb 2010 20:39:07 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1QKd7Gw047577; Fri, 26 Feb 2010 20:39:07 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201002262039.o1QKd7Gw047577@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 26 Feb 2010 20:39:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204371 - head/sys/dev/bce X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 26 Feb 2010 20:39:08 -0000 Author: yongari Date: Fri Feb 26 20:39:07 2010 New Revision: 204371 URL: http://svn.freebsd.org/changeset/base/204371 Log: Make toggling TSO, VLAN hardware checksum offloading work. Also fix TX/RX checksum handler to set/clear relavant assist bits which was used to cause unexpected results. With this change, bce(4) can be bridged with other interfaces that lack TSO, VLAN checksum offloading. Reviewed by: davidch Modified: head/sys/dev/bce/if_bce.c Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Fri Feb 26 20:26:17 2010 (r204370) +++ head/sys/dev/bce/if_bce.c Fri Feb 26 20:39:07 2010 (r204371) @@ -7102,33 +7102,35 @@ bce_ioctl(struct ifnet *ifp, u_long comm mask = ifr->ifr_reqcap ^ ifp->if_capenable; DBPRINT(sc, BCE_INFO_MISC, "Received SIOCSIFCAP = 0x%08X\n", (u32) mask); - /* Toggle the TX checksum capabilites enable flag. */ - if (mask & IFCAP_TXCSUM) { + /* Toggle the TX checksum capabilities enable flag. */ + if (mask & IFCAP_TXCSUM && + ifp->if_capabilities & IFCAP_TXCSUM) { ifp->if_capenable ^= IFCAP_TXCSUM; if (IFCAP_TXCSUM & ifp->if_capenable) - ifp->if_hwassist = BCE_IF_HWASSIST; + ifp->if_hwassist |= BCE_IF_HWASSIST; else - ifp->if_hwassist = 0; + ifp->if_hwassist &= ~BCE_IF_HWASSIST; } /* Toggle the RX checksum capabilities enable flag. */ - if (mask & IFCAP_RXCSUM) { + if (mask & IFCAP_RXCSUM && + ifp->if_capabilities & IFCAP_RXCSUM) ifp->if_capenable ^= IFCAP_RXCSUM; - if (IFCAP_RXCSUM & ifp->if_capenable) - ifp->if_hwassist = BCE_IF_HWASSIST; - else - ifp->if_hwassist = 0; - } /* Toggle the TSO capabilities enable flag. */ - if (bce_tso_enable && (mask & IFCAP_TSO4)) { + if (bce_tso_enable && (mask & IFCAP_TSO4) && + ifp->if_capabilities & IFCAP_TSO4) { ifp->if_capenable ^= IFCAP_TSO4; - if (IFCAP_RXCSUM & ifp->if_capenable) - ifp->if_hwassist = BCE_IF_HWASSIST; + if (IFCAP_TSO4 & ifp->if_capenable) + ifp->if_hwassist |= CSUM_TSO; else - ifp->if_hwassist = 0; + ifp->if_hwassist &= ~CSUM_TSO; } + if (mask & IFCAP_VLAN_HWCSUM && + ifp->if_capabilities & IFCAP_VLAN_HWCSUM) + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + /* * Don't actually disable VLAN tag stripping as * management firmware (ASF/IPMI/UMP) requires the