cvs commit: src/sys/net if_ethersubr.c

M. Warner Losh imp at bsdimp.com
Wed Dec 13 00:06:13 PST 2006


In message: <20061212145738.GC915 at lizard.fafoe.narf.at>
            Stefan Farfeleder <stefan at fafoe.narf.at> writes:
: On Tue, Dec 12, 2006 at 06:42:46AM -0800, Luigi Rizzo wrote:
: > [moving to arch]
: > 
: > sorry if it has been debated already, but looking in the
: > network code it seems that checks for architectures that
: > need strong alignment are done through a sequence of
: > 
: > 	#if defined(__ia64__) || defined(__blah__) || ...
: > 
: > one such sequence is in net/if_loop::if_simloop(), and was
: > related to a problem we are having with some recent
: > commits to net/if_ethersubr.c
: > 
: > While the easy fix (for this one) is to add
: > 	 || defined(__arm__)
: > to the sequence, we were wondering if there is some identifier
: > that we can use to the purpose.
: > 
: > Bernd Walter was suggesting this:
: > 
: > > I would have said ALIGNBYTES != 1, but this also matches with i386.
: > > Guess it's time to introduce somehing like ALIGN_STRONG, or whatever
: > > colour fits best.
: > 
: > ideas ?
: 
: Architectures without strong alignment define __NO_STRICT_ALIGNMENT in
: <machine/_types.h>.

This has been talked about at length in the past.  Nobody has followed
through on the implementation.  param.h was the preferred location for
these things.  This patch fixes the problem at hand and moves things
to their proper location.


http://perforce.freebsd.org/chv.cgi?CH=111579

Change 111579 by imp at 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 <sys/param.h>
 
-#ifdef sun
-#include <netinet/in.h>
-#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.



More information about the freebsd-arch mailing list