From owner-cvs-all@FreeBSD.ORG Wed Dec 13 04:15:31 2006 Return-Path: X-Original-To: cvs-all@FreeBSD.ORG Delivered-To: cvs-all@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A0EB16A5B2 for ; Wed, 13 Dec 2006 04:15:27 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1EBB643C9D for ; Wed, 13 Dec 2006 04:13:59 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kBD4CPSM022429; Tue, 12 Dec 2006 21:12:25 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Tue, 12 Dec 2006 21:13:23 -0700 (MST) Message-Id: <20061212.211323.-1573945956.imp@bsdimp.com> To: gurney_j@resnet.uoregon.edu From: "M. Warner Losh" In-Reply-To: <20061212.140133.1649770385.imp@bsdimp.com> References: <20061212062445.A61903@xorpc.icir.org> <20061212183825.GF781@funkthat.com> <20061212.140133.1649770385.imp@bsdimp.com> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Tue, 12 Dec 2006 21:12:26 -0700 (MST) Cc: luigi@FreeBSD.ORG, src-committers@FreeBSD.ORG, rizzo@icir.org, cvs-all@FreeBSD.ORG, cvs-src@FreeBSD.ORG, ticso@cicely.de Subject: Re: cvs commit: src/sys/net if_ethersubr.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: Wed, 13 Dec 2006 04:15:31 -0000 In message: <20061212.140133.1649770385.imp@bsdimp.com> "M. Warner Losh" writes: : In message: <20061212183825.GF781@funkthat.com> : John-Mark Gurney writes: : : Luigi Rizzo wrote this message on Tue, Dec 12, 2006 at 06:24 -0800: : : > On Tue, Dec 12, 2006 at 03:17:59PM +0100, Bernd Walter wrote: : : > > On Tue, Dec 12, 2006 at 05:57:56AM -0800, Luigi Rizzo wrote: : : > ... : : > > > then i suppose the proper fix is to revert to m_copy() and : : > > > work on if_simloop() so that 1. it handles a readonly chain, and : : > > > 2. when doing so, it passes up a properly aligned packet... : : > > : : > > Can't comment on this, as I don't have enough knowledge about network : : > > code. : : > > According to the xscale report it was likely never properly aligned, : : > > the alignment obviously just moved with your change. : : > > : : > > > however note that there is already some code in net/if_loop.c::if_simloop(), : : > > > just that it uses this: : : > > > : : > > > #if defined(__ia64__) || defined(__sparc64__) : : > ... : : > > > to detect whether the architecture is alignment-sensitive. : : > > > Is there any other identifier that we can use to check ? : : > > : : > > I wonder how many of these are missing __arm__? : : > : : > and this is why i wonder if there is a generic identifier : : > that we can use to provide alignment. : : : : How about? : : #define __NO_STRICT_ALIGNMENT : : : : It's already defined for amd64 and i386, so all you have to do it test : : that it isn't defined... : : __NO_STRICT_ALIGNMENT is relatively new. Its definition in _types.h, : while established practice in NetBSD, met with considerable : controversy when I tried to expand it in FreeBSD land. However, : putting things in param.h met with no resistance whatsoever and was : actively suggested. Maybe we should move this straggler from _types.h : to param.h and start using it more often. : : Warner : Here's what I came up with this afternoon between fires at work. Comments? Warner http://perforce.freebsd.org/chv.cgi?CH=111579 Change 111579 by imp@imp_lighthouse on 2006/12/12 22:08:26 Move __NO_STRICT_ALIGNMENT and use it. Affected files ... .. //depot/projects/arm/src/sys/amd64/include/_types.h#7 edit .. //depot/projects/arm/src/sys/amd64/include/param.h#5 edit .. //depot/projects/arm/src/sys/i386/include/_types.h#7 edit .. //depot/projects/arm/src/sys/i386/include/param.h#4 edit .. //depot/projects/arm/src/sys/net/bpf_filter.c#5 edit .. //depot/projects/arm/src/sys/net/if_loop.c#8 edit Differences ... ==== //depot/projects/arm/src/sys/amd64/include/_types.h#7 (text+ko) ==== @@ -43,8 +43,6 @@ #error this file needs sys/cdefs.h as a prerequisite #endif -#define __NO_STRICT_ALIGNMENT - /* * Basic types upon which most other types are built. */ ==== //depot/projects/arm/src/sys/amd64/include/param.h#5 (text+ko) ==== @@ -66,6 +66,7 @@ #ifndef _NO_NAMESPACE_POLLUTION +#define __NO_STRICT_ALIGNMENT #define __HAVE_ACPI #define __PCI_REROUTE_INTERRUPT ==== //depot/projects/arm/src/sys/i386/include/_types.h#7 (text+ko) ==== @@ -43,8 +43,6 @@ #error this file needs sys/cdefs.h as a prerequisite #endif -#define __NO_STRICT_ALIGNMENT - /* * Basic types upon which most other types are built. */ ==== //depot/projects/arm/src/sys/i386/include/param.h#4 (text+ko) ==== @@ -51,6 +51,7 @@ #ifndef _NO_NAMESPACE_POLLUTION +#define __NO_STRICT_ALIGNMENT #define __HAVE_ACPI #define __PCI_REROUTE_INTERRUPT ==== //depot/projects/arm/src/sys/net/bpf_filter.c#5 (text+ko) ==== @@ -38,11 +38,7 @@ #include -#ifdef sun -#include -#endif - -#ifndef __i386__ +#ifndef __NO_STRICT_ALIGNMENT #define BPF_ALIGN #endif ==== //depot/projects/arm/src/sys/net/if_loop.c#8 (text+ko) ==== @@ -290,7 +290,7 @@ /* Strip away media header */ if (hlen > 0) { m_adj(m, hlen); -#if defined(__ia64__) || defined(__sparc64__) +#ifndef __NO_STRICT_ALIGNMENT /* * Some archs do not like unaligned data, so * we move data down in the first mbuf.