aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ieee80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r--include/linux/ieee80211.h61
1 files changed, 58 insertions, 3 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 4b501b48ce86..a9173d5434d1 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -493,6 +493,7 @@ struct ieee80211s_hdr {
493/* Mesh flags */ 493/* Mesh flags */
494#define MESH_FLAGS_AE_A4 0x1 494#define MESH_FLAGS_AE_A4 0x1
495#define MESH_FLAGS_AE_A5_A6 0x2 495#define MESH_FLAGS_AE_A5_A6 0x2
496#define MESH_FLAGS_AE 0x3
496#define MESH_FLAGS_PS_DEEP 0x4 497#define MESH_FLAGS_PS_DEEP 0x4
497 498
498/** 499/**
@@ -540,10 +541,10 @@ struct ieee80211_tim_ie {
540 u8 dtim_period; 541 u8 dtim_period;
541 u8 bitmap_ctrl; 542 u8 bitmap_ctrl;
542 /* variable size: 1 - 251 bytes */ 543 /* variable size: 1 - 251 bytes */
543 u8 virtual_map[0]; 544 u8 virtual_map[1];
544} __attribute__ ((packed)); 545} __attribute__ ((packed));
545 546
546#define WLAN_SA_QUERY_TR_ID_LEN 16 547#define WLAN_SA_QUERY_TR_ID_LEN 2
547 548
548struct ieee80211_mgmt { 549struct ieee80211_mgmt {
549 __le16 frame_control; 550 __le16 frame_control;
@@ -1068,8 +1069,12 @@ enum ieee80211_category {
1068 WLAN_CATEGORY_DLS = 2, 1069 WLAN_CATEGORY_DLS = 2,
1069 WLAN_CATEGORY_BACK = 3, 1070 WLAN_CATEGORY_BACK = 3,
1070 WLAN_CATEGORY_PUBLIC = 4, 1071 WLAN_CATEGORY_PUBLIC = 4,
1072 WLAN_CATEGORY_HT = 7,
1071 WLAN_CATEGORY_SA_QUERY = 8, 1073 WLAN_CATEGORY_SA_QUERY = 8,
1074 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1072 WLAN_CATEGORY_WMM = 17, 1075 WLAN_CATEGORY_WMM = 17,
1076 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1077 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1073}; 1078};
1074 1079
1075/* SPECTRUM_MGMT action code */ 1080/* SPECTRUM_MGMT action code */
@@ -1081,6 +1086,15 @@ enum ieee80211_spectrum_mgmt_actioncode {
1081 WLAN_ACTION_SPCT_CHL_SWITCH = 4, 1086 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1082}; 1087};
1083 1088
1089/* Security key length */
1090enum ieee80211_key_len {
1091 WLAN_KEY_LEN_WEP40 = 5,
1092 WLAN_KEY_LEN_WEP104 = 13,
1093 WLAN_KEY_LEN_CCMP = 16,
1094 WLAN_KEY_LEN_TKIP = 32,
1095 WLAN_KEY_LEN_AES_CMAC = 16,
1096};
1097
1084/* 1098/*
1085 * IEEE 802.11-2007 7.3.2.9 Country information element 1099 * IEEE 802.11-2007 7.3.2.9 Country information element
1086 * 1100 *
@@ -1261,7 +1275,9 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1261 if (ieee80211_has_protected(hdr->frame_control)) 1275 if (ieee80211_has_protected(hdr->frame_control))
1262 return true; 1276 return true;
1263 category = ((u8 *) hdr) + 24; 1277 category = ((u8 *) hdr) + 24;
1264 return *category != WLAN_CATEGORY_PUBLIC; 1278 return *category != WLAN_CATEGORY_PUBLIC &&
1279 *category != WLAN_CATEGORY_HT &&
1280 *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
1265 } 1281 }
1266 1282
1267 return false; 1283 return false;
@@ -1383,4 +1399,43 @@ static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
1383 return -1; 1399 return -1;
1384} 1400}
1385 1401
1402/**
1403 * ieee80211_tu_to_usec - convert time units (TU) to microseconds
1404 * @tu: the TUs
1405 */
1406static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
1407{
1408 return 1024 * tu;
1409}
1410
1411/**
1412 * ieee80211_check_tim - check if AID bit is set in TIM
1413 * @tim: the TIM IE
1414 * @tim_len: length of the TIM IE
1415 * @aid: the AID to look for
1416 */
1417static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
1418 u8 tim_len, u16 aid)
1419{
1420 u8 mask;
1421 u8 index, indexn1, indexn2;
1422
1423 if (unlikely(!tim || tim_len < sizeof(*tim)))
1424 return false;
1425
1426 aid &= 0x3fff;
1427 index = aid / 8;
1428 mask = 1 << (aid & 7);
1429
1430 indexn1 = tim->bitmap_ctrl & 0xfe;
1431 indexn2 = tim_len + indexn1 - 4;
1432
1433 if (index < indexn1 || index > indexn2)
1434 return false;
1435
1436 index -= indexn1;
1437
1438 return !!(tim->virtual_map[index] & mask);
1439}
1440
1386#endif /* LINUX_IEEE80211_H */ 1441#endif /* LINUX_IEEE80211_H */