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