From owner-freebsd-stable@FreeBSD.ORG Tue Jan 31 09:09:30 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E81CC16A423; Tue, 31 Jan 2006 09:09:29 +0000 (GMT) (envelope-from oleg@lath.rinet.ru) Received: from lath.rinet.ru (lath.rinet.ru [195.54.192.90]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84CDE43D5E; Tue, 31 Jan 2006 09:09:14 +0000 (GMT) (envelope-from oleg@lath.rinet.ru) Received: from lath.rinet.ru (localhost [127.0.0.1]) by lath.rinet.ru (8.13.4/8.13.4) with ESMTP id k0V99DDR090239 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Jan 2006 12:09:13 +0300 (MSK) (envelope-from oleg@lath.rinet.ru) Received: (from oleg@localhost) by lath.rinet.ru (8.13.4/8.13.4/Submit) id k0V99D3O090238; Tue, 31 Jan 2006 12:09:13 +0300 (MSK) (envelope-from oleg) Date: Tue, 31 Jan 2006 12:09:13 +0300 From: Oleg Bulyzhin To: Koen Martens Message-ID: <20060131090912.GA88914@lath.rinet.ru> References: <43DB8EA6.7070503@metro.cx> <20060128211710.GA29790@lath.rinet.ru> <43DBED3F.3000408@metro.cx> <20060128230015.GC29790@lath.rinet.ru> <43DCCAA8.4050600@metro.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline In-Reply-To: <43DCCAA8.4050600@metro.cx> User-Agent: Mutt/1.5.11 Cc: darrenr@freebsd.org, glebius@freebsd.org, freebsd-stable@freebsd.org Subject: Re: ipfilter + bge strangeness X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2006 09:09:30 -0000 --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jan 29, 2006 at 03:01:12PM +0100, Koen Martens wrote: > Oleg Bulyzhin wrote: > > On Sat, Jan 28, 2006 at 11:16:31PM +0100, Koen Martens wrote: > >>Sure thing, although it happens with other kinds of traffic too (in > >>the dump, there's some NTP for example). Here's the netstat output > >>before: > > .... > > > > Btw, until recent changes bge had txcsum (not rxcsum) only. > > > > As i can see there is no problem with checksum's at all (at least inside > > bge driver). tcpdump reports bad checksum on outgoing packets due to > > nature of tx checksum offloading: packet will get it's checksum calculated > > right before it goes on wire (If you want to check tx checksum offloading > > you should look on incoming packets on other end of wire). > > > > Looks like something is wrong inside ipfilter. Can you test with ipfilter > > turned off (ipf -D or, if you using module, kld_unload ipl.ko)? > > With ipfilter disabled and rxcsum enabled all is well (also, with > ipfilter and rxcsum enabled but just two rules to allow anything > in/out it works fine too). > > The tcpdump output looks the same (see below). > > It is not a purely ipfilter thing i guess, since on an em interface > on another box with txcsum/rxcsum on, there is no problem. It is > something in the combination of bge and ipfilter, although that is > as far as my speculation goes right now.. Could you please test attached patch? Root of the problem is inside ipfilter - if driver use 'partial' (i.e. without pseudo header) rx checksum offloading ipfilter fails to calculate checksum correctly (it's using ip packet length (ip_fil_freebsd.c:1561) instead of tcp/udp length). This patch enables 'full' rxcsum offloading so ipfilter's bug should not be triggered. -- Oleg. --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bge_rxcsum.diff" Index: if_bge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.118 diff -u -r1.118 if_bge.c --- if_bge.c 30 Jan 2006 13:45:55 -0000 1.118 +++ if_bge.c 31 Jan 2006 08:53:00 -0000 @@ -1099,7 +1099,7 @@ */ CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS| BGE_MODECTL_MAC_ATTN_INTR|BGE_MODECTL_HOST_SEND_BDS| - BGE_MODECTL_TX_NO_PHDR_CSUM|BGE_MODECTL_RX_NO_PHDR_CSUM); + BGE_MODECTL_TX_NO_PHDR_CSUM); /* * Disable memory write invalidate. Apparently it is not supported @@ -2631,7 +2631,8 @@ m->m_pkthdr.len >= ETHER_MIN_NOPAD) { m->m_pkthdr.csum_data = cur_rx->bge_tcp_udp_csum; - m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; } } --lrZ03NoBR/3+SXJZ--