aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ieee80211.h
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-04-21 13:41:10 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-14 16:29:32 -0400
commit5a433b3ad497120d80f1045d37bd1a9ce897388f (patch)
treeebe60591db999fb941d37bea5c603dc65962710a /include/linux/ieee80211.h
parent88787d2842b6e6ff9bdc218445209c5e3c84d6fa (diff)
mac80211: remove unnecessary byteshifts in frame control testing
Byteswap the constants rather than the frame_control member. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/linux/ieee80211.h')
-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 0b5e03eae6d2..a9102bc78b61 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -552,16 +552,17 @@ enum ieee80211_back_parties {
552 */ 552 */
553static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) 553static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
554{ 554{
555 u8 *raw = (u8 *) hdr; 555 __le16 fc = hdr->frame_control;
556 u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */ 556 fc &= cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
557 557
558 switch (tofrom) { 558 switch (fc) {
559 case 2: 559 case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS):
560 return hdr->addr3; 560 return hdr->addr3;
561 case 3: 561 case __constant_cpu_to_le16(IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS):
562 return hdr->addr4; 562 return hdr->addr4;
563 default:
564 return hdr->addr2;
563 } 565 }
564 return hdr->addr2;
565} 566}
566 567
567/** 568/**
@@ -577,12 +578,13 @@ static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
577 */ 578 */
578static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) 579static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
579{ 580{
580 u8 *raw = (u8 *) hdr; 581 __le16 fc = hdr->frame_control;
581 u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */ 582 fc &= cpu_to_le16(IEEE80211_FCTL_TODS);
582 583
583 if (to_ds) 584 if (fc)
584 return hdr->addr3; 585 return hdr->addr3;
585 return hdr->addr1; 586 else
587 return hdr->addr1;
586} 588}
587 589
588/** 590/**
@@ -595,8 +597,8 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
595 */ 597 */
596static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr) 598static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
597{ 599{
598 return (le16_to_cpu(hdr->frame_control) & 600 __le16 fc = hdr->frame_control;
599 IEEE80211_FCTL_MOREFRAGS) != 0; 601 return !!(fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS));
600} 602}
601 603
602#endif /* IEEE80211_H */ 604#endif /* IEEE80211_H */