aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-05-15 00:52:37 -0700
committerDavid S. Miller <davem@davemloft.net>2008-05-15 00:52:37 -0700
commitf42a44494bcdf03fc851c03d438464d59c0ceaf5 (patch)
tree986ea7b54e9fc79a64863fd7e92eabd99ffd37a3 /include/linux
parent63fe46da9c380b3f2bbdf3765044649517cc717c (diff)
parentef85ad541f9a6ccd3f89ec73f92b2d6f45a9d3e8 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ieee80211.h32
1 files changed, 17 insertions, 15 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 0b5e03eae6d..a9102bc78b6 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -552,16 +552,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 &= cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
+
+ switch (fc) {
+ case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS):
+ return hdr->addr3;
+ case __constant_cpu_to_le16(IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS):
+ return hdr->addr4;
+ default:
+ return hdr->addr2;
}
- return hdr->addr2;
}
/**
@@ -577,12 +578,13 @@ static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
*/
static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
{
- u8 *raw = (u8 *) hdr;
- u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
+ __le16 fc = hdr->frame_control;
+ fc &= cpu_to_le16(IEEE80211_FCTL_TODS);
- if (to_ds)
+ if (fc)
return hdr->addr3;
- return hdr->addr1;
+ else
+ return hdr->addr1;
}
/**
@@ -595,8 +597,8 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
*/
static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
{
- return (le16_to_cpu(hdr->frame_control) &
- IEEE80211_FCTL_MOREFRAGS) != 0;
+ __le16 fc = hdr->frame_control;
+ return !!(fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS));
}
#endif /* IEEE80211_H */