diff options
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r-- | include/linux/ieee80211.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 63ab3873c5ed..8018c915ee63 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -838,6 +838,16 @@ enum ieee80211_vht_opmode_bits { | |||
838 | 838 | ||
839 | #define WLAN_SA_QUERY_TR_ID_LEN 2 | 839 | #define WLAN_SA_QUERY_TR_ID_LEN 2 |
840 | 840 | ||
841 | /** | ||
842 | * struct ieee80211_tpc_report_ie | ||
843 | * | ||
844 | * This structure refers to "TPC Report element" | ||
845 | */ | ||
846 | struct ieee80211_tpc_report_ie { | ||
847 | u8 tx_power; | ||
848 | u8 link_margin; | ||
849 | } __packed; | ||
850 | |||
841 | struct ieee80211_mgmt { | 851 | struct ieee80211_mgmt { |
842 | __le16 frame_control; | 852 | __le16 frame_control; |
843 | __le16 duration; | 853 | __le16 duration; |
@@ -973,6 +983,13 @@ struct ieee80211_mgmt { | |||
973 | u8 action_code; | 983 | u8 action_code; |
974 | u8 operating_mode; | 984 | u8 operating_mode; |
975 | } __packed vht_opmode_notif; | 985 | } __packed vht_opmode_notif; |
986 | struct { | ||
987 | u8 action_code; | ||
988 | u8 dialog_token; | ||
989 | u8 tpc_elem_id; | ||
990 | u8 tpc_elem_length; | ||
991 | struct ieee80211_tpc_report_ie tpc; | ||
992 | } __packed tpc_report; | ||
976 | } u; | 993 | } u; |
977 | } __packed action; | 994 | } __packed action; |
978 | } u; | 995 | } u; |
@@ -1865,6 +1882,7 @@ enum ieee80211_category { | |||
1865 | WLAN_CATEGORY_DLS = 2, | 1882 | WLAN_CATEGORY_DLS = 2, |
1866 | WLAN_CATEGORY_BACK = 3, | 1883 | WLAN_CATEGORY_BACK = 3, |
1867 | WLAN_CATEGORY_PUBLIC = 4, | 1884 | WLAN_CATEGORY_PUBLIC = 4, |
1885 | WLAN_CATEGORY_RADIO_MEASUREMENT = 5, | ||
1868 | WLAN_CATEGORY_HT = 7, | 1886 | WLAN_CATEGORY_HT = 7, |
1869 | WLAN_CATEGORY_SA_QUERY = 8, | 1887 | WLAN_CATEGORY_SA_QUERY = 8, |
1870 | WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, | 1888 | WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, |
@@ -2378,4 +2396,51 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim, | |||
2378 | #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) | 2396 | #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) |
2379 | #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) | 2397 | #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) |
2380 | 2398 | ||
2399 | /** | ||
2400 | * ieee80211_action_contains_tpc - checks if the frame contains TPC element | ||
2401 | * @skb: the skb containing the frame, length will be checked | ||
2402 | * | ||
2403 | * This function checks if it's either TPC report action frame or Link | ||
2404 | * Measurement report action frame as defined in IEEE Std. 802.11-2012 8.5.2.5 | ||
2405 | * and 8.5.7.5 accordingly. | ||
2406 | */ | ||
2407 | static inline bool ieee80211_action_contains_tpc(struct sk_buff *skb) | ||
2408 | { | ||
2409 | struct ieee80211_mgmt *mgmt = (void *)skb->data; | ||
2410 | |||
2411 | if (!ieee80211_is_action(mgmt->frame_control)) | ||
2412 | return false; | ||
2413 | |||
2414 | if (skb->len < IEEE80211_MIN_ACTION_SIZE + | ||
2415 | sizeof(mgmt->u.action.u.tpc_report)) | ||
2416 | return false; | ||
2417 | |||
2418 | /* | ||
2419 | * TPC report - check that: | ||
2420 | * category = 0 (Spectrum Management) or 5 (Radio Measurement) | ||
2421 | * spectrum management action = 3 (TPC/Link Measurement report) | ||
2422 | * TPC report EID = 35 | ||
2423 | * TPC report element length = 2 | ||
2424 | * | ||
2425 | * The spectrum management's tpc_report struct is used here both for | ||
2426 | * parsing tpc_report and radio measurement's link measurement report | ||
2427 | * frame, since the relevant part is identical in both frames. | ||
2428 | */ | ||
2429 | if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT && | ||
2430 | mgmt->u.action.category != WLAN_CATEGORY_RADIO_MEASUREMENT) | ||
2431 | return false; | ||
2432 | |||
2433 | /* both spectrum mgmt and link measurement have same action code */ | ||
2434 | if (mgmt->u.action.u.tpc_report.action_code != | ||
2435 | WLAN_ACTION_SPCT_TPC_RPRT) | ||
2436 | return false; | ||
2437 | |||
2438 | if (mgmt->u.action.u.tpc_report.tpc_elem_id != WLAN_EID_TPC_REPORT || | ||
2439 | mgmt->u.action.u.tpc_report.tpc_elem_length != | ||
2440 | sizeof(struct ieee80211_tpc_report_ie)) | ||
2441 | return false; | ||
2442 | |||
2443 | return true; | ||
2444 | } | ||
2445 | |||
2381 | #endif /* LINUX_IEEE80211_H */ | 2446 | #endif /* LINUX_IEEE80211_H */ |