From: Johannes Berg <johannes@sipsolutions.net>
To: Joe Perches <joe@perches.com>
Cc: Fabian Frederick <fabf@skynet.be>,
linux-kernel <linux-kernel@vger.kernel.org>,
"John W. Linville" <linville@tuxdriver.com>,
akpm <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/1] net/wireless/ibss.c: replace memcpy by ether_addr_copy
Date: Tue, 13 May 2014 09:30:37 +0200 [thread overview]
Message-ID: <1399966237.4137.4.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1399922277.9240.50.camel@joe-AO725>
On Mon, 2014-05-12 at 12:17 -0700, Joe Perches wrote:
> > I certainly don't see the benefit in changing all those other files,
> > particularly since it's not just that we have to verify alignment *now*,
> > we also have to add alignment attributes so that we don't break
> > alignment in the future.
>
> The same alignment requirements exist in quite a
> lot of the code so I don't see that as much of a
> continuing problem.
I disagree. This may be true for some of the cases we're discussing,
e.g. the change in net/wireless/util.c which has the assumption based on
frame alignment assumptions etc.
However, for things like the mac80211/mlme.c change we're operating
entirely on internal structures that are purely in software and don't
belong to any network frames or similar structs that already have
alignment guarantees.
As a consequence, something like this simple patch:
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5c7169b0ac57..fccbba2f4fe1 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1529,7 +1529,7 @@ struct cfg80211_bss {
u16 beacon_interval;
u16 capability;
-
+ u8 my_new_field;
u8 bssid[ETH_ALEN];
u8 priv[0] __aligned(sizeof(void *));
would already break at least one of the patches. The change looks
innocent enough, and is modifying a purely internal struct that doesn't
get used anywhere but the wireless stack (neither wire frame nor
userspace) so this is a perfectly valid change.
Therefore, the patch should mark the bssid with __aligned(2) or such, to
avoid having simple patches like that introduce problems.
> > Additionally doesn't even really save much typing:
> >
> > memcpy(x, y, ETH_ALEN);
> > ether_addr_copy(x, y);
>
> To me the general benefit isn't in the reduced
> source code size, but small improvements for
> ARM both in code size and execution speed.
Well, yes, but if it's in a configuration path, which you invoke maybe a
few times an hour, it doesn't seem worth it at all.
If it's in a frame/data hotpath, like the util.c change that already has
other alignment guarantees, it does seem somewhat worthwhile, but beyond
that I'm not so sure.
johannes
prev parent reply other threads:[~2014-05-13 7:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 17:30 Fabian Frederick
2014-05-12 17:50 ` Joe Perches
2014-05-12 18:00 ` Fabian Frederick
2014-05-12 18:07 ` Joe Perches
2014-05-12 18:51 ` Johannes Berg
2014-05-12 19:17 ` Joe Perches
2014-05-13 7:30 ` Johannes Berg [this message]
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=1399966237.4137.4.camel@jlt4.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=akpm@linux-foundation.org \
--cc=fabf@skynet.be \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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
all inboxes | Powered by JetHome®