1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2019 Realtek Corporation. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 * 14 *****************************************************************************/ 15 #ifndef __RTW_WOW_H_ 16 #define __RTW_WOW_H_ 17 18 #ifdef CONFIG_WOWLAN 19 /* WoWLAN Info define */ 20 /*=========================== Remote Control Info =========================== */ 21 #define REMOTECTRL_INFO_VALID_CHECK 0xdd 22 #define REMOTECTRL_INFO_SYMBOL_CHK_PTK BIT0 23 #define REMOTECTRL_INFO_SYMBOL_CHK_GTK BIT1 24 /*============================================================================*/ 25 #ifdef CONFIG_PLATFORM_ANDROID_INTEL_X86 26 /* TCP/ICMP/UDP multicast with specific IP addr */ 27 #define DEFAULT_PATTERN_NUM 4 28 #else 29 /* TCP/ICMP */ 30 #define DEFAULT_PATTERN_NUM 3 31 #endif 32 33 #define MAX_WKFM_CAM_NUM 18 /* same as MAX_WOW_CAM_NUM */ 34 35 #define MAX_WKFM_SIZE 16 /* (16 bytes for WKFM bit mask, 16*8 = 128 bits) */ 36 #define MAX_WKFM_PATTERN_SIZE 128 37 38 /* 39 * MAX_WKFM_PATTERN_STR_LEN : the max. length of wow pattern string 40 * e.g. echo 00:01:02:...:7f > /proc/net/rtl88x2bu/wlan0/wow_pattern_info 41 * - each byte of pattern is represented as 2-bytes ascii : MAX_WKFM_PATTERN_SIZE * 2 42 * - the number of common ':' in pattern string : MAX_WKFM_PATTERN_SIZE - 1 43 * - 1 byte '\n'(0x0a) is generated at the end when we use echo command 44 * so total max. length is (MAX_WKFM_PATTERN_SIZE * 3) 45 */ 46 #define MAX_WKFM_PATTERN_STR_LEN (MAX_WKFM_PATTERN_SIZE * 3) 47 48 #define WKFMCAM_ADDR_NUM 6 49 #define WKFMCAM_SIZE 24 /* each entry need 6*4 bytes */ 50 51 struct aoac_report { 52 u8 iv[8]; 53 u8 replay_counter_eapol_key[8]; 54 u8 group_key[32]; 55 u8 key_index; 56 u8 security_type; 57 u8 wow_pattern_idx; 58 u8 version_info; 59 u8 rekey_ok:1; 60 u8 dummy:7; 61 u8 reserved[3]; 62 u8 rxptk_iv[8]; 63 u8 rxgtk_iv[4][8]; 64 }; 65 66 enum pattern_type { 67 RTW_INVALID_PATTERN, 68 RTW_DEFAULT_PATTERN, 69 RTW_CUSTOMIZED_PATTERN, 70 }; 71 72 enum rtw_wow_dev2hst_gpio { 73 DEV2HST_GPIO_OUTPUT = 0, 74 DEV2HST_GPIO_INPUT = 1 75 }; 76 77 enum rtw_wow_dev2hst_active { 78 DEV2HST_LOW_ACTIVE = 0, 79 DEV2HST_HIGH_ACTIVE = 1 80 }; 81 82 enum rtw_wow_dev2hst_toggle_pulse { 83 DEV2HST_TOGGLE = 0, 84 DEV2HST_PULSE = 1 85 }; 86 87 enum rtw_wow_dev2hst_time_unit { 88 DEV2HST_32US = 0, 89 DEV2HST_4MS = 1 90 }; 91 92 typedef struct rtl_priv_pattern { 93 int len; 94 char content[MAX_WKFM_PATTERN_SIZE]; 95 char mask[MAX_WKFM_SIZE]; 96 } rtl_priv_pattern_t; 97 98 struct wow_priv { 99 struct rtw_wow_gpio_info wow_gpio; 100 struct rtw_disc_det_info wow_disc; 101 #ifdef CONFIG_PNO_SUPPORT 102 struct rtw_nlo_info wow_nlo; 103 #endif 104 enum pattern_type wow_ptrn_valid[MAX_WKFM_CAM_NUM]; 105 }; 106 107 void rtw_init_wow(_adapter *padapter); 108 void rtw_free_wow(_adapter *adapter); 109 void rtw_get_sec_iv(_adapter *padapter, u8 *pcur_dot11txpn, u8 *StaAddr); 110 bool rtw_wowlan_parser_pattern_cmd(u8 *input, char *pattern, 111 int *pattern_len, char *bit_mask); 112 u8 rtw_wow_pattern_set(_adapter *adapter, 113 struct rtw_wowcam_upd_info * wowcam_info, 114 enum pattern_type set_type); 115 void rtw_wow_pattern_clean(_adapter *adapter, enum pattern_type clean_type); 116 void rtw_set_default_pattern(_adapter *adapter); 117 void rtw_wow_pattern_sw_dump(_adapter *adapter); 118 void rtw_construct_remote_control_info(_adapter *adapter, 119 struct rtw_remote_wake_ctrl_info *ctrl_info); 120 void rtw_wow_lps_level_decide(_adapter *adapter, u8 wow_en); 121 int rtw_pm_set_wow_lps(_adapter *padapter, u8 mode); 122 int rtw_pm_set_wow_lps_level(_adapter *padapter, u8 level); 123 #ifdef CONFIG_LPS_1T1R 124 int rtw_pm_set_wow_lps_1t1r(_adapter *padapter, u8 en); 125 #endif 126 #ifdef CONFIG_GTK_OL 127 void rtw_update_gtk_ofld_info(void *drv_priv, struct rtw_aoac_report *aoac_info, 128 u8 aoac_report_get_ok, u8 phase); 129 #endif 130 bool _rtw_wow_chk_cap(_adapter *adapter, u8 cap); 131 void rtw_wowlan_set_pattern_cast_type(_adapter *adapter, struct rtw_wowcam_upd_info *wowcam_info); 132 #endif /* CONFIG_WOWLAN */ 133 134 #ifdef CONFIG_PNO_SUPPORT 135 #define MAX_NLO_SCAN_PLANS 2 136 #define MAX_NLO_SCAN_PERIOD 60 137 #define MAX_NLO_NORMAL_SCAN_CYCLE 255 138 #define NLO_DEFAULT_SCAN_DELAY 3 139 int rtw_nlo_enable(struct net_device *net, struct cfg80211_ssid *ssids, 140 int n_ssids, struct ieee80211_channel **channels, 141 u32 n_channels, u32 delay, u32 interval, u32 iterations, 142 u32 slow_interval); 143 int rtw_nlo_disable(struct net_device *net); 144 void rtw_nlo_debug(struct net_device * net); 145 #endif /* CONFIG_PNO_SUPPORT */ 146 147 #endif /* __RTW_WOW_H_ */ 148