mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
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>
This commit is contained in:
parent
88787d2842
commit
5a433b3ad4
1 changed files with 16 additions and 14 deletions
|
@ -552,16 +552,17 @@ enum ieee80211_back_parties {
|
||||||
*/
|
*/
|
||||||
static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
|
static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
|
||||||
{
|
{
|
||||||
u8 *raw = (u8 *) hdr;
|
__le16 fc = hdr->frame_control;
|
||||||
u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
|
fc &= cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
|
||||||
|
|
||||||
switch (tofrom) {
|
switch (fc) {
|
||||||
case 2:
|
case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS):
|
||||||
return hdr->addr3;
|
return hdr->addr3;
|
||||||
case 3:
|
case __constant_cpu_to_le16(IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS):
|
||||||
return hdr->addr4;
|
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)
|
static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
|
||||||
{
|
{
|
||||||
u8 *raw = (u8 *) hdr;
|
__le16 fc = hdr->frame_control;
|
||||||
u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
|
fc &= cpu_to_le16(IEEE80211_FCTL_TODS);
|
||||||
|
|
||||||
if (to_ds)
|
if (fc)
|
||||||
return hdr->addr3;
|
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)
|
static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
|
||||||
{
|
{
|
||||||
return (le16_to_cpu(hdr->frame_control) &
|
__le16 fc = hdr->frame_control;
|
||||||
IEEE80211_FCTL_MOREFRAGS) != 0;
|
return !!(fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* IEEE80211_H */
|
#endif /* IEEE80211_H */
|
||||||
|
|
Loading…
Reference in a new issue