From owner-cvs-all@FreeBSD.ORG Tue Feb 7 09:34:42 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 7C5D916A420; Tue, 7 Feb 2006 09:34:42 +0000 (GMT) (envelope-from netchild@FreeBSD.org) Received: from www.ebusiness-leidinger.de (jojo.ms-net.de [84.16.236.246]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F2B043D49; Tue, 7 Feb 2006 09:34:41 +0000 (GMT) (envelope-from netchild@FreeBSD.org) Received: from Andro-Beta.Leidinger.net (p54A5CD03.dip.t-dialin.net [84.165.205.3]) (authenticated bits=0) by www.ebusiness-leidinger.de (8.13.1/8.13.1) with ESMTP id k179NowQ063165; Tue, 7 Feb 2006 10:23:52 +0100 (CET) (envelope-from netchild@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by Andro-Beta.Leidinger.net (8.13.3/8.13.3) with ESMTP id k179YU7P063066; Tue, 7 Feb 2006 10:34:30 +0100 (CET) (envelope-from netchild@FreeBSD.org) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde MIME library) with HTTP; Tue, 07 Feb 2006 10:34:29 +0100 Message-ID: <20060207103429.4j3bktv00ow040cg@netchild.homeip.net> X-Priority: 3 (Normal) Date: Tue, 07 Feb 2006 10:34:29 +0100 From: Alexander Leidinger To: Bruce Evans 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> <20060207102727.D21867@delplex.bde.org> In-Reply-To: <20060207102727.D21867@delplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.3) / FreeBSD-4.11 X-Virus-Scanned: by amavisd-new Cc: src-committers@FreeBSD.org, andre@FreeBSD.org, cvs-src@FreeBSD.org, Alan Cox , cvs-all@FreeBSD.org, Nate Lawson , Oleg Bulyzhin Subject: IP checksum code (was: 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 09:34:42 -0000 Bruce Evans wrote: > in_pseudo() handles both carry steps, but is fairly bogus. Here is the > i386 version: > > % static __inline u_short > % in_pseudo(u_int sum, u_int b, u_int c) > % { > % /* __volatile is necessary because the condition codes are used. */ > % __asm __volatile ("addl %1, %0" : "+r" (sum) : "g" (b)); > % __asm __volatile ("adcl %1, %0" : "+r" (sum) : "g" (c)); > % __asm __volatile ("adcl $0, %0" : "+r" (sum)); > > The asms here are mostly bogus, if not broken. Andre got patches which port the completely rewritten version of the IP checksum code from DragonFly to FreeBSD (an entry for this was part of a previous version of the FreeBSD ideas list but was removed in the initial commit of the list, since the item was already taken and done). According to Matt's description in DragonFly this fixes some bugs (specially in the asm part). AFAIK Andre told the submitter to have a look at it as part of his network related work. IIRC: in the benchmarks I've seen, this patch also improves the speed of the checksumming. Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 God said it, I believe it and that's all there is to it.