From owner-cvs-all@FreeBSD.ORG Tue Feb 7 10:38:12 2006 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B462E16A420; Tue, 7 Feb 2006 10:38:12 +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 DBB5F43D46; Tue, 7 Feb 2006 10:38:11 +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 k17AbQaN064787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Feb 2006 13:37:26 +0300 (MSK) (envelope-from oleg@lath.rinet.ru) Received: (from oleg@localhost) by lath.rinet.ru (8.13.4/8.13.4/Submit) id k17AbPjf064782; Tue, 7 Feb 2006 13:37:25 +0300 (MSK) (envelope-from oleg) Date: Tue, 7 Feb 2006 13:37:25 +0300 From: Oleg Bulyzhin To: Bruce Evans Message-ID: <20060207103725.GA64400@lath.rinet.ru> References: <200602020958.k129wWtc066930@repoman.freebsd.org> <20060202100637.GB24350@lath.rinet.ru> <20060205235817.GQ5499@cs.rice.edu> <20060206221141.GA57775@lath.rinet.ru> <43E7CBD5.5090203@root.org> <20060206223436.GB57775@lath.rinet.ru> <43E7D662.6000608@root.org> <43E7DAC2.8060101@root.org> <20060207201220.W4040@epsplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060207201220.W4040@epsplex.bde.org> User-Agent: Mutt/1.5.11 Cc: cvs-src@freebsd.org, src-committers@freebsd.org, Alan Cox , cvs-all@freebsd.org, Nate Lawson Subject: Re: cvs commit: src/sys/dev/bge if_bge.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2006 10:38:12 -0000 On Tue, Feb 07, 2006 at 08:44:42PM +1100, Bruce Evans wrote: > On Mon, 6 Feb 2006, Nate Lawson wrote: > > >Nate Lawson wrote: > >>Oleg Bulyzhin wrote: > >> > >>>On Mon, Feb 06, 2006 at 02:21:09PM -0800, Nate Lawson wrote: > >>> > >>>>Oleg Bulyzhin wrote: > >>>> > >>>>> nq = q->m_nextpkt; > >>>>> q->m_nextpkt = NULL; > >>>>> m->m_pkthdr.csum_flags &= q->m_pkthdr.csum_flags; > >>>>>- m->m_pkthdr.csum_data += q->m_pkthdr.csum_data; > >>>>>+ sum = m->m_pkthdr.csum_data + q->m_pkthdr.csum_data; > >>>>>+ m->m_pkthdr.csum_data = (sum & 0xffff) + (sum >> 16); > >>>>> m_cat(m, q); > >>>>> } > >>>>>#ifdef MAC > >... > >Sam Leffler mentioned this comment from NetBSD would be helpful. Might > >you add it to clear up misunderstandings like I had? > > > >sys/mbuf.h has useful comments not found in the freebsd file: > >... > >* Note for in-bound TCP/UDP checksums, we expect the csum_data to NOT > >* be bit-wise inverted (the final step in the calculation of an IP > >* checksum) -- this is so we can accumulate the checksum for fragmented > >* packets during reassembly. > >*/ > > This almost makes the carry-folding (including the above change) > unnecessary too. csum_data can accumulate at least 64K terms each > less than 0x10000 before it might have a carry out of its 32-bit int. > I think there can't be 64K fragments, so the unpatched version would > work if the final step did the carry-folding and no intermediate step > assumes that csum_data < 0x10000. I couldn't find any final or > intermediate steps that would cause problems. > > Bruce You are right. If we are not going to reassemble more than 64k fragments we can just add (into original ip_reass()): m->m_pkthdr.csum_data = (m->m_pkthdr.csum_data & 0xffff) + (m->m_pkthdr.csum_data >> 16); right after for {} loop. -- Oleg.