]> err.no Git - linux-2.6/blobdiff - include/linux/ieee80211.h
mac80211: remove unnecessary byteshifts in frame control testing
[linux-2.6] / include / linux / ieee80211.h
index 5de6d911cdf7be1d8f7edf1b228fa70495e553e5..a9102bc78b6163703d056cd1386f3e422f022b22 100644 (file)
@@ -97,6 +97,7 @@
 #define IEEE80211_MAX_FRAME_LEN                2352
 
 #define IEEE80211_MAX_SSID_LEN         32
+#define IEEE80211_MAX_MESH_ID_LEN      32
 
 struct ieee80211_hdr {
        __le16 frame_control;
@@ -109,6 +110,16 @@ struct ieee80211_hdr {
 } __attribute__ ((packed));
 
 
+struct ieee80211s_hdr {
+       u8 flags;
+       u8 ttl;
+       __le32 seqnum;
+       u8 eaddr1[6];
+       u8 eaddr2[6];
+       u8 eaddr3[6];
+} __attribute__ ((packed));
+
+
 struct ieee80211_mgmt {
        __le16 frame_control;
        __le16 duration;
@@ -206,6 +217,23 @@ struct ieee80211_mgmt {
                                        __le16 params;
                                        __le16 reason_code;
                                } __attribute__((packed)) delba;
+                               struct{
+                                       u8 action_code;
+                                       /* capab_info for open and confirm,
+                                        * reason for close
+                                        */
+                                       __le16 aux;
+                                       /* Followed in plink_confirm by status
+                                        * code, AID and supported rates,
+                                        * and directly by supported rates in
+                                        * plink_open and plink_close
+                                        */
+                                       u8 variable[0];
+                               } __attribute__((packed)) plink_action;
+                               struct{
+                                       u8 action_code;
+                                       u8 variable[0];
+                               } __attribute__((packed)) mesh_action;
                        } u;
                } __attribute__ ((packed)) action;
        } u;
@@ -287,6 +315,12 @@ struct ieee80211_ht_addt_info {
 #define IEEE80211_HT_IE_NON_GF_STA_PRSNT       0x0004
 #define IEEE80211_HT_IE_NON_HT_STA_PRSNT       0x0010
 
+/* MIMO Power Save Modes */
+#define WLAN_HT_CAP_MIMO_PS_STATIC         0
+#define WLAN_HT_CAP_MIMO_PS_DYNAMIC        1
+#define WLAN_HT_CAP_MIMO_PS_INVALID        2
+#define WLAN_HT_CAP_MIMO_PS_DISABLED       3
+
 /* Authentication algorithms */
 #define WLAN_AUTH_OPEN 0
 #define WLAN_AUTH_SHARED_KEY 1
@@ -431,6 +465,19 @@ enum ieee80211_eid {
        WLAN_EID_TS_DELAY = 43,
        WLAN_EID_TCLAS_PROCESSING = 44,
        WLAN_EID_QOS_CAPA = 46,
+       /* 802.11s
+        *
+        * All mesh EID numbers are pending IEEE 802.11 ANA approval.
+        * The numbers have been incremented from those suggested in
+        * 802.11s/D2.0 so that MESH_CONFIG does not conflict with
+        * EXT_SUPP_RATES.
+        */
+       WLAN_EID_MESH_CONFIG = 51,
+       WLAN_EID_MESH_ID = 52,
+       WLAN_EID_PEER_LINK = 55,
+       WLAN_EID_PREQ = 68,
+       WLAN_EID_PREP = 69,
+       WLAN_EID_PERR = 70,
        /* 802.11h */
        WLAN_EID_PWR_CONSTRAINT = 32,
        WLAN_EID_PWR_CAPABILITY = 33,
@@ -505,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;
 }
 
 /**
@@ -530,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;
 }
 
 /**
@@ -548,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 */