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 #include <osdep_service.h> 11 #include <drv_types.h> 12 #include <wlan_bssdef.h> 13 14 /* Commented by Albert 20101105 */ 15 /* Increase the SURVEY_TO value from 100 to 150 ( 100ms to 150ms ) */ 16 /* The Realtek 8188CE SoftAP will spend around 100ms to send the probe response after receiving the probe request. */ 17 /* So, this driver tried to extend the dwell time for each scanning channel. */ 18 /* This will increase the chance to receive the probe response from SoftAP. */ 19 20 #define SURVEY_TO (100) 21 #define REAUTH_TO (300) /* 50) */ 22 #define REASSOC_TO (300) /* 50) */ 23 /* define DISCONNECT_TO (3000) */ 24 #define ADDBA_TO (2000) 25 26 #define LINKED_TO (1) /* unit:2 sec, 1x2=2 sec */ 27 28 #define REAUTH_LIMIT (4) 29 #define REASSOC_LIMIT (4) 30 #define READDBA_LIMIT (2) 31 32 #define ROAMING_LIMIT 8 33 34 #define DYNAMIC_FUNC_DISABLE (0x0) 35 36 /* ====== ODM_ABILITY_E ======== */ 37 /* BB ODM section BIT 0-15 */ 38 #define DYNAMIC_BB_DIG BIT(0) 39 #define DYNAMIC_BB_RA_MASK BIT(1) 40 #define DYNAMIC_BB_DYNAMIC_TXPWR BIT(2) 41 #define DYNAMIC_BB_BB_FA_CNT BIT(3) 42 43 #define DYNAMIC_BB_RSSI_MONITOR BIT(4) 44 #define DYNAMIC_BB_CCK_PD BIT(5) 45 #define DYNAMIC_BB_ANT_DIV BIT(6) 46 #define DYNAMIC_BB_PWR_SAVE BIT(7) 47 #define DYNAMIC_BB_PWR_TRA BIT(8) 48 #define DYNAMIC_BB_RATE_ADAPTIVE BIT(9) 49 #define DYNAMIC_BB_PATH_DIV BIT(10) 50 #define DYNAMIC_BB_PSD BIT(11) 51 52 /* MAC DM section BIT 16-23 */ 53 #define DYNAMIC_MAC_EDCA_TURBO BIT(16) 54 #define DYNAMIC_MAC_EARLY_MODE BIT(17) 55 56 /* RF ODM section BIT 24-31 */ 57 #define DYNAMIC_RF_TX_PWR_TRACK BIT(24) 58 #define DYNAMIC_RF_RX_GAIN_TRACK BIT(25) 59 #define DYNAMIC_RF_CALIBRATION BIT(26) 60 61 #define DYNAMIC_ALL_FUNC_ENABLE 0xFFFFFFF 62 63 #define _HW_STATE_NOLINK_ 0x00 64 #define _HW_STATE_ADHOC_ 0x01 65 #define _HW_STATE_STATION_ 0x02 66 #define _HW_STATE_AP_ 0x03 67 68 #define _1M_RATE_ 0 69 #define _2M_RATE_ 1 70 #define _5M_RATE_ 2 71 #define _11M_RATE_ 3 72 #define _6M_RATE_ 4 73 #define _9M_RATE_ 5 74 #define _12M_RATE_ 6 75 #define _18M_RATE_ 7 76 #define _24M_RATE_ 8 77 #define _36M_RATE_ 9 78 #define _48M_RATE_ 10 79 #define _54M_RATE_ 11 80 81 extern const u8 RTW_WPA_OUI[]; 82 extern const u8 WPS_OUI[]; 83 84 /* Channel Plan Type. */ 85 /* Note: */ 86 /* We just add new channel plan when the new channel plan is different 87 * from any of the following channel plan. 88 */ 89 /* If you just want to customize the actions(scan period or join actions) 90 * about one of the channel plan, 91 */ 92 /* customize them in struct rt_channel_info in the RT_CHANNEL_LIST. */ 93 enum RT_CHANNEL_DOMAIN { 94 /* old channel plan mapping ===== */ 95 RT_CHANNEL_DOMAIN_FCC = 0x00, 96 RT_CHANNEL_DOMAIN_IC = 0x01, 97 RT_CHANNEL_DOMAIN_ETSI = 0x02, 98 RT_CHANNEL_DOMAIN_SPAIN = 0x03, 99 RT_CHANNEL_DOMAIN_FRANCE = 0x04, 100 RT_CHANNEL_DOMAIN_MKK = 0x05, 101 RT_CHANNEL_DOMAIN_MKK1 = 0x06, 102 RT_CHANNEL_DOMAIN_ISRAEL = 0x07, 103 RT_CHANNEL_DOMAIN_TELEC = 0x08, 104 RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 0x09, 105 RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 0x0A, 106 RT_CHANNEL_DOMAIN_TAIWAN = 0x0B, 107 RT_CHANNEL_DOMAIN_CHINA = 0x0C, 108 RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO = 0x0D, 109 RT_CHANNEL_DOMAIN_KOREA = 0x0E, 110 RT_CHANNEL_DOMAIN_TURKEY = 0x0F, 111 RT_CHANNEL_DOMAIN_JAPAN = 0x10, 112 RT_CHANNEL_DOMAIN_FCC_NO_DFS = 0x11, 113 RT_CHANNEL_DOMAIN_JAPAN_NO_DFS = 0x12, 114 RT_CHANNEL_DOMAIN_WORLD_WIDE_5G = 0x13, 115 RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS = 0x14, 116 117 /* new channel plan mapping, (2GDOMAIN_5GDOMAIN) ===== */ 118 RT_CHANNEL_DOMAIN_WORLD_NULL = 0x20, 119 RT_CHANNEL_DOMAIN_ETSI1_NULL = 0x21, 120 RT_CHANNEL_DOMAIN_FCC1_NULL = 0x22, 121 RT_CHANNEL_DOMAIN_MKK1_NULL = 0x23, 122 RT_CHANNEL_DOMAIN_ETSI2_NULL = 0x24, 123 RT_CHANNEL_DOMAIN_FCC1_FCC1 = 0x25, 124 RT_CHANNEL_DOMAIN_WORLD_ETSI1 = 0x26, 125 RT_CHANNEL_DOMAIN_MKK1_MKK1 = 0x27, 126 RT_CHANNEL_DOMAIN_WORLD_KCC1 = 0x28, 127 RT_CHANNEL_DOMAIN_WORLD_FCC2 = 0x29, 128 RT_CHANNEL_DOMAIN_WORLD_FCC3 = 0x30, 129 RT_CHANNEL_DOMAIN_WORLD_FCC4 = 0x31, 130 RT_CHANNEL_DOMAIN_WORLD_FCC5 = 0x32, 131 RT_CHANNEL_DOMAIN_WORLD_FCC6 = 0x33, 132 RT_CHANNEL_DOMAIN_FCC1_FCC7 = 0x34, 133 RT_CHANNEL_DOMAIN_WORLD_ETSI2 = 0x35, 134 RT_CHANNEL_DOMAIN_WORLD_ETSI3 = 0x36, 135 RT_CHANNEL_DOMAIN_MKK1_MKK2 = 0x37, 136 RT_CHANNEL_DOMAIN_MKK1_MKK3 = 0x38, 137 RT_CHANNEL_DOMAIN_FCC1_NCC1 = 0x39, 138 RT_CHANNEL_DOMAIN_FCC1_NCC2 = 0x40, 139 RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN_2G = 0x41, 140 /* Add new channel plan above this line=============== */ 141 RT_CHANNEL_DOMAIN_MAX, 142 RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F, 143 }; 144 145 enum RT_CHANNEL_DOMAIN_2G { 146 RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, /* Worldwide 13 */ 147 RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, /* Europe */ 148 RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, /* US */ 149 RT_CHANNEL_DOMAIN_2G_MKK1 = 0x03, /* Japan */ 150 RT_CHANNEL_DOMAIN_2G_ETSI2 = 0x04, /* France */ 151 RT_CHANNEL_DOMAIN_2G_NULL = 0x05, 152 /* Add new channel plan above this line=============== */ 153 RT_CHANNEL_DOMAIN_2G_MAX, 154 }; 155 156 #define rtw_is_channel_plan_valid(chplan) \ 157 (chplan < RT_CHANNEL_DOMAIN_MAX || \ 158 chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE) 159 160 struct rt_channel_plan { 161 unsigned char Channel[MAX_CHANNEL_NUM]; 162 unsigned char Len; 163 }; 164 165 struct rt_channel_plan_2g { 166 unsigned char Channel[MAX_CHANNEL_NUM_2G]; 167 unsigned char Len; 168 }; 169 170 struct rt_channel_plan_map { 171 unsigned char Index2G; 172 }; 173 174 static const struct { 175 int channel_plan; 176 char *name; 177 } channel_table[] = { { RT_CHANNEL_DOMAIN_FCC, "US" }, 178 { RT_CHANNEL_DOMAIN_ETSI, "EU" }, 179 { RT_CHANNEL_DOMAIN_MKK, "JP" }, 180 { RT_CHANNEL_DOMAIN_CHINA, "CN"} }; 181 182 enum Associated_AP { 183 atherosAP = 0, 184 broadcomAP = 1, 185 ciscoAP = 2, 186 marvellAP = 3, 187 ralinkAP = 4, 188 realtekAP = 5, 189 airgocapAP = 6, 190 unknownAP = 7, 191 maxAP, 192 }; 193 194 enum HT_IOT_PEER { 195 HT_IOT_PEER_UNKNOWN = 0, 196 HT_IOT_PEER_REALTEK = 1, 197 HT_IOT_PEER_REALTEK_92SE = 2, 198 HT_IOT_PEER_BROADCOM = 3, 199 HT_IOT_PEER_RALINK = 4, 200 HT_IOT_PEER_ATHEROS = 5, 201 HT_IOT_PEER_CISCO = 6, 202 HT_IOT_PEER_MERU = 7, 203 HT_IOT_PEER_MARVELL = 8, 204 HT_IOT_PEER_REALTEK_SOFTAP = 9,/* peer is RealTek SOFT_AP */ 205 HT_IOT_PEER_SELF_SOFTAP = 10, /* Self is SoftAP */ 206 HT_IOT_PEER_AIRGO = 11, 207 HT_IOT_PEER_INTEL = 12, 208 HT_IOT_PEER_RTK_APCLIENT = 13, 209 HT_IOT_PEER_REALTEK_81XX = 14, 210 HT_IOT_PEER_REALTEK_WOW = 15, 211 HT_IOT_PEER_TENDA = 16, 212 HT_IOT_PEER_MAX = 17 213 }; 214 215 enum SCAN_STATE { 216 SCAN_DISABLE = 0, 217 SCAN_START = 1, 218 SCAN_TXNULL = 2, 219 SCAN_PROCESS = 3, 220 SCAN_COMPLETE = 4, 221 SCAN_STATE_MAX, 222 }; 223 224 struct mlme_handler { 225 unsigned int num; 226 const char *str; 227 unsigned int (*func)(struct adapter *adapt, struct recv_frame *frame); 228 }; 229 230 struct action_handler { 231 unsigned int num; 232 const char *str; 233 unsigned int (*func)(struct adapter *adapt, struct recv_frame *frame); 234 }; 235 236 struct ss_res { 237 int state; 238 int bss_cnt; 239 int channel_idx; 240 int scan_mode; 241 u8 ssid_num; 242 u8 ch_num; 243 struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT]; 244 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; 245 }; 246 247 /* define AP_MODE 0x0C */ 248 /* define STATION_MODE 0x08 */ 249 /* define AD_HOC_MODE 0x04 */ 250 /* define NO_LINK_MODE 0x00 */ 251 252 #define WIFI_FW_NULL_STATE _HW_STATE_NOLINK_ 253 #define WIFI_FW_STATION_STATE _HW_STATE_STATION_ 254 #define WIFI_FW_AP_STATE _HW_STATE_AP_ 255 #define WIFI_FW_ADHOC_STATE _HW_STATE_ADHOC_ 256 257 #define WIFI_FW_AUTH_NULL 0x00000100 258 #define WIFI_FW_AUTH_STATE 0x00000200 259 #define WIFI_FW_AUTH_SUCCESS 0x00000400 260 261 #define WIFI_FW_ASSOC_STATE 0x00002000 262 #define WIFI_FW_ASSOC_SUCCESS 0x00004000 263 264 #define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | \ 265 WIFI_FW_AUTH_STATE | \ 266 WIFI_FW_AUTH_SUCCESS | \ 267 WIFI_FW_ASSOC_STATE) 268 269 struct FW_Sta_Info { 270 struct sta_info *psta; 271 u32 status; 272 u32 rx_pkt; 273 u32 retry; 274 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX]; 275 }; 276 277 /* 278 * Usage: 279 * When one iface acted as AP mode and the other iface is STA mode and scanning, 280 * it should switch back to AP's operating channel periodically. 281 * Parameters info: 282 * When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to 283 * AP's operating channel for 284 * RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds. 285 * Example: 286 * For chip supports 2.4G + 5GHz and AP mode is operating in channel 1, 287 * RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MS is 3 and SURVEY_TO is 100. 288 * When it's STA mode gets set_scan command, 289 * it would 290 * 1. Doing the scan on channel 1.2.3.4.5.6.7.8 291 * 2. Back to channel 1 for 300 milliseconds 292 * 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52 293 * 4. Back to channel 1 for 300 milliseconds 294 * 5. ... and so on, till survey done. 295 */ 296 297 struct mlme_ext_info { 298 u32 state; 299 u32 reauth_count; 300 u32 reassoc_count; 301 u32 link_count; 302 u32 auth_seq; 303 u32 auth_algo; /* 802.11 auth, could be open, shared, auto */ 304 u32 authModeToggle; 305 u32 enc_algo;/* encrypt algorithm; */ 306 u32 key_index; /* this is only valid for legacy wep, 307 * 0~3 for key id. 308 */ 309 u32 iv; 310 u8 chg_txt[128]; 311 u16 aid; 312 u16 bcn_interval; 313 u16 capability; 314 u8 assoc_AP_vendor; 315 u8 slotTime; 316 u8 preamble_mode; 317 u8 WMM_enable; 318 u8 ERP_enable; 319 u8 ERP_IE; 320 u8 HT_enable; 321 u8 HT_caps_enable; 322 u8 HT_info_enable; 323 u8 HT_protection; 324 u8 turboMode_cts2self; 325 u8 turboMode_rtsen; 326 u8 SM_PS; 327 u8 agg_enable_bitmap; 328 u8 ADDBA_retry_count; 329 u8 candidate_tid_bitmap; 330 u8 dialogToken; 331 /* Accept ADDBA Request */ 332 bool accept_addba_req; 333 u8 bwmode_updated; 334 u8 hidden_ssid_mode; 335 336 struct ADDBA_request ADDBA_req; 337 struct WMM_para_element WMM_param; 338 struct ieee80211_ht_cap HT_caps; 339 struct HT_info_element HT_info; 340 struct wlan_bssid_ex network;/* join network or bss_network, 341 * if in ap mode, it is the same 342 * as cur_network.network 343 */ 344 struct FW_Sta_Info FW_sta_info[NUM_STA]; 345 }; 346 347 /* The channel information about this channel including joining, 348 * scanning, and power constraints. 349 */ 350 struct rt_channel_info { 351 u8 ChannelNum; /* The channel number. */ 352 enum rt_scan_type ScanType; /* Scan type such as passive 353 * or active scan. 354 */ 355 u32 rx_count; 356 }; 357 358 int rtw_ch_set_search_ch(struct rt_channel_info *ch_set, const u32 ch); 359 360 /* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */ 361 #define P2P_MAX_REG_CLASSES 10 362 363 /* P2P_MAX_REG_CLASS_CHANNELS - Maximum number of chan per regulatory class */ 364 #define P2P_MAX_REG_CLASS_CHANNELS 20 365 366 /* struct p2p_channels - List of supported channels */ 367 struct p2p_channels { 368 /* struct p2p_reg_class - Supported regulatory class */ 369 struct p2p_reg_class { 370 /* reg_class - Regulatory class (IEEE 802.11-2007, Annex J) */ 371 u8 reg_class; 372 373 /* channel - Supported channels */ 374 u8 channel[P2P_MAX_REG_CLASS_CHANNELS]; 375 376 /* channels - Number of channel entries in use */ 377 size_t channels; 378 } reg_class[P2P_MAX_REG_CLASSES]; 379 380 /* reg_classes - Number of reg_class entries in use */ 381 size_t reg_classes; 382 }; 383 384 struct p2p_oper_class_map { 385 enum hw_mode {IEEE80211G} mode; 386 u8 op_class; 387 u8 min_chan; 388 u8 max_chan; 389 u8 inc; 390 enum {BW20, BW40PLUS, BW40MINUS} bw; 391 }; 392 393 struct mlme_ext_priv { 394 struct adapter *padapter; 395 u8 mlmeext_init; 396 atomic_t event_seq; 397 u16 mgnt_seq; 398 399 unsigned char cur_channel; 400 unsigned char cur_bwmode; 401 unsigned char cur_ch_offset;/* PRIME_CHNL_OFFSET */ 402 unsigned char cur_wireless_mode; /* NETWORK_TYPE */ 403 404 unsigned char oper_channel; /* saved chan info when call 405 * set_channel_bw 406 */ 407 unsigned char oper_bwmode; 408 unsigned char oper_ch_offset;/* PRIME_CHNL_OFFSET */ 409 410 unsigned char max_chan_nums; 411 struct rt_channel_info channel_set[MAX_CHANNEL_NUM]; 412 struct p2p_channels channel_list; 413 unsigned char basicrate[NumRates]; 414 unsigned char datarate[NumRates]; 415 416 struct ss_res sitesurvey_res; 417 struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including 418 * current scan/connecting/connected 419 * related info. For ap mode, 420 * network includes ap's cap_info 421 */ 422 struct timer_list survey_timer; 423 struct timer_list link_timer; 424 u16 chan_scan_time; 425 426 u8 scan_abort; 427 u8 tx_rate; /* TXRATE when USERATE is set. */ 428 429 u32 retry; /* retry for issue probereq */ 430 431 u64 TSFValue; 432 433 #ifdef CONFIG_88EU_AP_MODE 434 unsigned char bstart_bss; 435 #endif 436 u8 update_channel_plan_by_ap_done; 437 /* recv_decache check for Action_public frame */ 438 u8 action_public_dialog_token; 439 u16 action_public_rxseq; 440 u8 active_keep_alive_check; 441 }; 442 443 int init_mlme_ext_priv(struct adapter *adapter); 444 int init_hw_mlme_ext(struct adapter *padapter); 445 void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext); 446 void init_mlme_ext_timer(struct adapter *padapter); 447 void init_addba_retry_timer(struct adapter *adapt, struct sta_info *sta); 448 struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv); 449 450 unsigned char networktype_to_raid(unsigned char network_type); 451 u8 judge_network_type(struct adapter *padapter, unsigned char *rate); 452 void get_rate_set(struct adapter *padapter, unsigned char *pbssrate, int *len); 453 void UpdateBrateTbl(struct adapter *padapter, u8 *mBratesOS); 454 void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen); 455 456 void Save_DM_Func_Flag(struct adapter *padapter); 457 void Restore_DM_Func_Flag(struct adapter *padapter); 458 void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable); 459 460 void Set_MSR(struct adapter *padapter, u8 type); 461 462 u8 rtw_get_oper_ch(struct adapter *adapter); 463 void rtw_set_oper_ch(struct adapter *adapter, u8 ch); 464 void rtw_set_oper_bw(struct adapter *adapter, u8 bw); 465 void rtw_set_oper_choffset(struct adapter *adapter, u8 offset); 466 467 void set_channel_bwmode(struct adapter *padapter, unsigned char channel, 468 unsigned char channel_offset, unsigned short bwmode); 469 void SelectChannel(struct adapter *padapter, unsigned char channel); 470 void SetBWMode(struct adapter *padapter, unsigned short bwmode, 471 unsigned char channel_offset); 472 473 unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval); 474 475 void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key); 476 void clear_cam_entry(struct adapter *padapter, u8 entry); 477 478 void invalidate_cam_all(struct adapter *padapter); 479 480 int allocate_fw_sta_entry(struct adapter *padapter); 481 void flush_all_cam_entry(struct adapter *padapter); 482 483 void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, 484 struct adapter *adapter, bool update_ie); 485 486 u16 get_beacon_interval(struct wlan_bssid_ex *bss); 487 488 int is_client_associated_to_ap(struct adapter *padapter); 489 int is_client_associated_to_ibss(struct adapter *padapter); 490 int is_IBSS_empty(struct adapter *padapter); 491 492 unsigned char check_assoc_AP(u8 *pframe, uint len); 493 494 int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE); 495 void WMMOnAssocRsp(struct adapter *padapter); 496 497 void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE); 498 void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE); 499 void HTOnAssocRsp(struct adapter *padapter); 500 501 void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE); 502 void VCS_update(struct adapter *padapter, struct sta_info *psta); 503 504 void update_beacon_info(struct adapter *padapter, u8 *pframe, uint len, 505 struct sta_info *psta); 506 int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len); 507 void update_IOT_info(struct adapter *padapter); 508 void update_capinfo(struct adapter *adapter, u16 updatecap); 509 void update_wireless_mode(struct adapter *padapter); 510 void update_tx_basic_rate(struct adapter *padapter, u8 modulation); 511 void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id); 512 int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, 513 uint var_ie_len, int cam_idx); 514 515 /* for sta/adhoc mode */ 516 void update_sta_info(struct adapter *padapter, struct sta_info *psta); 517 unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz); 518 unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz); 519 unsigned int update_MSC_rate(struct ieee80211_ht_cap *pHT_caps); 520 void Update_RA_Entry(struct adapter *padapter, u32 mac_id); 521 void set_sta_rate(struct adapter *padapter, struct sta_info *psta); 522 523 unsigned char get_highest_rate_idx(u32 mask); 524 int support_short_GI(struct adapter *padapter, struct ieee80211_ht_cap *caps); 525 unsigned int is_ap_in_tkip(struct adapter *padapter); 526 527 void report_join_res(struct adapter *padapter, int res); 528 void report_survey_event(struct adapter *padapter, 529 struct recv_frame *precv_frame); 530 void report_surveydone_event(struct adapter *padapter); 531 void report_del_sta_event(struct adapter *padapter, 532 unsigned char *addr, unsigned short reason); 533 void report_add_sta_event(struct adapter *padapter, unsigned char *addr, 534 int cam_idx); 535 536 u8 set_tx_beacon_cmd(struct adapter *padapter); 537 unsigned int setup_beacon_frame(struct adapter *padapter, 538 unsigned char *beacon_frame); 539 void update_mgnt_tx_rate(struct adapter *padapter, u8 rate); 540 void update_mgntframe_attrib(struct adapter *padapter, 541 struct pkt_attrib *pattrib); 542 543 int issue_nulldata(struct adapter *padapter, unsigned char *da, 544 unsigned int power_mode, int try_cnt, int wait_ms); 545 int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, 546 u16 tid, int try_cnt, int wait_ms); 547 int issue_deauth(struct adapter *padapter, unsigned char *da, 548 unsigned short reason); 549 unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr); 550 unsigned int send_beacon(struct adapter *padapter); 551 552 void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res); 553 void mlmeext_sta_del_event_callback(struct adapter *padapter); 554 void mlmeext_sta_add_event_callback(struct adapter *padapter, 555 struct sta_info *psta); 556 557 void linked_status_chk(struct adapter *padapter); 558 559 void survey_timer_hdl(struct timer_list *t); 560 void link_timer_hdl(struct timer_list *t); 561 void addba_timer_hdl(struct timer_list *t); 562 563 #define set_survey_timer(mlmeext, ms) \ 564 mod_timer(&mlmeext->survey_timer, jiffies + \ 565 msecs_to_jiffies(ms)) 566 567 #define set_link_timer(mlmeext, ms) \ 568 mod_timer(&mlmeext->link_timer, jiffies + \ 569 msecs_to_jiffies(ms)) 570 571 void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr); 572 573 void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len); 574 void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext); 575 576 struct cmd_hdl { 577 uint parmsize; 578 u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf); 579 }; 580 581 u8 read_macreg_hdl(struct adapter *padapter, u8 *pbuf); 582 u8 write_macreg_hdl(struct adapter *padapter, u8 *pbuf); 583 u8 read_bbreg_hdl(struct adapter *padapter, u8 *pbuf); 584 u8 write_bbreg_hdl(struct adapter *padapter, u8 *pbuf); 585 u8 read_rfreg_hdl(struct adapter *padapter, u8 *pbuf); 586 u8 write_rfreg_hdl(struct adapter *padapter, u8 *pbuf); 587 u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf); 588 u8 disconnect_hdl(struct adapter *padapter, u8 *pbuf); 589 u8 createbss_hdl(struct adapter *padapter, u8 *pbuf); 590 u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf); 591 u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf); 592 u8 setauth_hdl(struct adapter *padapter, u8 *pbuf); 593 u8 setkey_hdl(struct adapter *padapter, u8 *pbuf); 594 u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf); 595 u8 set_assocsta_hdl(struct adapter *padapter, u8 *pbuf); 596 u8 del_assocsta_hdl(struct adapter *padapter, u8 *pbuf); 597 u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf); 598 599 u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf); 600 u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf); 601 u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf); 602 u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf); 603 u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf); 604 u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf); 605 /* Handling DFS channel switch announcement ie. */ 606 u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf); 607 u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf); 608 609 #ifdef _RTW_CMD_C_ 610 611 static struct cmd_hdl wlancmds[] = { 612 {sizeof(struct wlan_bssid_ex), join_cmd_hdl}, 613 {sizeof(struct disconnect_parm), disconnect_hdl}, 614 {sizeof(struct wlan_bssid_ex), createbss_hdl}, 615 {sizeof(struct setopmode_parm), setopmode_hdl}, 616 {sizeof(struct sitesurvey_parm), sitesurvey_cmd_hdl}, 617 {sizeof(struct setauth_parm), setauth_hdl}, 618 {sizeof(struct setkey_parm), setkey_hdl}, 619 {sizeof(struct set_stakey_parm), set_stakey_hdl}, 620 {sizeof(struct set_assocsta_parm), NULL}, 621 {sizeof(struct addBaReq_parm), add_ba_hdl}, 622 {sizeof(struct set_ch_parm), set_ch_hdl}, 623 {sizeof(struct wlan_bssid_ex), tx_beacon_hdl}, 624 {0, mlme_evt_hdl}, 625 {0, rtw_drvextra_cmd_hdl}, 626 {sizeof(struct SetChannelPlan_param), set_chplan_hdl} 627 }; 628 629 #endif 630 631 struct C2HEvent_Header { 632 #ifdef __LITTLE_ENDIAN 633 unsigned int len:16; 634 unsigned int ID:8; 635 unsigned int seq:8; 636 #elif defined(__BIG_ENDIAN) 637 unsigned int seq:8; 638 unsigned int ID:8; 639 unsigned int len:16; 640 #endif 641 unsigned int rsvd; 642 }; 643 644 void rtw_dummy_event_callback(struct adapter *adapter, u8 *pbuf); 645 void rtw_fwdbg_event_callback(struct adapter *adapter, u8 *pbuf); 646 647 enum rtw_c2h_event { 648 _Read_MACREG_EVT_ = 0, /*0*/ 649 _Read_BBREG_EVT_, 650 _Read_RFREG_EVT_, 651 _Read_EEPROM_EVT_, 652 _Read_EFUSE_EVT_, 653 _Read_CAM_EVT_, /*5*/ 654 _Get_BasicRate_EVT_, 655 _Get_DataRate_EVT_, 656 _Survey_EVT_, /*8*/ 657 _SurveyDone_EVT_, /*9*/ 658 659 _JoinBss_EVT_, /*10*/ 660 _AddSTA_EVT_, 661 _DelSTA_EVT_, 662 _AtimDone_EVT_, 663 _TX_Report_EVT_, 664 _CCX_Report_EVT_, /*15*/ 665 _DTM_Report_EVT_, 666 _TX_Rate_Statistics_EVT_, 667 _C2HLBK_EVT_, 668 _FWDBG_EVT_, 669 _C2HFEEDBACK_EVT_, /*20*/ 670 _ADDBA_EVT_, 671 _C2HBCN_EVT_, 672 _ReportPwrState_EVT_, /* filen: only for PCIE, USB */ 673 _CloseRF_EVT_, /* filen: only for PCIE, 674 * work around ASPM 675 */ 676 MAX_C2HEVT 677 }; 678 679 #ifdef _RTW_MLME_EXT_C_ 680 681 static struct fwevent wlanevents[] = { 682 {0, rtw_dummy_event_callback}, /*0*/ 683 {0, NULL}, 684 {0, NULL}, 685 {0, NULL}, 686 {0, NULL}, 687 {0, NULL}, 688 {0, NULL}, 689 {0, NULL}, 690 {0, &rtw_survey_event_callback}, /*8*/ 691 {sizeof(struct surveydone_event), &rtw_surveydone_event_callback},/*9*/ 692 {0, &rtw_joinbss_event_callback}, /*10*/ 693 {sizeof(struct stassoc_event), &rtw_stassoc_event_callback}, 694 {sizeof(struct stadel_event), &rtw_stadel_event_callback}, 695 {0, &rtw_atimdone_event_callback}, 696 {0, rtw_dummy_event_callback}, 697 {0, NULL}, /*15*/ 698 {0, NULL}, 699 {0, NULL}, 700 {0, NULL}, 701 {0, rtw_fwdbg_event_callback}, 702 {0, NULL}, /*20*/ 703 {0, NULL}, 704 {0, NULL}, 705 {0, &rtw_cpwm_event_callback}, 706 {0, NULL}, 707 }; 708 709 #endif/* _RTL_MLME_EXT_C_ */ 710 711 #endif /* __RTW_MLME_EXT_H_ */ 712