/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/ #ifndef __RTW_MLME_EXT_H_ #define __RTW_MLME_EXT_H_ #include #include #include #include // Commented by Albert 20101105 // Increase the SURVEY_TO value from 100 to 150 ( 100ms to 150ms ) // The Realtek 8188CE SoftAP will spend around 100ms to send the probe response after receiving the probe request. // So, this driver tried to extend the dwell time for each scanning channel. // This will increase the chance to receive the probe response from SoftAP. #define SURVEY_TO (100) #define REAUTH_TO (300) //(50) #define REASSOC_TO (300) //(50) //#define DISCONNECT_TO (3000) #define ADDBA_TO (2000) #define LINKED_TO (1) //unit:2 sec, 1x2=2 sec #define REAUTH_LIMIT (4) #define REASSOC_LIMIT (4) #define READDBA_LIMIT (2) #define ROAMING_LIMIT 8 #define DYNAMIC_FUNC_DISABLE (0x0) // ====== ODM_ABILITY_E ======== // BB ODM section BIT 0-15 #define DYNAMIC_BB_DIG BIT(0) #define DYNAMIC_BB_RA_MASK BIT(1) #define DYNAMIC_BB_DYNAMIC_TXPWR BIT(2) #define DYNAMIC_BB_BB_FA_CNT BIT(3) #define DYNAMIC_BB_RSSI_MONITOR BIT(4) #define DYNAMIC_BB_CCK_PD BIT(5) #define DYNAMIC_BB_ANT_DIV BIT(6) #define DYNAMIC_BB_PWR_SAVE BIT(7) #define DYNAMIC_BB_PWR_TRAIN BIT(8) #define DYNAMIC_BB_RATE_ADAPTIVE BIT(9) #define DYNAMIC_BB_PATH_DIV BIT(10) #define DYNAMIC_BB_PSD BIT(11) // MAC DM section BIT 16-23 #define DYNAMIC_MAC_EDCA_TURBO BIT(16) #define DYNAMIC_MAC_EARLY_MODE BIT(17) // RF ODM section BIT 24-31 #define DYNAMIC_RF_TX_PWR_TRACK BIT(24) #define DYNAMIC_RF_RX_GAIN_TRACK BIT(25) #define DYNAMIC_RF_CALIBRATION BIT(26) #define DYNAMIC_ALL_FUNC_ENABLE 0xFFFFFFF #define _HW_STATE_NOLINK_ 0x00 #define _HW_STATE_ADHOC_ 0x01 #define _HW_STATE_STATION_ 0x02 #define _HW_STATE_AP_ 0x03 #define _1M_RATE_ 0 #define _2M_RATE_ 1 #define _5M_RATE_ 2 #define _11M_RATE_ 3 #define _6M_RATE_ 4 #define _9M_RATE_ 5 #define _12M_RATE_ 6 #define _18M_RATE_ 7 #define _24M_RATE_ 8 #define _36M_RATE_ 9 #define _48M_RATE_ 10 #define _54M_RATE_ 11 extern unsigned char RTW_WPA_OUI[]; extern unsigned char WMM_OUI[]; extern unsigned char WPS_OUI[]; extern unsigned char WFD_OUI[]; extern unsigned char P2P_OUI[]; extern unsigned char WMM_INFO_OUI[]; extern unsigned char WMM_PARA_OUI[]; extern unsigned char REALTEK_96B_IE[]; // // Channel Plan Type. // Note: // We just add new channel plan when the new channel plan is different from any of the following // channel plan. // If you just wnat to customize the acitions(scan period or join actions) about one of the channel plan, // customize them in struct rt_channel_info in the RT_CHANNEL_LIST. // enum rt_channel_domain { //===== old channel plan mapping =====// RT_CHANNEL_DOMAIN_FCC = 0x00, RT_CHANNEL_DOMAIN_IC = 0x01, RT_CHANNEL_DOMAIN_ETSI = 0x02, RT_CHANNEL_DOMAIN_SPAIN = 0x03, RT_CHANNEL_DOMAIN_FRANCE = 0x04, RT_CHANNEL_DOMAIN_MKK = 0x05, RT_CHANNEL_DOMAIN_MKK1 = 0x06, RT_CHANNEL_DOMAIN_ISRAEL = 0x07, RT_CHANNEL_DOMAIN_TELEC = 0x08, RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 0x09, RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 0x0A, RT_CHANNEL_DOMAIN_TAIWAN = 0x0B, RT_CHANNEL_DOMAIN_CHINA = 0x0C, RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO = 0x0D, RT_CHANNEL_DOMAIN_KOREA = 0x0E, RT_CHANNEL_DOMAIN_TURKEY = 0x0F, RT_CHANNEL_DOMAIN_JAPAN = 0x10, RT_CHANNEL_DOMAIN_FCC_NO_DFS = 0x11, RT_CHANNEL_DOMAIN_JAPAN_NO_DFS = 0x12, RT_CHANNEL_DOMAIN_WORLD_WIDE_5G = 0x13, RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS = 0x14, //===== new channel plan mapping, (2GDOMAIN_5GDOMAIN) =====// RT_CHANNEL_DOMAIN_WORLD_NULL = 0x20, RT_CHANNEL_DOMAIN_ETSI1_NULL = 0x21, RT_CHANNEL_DOMAIN_FCC1_NULL = 0x22, RT_CHANNEL_DOMAIN_MKK1_NULL = 0x23, RT_CHANNEL_DOMAIN_ETSI2_NULL = 0x24, RT_CHANNEL_DOMAIN_FCC1_FCC1 = 0x25, RT_CHANNEL_DOMAIN_WORLD_ETSI1 = 0x26, RT_CHANNEL_DOMAIN_MKK1_MKK1 = 0x27, RT_CHANNEL_DOMAIN_WORLD_KCC1 = 0x28, RT_CHANNEL_DOMAIN_WORLD_FCC2 = 0x29, RT_CHANNEL_DOMAIN_WORLD_FCC3 = 0x30, RT_CHANNEL_DOMAIN_WORLD_FCC4 = 0x31, RT_CHANNEL_DOMAIN_WORLD_FCC5 = 0x32, RT_CHANNEL_DOMAIN_WORLD_FCC6 = 0x33, RT_CHANNEL_DOMAIN_FCC1_FCC7 = 0x34, RT_CHANNEL_DOMAIN_WORLD_ETSI2 = 0x35, RT_CHANNEL_DOMAIN_WORLD_ETSI3 = 0x36, RT_CHANNEL_DOMAIN_MKK1_MKK2 = 0x37, RT_CHANNEL_DOMAIN_MKK1_MKK3 = 0x38, RT_CHANNEL_DOMAIN_FCC1_NCC1 = 0x39, RT_CHANNEL_DOMAIN_FCC1_NCC2 = 0x40, RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN_2G = 0x41, //===== Add new channel plan above this line===============// RT_CHANNEL_DOMAIN_MAX, RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F, }; enum RT_CHANNEL_DOMAIN_2G { RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, //Worldwird 13 RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, //Europe RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, //US RT_CHANNEL_DOMAIN_2G_MKK1 = 0x03, //Japan RT_CHANNEL_DOMAIN_2G_ETSI2 = 0x04, //France RT_CHANNEL_DOMAIN_2G_NULL = 0x05, //===== Add new channel plan above this line===============// RT_CHANNEL_DOMAIN_2G_MAX, }; enum RT_CHANNEL_DOMAIN_5G { RT_CHANNEL_DOMAIN_5G_NULL = 0x00, RT_CHANNEL_DOMAIN_5G_ETSI1 = 0x01, //Europe RT_CHANNEL_DOMAIN_5G_ETSI2 = 0x02, //Australia, New Zealand RT_CHANNEL_DOMAIN_5G_ETSI3 = 0x03, //Russia RT_CHANNEL_DOMAIN_5G_FCC1 = 0x04, //US RT_CHANNEL_DOMAIN_5G_FCC2 = 0x05, //FCC o/w DFS Channels RT_CHANNEL_DOMAIN_5G_FCC3 = 0x06, //India, Mexico RT_CHANNEL_DOMAIN_5G_FCC4 = 0x07, //Venezuela RT_CHANNEL_DOMAIN_5G_FCC5 = 0x08, //China RT_CHANNEL_DOMAIN_5G_FCC6 = 0x09, //Israel RT_CHANNEL_DOMAIN_5G_FCC7_IC1 = 0x0A, //US, Canada RT_CHANNEL_DOMAIN_5G_KCC1 = 0x0B, //Korea RT_CHANNEL_DOMAIN_5G_MKK1 = 0x0C, //Japan RT_CHANNEL_DOMAIN_5G_MKK2 = 0x0D, //Japan (W52, W53) RT_CHANNEL_DOMAIN_5G_MKK3 = 0x0E, //Japan (W56) RT_CHANNEL_DOMAIN_5G_NCC1 = 0x0F, //Taiwan RT_CHANNEL_DOMAIN_5G_NCC2 = 0x10, //Taiwan o/w DFS //===== Add new channel plan above this line===============// //===== Driver Self Defined =====// RT_CHANNEL_DOMAIN_5G_FCC = 0x11, RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS = 0x12, RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS = 0x13, RT_CHANNEL_DOMAIN_5G_MAX, }; #define rtw_is_channel_plan_valid(chplan) (chplansurvey_timer, (ms)); \ } while(0) #define set_link_timer(mlmeext, ms) \ do { \ _set_timer(&(mlmeext)->link_timer, (ms)); \ } while(0) #ifdef CONFIG_IEEE80211W #define set_sa_query_timer(mlmeext, ms) \ do { \ DBG_871X("%s set_sa_query_timer(%p, %d)\n", __FUNCTION__, (mlmeext), (ms)); \ _set_timer(&(mlmeext)->sa_query_timer, (ms)); \ } while(0) #endif //CONFIG_IEEE80211W extern int cckrates_included(unsigned char *rate, int ratelen); extern int cckratesonly_included(unsigned char *rate, int ratelen); extern void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr); extern void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len); extern void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext); int rtw_chk_start_clnt_join(struct adapter *padapter, u8 *ch, u8 *bw, u8 *offset); int rtw_get_ch_setting_union(struct adapter *adapter, u8 *ch, u8 *bw, u8 *offset); struct cmd_hdl { uint parmsize; u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf); }; u8 read_macreg_hdl(struct adapter *padapter, u8 *pbuf); u8 write_macreg_hdl(struct adapter *padapter, u8 *pbuf); u8 read_bbreg_hdl(struct adapter *padapter, u8 *pbuf); u8 write_bbreg_hdl(struct adapter *padapter, u8 *pbuf); u8 read_rfreg_hdl(struct adapter *padapter, u8 *pbuf); u8 write_rfreg_hdl(struct adapter *padapter, u8 *pbuf); u8 NULL_hdl(struct adapter *padapter, u8 *pbuf); u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf); u8 disconnect_hdl(struct adapter *padapter, u8 *pbuf); u8 createbss_hdl(struct adapter *padapter, u8 *pbuf); u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf); u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf); u8 setauth_hdl(struct adapter *padapter, u8 *pbuf); u8 setkey_hdl(struct adapter *padapter, u8 *pbuf); u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf); u8 set_assocsta_hdl(struct adapter *padapter, u8 *pbuf); u8 del_assocsta_hdl(struct adapter *padapter, u8 *pbuf); u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf); u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf); u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf); u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf); u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf); u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf); u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf); u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf); //Kurt: Handling DFS channel switch announcement ie. u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf); #define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl}, #define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd}, #ifdef _RTW_CMD_C_ static struct cmd_hdl wlancmds[] = { GEN_DRV_CMD_HANDLER(0, NULL) /*0*/ GEN_DRV_CMD_HANDLER(0, NULL) GEN_DRV_CMD_HANDLER(0, NULL) GEN_DRV_CMD_HANDLER(0, NULL) GEN_DRV_CMD_HANDLER(0, NULL) GEN_DRV_CMD_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) /*10*/ GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(sizeof (struct joinbss_parm), join_cmd_hdl) /*14*/ GEN_MLME_EXT_HANDLER(sizeof (struct disconnect_parm), disconnect_hdl) GEN_MLME_EXT_HANDLER(sizeof (struct createbss_parm), createbss_hdl) GEN_MLME_EXT_HANDLER(sizeof (struct setopmode_parm), setopmode_hdl) GEN_MLME_EXT_HANDLER(sizeof (struct sitesurvey_parm), sitesurvey_cmd_hdl) /*18*/ GEN_MLME_EXT_HANDLER(sizeof (struct setauth_parm), setauth_hdl) GEN_MLME_EXT_HANDLER(sizeof (struct setkey_parm), setkey_hdl) /*20*/ GEN_MLME_EXT_HANDLER(sizeof (struct set_stakey_parm), set_stakey_hdl) GEN_MLME_EXT_HANDLER(sizeof (struct set_assocsta_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct del_assocsta_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct setstapwrstate_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct setbasicrate_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct getbasicrate_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct setdatarate_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct getdatarate_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct setphyinfo_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct getphyinfo_parm), NULL) /*30*/ GEN_MLME_EXT_HANDLER(sizeof (struct setphy_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof (struct getphy_parm), NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) /*40*/ GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(sizeof(struct addBaReq_parm), add_ba_hdl) GEN_MLME_EXT_HANDLER(sizeof(struct set_ch_parm), set_ch_hdl) /* 46 */ GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) /*50*/ GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(sizeof(struct Tx_Beacon_param), tx_beacon_hdl) /*55*/ GEN_MLME_EXT_HANDLER(0, mlme_evt_hdl) /*56*/ GEN_MLME_EXT_HANDLER(0, rtw_drvextra_cmd_hdl) /*57*/ GEN_MLME_EXT_HANDLER(0, h2c_msg_hdl) /*58*/ GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), set_chplan_hdl) /*59*/ GEN_MLME_EXT_HANDLER(sizeof(struct LedBlink_param), led_blink_hdl) /*60*/ GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), set_csa_hdl) /*61*/ GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*62*/ }; #endif struct C2HEvent_Header { #ifdef __LITTLE_ENDIAN unsigned int len:16; unsigned int ID:8; unsigned int seq:8; #elif defined(__BIG_ENDIAN) unsigned int seq:8; unsigned int ID:8; unsigned int len:16; #else # error "Must be LITTLE or BIG Endian" #endif unsigned int rsvd; }; void rtw_dummy_event_callback(struct adapter *adapter , u8 *pbuf); void rtw_fwdbg_event_callback(struct adapter *adapter , u8 *pbuf); enum rtw_c2h_event { GEN_EVT_CODE(_Read_MACREG)=0, /*0*/ GEN_EVT_CODE(_Read_BBREG), GEN_EVT_CODE(_Read_RFREG), GEN_EVT_CODE(_Read_EEPROM), GEN_EVT_CODE(_Read_EFUSE), GEN_EVT_CODE(_Read_CAM), /*5*/ GEN_EVT_CODE(_Get_BasicRate), GEN_EVT_CODE(_Get_DataRate), GEN_EVT_CODE(_Survey), /*8*/ GEN_EVT_CODE(_SurveyDone), /*9*/ GEN_EVT_CODE(_JoinBss) , /*10*/ GEN_EVT_CODE(_AddSTA), GEN_EVT_CODE(_DelSTA), GEN_EVT_CODE(_AtimDone) , GEN_EVT_CODE(_TX_Report), GEN_EVT_CODE(_CCX_Report), /*15*/ GEN_EVT_CODE(_DTM_Report), GEN_EVT_CODE(_TX_Rate_Statistics), GEN_EVT_CODE(_C2HLBK), GEN_EVT_CODE(_FWDBG), GEN_EVT_CODE(_C2HFEEDBACK), /*20*/ GEN_EVT_CODE(_ADDBA), GEN_EVT_CODE(_C2HBCN), GEN_EVT_CODE(_ReportPwrState), //filen: only for PCIE, USB GEN_EVT_CODE(_CloseRF), //filen: only for PCIE, work around ASPM MAX_C2HEVT }; #ifdef _RTW_MLME_EXT_C_ static struct fwevent wlanevents[] = { {0, rtw_dummy_event_callback}, /*0*/ {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, &rtw_survey_event_callback}, /*8*/ {sizeof (struct surveydone_event), &rtw_surveydone_event_callback}, /*9*/ {0, &rtw_joinbss_event_callback}, /*10*/ {sizeof(struct stassoc_event), &rtw_stassoc_event_callback}, {sizeof(struct stadel_event), &rtw_stadel_event_callback}, {0, &rtw_atimdone_event_callback}, {0, rtw_dummy_event_callback}, {0, NULL}, /*15*/ {0, NULL}, {0, NULL}, {0, NULL}, {0, rtw_fwdbg_event_callback}, {0, NULL}, /*20*/ {0, NULL}, {0, NULL}, {0, &rtw_cpwm_event_callback}, }; #endif//_RTL8192C_CMD_C_ #endif