From: David Miller <davem@davemloft.net>
To: shemminger@linux-foundation.org
Cc: xemul@sw.ru, netdev@vger.kernel.org, bridge@lists.osdl.org,
devel@openvz.org
Subject: Re: [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses
Date: Wed, 18 Apr 2007 13:04:22 -0700 (PDT) [thread overview]
Message-ID: <20070418.130422.88477383.davem@davemloft.net> (raw)
In-Reply-To: <20070418074439.1ba41718@localhost.localdomain>
From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Wed, 18 Apr 2007 07:44:39 -0700
> On Wed, 18 Apr 2007 01:28:04 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
>
> > From: Pavel Emelianov <xemul@sw.ru>
> > Date: Wed, 18 Apr 2007 10:43:56 +0400
> >
> > > [snip]
> > >
> > > > --- linux-2.6.orig/net/bridge/br_private.h 2007-04-17
> > > > 13:26:48.000000000 -0700 +++ linux-2.6/net/bridge/br_private.h
> > > > 2007-04-17 13:30:29.000000000 -0700 @@ -36,7 +36,7 @@
> > > > {
> > > > unsigned char prio[2];
> > > > unsigned char addr[6];
> > > > -};
> > > > +} __attribute__((aligned(8)));
> > >
> > > Why "8"? Mustn't it be "16"? Address is to be 2-bytes aligned...
> >
> > Actually it could be made "2", the aligned() attribute is
> > in bytes, not bits.
>
> It could be 2 but 8 might allow a compiler on a 64 bit platform
> to be smarter in comparisons and assignments.
Absolutely.
Although I don't think gcc does anything fancy since we don't
use memcmp(). It's a tradeoff, we'd like to use unsigned long
comparisons when both objects are aligned correctly but we also
don't want it to use any more than one potentially mispredicted
branch.
We could add some alignment tests to the ethernet address
comparison code, but it's probably more trouble than it's
worth.
next prev parent reply other threads:[~2007-04-18 20:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-17 11:49 [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses Pavel Emelianov
2007-04-17 19:31 ` David Miller
2007-04-17 19:55 ` Stephen Hemminger
2007-04-17 20:09 ` David Miller
2007-04-17 20:37 ` Stephen Hemminger
2007-04-17 21:09 ` David Miller
2007-04-17 21:24 ` Eric Dumazet
2007-04-17 21:27 ` David Miller
2007-04-18 6:43 ` Pavel Emelianov
2007-04-18 8:28 ` David Miller
2007-04-18 8:37 ` Pavel Emelianov
2007-04-18 14:44 ` Stephen Hemminger
2007-04-18 20:04 ` David Miller [this message]
2007-04-19 14:14 ` Eric Dumazet
2007-04-19 18:18 ` Stephen Hemminger
2007-04-19 20:01 ` [BRIDGE] " David Miller
2007-04-19 20:29 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070418.130422.88477383.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=bridge@lists.osdl.org \
--cc=devel@openvz.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
--cc=xemul@sw.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).