1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* Copyright(c) 2019-2022 Realtek Corporation 3 */ 4 5 #ifndef __RTW89_WOW_H__ 6 #define __RTW89_WOW_H__ 7 8 #define RTW89_KEY_PN_0 GENMASK_ULL(7, 0) 9 #define RTW89_KEY_PN_1 GENMASK_ULL(15, 8) 10 #define RTW89_KEY_PN_2 GENMASK_ULL(23, 16) 11 #define RTW89_KEY_PN_3 GENMASK_ULL(31, 24) 12 #define RTW89_KEY_PN_4 GENMASK_ULL(39, 32) 13 #define RTW89_KEY_PN_5 GENMASK_ULL(47, 40) 14 15 #define RTW89_IGTK_IPN_0 GENMASK_ULL(7, 0) 16 #define RTW89_IGTK_IPN_1 GENMASK_ULL(15, 8) 17 #define RTW89_IGTK_IPN_2 GENMASK_ULL(23, 16) 18 #define RTW89_IGTK_IPN_3 GENMASK_ULL(31, 24) 19 #define RTW89_IGTK_IPN_4 GENMASK_ULL(39, 32) 20 #define RTW89_IGTK_IPN_5 GENMASK_ULL(47, 40) 21 #define RTW89_IGTK_IPN_6 GENMASK_ULL(55, 48) 22 #define RTW89_IGTK_IPN_7 GENMASK_ULL(63, 56) 23 24 #define RTW89_WOW_VALID_CHECK 0xDD 25 #define RTW89_WOW_SYMBOL_CHK_PTK BIT(0) 26 #define RTW89_WOW_SYMBOL_CHK_GTK BIT(1) 27 28 enum rtw89_wake_reason { 29 RTW89_WOW_RSN_RX_PTK_REKEY = 0x1, 30 RTW89_WOW_RSN_RX_GTK_REKEY = 0x2, 31 RTW89_WOW_RSN_RX_DEAUTH = 0x8, 32 RTW89_WOW_RSN_DISCONNECT = 0x10, 33 RTW89_WOW_RSN_RX_MAGIC_PKT = 0x21, 34 RTW89_WOW_RSN_RX_PATTERN_MATCH = 0x23, 35 RTW89_WOW_RSN_RX_NLO = 0x55, 36 }; 37 38 struct rtw89_cipher_suite { 39 u8 oui[3]; 40 u8 type; 41 } __packed; 42 43 struct rtw89_rsn_ie { 44 u8 tag_number; 45 u8 tag_length; 46 __le16 rsn_version; 47 struct rtw89_cipher_suite group_cipher_suite; 48 __le16 pairwise_cipher_suite_cnt; 49 struct rtw89_cipher_suite pairwise_cipher_suite; 50 __le16 akm_cipher_suite_cnt; 51 struct rtw89_cipher_suite akm_cipher_suite; 52 } __packed; 53 54 struct rtw89_cipher_info { 55 u32 cipher; 56 u8 fw_alg; 57 enum ieee80211_key_len len; 58 }; 59 60 struct rtw89_set_key_info_iter_data { 61 u32 gtk_cipher; 62 u32 igtk_cipher; 63 bool rx_ready; 64 bool error; 65 }; 66 67 #ifdef CONFIG_PM 68 int rtw89_wow_suspend(struct rtw89_dev *rtwdev, struct cfg80211_wowlan *wowlan); 69 int rtw89_wow_resume(struct rtw89_dev *rtwdev); 70 void rtw89_wow_parse_akm(struct rtw89_dev *rtwdev, struct sk_buff *skb); 71 #else 72 static inline 73 void rtw89_wow_parse_akm(struct rtw89_dev *rtwdev, struct sk_buff *skb) 74 { 75 } 76 #endif 77 78 #endif 79