Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 Jul 2004 13:49:05 +0400
From:      Roman Kurakin <rik@cronyx.ru>
To:        Bruce M Simpson <bms@spc.org>
Cc:        rea@mbslab.kiae.ru
Subject:   Re: kern/57100: disable hardware checksums when using bridge(4).
Message-ID:  <40E7D291.6010002@cronyx.ru>
In-Reply-To: <20040703173945.GW97102@empiric.dek.spc.org>
References:  <20040703173945.GW97102@empiric.dek.spc.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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"
>  
>






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40E7D291.6010002>