aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/ieee80211.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 53563d53b5ad..c52e7fba4e40 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -540,7 +540,7 @@ struct ieee80211_tim_ie {
540 u8 dtim_period; 540 u8 dtim_period;
541 u8 bitmap_ctrl; 541 u8 bitmap_ctrl;
542 /* variable size: 1 - 251 bytes */ 542 /* variable size: 1 - 251 bytes */
543 u8 virtual_map[0]; 543 u8 virtual_map[1];
544} __attribute__ ((packed)); 544} __attribute__ ((packed));
545 545
546#define WLAN_SA_QUERY_TR_ID_LEN 16 546#define WLAN_SA_QUERY_TR_ID_LEN 16
@@ -1392,4 +1392,34 @@ static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
1392 return 1024 * tu; 1392 return 1024 * tu;
1393} 1393}
1394 1394
1395/**
1396 * ieee80211_check_tim - check if AID bit is set in TIM
1397 * @tim: the TIM IE
1398 * @tim_len: length of the TIM IE
1399 * @aid: the AID to look for
1400 */
1401static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
1402 u8 tim_len, u16 aid)
1403{
1404 u8 mask;
1405 u8 index, indexn1, indexn2;
1406
1407 if (unlikely(!tim || tim_len < sizeof(*tim)))
1408 return false;
1409
1410 aid &= 0x3fff;
1411 index = aid / 8;
1412 mask = 1 << (aid & 7);
1413
1414 indexn1 = tim->bitmap_ctrl & 0xfe;
1415 indexn2 = tim_len + indexn1 - 4;
1416
1417 if (index < indexn1 || index > indexn2)
1418 return false;
1419
1420 index -= indexn1;
1421
1422 return !!(tim->virtual_map[index] & mask);
1423}
1424
1395#endif /* LINUX_IEEE80211_H */ 1425#endif /* LINUX_IEEE80211_H */