Search Linux Wireless

Re: [PATCH] mac80211: remove unnecessary byteshifts in frame control testing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux