From owner-freebsd-arch@FreeBSD.ORG Sun May 30 12:56:30 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 0D2AB16A4CE for ; Sun, 30 May 2004 12:56:30 -0700 (PDT) Received: from pfepc.post.tele.dk (pfepc.post.tele.dk [195.41.46.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id 945F143D31 for ; Sun, 30 May 2004 12:56:29 -0700 (PDT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (0x50c7994c.naenxx7.adsl-dhcp.tele.dk [80.199.153.76]) by pfepc.post.tele.dk (Postfix) with ESMTP id 15BED26288C; Sun, 30 May 2004 21:56:19 +0200 (CEST) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.11/8.12.11) with ESMTP id i4UJuImk098762; Sun, 30 May 2004 21:56:19 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: naddy@mips.inka.de (Christian Weisgerber) From: "Poul-Henning Kamp" In-Reply-To: Your message of "Sun, 30 May 2004 18:42:11 -0000." Date: Sun, 30 May 2004 21:56:18 +0200 Message-ID: <98761.1085946978@critter.freebsd.dk> 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: Sun, 30 May 2004 19:56:30 -0000 In message , Christian Weisgerber writes: >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) > >that will calculate an ethernet CRC-32 in little endian/big endian >fashion. > >These CRCs are used all over our network drivers, e.g. for setting >up multicast hash filters. Functions to calculate them are duplicated >all over. These could be factored out of some thirty drivers. >NetBSD has done so, btw. > >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? In general for stuff like this, if you save more than a handful of lines in more than a handful of drivers you can assume that we want it. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.