From: Johannes Berg <johannes@sipsolutions.net>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: John Linville <linville@tuxdriver.com>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] mac80211: remove unnecessary byteshifts in frame control testing
Date: Mon, 21 Apr 2008 10:20:13 +0200 [thread overview]
Message-ID: <1208766013.26186.30.camel@johannes.berg> (raw)
In-Reply-To: <1208745209.7941.11.camel@brick> (sfid-20080421_033544_733702_6DA132C4)
[-- Attachment #1: Type: text/plain, Size: 837 bytes --]
On Sun, 2008-04-20 at 19:33 -0700, Harvey Harrison wrote:
> Byteshift the constants rather than the data.
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index f27d11a..1068965 100644
> --- a/include/linux/ieee80211.h
> +++ b/include/linux/ieee80211.h
> @@ -546,16 +546,17 @@ enum ieee80211_back_parties {
> */
> static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
> {
> - u8 *raw = (u8 *) hdr;
> - u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
> -
> - switch (tofrom) {
> - case 2:
> - return hdr->addr3;
> - case 3:
> - return hdr->addr4;
> + __le16 fc = hdr->frame_control;
> + fc &= __constant_cpu_to_le16(IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS);
Can you use the non-underscore versions except where necessary (i.e. for
"case ...")
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2008-04-21 8:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-21 2:33 [PATCH] mac80211: remove unnecessary byteshifts in frame control testing Harvey Harrison
2008-04-21 8:20 ` Johannes Berg [this message]
2008-04-21 17:41 ` Harvey Harrison
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=1208766013.26186.30.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=harvey.harrison@gmail.com \
--cc=linux-wireless@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;
as well as URLs for NNTP newsgroup(s).