1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /****************************************************************************** 3 * 4 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 * 6 ******************************************************************************/ 7 #ifndef __RTW_MLME_EXT_H_ 8 #define __RTW_MLME_EXT_H_ 9 10 11 /* Commented by Albert 20101105 */ 12 /* Increase the SURVEY_TO value from 100 to 150 (100ms to 150ms) */ 13 /* The Realtek 8188CE SoftAP will spend around 100ms to send the probe response after receiving the probe request. */ 14 /* So, this driver tried to extend the dwell time for each scanning channel. */ 15 /* This will increase the chance to receive the probe response from SoftAP. */ 16 17 #define SURVEY_TO (100) 18 #define REAUTH_TO (300) /* 50) */ 19 #define REASSOC_TO (300) /* 50) */ 20 /* define DISCONNECT_TO (3000) */ 21 #define ADDBA_TO (2000) 22 23 #define LINKED_TO (1) /* unit:2 sec, 1x2 =2 sec */ 24 25 #define REAUTH_LIMIT (4) 26 #define REASSOC_LIMIT (4) 27 #define READDBA_LIMIT (2) 28 29 #define ROAMING_LIMIT 8 30 /* define IOCMD_REG0 0x10250370 */ 31 /* define IOCMD_REG1 0x10250374 */ 32 /* define IOCMD_REG2 0x10250378 */ 33 34 /* define FW_DYNAMIC_FUN_SWITCH 0x10250364 */ 35 36 /* define WRITE_BB_CMD 0xF0000001 */ 37 /* define SET_CHANNEL_CMD 0xF3000000 */ 38 /* define UPDATE_RA_CMD 0xFD0000A2 */ 39 40 #define DYNAMIC_FUNC_DISABLE (0x0) 41 42 /* ====== ODM_ABILITY_E ======== */ 43 /* BB ODM section BIT 0-15 */ 44 #define DYNAMIC_BB_DIG BIT0 /* ODM_BB_DIG */ 45 #define DYNAMIC_BB_RA_MASK BIT1 /* ODM_BB_RA_MASK */ 46 #define DYNAMIC_BB_DYNAMIC_TXPWR BIT2 /* ODM_BB_DYNAMIC_TXPWR */ 47 #define DYNAMIC_BB_BB_FA_CNT BIT3 /* ODM_BB_FA_CNT */ 48 #define DYNAMIC_BB_RSSI_MONITOR BIT4 /* ODM_BB_RSSI_MONITOR */ 49 #define DYNAMIC_BB_CCK_PD BIT5 /* ODM_BB_CCK_PD */ 50 #define DYNAMIC_BB_ANT_DIV BIT6 /* ODM_BB_ANT_DIV */ 51 #define DYNAMIC_BB_PWR_SAVE BIT7 /* ODM_BB_PWR_SAVE */ 52 #define DYNAMIC_BB_PWR_TRAIN BIT8 /* ODM_BB_PWR_TRAIN */ 53 #define DYNAMIC_BB_RATE_ADAPTIVE BIT9 /* ODM_BB_RATE_ADAPTIVE */ 54 #define DYNAMIC_BB_PATH_DIV BIT10/* ODM_BB_PATH_DIV */ 55 #define DYNAMIC_BB_PSD BIT11/* ODM_BB_PSD */ 56 #define DYNAMIC_BB_RXHP BIT12/* ODM_BB_RXHP */ 57 #define DYNAMIC_BB_ADAPTIVITY BIT13/* ODM_BB_ADAPTIVITY */ 58 #define DYNAMIC_BB_DYNAMIC_ATC BIT14/* ODM_BB_DYNAMIC_ATC */ 59 60 /* MAC DM section BIT 16-23 */ 61 #define DYNAMIC_MAC_EDCA_TURBO BIT16/* ODM_MAC_EDCA_TURBO */ 62 #define DYNAMIC_MAC_EARLY_MODE BIT17/* ODM_MAC_EARLY_MODE */ 63 64 /* RF ODM section BIT 24-31 */ 65 #define DYNAMIC_RF_TX_PWR_TRACK BIT24/* ODM_RF_TX_PWR_TRACK */ 66 #define DYNAMIC_RF_RX_GAIN_TRACK BIT25/* ODM_RF_RX_GAIN_TRACK */ 67 #define DYNAMIC_RF_CALIBRATION BIT26/* ODM_RF_CALIBRATION */ 68 69 #define DYNAMIC_ALL_FUNC_ENABLE 0xFFFFFFF 70 71 #define _HW_STATE_NOLINK_ 0x00 72 #define _HW_STATE_ADHOC_ 0x01 73 #define _HW_STATE_STATION_ 0x02 74 #define _HW_STATE_AP_ 0x03 75 76 77 #define _1M_RATE_ 0 78 #define _2M_RATE_ 1 79 #define _5M_RATE_ 2 80 #define _11M_RATE_ 3 81 #define _6M_RATE_ 4 82 #define _9M_RATE_ 5 83 #define _12M_RATE_ 6 84 #define _18M_RATE_ 7 85 #define _24M_RATE_ 8 86 #define _36M_RATE_ 9 87 #define _48M_RATE_ 10 88 #define _54M_RATE_ 11 89 90 /******************************************************** 91 MCS rate definitions 92 *********************************************************/ 93 #define MCS_RATE_1R (0x000000ff) 94 #define MCS_RATE_2R (0x0000ffff) 95 #define MCS_RATE_3R (0x00ffffff) 96 #define MCS_RATE_4R (0xffffffff) 97 #define MCS_RATE_2R_13TO15_OFF (0x00001fff) 98 99 100 extern unsigned char RTW_WPA_OUI[]; 101 extern unsigned char WMM_OUI[]; 102 extern unsigned char WPS_OUI[]; 103 extern unsigned char WFD_OUI[]; 104 extern unsigned char P2P_OUI[]; 105 106 extern unsigned char WMM_INFO_OUI[]; 107 extern unsigned char WMM_PARA_OUI[]; 108 109 110 /* */ 111 /* Channel Plan Type. */ 112 /* Note: */ 113 /* We just add new channel plan when the new channel plan is different from any of the following */ 114 /* channel plan. */ 115 /* If you just wnat to customize the acitions(scan period or join actions) about one of the channel plan, */ 116 /* customize them in RT_CHANNEL_INFO in the RT_CHANNEL_LIST. */ 117 /* */ 118 typedef enum _RT_CHANNEL_DOMAIN { 119 /* old channel plan mapping ===== */ 120 RT_CHANNEL_DOMAIN_FCC = 0x00, 121 RT_CHANNEL_DOMAIN_IC = 0x01, 122 RT_CHANNEL_DOMAIN_ETSI = 0x02, 123 RT_CHANNEL_DOMAIN_SPAIN = 0x03, 124 RT_CHANNEL_DOMAIN_FRANCE = 0x04, 125 RT_CHANNEL_DOMAIN_MKK = 0x05, 126 RT_CHANNEL_DOMAIN_MKK1 = 0x06, 127 RT_CHANNEL_DOMAIN_ISRAEL = 0x07, 128 RT_CHANNEL_DOMAIN_TELEC = 0x08, 129 RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 0x09, 130 RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 0x0A, 131 RT_CHANNEL_DOMAIN_TAIWAN = 0x0B, 132 RT_CHANNEL_DOMAIN_CHINA = 0x0C, 133 RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO = 0x0D, 134 RT_CHANNEL_DOMAIN_KOREA = 0x0E, 135 RT_CHANNEL_DOMAIN_TURKEY = 0x0F, 136 RT_CHANNEL_DOMAIN_JAPAN = 0x10, 137 RT_CHANNEL_DOMAIN_FCC_NO_DFS = 0x11, 138 RT_CHANNEL_DOMAIN_JAPAN_NO_DFS = 0x12, 139 RT_CHANNEL_DOMAIN_WORLD_WIDE_5G = 0x13, 140 RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS = 0x14, 141 142 /* new channel plan mapping, (2GDOMAIN_5GDOMAIN) ===== */ 143 RT_CHANNEL_DOMAIN_WORLD_NULL = 0x20, 144 RT_CHANNEL_DOMAIN_ETSI1_NULL = 0x21, 145 RT_CHANNEL_DOMAIN_FCC1_NULL = 0x22, 146 RT_CHANNEL_DOMAIN_MKK1_NULL = 0x23, 147 RT_CHANNEL_DOMAIN_ETSI2_NULL = 0x24, 148 RT_CHANNEL_DOMAIN_FCC1_FCC1 = 0x25, 149 RT_CHANNEL_DOMAIN_WORLD_ETSI1 = 0x26, 150 RT_CHANNEL_DOMAIN_MKK1_MKK1 = 0x27, 151 RT_CHANNEL_DOMAIN_WORLD_KCC1 = 0x28, 152 RT_CHANNEL_DOMAIN_WORLD_FCC2 = 0x29, 153 RT_CHANNEL_DOMAIN_WORLD_FCC3 = 0x30, 154 RT_CHANNEL_DOMAIN_WORLD_FCC4 = 0x31, 155 RT_CHANNEL_DOMAIN_WORLD_FCC5 = 0x32, 156 RT_CHANNEL_DOMAIN_WORLD_FCC6 = 0x33, 157 RT_CHANNEL_DOMAIN_FCC1_FCC7 = 0x34, 158 RT_CHANNEL_DOMAIN_WORLD_ETSI2 = 0x35, 159 RT_CHANNEL_DOMAIN_WORLD_ETSI3 = 0x36, 160 RT_CHANNEL_DOMAIN_MKK1_MKK2 = 0x37, 161 RT_CHANNEL_DOMAIN_MKK1_MKK3 = 0x38, 162 RT_CHANNEL_DOMAIN_FCC1_NCC1 = 0x39, 163 RT_CHANNEL_DOMAIN_FCC1_NCC2 = 0x40, 164 RT_CHANNEL_DOMAIN_GLOBAL_NULL = 0x41, 165 RT_CHANNEL_DOMAIN_ETSI1_ETSI4 = 0x42, 166 RT_CHANNEL_DOMAIN_FCC1_FCC2 = 0x43, 167 RT_CHANNEL_DOMAIN_FCC1_NCC3 = 0x44, 168 RT_CHANNEL_DOMAIN_WORLD_ETSI5 = 0x45, 169 RT_CHANNEL_DOMAIN_FCC1_FCC8 = 0x46, 170 RT_CHANNEL_DOMAIN_WORLD_ETSI6 = 0x47, 171 RT_CHANNEL_DOMAIN_WORLD_ETSI7 = 0x48, 172 RT_CHANNEL_DOMAIN_WORLD_ETSI8 = 0x49, 173 RT_CHANNEL_DOMAIN_WORLD_ETSI9 = 0x50, 174 RT_CHANNEL_DOMAIN_WORLD_ETSI10 = 0x51, 175 RT_CHANNEL_DOMAIN_WORLD_ETSI11 = 0x52, 176 RT_CHANNEL_DOMAIN_FCC1_NCC4 = 0x53, 177 RT_CHANNEL_DOMAIN_WORLD_ETSI12 = 0x54, 178 RT_CHANNEL_DOMAIN_FCC1_FCC9 = 0x55, 179 RT_CHANNEL_DOMAIN_WORLD_ETSI13 = 0x56, 180 RT_CHANNEL_DOMAIN_FCC1_FCC10 = 0x57, 181 /* Add new channel plan above this line =============== */ 182 RT_CHANNEL_DOMAIN_MAX, 183 RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F, 184 } RT_CHANNEL_DOMAIN, *PRT_CHANNEL_DOMAIN; 185 186 typedef enum _RT_CHANNEL_DOMAIN_2G { 187 RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, /* Worldwird 13 */ 188 RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, /* Europe */ 189 RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, /* US */ 190 RT_CHANNEL_DOMAIN_2G_MKK1 = 0x03, /* Japan */ 191 RT_CHANNEL_DOMAIN_2G_ETSI2 = 0x04, /* France */ 192 RT_CHANNEL_DOMAIN_2G_GLOBAL = 0x05, /* Global domain */ 193 RT_CHANNEL_DOMAIN_2G_NULL = 0x06, 194 /* Add new channel plan above this line =============== */ 195 RT_CHANNEL_DOMAIN_2G_MAX, 196 } RT_CHANNEL_DOMAIN_2G, *PRT_CHANNEL_DOMAIN_2G; 197 198 typedef enum _RT_CHANNEL_DOMAIN_5G { 199 RT_CHANNEL_DOMAIN_5G_NULL = 0x00, 200 RT_CHANNEL_DOMAIN_5G_ETSI1 = 0x01, /* Europe */ 201 RT_CHANNEL_DOMAIN_5G_ETSI2 = 0x02, /* Australia, New Zealand */ 202 RT_CHANNEL_DOMAIN_5G_ETSI3 = 0x03, /* Russia */ 203 RT_CHANNEL_DOMAIN_5G_FCC1 = 0x04, /* US */ 204 RT_CHANNEL_DOMAIN_5G_FCC2 = 0x05, /* FCC o/w DFS Channels */ 205 RT_CHANNEL_DOMAIN_5G_FCC3 = 0x06, /* India, Mexico */ 206 RT_CHANNEL_DOMAIN_5G_FCC4 = 0x07, /* Venezuela */ 207 RT_CHANNEL_DOMAIN_5G_FCC5 = 0x08, /* China */ 208 RT_CHANNEL_DOMAIN_5G_FCC6 = 0x09, /* Israel */ 209 RT_CHANNEL_DOMAIN_5G_FCC7_IC1 = 0x0A, /* US, Canada */ 210 RT_CHANNEL_DOMAIN_5G_KCC1 = 0x0B, /* Korea */ 211 RT_CHANNEL_DOMAIN_5G_MKK1 = 0x0C, /* Japan */ 212 RT_CHANNEL_DOMAIN_5G_MKK2 = 0x0D, /* Japan (W52, W53) */ 213 RT_CHANNEL_DOMAIN_5G_MKK3 = 0x0E, /* Japan (W56) */ 214 RT_CHANNEL_DOMAIN_5G_NCC1 = 0x0F, /* Taiwan */ 215 RT_CHANNEL_DOMAIN_5G_NCC2 = 0x10, /* Taiwan o/w DFS */ 216 RT_CHANNEL_DOMAIN_5G_NCC3 = 0x11, /* Taiwan w/o DFS, Band4 only */ 217 RT_CHANNEL_DOMAIN_5G_ETSI4 = 0x12, /* Europe w/o DFS, Band1 only */ 218 RT_CHANNEL_DOMAIN_5G_ETSI5 = 0x13, /* Australia, New Zealand(w/o Weather radar) */ 219 RT_CHANNEL_DOMAIN_5G_FCC8 = 0x14, /* Latin America */ 220 RT_CHANNEL_DOMAIN_5G_ETSI6 = 0x15, /* Israel, Bahrain, Egypt, India, China, Malaysia */ 221 RT_CHANNEL_DOMAIN_5G_ETSI7 = 0x16, /* China */ 222 RT_CHANNEL_DOMAIN_5G_ETSI8 = 0x17, /* Jordan */ 223 RT_CHANNEL_DOMAIN_5G_ETSI9 = 0x18, /* Lebanon */ 224 RT_CHANNEL_DOMAIN_5G_ETSI10 = 0x19, /* Qatar */ 225 RT_CHANNEL_DOMAIN_5G_ETSI11 = 0x1A, /* Russia */ 226 RT_CHANNEL_DOMAIN_5G_NCC4 = 0x1B, /* Taiwan, (w/o Weather radar) */ 227 RT_CHANNEL_DOMAIN_5G_ETSI12 = 0x1C, /* Indonesia */ 228 RT_CHANNEL_DOMAIN_5G_FCC9 = 0x1D, /* w/o Weather radar) */ 229 RT_CHANNEL_DOMAIN_5G_ETSI13 = 0x1E, /* w/o Weather radar) */ 230 RT_CHANNEL_DOMAIN_5G_FCC10 = 0x1F, /* Argentina (w/o Weather radar) */ 231 /* Add new channel plan above this line =============== */ 232 /* Driver Self Defined ===== */ 233 RT_CHANNEL_DOMAIN_5G_FCC = 0x20, 234 RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS = 0x21, 235 RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS = 0x22, 236 RT_CHANNEL_DOMAIN_5G_MAX, 237 } RT_CHANNEL_DOMAIN_5G, *PRT_CHANNEL_DOMAIN_5G; 238 239 #define rtw_is_channel_plan_valid(chplan) (chplan < RT_CHANNEL_DOMAIN_MAX || chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE) 240 241 typedef struct _RT_CHANNEL_PLAN { 242 unsigned char Channel[MAX_CHANNEL_NUM]; 243 unsigned char Len; 244 } RT_CHANNEL_PLAN, *PRT_CHANNEL_PLAN; 245 246 typedef struct _RT_CHANNEL_PLAN_2G { 247 unsigned char Channel[MAX_CHANNEL_NUM_2G]; 248 unsigned char Len; 249 } RT_CHANNEL_PLAN_2G, *PRT_CHANNEL_PLAN_2G; 250 251 typedef struct _RT_CHANNEL_PLAN_5G { 252 unsigned char Channel[MAX_CHANNEL_NUM_5G]; 253 unsigned char Len; 254 } RT_CHANNEL_PLAN_5G, *PRT_CHANNEL_PLAN_5G; 255 256 typedef struct _RT_CHANNEL_PLAN_MAP { 257 unsigned char Index2G; 258 unsigned char Index5G; 259 } RT_CHANNEL_PLAN_MAP, *PRT_CHANNEL_PLAN_MAP; 260 261 enum Associated_AP { 262 atherosAP = 0, 263 broadcomAP = 1, 264 ciscoAP = 2, 265 marvellAP = 3, 266 ralinkAP = 4, 267 realtekAP = 5, 268 airgocapAP = 6, 269 unknownAP = 7, 270 maxAP, 271 }; 272 273 typedef enum _HT_IOT_PEER { 274 HT_IOT_PEER_UNKNOWN = 0, 275 HT_IOT_PEER_REALTEK = 1, 276 HT_IOT_PEER_REALTEK_92SE = 2, 277 HT_IOT_PEER_BROADCOM = 3, 278 HT_IOT_PEER_RALINK = 4, 279 HT_IOT_PEER_ATHEROS = 5, 280 HT_IOT_PEER_CISCO = 6, 281 HT_IOT_PEER_MERU = 7, 282 HT_IOT_PEER_MARVELL = 8, 283 HT_IOT_PEER_REALTEK_SOFTAP = 9,/* peer is RealTek SOFT_AP, by Bohn, 2009.12.17 */ 284 HT_IOT_PEER_SELF_SOFTAP = 10, /* Self is SoftAP */ 285 HT_IOT_PEER_AIRGO = 11, 286 HT_IOT_PEER_INTEL = 12, 287 HT_IOT_PEER_RTK_APCLIENT = 13, 288 HT_IOT_PEER_REALTEK_81XX = 14, 289 HT_IOT_PEER_REALTEK_WOW = 15, 290 HT_IOT_PEER_REALTEK_JAGUAR_BCUTAP = 16, 291 HT_IOT_PEER_REALTEK_JAGUAR_CCUTAP = 17, 292 HT_IOT_PEER_MAX = 18 293 } HT_IOT_PEER_E, *PHTIOT_PEER_E; 294 295 296 enum SCAN_STATE { 297 SCAN_DISABLE = 0, 298 SCAN_START = 1, 299 SCAN_TXNULL = 2, 300 SCAN_PROCESS = 3, 301 SCAN_COMPLETE = 4, 302 SCAN_STATE_MAX, 303 }; 304 305 struct mlme_handler { 306 unsigned int num; 307 char* str; 308 unsigned int (*func)(struct adapter *padapter, union recv_frame *precv_frame); 309 }; 310 311 struct action_handler { 312 unsigned int num; 313 char* str; 314 unsigned int (*func)(struct adapter *padapter, union recv_frame *precv_frame); 315 }; 316 317 struct ss_res { 318 int state; 319 int bss_cnt; 320 int channel_idx; 321 int scan_mode; 322 u8 ssid_num; 323 u8 ch_num; 324 struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT]; 325 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; 326 }; 327 328 /* define AP_MODE 0x0C */ 329 /* define STATION_MODE 0x08 */ 330 /* define AD_HOC_MODE 0x04 */ 331 /* define NO_LINK_MODE 0x00 */ 332 333 #define WIFI_FW_NULL_STATE _HW_STATE_NOLINK_ 334 #define WIFI_FW_STATION_STATE _HW_STATE_STATION_ 335 #define WIFI_FW_AP_STATE _HW_STATE_AP_ 336 #define WIFI_FW_ADHOC_STATE _HW_STATE_ADHOC_ 337 338 #define WIFI_FW_AUTH_NULL 0x00000100 339 #define WIFI_FW_AUTH_STATE 0x00000200 340 #define WIFI_FW_AUTH_SUCCESS 0x00000400 341 342 #define WIFI_FW_ASSOC_STATE 0x00002000 343 #define WIFI_FW_ASSOC_SUCCESS 0x00004000 344 345 #define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | WIFI_FW_AUTH_STATE | WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE) 346 347 struct FW_Sta_Info { 348 struct sta_info *psta; 349 u32 status; 350 u32 rx_pkt; 351 u32 retry; 352 NDIS_802_11_RATES_EX SupportedRates; 353 }; 354 355 /* 356 * Usage: 357 * When one iface acted as AP mode and the other iface is STA mode and scanning, 358 * it should switch back to AP's operating channel periodically. 359 * Parameters info: 360 * When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to AP's operating channel for 361 * RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds. 362 * Example: 363 * For chip supports 2.4G + 5GHz and AP mode is operating in channel 1, 364 * RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MILLISECOND is 3 and SURVEY_TO is 100. 365 * When it's STA mode gets set_scan command, 366 * it would 367 * 1. Doing the scan on channel 1.2.3.4.5.6.7.8 368 * 2. Back to channel 1 for 300 milliseconds 369 * 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52 370 * 4. Back to channel 1 for 300 milliseconds 371 * 5. ... and so on, till survey done. 372 */ 373 struct mlme_ext_info { 374 u32 state; 375 u32 reauth_count; 376 u32 reassoc_count; 377 u32 link_count; 378 u32 auth_seq; 379 u32 auth_algo; /* 802.11 auth, could be open, shared, auto */ 380 u32 authModeToggle; 381 u32 enc_algo;/* encrypt algorithm; */ 382 u32 key_index; /* this is only valid for legendary wep, 0~3 for key id. */ 383 u32 iv; 384 u8 chg_txt[128]; 385 u16 aid; 386 u16 bcn_interval; 387 u16 capability; 388 u8 assoc_AP_vendor; 389 u8 slotTime; 390 u8 preamble_mode; 391 u8 WMM_enable; 392 u8 ERP_enable; 393 u8 ERP_IE; 394 u8 HT_enable; 395 u8 HT_caps_enable; 396 u8 HT_info_enable; 397 u8 HT_protection; 398 u8 turboMode_cts2self; 399 u8 turboMode_rtsen; 400 u8 SM_PS; 401 u8 agg_enable_bitmap; 402 u8 ADDBA_retry_count; 403 u8 candidate_tid_bitmap; 404 u8 dialogToken; 405 /* Accept ADDBA Request */ 406 bool accept_addba_req; 407 u8 bwmode_updated; 408 u8 hidden_ssid_mode; 409 u8 VHT_enable; 410 411 struct ADDBA_request ADDBA_req; 412 struct WMM_para_element WMM_param; 413 struct HT_caps_element HT_caps; 414 struct HT_info_element HT_info; 415 struct wlan_bssid_ex network;/* join network or bss_network, if in ap mode, it is the same to cur_network.network */ 416 struct FW_Sta_Info FW_sta_info[NUM_STA]; 417 }; 418 419 /* The channel information about this channel including joining, scanning, and power constraints. */ 420 typedef struct _RT_CHANNEL_INFO { 421 u8 ChannelNum; /* The channel number. */ 422 RT_SCAN_TYPE ScanType; /* Scan type such as passive or active scan. */ 423 } RT_CHANNEL_INFO, *PRT_CHANNEL_INFO; 424 425 int rtw_ch_set_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch); 426 bool rtw_mlme_band_check(struct adapter *adapter, const u32 ch); 427 428 /* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */ 429 #define P2P_MAX_REG_CLASSES 10 430 431 /* P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class */ 432 #define P2P_MAX_REG_CLASS_CHANNELS 20 433 434 /* struct p2p_channels - List of supported channels */ 435 struct p2p_channels { 436 /* struct p2p_reg_class - Supported regulatory class */ 437 struct p2p_reg_class { 438 /* reg_class - Regulatory class (IEEE 802.11-2007, Annex J) */ 439 u8 reg_class; 440 441 /* channel - Supported channels */ 442 u8 channel[P2P_MAX_REG_CLASS_CHANNELS]; 443 444 /* channels - Number of channel entries in use */ 445 size_t channels; 446 } reg_class[P2P_MAX_REG_CLASSES]; 447 448 /* reg_classes - Number of reg_class entries in use */ 449 size_t reg_classes; 450 }; 451 452 struct p2p_oper_class_map { 453 enum hw_mode {IEEE80211G, IEEE80211A} mode; 454 u8 op_class; 455 u8 min_chan; 456 u8 max_chan; 457 u8 inc; 458 enum { BW20, BW40PLUS, BW40MINUS } bw; 459 }; 460 461 struct mlme_ext_priv { 462 struct adapter *padapter; 463 u8 mlmeext_init; 464 atomic_t event_seq; 465 u16 mgnt_seq; 466 u16 sa_query_seq; 467 u64 mgnt_80211w_IPN; 468 u64 mgnt_80211w_IPN_rx; 469 /* struct fw_priv fwpriv; */ 470 471 unsigned char cur_channel; 472 unsigned char cur_bwmode; 473 unsigned char cur_ch_offset;/* PRIME_CHNL_OFFSET */ 474 unsigned char cur_wireless_mode; /* NETWORK_TYPE */ 475 476 unsigned char max_chan_nums; 477 RT_CHANNEL_INFO channel_set[MAX_CHANNEL_NUM]; 478 struct p2p_channels channel_list; 479 unsigned char basicrate[NumRates]; 480 unsigned char datarate[NumRates]; 481 unsigned char default_supported_mcs_set[16]; 482 483 struct ss_res sitesurvey_res; 484 struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including current scanning/connecting/connected related info. */ 485 /* for ap mode, network includes ap's cap_info */ 486 _timer survey_timer; 487 _timer link_timer; 488 _timer sa_query_timer; 489 /* _timer ADDBA_timer; */ 490 u16 chan_scan_time; 491 unsigned long last_scan_time; 492 u8 scan_abort; 493 u8 tx_rate; /* TXRATE when USERATE is set. */ 494 495 u32 retry; /* retry for issue probereq */ 496 497 u64 TSFValue; 498 499 /* for LPS-32K to adaptive bcn early and timeout */ 500 u8 adaptive_tsf_done; 501 u32 bcn_delay_cnt[9]; 502 u32 bcn_delay_ratio[9]; 503 u32 bcn_cnt; 504 u8 DrvBcnEarly; 505 u8 DrvBcnTimeOut; 506 507 unsigned char bstart_bss; 508 509 u8 update_channel_plan_by_ap_done; 510 511 /* recv_decache check for Action_public frame */ 512 u8 action_public_dialog_token; 513 u16 action_public_rxseq; 514 515 u8 active_keep_alive_check; 516 #ifdef DBG_FIXED_CHAN 517 u8 fixed_chan; 518 #endif 519 520 }; 521 522 void init_mlme_default_rate_set(struct adapter *padapter); 523 void init_mlme_ext_priv(struct adapter *padapter); 524 int init_hw_mlme_ext(struct adapter *padapter); 525 void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext); 526 extern void init_mlme_ext_timer(struct adapter *padapter); 527 extern void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta); 528 extern struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv); 529 530 /* void fill_fwpriv(struct adapter *padapter, struct fw_priv *pfwpriv); */ 531 532 u8 networktype_to_raid_ex(struct adapter *adapter, struct sta_info *psta); 533 534 void get_rate_set(struct adapter *padapter, unsigned char *pbssrate, int *bssrate_len); 535 void set_mcs_rate_by_mask(u8 *mcs_set, u32 mask); 536 void UpdateBrateTbl(struct adapter *padapter, u8 *mBratesOS); 537 void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen); 538 539 void Save_DM_Func_Flag(struct adapter *padapter); 540 void Restore_DM_Func_Flag(struct adapter *padapter); 541 void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable); 542 543 void Set_MSR(struct adapter *padapter, u8 type); 544 545 u8 rtw_get_oper_ch(struct adapter *adapter); 546 void rtw_set_oper_ch(struct adapter *adapter, u8 ch); 547 u8 rtw_get_oper_bw(struct adapter *adapter); 548 void rtw_set_oper_bw(struct adapter *adapter, u8 bw); 549 u8 rtw_get_oper_choffset(struct adapter *adapter); 550 void rtw_set_oper_choffset(struct adapter *adapter, u8 offset); 551 u8 rtw_get_center_ch(u8 channel, u8 chnl_bw, u8 chnl_offset); 552 unsigned long rtw_get_on_cur_ch_time(struct adapter *adapter); 553 554 void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigned char channel_offset, unsigned short bwmode); 555 void SelectChannel(struct adapter *padapter, unsigned char channel); 556 557 unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval); 558 559 void read_cam(struct adapter *padapter, u8 entry, u8 *get_key); 560 561 /* modify HW only */ 562 void _write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key); 563 void _clear_cam_entry(struct adapter *padapter, u8 entry); 564 565 /* modify both HW and cache */ 566 void write_cam(struct adapter *padapter, u8 id, u16 ctrl, u8 *mac, u8 *key); 567 void clear_cam_entry(struct adapter *padapter, u8 id); 568 569 /* modify cache only */ 570 void write_cam_cache(struct adapter *adapter, u8 id, u16 ctrl, u8 *mac, u8 *key); 571 void clear_cam_cache(struct adapter *adapter, u8 id); 572 573 void invalidate_cam_all(struct adapter *padapter); 574 575 576 int allocate_fw_sta_entry(struct adapter *padapter); 577 void flush_all_cam_entry(struct adapter *padapter); 578 579 void site_survey(struct adapter *padapter); 580 u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, struct wlan_bssid_ex *bssid); 581 void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, struct adapter *padapter, bool update_ie); 582 583 u8 *get_my_bssid(struct wlan_bssid_ex *pnetwork); 584 u16 get_beacon_interval(struct wlan_bssid_ex *bss); 585 586 int is_client_associated_to_ap(struct adapter *padapter); 587 int is_client_associated_to_ibss(struct adapter *padapter); 588 int is_IBSS_empty(struct adapter *padapter); 589 590 unsigned char check_assoc_AP(u8 *pframe, uint len); 591 592 int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); 593 void WMMOnAssocRsp(struct adapter *padapter); 594 595 void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); 596 void HT_info_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); 597 void HTOnAssocRsp(struct adapter *padapter); 598 599 void ERP_IE_handler(struct adapter *padapter, struct ndis_80211_var_ie * pIE); 600 void VCS_update(struct adapter *padapter, struct sta_info *psta); 601 void update_ldpc_stbc_cap(struct sta_info *psta); 602 603 void update_beacon_info(struct adapter *padapter, u8 *pframe, uint len, struct sta_info *psta); 604 int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len); 605 void update_IOT_info(struct adapter *padapter); 606 void update_capinfo(struct adapter * Adapter, u16 updateCap); 607 void update_wireless_mode(struct adapter *padapter); 608 void update_sta_basic_rate(struct sta_info *psta, u8 wireless_mode); 609 int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_len, int cam_idx); 610 611 /* for sta/adhoc mode */ 612 void update_sta_info(struct adapter *padapter, struct sta_info *psta); 613 void Update_RA_Entry(struct adapter *padapter, struct sta_info *psta); 614 void set_sta_rate(struct adapter *padapter, struct sta_info *psta); 615 616 unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason); 617 618 unsigned char get_highest_rate_idx(u32 mask); 619 int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps, u8 bwmode); 620 unsigned int is_ap_in_tkip(struct adapter *padapter); 621 622 s16 rtw_camid_search(struct adapter *adapter, u8 *addr, s16 kid); 623 s16 rtw_camid_alloc(struct adapter *adapter, struct sta_info *sta, u8 kid); 624 void rtw_camid_free(struct adapter *adapter, u8 cam_id); 625 626 extern void rtw_alloc_macid(struct adapter *padapter, struct sta_info *psta); 627 extern void rtw_release_macid(struct adapter *padapter, struct sta_info *psta); 628 extern u8 rtw_search_max_mac_id(struct adapter *padapter); 629 630 void report_join_res(struct adapter *padapter, int res); 631 void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame); 632 void report_surveydone_event(struct adapter *padapter); 633 void report_del_sta_event(struct adapter *padapter, unsigned char* MacAddr, unsigned short reason); 634 void report_add_sta_event(struct adapter *padapter, unsigned char* MacAddr, int cam_idx); 635 void report_wmm_edca_update(struct adapter *padapter); 636 637 u8 chk_bmc_sleepq_cmd(struct adapter *padapter); 638 extern u8 set_tx_beacon_cmd(struct adapter *padapter); 639 unsigned int setup_beacon_frame(struct adapter *padapter, unsigned char *beacon_frame); 640 void update_mgnt_tx_rate(struct adapter *padapter, u8 rate); 641 void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattrib); 642 void update_mgntframe_attrib_addr(struct adapter *padapter, struct xmit_frame *pmgntframe); 643 void dump_mgntframe(struct adapter *padapter, struct xmit_frame *pmgntframe); 644 s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntframe, int timeout_ms); 645 s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmgntframe); 646 647 void issue_beacon(struct adapter *padapter, int timeout_ms); 648 void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p_probereq); 649 void issue_assocreq(struct adapter *padapter); 650 void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_info *pstat, int pkt_type); 651 void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short status); 652 void issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da); 653 s32 issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, u8 ch, bool append_wps, int try_cnt, int wait_ms); 654 int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms); 655 s32 issue_nulldata_in_interrupt(struct adapter *padapter, u8 *da); 656 int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int try_cnt, int wait_ms); 657 int issue_deauth(struct adapter *padapter, unsigned char *da, unsigned short reason); 658 int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int try_cnt, int wait_ms); 659 void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short status); 660 void issue_action_SA_Query(struct adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short tid); 661 unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr); 662 unsigned int send_beacon(struct adapter *padapter); 663 664 void start_clnt_assoc(struct adapter *padapter); 665 void start_clnt_auth(struct adapter *padapter); 666 void start_clnt_join(struct adapter *padapter); 667 void start_create_ibss(struct adapter *padapter); 668 669 unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame); 670 unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame); 671 unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame); 672 unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame); 673 unsigned int DoReserved(struct adapter *padapter, union recv_frame *precv_frame); 674 unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame); 675 unsigned int OnAtim(struct adapter *padapter, union recv_frame *precv_frame); 676 unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame); 677 unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame); 678 unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_frame); 679 unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame); 680 unsigned int OnAction(struct adapter *padapter, union recv_frame *precv_frame); 681 682 unsigned int on_action_spct(struct adapter *padapter, union recv_frame *precv_frame); 683 unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_frame); 684 unsigned int on_action_public(struct adapter *padapter, union recv_frame *precv_frame); 685 unsigned int OnAction_ht(struct adapter *padapter, union recv_frame *precv_frame); 686 unsigned int OnAction_sa_query(struct adapter *padapter, union recv_frame *precv_frame); 687 688 void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res); 689 void mlmeext_sta_del_event_callback(struct adapter *padapter); 690 void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *psta); 691 692 void linked_status_chk(struct adapter *padapter); 693 694 void _linked_info_dump(struct adapter *padapter); 695 696 void survey_timer_hdl(struct timer_list *t); 697 void link_timer_hdl(struct timer_list *t); 698 void addba_timer_hdl(struct timer_list *t); 699 void sa_query_timer_hdl(struct timer_list *t); 700 /* void reauth_timer_hdl(struct adapter *padapter); */ 701 /* void reassoc_timer_hdl(struct adapter *padapter); */ 702 703 #define set_survey_timer(mlmeext, ms) \ 704 do { \ 705 /*DBG_871X("%s set_survey_timer(%p, %d)\n", __func__, (mlmeext), (ms));*/ \ 706 _set_timer(&(mlmeext)->survey_timer, (ms)); \ 707 } while (0) 708 709 #define set_link_timer(mlmeext, ms) \ 710 do { \ 711 /*DBG_871X("%s set_link_timer(%p, %d)\n", __func__, (mlmeext), (ms));*/ \ 712 _set_timer(&(mlmeext)->link_timer, (ms)); \ 713 } while (0) 714 #define set_sa_query_timer(mlmeext, ms) \ 715 do { \ 716 DBG_871X("%s set_sa_query_timer(%p, %d)\n", __func__, (mlmeext), (ms)); \ 717 _set_timer(&(mlmeext)->sa_query_timer, (ms)); \ 718 } while (0) 719 720 extern void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr); 721 722 extern void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len); 723 extern void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext); 724 extern void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len); 725 extern u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer); 726 727 int rtw_chk_start_clnt_join(struct adapter *padapter, u8 *ch, u8 *bw, u8 *offset); 728 int rtw_get_ch_setting_union(struct adapter *adapter, u8 *ch, u8 *bw, u8 *offset); 729 730 struct cmd_hdl { 731 uint parmsize; 732 u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf); 733 }; 734 735 736 u8 read_macreg_hdl(struct adapter *padapter, u8 *pbuf); 737 u8 write_macreg_hdl(struct adapter *padapter, u8 *pbuf); 738 u8 read_bbreg_hdl(struct adapter *padapter, u8 *pbuf); 739 u8 write_bbreg_hdl(struct adapter *padapter, u8 *pbuf); 740 u8 read_rfreg_hdl(struct adapter *padapter, u8 *pbuf); 741 u8 write_rfreg_hdl(struct adapter *padapter, u8 *pbuf); 742 743 744 u8 NULL_hdl(struct adapter *padapter, u8 *pbuf); 745 u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf); 746 u8 disconnect_hdl(struct adapter *padapter, u8 *pbuf); 747 u8 createbss_hdl(struct adapter *padapter, u8 *pbuf); 748 u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf); 749 u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf); 750 u8 setauth_hdl(struct adapter *padapter, u8 *pbuf); 751 u8 setkey_hdl(struct adapter *padapter, u8 *pbuf); 752 u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf); 753 u8 set_assocsta_hdl(struct adapter *padapter, u8 *pbuf); 754 u8 del_assocsta_hdl(struct adapter *padapter, u8 *pbuf); 755 u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf); 756 757 u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf); 758 u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf); 759 u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf); 760 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf); 761 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf); 762 u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf); 763 u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf); 764 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf); /* Kurt: Handling DFS channel switch announcement ie. */ 765 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf); 766 u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf); 767 768 769 #define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl}, 770 #define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd}, 771 772 struct C2HEvent_Header { 773 774 #ifdef __LITTLE_ENDIAN 775 776 unsigned int len:16; 777 unsigned int ID:8; 778 unsigned int seq:8; 779 #else 780 unsigned int seq:8; 781 unsigned int ID:8; 782 unsigned int len:16; 783 #endif 784 unsigned int rsvd; 785 }; 786 787 void rtw_dummy_event_callback(struct adapter *adapter, u8 *pbuf); 788 void rtw_fwdbg_event_callback(struct adapter *adapter, u8 *pbuf); 789 790 enum rtw_c2h_event { 791 GEN_EVT_CODE(_Read_MACREG) = 0, /*0*/ 792 GEN_EVT_CODE(_Read_BBREG), 793 GEN_EVT_CODE(_Read_RFREG), 794 GEN_EVT_CODE(_Read_EEPROM), 795 GEN_EVT_CODE(_Read_EFUSE), 796 GEN_EVT_CODE(_Read_CAM), /*5*/ 797 GEN_EVT_CODE(_Get_BasicRate), 798 GEN_EVT_CODE(_Get_DataRate), 799 GEN_EVT_CODE(_Survey), /*8*/ 800 GEN_EVT_CODE(_SurveyDone), /*9*/ 801 802 GEN_EVT_CODE(_JoinBss), /*10*/ 803 GEN_EVT_CODE(_AddSTA), 804 GEN_EVT_CODE(_DelSTA), 805 GEN_EVT_CODE(_AtimDone), 806 GEN_EVT_CODE(_TX_Report), 807 GEN_EVT_CODE(_CCX_Report), /*15*/ 808 GEN_EVT_CODE(_DTM_Report), 809 GEN_EVT_CODE(_TX_Rate_Statistics), 810 GEN_EVT_CODE(_C2HLBK), 811 GEN_EVT_CODE(_FWDBG), 812 GEN_EVT_CODE(_C2HFEEDBACK), /*20*/ 813 GEN_EVT_CODE(_ADDBA), 814 GEN_EVT_CODE(_C2HBCN), 815 GEN_EVT_CODE(_ReportPwrState), /* filen: only for PCIE, USB */ 816 GEN_EVT_CODE(_CloseRF), /* filen: only for PCIE, work around ASPM */ 817 GEN_EVT_CODE(_WMM), /*25*/ 818 MAX_C2HEVT 819 }; 820 821 822 #ifdef _RTW_MLME_EXT_C_ 823 824 static struct fwevent wlanevents[] = 825 { 826 {0, rtw_dummy_event_callback}, /*0*/ 827 {0, NULL}, 828 {0, NULL}, 829 {0, NULL}, 830 {0, NULL}, 831 {0, NULL}, 832 {0, NULL}, 833 {0, NULL}, 834 {0, &rtw_survey_event_callback}, /*8*/ 835 {sizeof(struct surveydone_event), &rtw_surveydone_event_callback}, /*9*/ 836 837 {0, &rtw_joinbss_event_callback}, /*10*/ 838 {sizeof(struct stassoc_event), &rtw_stassoc_event_callback}, 839 {sizeof(struct stadel_event), &rtw_stadel_event_callback}, 840 {0, &rtw_atimdone_event_callback}, 841 {0, rtw_dummy_event_callback}, 842 {0, NULL}, /*15*/ 843 {0, NULL}, 844 {0, NULL}, 845 {0, NULL}, 846 {0, rtw_fwdbg_event_callback}, 847 {0, NULL}, /*20*/ 848 {0, NULL}, 849 {0, NULL}, 850 {0, &rtw_cpwm_event_callback}, 851 {0, NULL}, 852 {0, &rtw_wmm_event_callback}, 853 854 }; 855 856 #endif/* _RTL8192C_CMD_C_ */ 857 858 #endif 859