From owner-freebsd-net@FreeBSD.ORG Sat Jul 3 17:39:52 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 33E2716A4CE; Sat, 3 Jul 2004 17:39:52 +0000 (GMT) Received: from arginine.spc.org (arginine.spc.org [195.206.69.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id B30E043D2D; Sat, 3 Jul 2004 17:39:51 +0000 (GMT) (envelope-from bms@spc.org) Received: from localhost (localhost [127.0.0.1]) by arginine.spc.org (Postfix) with ESMTP id BE35D65428; Sat, 3 Jul 2004 18:39:50 +0100 (BST) Received: from arginine.spc.org ([127.0.0.1]) by localhost (arginine.spc.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 74909-03-9; Sat, 3 Jul 2004 18:39:50 +0100 (BST) Received: from empiric.dek.spc.org (82-147-17-88.dsl.uk.rapidplay.com [82.147.17.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by arginine.spc.org (Postfix) with ESMTP id 9A6B66530A; Sat, 3 Jul 2004 18:39:49 +0100 (BST) Received: by empiric.dek.spc.org (Postfix, from userid 1001) id 77C58614B; Sat, 3 Jul 2004 18:39:45 +0100 (BST) Date: Sat, 3 Jul 2004 18:39:45 +0100 From: Bruce M Simpson To: pak Message-ID: <20040703173945.GW97102@empiric.dek.spc.org> Mail-Followup-To: pak , freebsd-net@freebsd.org, freebsd-gnats-submit@freebsd.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="JvUS8mwutKMHKosv" Content-Disposition: inline cc: freebsd-net@freebsd.org cc: freebsd-gnats-submit@freebsd.org Subject: Re: kern/57100: disable hardware checksums when using bridge(4). X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2004 17:39:52 -0000 --JvUS8mwutKMHKosv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here is a somewhat improved patch for tweaking the behaviour of the bridge code with respect to disabling the hardware-assist-checksum features of driver instances which are members of the bridge. I don't make use of the bridge code so I'd appreciate it if others who do could test this patch. To disable *all* capabilities, setting net.link.ether.bridge.hwassmask to 0 should suffice. Regards, BMS --JvUS8mwutKMHKosv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bridge-hwassist.patch" This patch implements a sysctl MIB variable, net.link.ether.bridge.hwassmask, which may be used to specify a bitmask which is applied to each member interface of a bridge to selectively disable interface hardware assist capabilities, and provides finer run-time control over such behaviour. Index: bridge.c =================================================================== RCS file: /home/ncvs/src/sys/net/bridge.c,v retrieving revision 1.79 diff -u -p -r1.79 bridge.c --- bridge.c 15 Jun 2004 23:57:41 -0000 1.79 +++ bridge.c 3 Jul 2004 17:33:47 -0000 @@ -204,6 +204,10 @@ SYSCTL_NODE(_net_link_ether, OID_AUTO, b static char bridge_version[] = "031224"; SYSCTL_STRING(_net_link_ether_bridge, OID_AUTO, version, CTLFLAG_RD, bridge_version, 0, "software version"); +static u_long bridge_hwassmask = 0xFFFFFFFFUL; +SYSCTL_ULONG(_net_link_ether_bridge, OID_AUTO, hwassmask, CTLFLAG_RW, + &bridge_hwassmask, 0, + "Mask to apply to if_hwassist field for bridge interfaces"); #define BRIDGE_DEBUG #ifdef BRIDGE_DEBUG @@ -391,6 +395,7 @@ bridge_off(void) if ( b->flags & IFF_BDG_PROMISC ) { ifpromisc(ifp, 0); + ifp->if_hwassist = b->hwassist; b->flags &= ~(IFF_BDG_PROMISC|IFF_MUTE) ; DPRINTF(("%s: %s promisc OFF if_flags 0x%x " "bdg_flags 0x%x\n", __func__, ifp->if_xname, @@ -433,6 +438,8 @@ bridge_on(void) if_up(ifp); } if ( !(b->flags & IFF_BDG_PROMISC) ) { + b->hwassist = ifp->if_hwassist; + ifp->if_hwassist &= bridge_hwassmask; (void) ifpromisc(ifp, 1); b->flags |= IFF_BDG_PROMISC ; DPRINTF(("%s: %s promisc ON if_flags 0x%x bdg_flags 0x%x\n", Index: bridge.h =================================================================== RCS file: /home/ncvs/src/sys/net/bridge.h,v retrieving revision 1.12 diff -u -p -r1.12 bridge.h --- bridge.h 15 Nov 2002 00:00:14 -0000 1.12 +++ bridge.h 3 Jul 2004 17:26:44 -0000 @@ -48,6 +48,7 @@ struct bdg_softc { #define IFF_MUTE 0x0002 /* mute this if for bridging. */ #define IFF_USED 0x0004 /* use this if for bridging. */ struct cluster_softc *cluster; + u_long hwassist; /* saved ifp->if_hwassist field */ } ; extern struct bdg_softc *ifp2sc; --JvUS8mwutKMHKosv--