From owner-freebsd-net@FreeBSD.ORG Sun Jul 4 09:59:23 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 345AC16A4CE for ; Sun, 4 Jul 2004 09:59:23 +0000 (GMT) Received: from hanoi.cronyx.ru (hanoi.cronyx.ru [144.206.181.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5114743D45 for ; Sun, 4 Jul 2004 09:59:22 +0000 (GMT) (envelope-from rik@cronyx.ru) Received: (from root@localhost) by hanoi.cronyx.ru id i649u4CM025473 for freebsd-net@freebsd.org.checked; (8.12.8/vak/2.1) Sun, 4 Jul 2004 13:56:04 +0400 (MSD) (envelope-from rik@cronyx.ru) Received: from cronyx.ru (rik.cronyx.ru [172.22.4.1]) by hanoi.cronyx.ru with ESMTP id i649tsLf025407; (8.12.8/vak/2.1) Sun, 4 Jul 2004 13:55:54 +0400 (MSD) (envelope-from rik@cronyx.ru) Message-ID: <40E7D291.6010002@cronyx.ru> Date: Sun, 04 Jul 2004 13:49:05 +0400 From: Roman Kurakin User-Agent: Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.2.1) Gecko/20030426 X-Accept-Language: ru-ru, en MIME-Version: 1.0 To: Bruce M Simpson References: <20040703173945.GW97102@empiric.dek.spc.org> In-Reply-To: <20040703173945.GW97102@empiric.dek.spc.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-net@freebsd.org cc: pak cc: rea@mbslab.kiae.ru 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: Sun, 04 Jul 2004 09:59:23 -0000 Also: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/67823 It was send by my friend, and his server runs with this patch. I guess that it should be idential to what you send here. If not you may contact him and ask to try your one. By the way, I thought that should be better solution. For example, why not to tag packets if they already checksumed or not? rik Bruce M Simpson: >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 > > >------------------------------------------------------------------------ > >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; > > >------------------------------------------------------------------------ > >_______________________________________________ >freebsd-net@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-net >To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > >