Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Feb 2006 10:34:29 +0100
From:      Alexander Leidinger <netchild@FreeBSD.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        src-committers@FreeBSD.org, andre@FreeBSD.org, cvs-src@FreeBSD.org, Alan Cox <alc@cs.rice.edu>, cvs-all@FreeBSD.org, Nate Lawson <nate@root.org>, Oleg Bulyzhin <oleg@FreeBSD.org>
Subject:   IP checksum code (was: Re: cvs commit: src/sys/dev/bge if_bge.c)
Message-ID:  <20060207103429.4j3bktv00ow040cg@netchild.homeip.net>
In-Reply-To: <20060207102727.D21867@delplex.bde.org>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans <bde@zeta.org.au> 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.





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