From owner-freebsd-arch@FreeBSD.ORG Tue Jun 1 02:37:52 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A819A16A4CE; Tue, 1 Jun 2004 02:37:52 -0700 (PDT) Received: from mailout07.sul.t-online.com (mailout07.sul.t-online.com [194.25.134.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1DB543D48; Tue, 1 Jun 2004 02:37:49 -0700 (PDT) (envelope-from Alexander@Leidinger.net) Received: from fwd00.aul.t-online.de by mailout07.sul.t-online.com with smtp id 1BV5iK-0003t2-01; Tue, 01 Jun 2004 11:37:44 +0200 Received: from Andro-Beta.Leidinger.net (SalNgOZVgepw4V4e4+Ge7lad5rFrGme735kwmqPdrwXqrylBUSqErF@[84.128.204.101]) by fmrl00.sul.t-online.com with esmtp id 1BV5hZ-0QY2l60; Tue, 1 Jun 2004 11:36:57 +0200 Received: from Magellan.Leidinger.net (Magellan.Leidinger.net [192.168.1.1]) i519b5Lf054113; Tue, 1 Jun 2004 11:37:05 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Date: Tue, 1 Jun 2004 11:38:25 +0200 From: Alexander Leidinger To: "M. Warner Losh" Message-Id: <20040601113825.54e5b57b@Magellan.Leidinger.net> In-Reply-To: <20040531.112057.52958848.imp@bsdimp.com> References: <20040531164514.GA7776@green.homeunix.org> <20040531.112057.52958848.imp@bsdimp.com> X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i386-portbld-freebsd5.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Seen: false X-ID: SalNgOZVgepw4V4e4+Ge7lad5rFrGme735kwmqPdrwXqrylBUSqErF@t-dialin.net cc: naddy@mips.inka.de cc: freebsd-arch@freebsd.org Subject: Re: ether_crc32_[bl]e() X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2004 09:37:52 -0000 On Mon, 31 May 2004 11:20:57 -0600 (MDT) "M. Warner Losh" wrote: > In message: <20040531164514.GA7776@green.homeunix.org> > Brian Feldman writes: > : On Sun, May 30, 2004 at 06:42:11PM +0000, Christian Weisgerber wrote: > : > NetBSD and OpenBSD have two helper functions in if_ethersubr.c > : > > : > ether_crc32_le(const u_int8_t *buf, size_t len) > : > ether_crc32_be(const u_int8_t *buf, size_t len) > : > [...] > : > The patch below adds the functions to if_ethersubr.c and, as an > : > example, switches re(4) to make use of this. > : > > : > 1. Do we want this? > : > : Yeah :) > > I think so too. I had something like this on my list after I found a > very badly implemented big endian crc routine whose provenance was in > question. So this is excellent timing. Is someone interested in improving our IP checksum code too? On i386 it uses assembly language which "works ok" with gcc 3.x (so far), but it isn't guaranteed it will work with future versions of gcc. Intels C compiler already has problems with it (and it's verified it's because of bugs in the asm code), so in case of the use of icc a C version is used. All other architectures use a C version ("MD" code, even if it could be made MI... at least it could be shared between the big and little endian architectures). Matthew Dillon rewrote the IP checksum code in dragonfly: ---snip--- Modified files: sys/conf files.i386 sys/i386/i386 in_cksum.c sys/i386/include in_cksum.h sys/netinet igmp.c in.h ip_icmp.c Added files: sys/i386/i386 in_cksum2.s Log: Rewrite the IP checksum code. Get rid of all the inline assembly garbage, get rid of old APIs that are no longer used, and build a new 'core' checksum function in C capable of handling any alignment. Add an assembly procedure (in its own file) for handling large blocks of 32-bit aligned data. This new code is better suited for modern cpus and should at least as good as the previous code, and it is far more portable. Note that in_cksum_hdr() still assumes 32 bit alignment. This will be fixed soon. Revision Changes Path 1.12 +1 -0 src/sys/conf/files.i386 1.4 +142 -558 src/sys/i386/i386/in_cksum.c 1.5 +33 -69 src/sys/i386/include/in_cksum.h 1.5 +2 -0 src/sys/netinet/igmp.c 1.6 +0 -1 src/sys/netinet/in.h 1.6 +2 -0 src/sys/netinet/ip_icmp.c ---snip--- If someone wants to look at this I can forward additional commit logs regarding this issue (e.g. moving in_cksum.h from MD to MI). Bye, Alexander. -- I'm available to get hired (preferred in .lu). http://www.Leidinger.net Alexander @ Leidinger.net GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7