2013-05-08 21:45:39 +00:00
/******************************************************************************
*
* Copyright ( c ) 2007 - 2011 Realtek Corporation . All rights reserved .
2013-05-19 04:28:07 +00:00
*
2013-05-08 21:45:39 +00:00
* 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
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# define _OS_INTFS_C_
# include <osdep_service.h>
2014-11-16 00:18:30 +00:00
# include <osdep_intf.h>
2013-05-08 21:45:39 +00:00
# include <drv_types.h>
# include <xmit_osdep.h>
# include <recv_osdep.h>
# include <hal_intf.h>
# include <rtw_ioctl.h>
2014-11-16 00:18:30 +00:00
# include <rtl8188e_hal.h>
2013-05-08 21:45:39 +00:00
2013-05-26 02:17:38 +00:00
# include <usb_hal.h>
2013-05-08 21:45:39 +00:00
MODULE_LICENSE ( " GPL " ) ;
MODULE_DESCRIPTION ( " Realtek Wireless Lan Driver " ) ;
MODULE_AUTHOR ( " Realtek Semiconductor Corp. " ) ;
MODULE_VERSION ( DRIVERVERSION ) ;
2013-10-19 17:45:47 +00:00
# define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */
2013-05-08 21:45:39 +00:00
/* module param defaults */
2013-06-03 19:52:18 +00:00
static int rtw_chip_version = 0x00 ;
static int rtw_rfintfs = HWPI ;
2013-08-11 02:53:06 +00:00
static int rtw_lbkmode ; /* RTL8712_AIR_TRX; */
static int rtw_network_mode = Ndis802_11IBSS ; /* Ndis802_11Infrastructure; infra, ad-hoc, auto */
static int rtw_channel = 1 ; /* ad-hoc support requirement */
2013-06-03 19:52:18 +00:00
static int rtw_wireless_mode = WIRELESS_11BG_24N ;
static int rtw_vrtl_carrier_sense = AUTO_VCS ;
2013-08-11 02:53:06 +00:00
static int rtw_vcs_type = RTS_CTS ; /* */
static int rtw_rts_thresh = 2347 ; /* */
static int rtw_frag_thresh = 2346 ; /* */
static int rtw_preamble = PREAMBLE_LONG ; /* long, short, auto */
static int rtw_scan_mode = 1 ; /* active, passive */
2013-06-03 19:52:18 +00:00
static int rtw_adhoc_tx_pwr = 1 ;
2013-08-11 02:53:06 +00:00
static int rtw_soft_ap ;
2013-06-03 19:52:18 +00:00
static int rtw_power_mgnt = 1 ;
static int rtw_ips_mode = IPS_NORMAL ;
2013-05-08 21:45:39 +00:00
2013-06-03 19:52:18 +00:00
static int rtw_smart_ps = 2 ;
2013-05-08 21:45:39 +00:00
module_param ( rtw_ips_mode , int , 0644 ) ;
2013-08-11 02:53:06 +00:00
MODULE_PARM_DESC ( rtw_ips_mode , " The default IPS mode " ) ;
2013-05-08 21:45:39 +00:00
2013-05-17 21:52:06 +00:00
static int rtw_debug = 1 ;
2013-06-03 19:52:18 +00:00
static int rtw_radio_enable = 1 ;
static int rtw_long_retry_lmt = 7 ;
static int rtw_short_retry_lmt = 7 ;
static int rtw_busy_thresh = 40 ;
static int rtw_ack_policy = NORMAL_ACK ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_software_encrypt ;
static int rtw_software_decrypt ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_acm_method ; /* 0:By SW 1:By HW. */
2013-05-19 04:28:07 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_wmm_enable = 1 ; /* default is set to enable the wmm. */
static int rtw_uapsd_enable ;
2013-06-03 19:52:18 +00:00
static int rtw_uapsd_max_sp = NO_LIMIT ;
2013-08-11 02:53:06 +00:00
static int rtw_uapsd_acbk_en ;
static int rtw_uapsd_acbe_en ;
static int rtw_uapsd_acvi_en ;
static int rtw_uapsd_acvo_en ;
2013-05-19 04:28:07 +00:00
2014-11-16 00:18:30 +00:00
static int rtw_ht_enable = 1 ;
static int rtw_cbw40_enable = 3 ; /* 0 :disable, bit(0): enable 2.4g, bit(1): enable 5g */
static int rtw_ampdu_enable = 1 ; /* for enable tx_ampdu */
2013-08-11 02:53:06 +00:00
static int rtw_rx_stbc = 1 ; /* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */
static int rtw_ampdu_amsdu ; /* 0: disabled, 1:enabled, 2:auto */
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_lowrate_two_xmit = 1 ; /* Use 2 path Tx to transmit MCS0~7 and legacy mode */
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_rf_config = RF_819X_MAX_TYPE ; /* auto */
static int rtw_low_power ;
static int rtw_wifi_spec ;
2013-06-03 19:52:18 +00:00
static int rtw_channel_plan = RT_CHANNEL_DOMAIN_MAX ;
2013-08-11 02:53:06 +00:00
static int rtw_AcceptAddbaReq = true ; /* 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. */
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_antdiv_cfg = 2 ; /* 0:OFF , 1:ON, 2:decide by Efuse config */
static int rtw_antdiv_type ; /* 0:decide by efuse 1: for 88EE, 1Tx and 1RxCG are diversity.(2 Ant with SPDT), 2: for 88EE, 1Tx and 2Rx are diversity.(2 Ant, Tx and RxCG are both on aux port, RxCS is on main port), 3: for 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) */
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_enusbss ; /* 0:disable, 1:enable */
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_hwpdn_mode = 2 ; /* 0:disable, 1:enable, 2: by EFUSE config */
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_hwpwrp_detect ; /* HW power ping detect 0:disable , 1:enable */
2013-05-08 21:45:39 +00:00
2013-06-03 19:52:18 +00:00
static int rtw_hw_wps_pbc = 1 ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
int rtw_mc2u_disable ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_80211d ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static char * ifname = " wlan%d " ;
2013-05-08 21:45:39 +00:00
module_param ( ifname , charp , 0644 ) ;
MODULE_PARM_DESC ( ifname , " The default name to allocate for first interface " ) ;
2013-08-11 02:53:06 +00:00
static char * if2name = " wlan%d " ;
2013-05-08 21:45:39 +00:00
module_param ( if2name , charp , 0644 ) ;
MODULE_PARM_DESC ( if2name , " The default name to allocate for second interface " ) ;
2013-08-11 02:53:06 +00:00
char * rtw_initmac ; /* temp mac address if users want to use instead of the mac address in Efuse */
2013-05-08 21:45:39 +00:00
module_param ( rtw_initmac , charp , 0644 ) ;
module_param ( rtw_channel_plan , int , 0644 ) ;
module_param ( rtw_chip_version , int , 0644 ) ;
module_param ( rtw_rfintfs , int , 0644 ) ;
module_param ( rtw_lbkmode , int , 0644 ) ;
module_param ( rtw_network_mode , int , 0644 ) ;
module_param ( rtw_channel , int , 0644 ) ;
module_param ( rtw_wmm_enable , int , 0644 ) ;
module_param ( rtw_vrtl_carrier_sense , int , 0644 ) ;
module_param ( rtw_vcs_type , int , 0644 ) ;
module_param ( rtw_busy_thresh , int , 0644 ) ;
module_param ( rtw_ht_enable , int , 0644 ) ;
module_param ( rtw_cbw40_enable , int , 0644 ) ;
module_param ( rtw_ampdu_enable , int , 0644 ) ;
module_param ( rtw_rx_stbc , int , 0644 ) ;
module_param ( rtw_ampdu_amsdu , int , 0644 ) ;
module_param ( rtw_lowrate_two_xmit , int , 0644 ) ;
module_param ( rtw_rf_config , int , 0644 ) ;
module_param ( rtw_power_mgnt , int , 0644 ) ;
module_param ( rtw_smart_ps , int , 0644 ) ;
module_param ( rtw_low_power , int , 0644 ) ;
module_param ( rtw_wifi_spec , int , 0644 ) ;
module_param ( rtw_antdiv_cfg , int , 0644 ) ;
module_param ( rtw_antdiv_type , int , 0644 ) ;
module_param ( rtw_enusbss , int , 0644 ) ;
module_param ( rtw_hwpdn_mode , int , 0644 ) ;
module_param ( rtw_hwpwrp_detect , int , 0644 ) ;
module_param ( rtw_hw_wps_pbc , int , 0644 ) ;
2013-08-11 02:53:06 +00:00
static uint rtw_max_roaming_times = 2 ;
2013-05-08 21:45:39 +00:00
module_param ( rtw_max_roaming_times , uint , 0644 ) ;
2013-08-11 02:53:06 +00:00
MODULE_PARM_DESC ( rtw_max_roaming_times , " The max roaming times to try " ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
static int rtw_fw_iol = 1 ; /* 0:Disable, 1:enable, 2:by usb speed */
2013-05-08 21:45:39 +00:00
module_param ( rtw_fw_iol , int , 0644 ) ;
2013-08-11 02:53:06 +00:00
MODULE_PARM_DESC ( rtw_fw_iol , " FW IOL " ) ;
2013-05-08 21:45:39 +00:00
module_param ( rtw_mc2u_disable , int , 0644 ) ;
module_param ( rtw_80211d , int , 0644 ) ;
MODULE_PARM_DESC ( rtw_80211d , " Enable 802.11d mechanism " ) ;
2013-06-03 19:52:18 +00:00
static uint rtw_notch_filter = RTW_NOTCH_FILTER ;
2013-05-08 21:45:39 +00:00
module_param ( rtw_notch_filter , uint , 0644 ) ;
MODULE_PARM_DESC ( rtw_notch_filter , " 0:Disable, 1:Enable, 2:Enable only for P2P " ) ;
2013-05-17 21:52:06 +00:00
module_param_named ( debug , rtw_debug , int , 0444 ) ;
MODULE_PARM_DESC ( debug , " Set debug level (1-9) (default 1) " ) ;
2013-05-08 21:45:39 +00:00
/* dummy routines */
void rtw_proc_remove_one ( struct net_device * dev )
{
}
void rtw_proc_init_one ( struct net_device * dev )
{
}
2013-10-19 17:45:47 +00:00
#if 0 /* TODO: Convert these to /sys */
2013-05-08 21:45:39 +00:00
void rtw_proc_init_one ( struct net_device * dev )
{
struct proc_dir_entry * dir_dev = NULL ;
2013-08-11 02:53:06 +00:00
struct proc_dir_entry * entry = NULL ;
2013-07-27 01:08:39 +00:00
struct adapter * padapter = rtw_netdev_priv ( dev ) ;
2013-05-08 21:45:39 +00:00
u8 rf_type ;
2013-05-26 02:17:38 +00:00
if ( rtw_proc = = NULL ) {
2013-10-19 17:45:47 +00:00
memcpy ( rtw_proc_name , DRV_NAME , sizeof ( DRV_NAME ) ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
rtw_proc = create_proc_entry ( rtw_proc_name , S_IFDIR , init_net . proc_net ) ;
2013-05-08 21:45:39 +00:00
if ( rtw_proc = = NULL ) {
2013-05-25 23:35:42 +00:00
DBG_88E ( KERN_ERR " Unable to create rtw_proc directory \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " ver_info " , S_IFREG | S_IRUGO , rtw_proc , proc_get_drv_version , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
}
2013-05-26 02:17:38 +00:00
if ( padapter - > dir_dev = = NULL ) {
2013-05-08 21:45:39 +00:00
padapter - > dir_dev = create_proc_entry ( dev - > name ,
S_IFDIR | S_IRUGO | S_IXUGO ,
rtw_proc ) ;
dir_dev = padapter - > dir_dev ;
2013-08-11 02:53:06 +00:00
if ( dir_dev = = NULL ) {
2013-05-26 02:17:38 +00:00
if ( rtw_proc_cnt = = 0 ) {
2013-08-11 02:53:06 +00:00
if ( rtw_proc ) {
2013-05-08 21:45:39 +00:00
remove_proc_entry ( rtw_proc_name , init_net . proc_net ) ;
rtw_proc = NULL ;
}
}
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create dir_dev directory \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
2013-05-26 02:17:38 +00:00
} else {
2013-05-08 21:45:39 +00:00
return ;
}
rtw_proc_cnt + + ;
entry = create_proc_read_entry ( " write_reg " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_write_reg , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry - > write_proc = proc_set_write_reg ;
entry = create_proc_read_entry ( " read_reg " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_read_reg , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry - > write_proc = proc_set_read_reg ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " fwstate " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_fwstate , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " sec_info " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_sec_info , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " mlmext_state " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_mlmext_state , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " qos_option " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_qos_option , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " ht_option " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_ht_option , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " rf_info " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_rf_info , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " ap_info " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_ap_info , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " adapter_state " , S_IFREG | S_IRUGO ,
2013-07-27 01:08:39 +00:00
dir_dev , proc_getstruct adapter_state , dev ) ;
2013-05-08 21:45:39 +00:00
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " trx_info " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_trx_info , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " mac_reg_dump1 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_mac_reg_dump1 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " mac_reg_dump2 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_mac_reg_dump2 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " mac_reg_dump3 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_mac_reg_dump3 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " bb_reg_dump1 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_bb_reg_dump1 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " bb_reg_dump2 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_bb_reg_dump2 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " bb_reg_dump3 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_bb_reg_dump3 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " rf_reg_dump1 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_rf_reg_dump1 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " rf_reg_dump2 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_rf_reg_dump2 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
rtw_hal_get_hwreg ( padapter , HW_VAR_RF_TYPE , ( u8 * ) ( & rf_type ) ) ;
2013-08-11 02:53:06 +00:00
if ( ( RF_1T2R = = rf_type ) | | ( RF_1T1R = = rf_type ) ) {
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " rf_reg_dump3 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_rf_reg_dump3 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " rf_reg_dump4 " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_rf_reg_dump4 , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
}
2013-05-19 04:28:07 +00:00
2013-10-19 17:45:47 +00:00
# ifdef CONFIG_88EU_AP_MODE
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " all_sta_info " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_all_sta_info , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
# endif
entry = create_proc_read_entry ( " best_channel " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_best_channel , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry = create_proc_read_entry ( " rx_signal " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_rx_signal , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry - > write_proc = proc_set_rx_signal ;
entry = create_proc_read_entry ( " ht_enable " , S_IFREG | S_IRUGO ,
2013-05-19 04:28:07 +00:00
dir_dev , proc_get_ht_enable , dev ) ;
2013-05-08 21:45:39 +00:00
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry - > write_proc = proc_set_ht_enable ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " cbw40_enable " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_cbw40_enable , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry - > write_proc = proc_set_cbw40_enable ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " ampdu_enable " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_ampdu_enable , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry - > write_proc = proc_set_ampdu_enable ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " rx_stbc " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_rx_stbc , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry - > write_proc = proc_set_rx_stbc ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " path_rssi " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_two_path_rssi , dev ) ;
2013-05-26 02:17:38 +00:00
if ( ! entry ) {
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
return ;
}
2013-05-08 21:45:39 +00:00
entry = create_proc_read_entry ( " rssi_disp " , S_IFREG | S_IRUGO ,
dir_dev , proc_get_rssi_disp , dev ) ;
if ( ! entry ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Unable to create_proc_read_entry! \n " ) ;
2013-05-08 21:45:39 +00:00
return ;
}
entry - > write_proc = proc_set_rssi_disp ;
}
void rtw_proc_remove_one ( struct net_device * dev )
{
struct proc_dir_entry * dir_dev = NULL ;
2013-07-27 01:08:39 +00:00
struct adapter * padapter = rtw_netdev_priv ( dev ) ;
2013-05-08 21:45:39 +00:00
u8 rf_type ;
dir_dev = padapter - > dir_dev ;
padapter - > dir_dev = NULL ;
if ( dir_dev ) {
remove_proc_entry ( " write_reg " , dir_dev ) ;
remove_proc_entry ( " read_reg " , dir_dev ) ;
remove_proc_entry ( " fwstate " , dir_dev ) ;
remove_proc_entry ( " sec_info " , dir_dev ) ;
remove_proc_entry ( " mlmext_state " , dir_dev ) ;
remove_proc_entry ( " qos_option " , dir_dev ) ;
remove_proc_entry ( " ht_option " , dir_dev ) ;
2013-05-19 04:28:07 +00:00
remove_proc_entry ( " rf_info " , dir_dev ) ;
2013-05-08 21:45:39 +00:00
remove_proc_entry ( " ap_info " , dir_dev ) ;
remove_proc_entry ( " adapter_state " , dir_dev ) ;
remove_proc_entry ( " trx_info " , dir_dev ) ;
remove_proc_entry ( " mac_reg_dump1 " , dir_dev ) ;
remove_proc_entry ( " mac_reg_dump2 " , dir_dev ) ;
remove_proc_entry ( " mac_reg_dump3 " , dir_dev ) ;
remove_proc_entry ( " bb_reg_dump1 " , dir_dev ) ;
remove_proc_entry ( " bb_reg_dump2 " , dir_dev ) ;
remove_proc_entry ( " bb_reg_dump3 " , dir_dev ) ;
remove_proc_entry ( " rf_reg_dump1 " , dir_dev ) ;
remove_proc_entry ( " rf_reg_dump2 " , dir_dev ) ;
2013-05-19 04:28:07 +00:00
rtw_hal_get_hwreg ( padapter , HW_VAR_RF_TYPE , ( u8 * ) ( & rf_type ) ) ;
2013-08-11 02:53:06 +00:00
if ( ( RF_1T2R = = rf_type ) | | ( RF_1T1R = = rf_type ) ) {
2013-05-08 21:45:39 +00:00
remove_proc_entry ( " rf_reg_dump3 " , dir_dev ) ;
remove_proc_entry ( " rf_reg_dump4 " , dir_dev ) ;
}
2013-10-19 17:45:47 +00:00
# ifdef CONFIG_88EU_AP_MODE
2013-05-08 21:45:39 +00:00
remove_proc_entry ( " all_sta_info " , dir_dev ) ;
2013-05-19 04:28:07 +00:00
# endif
2013-05-08 21:45:39 +00:00
remove_proc_entry ( " best_channel " , dir_dev ) ;
remove_proc_entry ( " rx_signal " , dir_dev ) ;
remove_proc_entry ( " cbw40_enable " , dir_dev ) ;
remove_proc_entry ( " ht_enable " , dir_dev ) ;
remove_proc_entry ( " ampdu_enable " , dir_dev ) ;
remove_proc_entry ( " rx_stbc " , dir_dev ) ;
remove_proc_entry ( " path_rssi " , dir_dev ) ;
remove_proc_entry ( " rssi_disp " , dir_dev ) ;
remove_proc_entry ( dev - > name , rtw_proc ) ;
dir_dev = NULL ;
2013-05-26 02:17:38 +00:00
} else {
2013-05-08 21:45:39 +00:00
return ;
}
rtw_proc_cnt - - ;
2013-05-26 02:17:38 +00:00
if ( rtw_proc_cnt = = 0 ) {
2013-08-11 02:53:06 +00:00
if ( rtw_proc ) {
2013-05-08 21:45:39 +00:00
remove_proc_entry ( " ver_info " , rtw_proc ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
remove_proc_entry ( rtw_proc_name , init_net . proc_net ) ;
rtw_proc = NULL ;
}
}
}
# endif
2013-08-11 02:53:06 +00:00
static uint loadparam ( struct adapter * padapter , struct net_device * pnetdev )
2013-05-08 21:45:39 +00:00
{
struct registry_priv * registry_par = & padapter - > registrypriv ;
2013-05-17 21:52:06 +00:00
GlobalDebugLevel = rtw_debug ;
2013-05-08 21:45:39 +00:00
registry_par - > chip_version = ( u8 ) rtw_chip_version ;
registry_par - > rfintfs = ( u8 ) rtw_rfintfs ;
2013-05-19 04:28:07 +00:00
registry_par - > lbkmode = ( u8 ) rtw_lbkmode ;
registry_par - > network_mode = ( u8 ) rtw_network_mode ;
2013-05-08 21:45:39 +00:00
2013-10-19 17:45:47 +00:00
memcpy ( registry_par - > ssid . Ssid , " ANY " , 3 ) ;
2013-05-08 21:45:39 +00:00
registry_par - > ssid . SsidLength = 3 ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
registry_par - > channel = ( u8 ) rtw_channel ;
registry_par - > wireless_mode = ( u8 ) rtw_wireless_mode ;
2014-11-16 00:18:30 +00:00
registry_par - > vrtl_carrier_sense = ( u8 ) rtw_vrtl_carrier_sense ;
2013-05-08 21:45:39 +00:00
registry_par - > vcs_type = ( u8 ) rtw_vcs_type ;
2013-08-11 02:53:06 +00:00
registry_par - > rts_thresh = ( u16 ) rtw_rts_thresh ;
registry_par - > frag_thresh = ( u16 ) rtw_frag_thresh ;
2013-05-08 21:45:39 +00:00
registry_par - > preamble = ( u8 ) rtw_preamble ;
registry_par - > scan_mode = ( u8 ) rtw_scan_mode ;
registry_par - > adhoc_tx_pwr = ( u8 ) rtw_adhoc_tx_pwr ;
2013-08-11 02:53:06 +00:00
registry_par - > soft_ap = ( u8 ) rtw_soft_ap ;
2013-05-19 04:28:07 +00:00
registry_par - > smart_ps = ( u8 ) rtw_smart_ps ;
2013-05-08 21:45:39 +00:00
registry_par - > power_mgnt = ( u8 ) rtw_power_mgnt ;
registry_par - > ips_mode = ( u8 ) rtw_ips_mode ;
registry_par - > radio_enable = ( u8 ) rtw_radio_enable ;
registry_par - > long_retry_lmt = ( u8 ) rtw_long_retry_lmt ;
registry_par - > short_retry_lmt = ( u8 ) rtw_short_retry_lmt ;
2013-05-19 04:28:07 +00:00
registry_par - > busy_thresh = ( u16 ) rtw_busy_thresh ;
2013-05-08 21:45:39 +00:00
registry_par - > ack_policy = ( u8 ) rtw_ack_policy ;
2014-11-16 00:18:30 +00:00
registry_par - > mp_mode = 0 ;
2013-05-08 21:45:39 +00:00
registry_par - > software_encrypt = ( u8 ) rtw_software_encrypt ;
2013-05-19 04:28:07 +00:00
registry_par - > software_decrypt = ( u8 ) rtw_software_decrypt ;
2013-05-08 21:45:39 +00:00
registry_par - > acm_method = ( u8 ) rtw_acm_method ;
2013-08-11 02:53:06 +00:00
/* UAPSD */
2013-05-08 21:45:39 +00:00
registry_par - > wmm_enable = ( u8 ) rtw_wmm_enable ;
2013-05-19 04:28:07 +00:00
registry_par - > uapsd_enable = ( u8 ) rtw_uapsd_enable ;
2013-05-08 21:45:39 +00:00
registry_par - > uapsd_max_sp = ( u8 ) rtw_uapsd_max_sp ;
registry_par - > uapsd_acbk_en = ( u8 ) rtw_uapsd_acbk_en ;
registry_par - > uapsd_acbe_en = ( u8 ) rtw_uapsd_acbe_en ;
registry_par - > uapsd_acvi_en = ( u8 ) rtw_uapsd_acvi_en ;
registry_par - > uapsd_acvo_en = ( u8 ) rtw_uapsd_acvo_en ;
registry_par - > ht_enable = ( u8 ) rtw_ht_enable ;
registry_par - > cbw40_enable = ( u8 ) rtw_cbw40_enable ;
registry_par - > ampdu_enable = ( u8 ) rtw_ampdu_enable ;
2013-05-19 04:28:07 +00:00
registry_par - > rx_stbc = ( u8 ) rtw_rx_stbc ;
2013-05-08 21:45:39 +00:00
registry_par - > ampdu_amsdu = ( u8 ) rtw_ampdu_amsdu ;
registry_par - > lowrate_two_xmit = ( u8 ) rtw_lowrate_two_xmit ;
registry_par - > rf_config = ( u8 ) rtw_rf_config ;
registry_par - > low_power = ( u8 ) rtw_low_power ;
registry_par - > wifi_spec = ( u8 ) rtw_wifi_spec ;
registry_par - > channel_plan = ( u8 ) rtw_channel_plan ;
registry_par - > bAcceptAddbaReq = ( u8 ) rtw_AcceptAddbaReq ;
registry_par - > antdiv_cfg = ( u8 ) rtw_antdiv_cfg ;
registry_par - > antdiv_type = ( u8 ) rtw_antdiv_type ;
2013-08-11 02:53:06 +00:00
registry_par - > hwpdn_mode = ( u8 ) rtw_hwpdn_mode ; /* 0:disable, 1:enable, 2:by EFUSE config */
registry_par - > hwpwrp_detect = ( u8 ) rtw_hwpwrp_detect ; /* 0:disable, 1:enable */
2013-05-08 21:45:39 +00:00
registry_par - > hw_wps_pbc = ( u8 ) rtw_hw_wps_pbc ;
registry_par - > max_roaming_times = ( u8 ) rtw_max_roaming_times ;
registry_par - > fw_iol = rtw_fw_iol ;
registry_par - > enable80211d = ( u8 ) rtw_80211d ;
snprintf ( registry_par - > ifname , 16 , " %s " , ifname ) ;
snprintf ( registry_par - > if2name , 16 , " %s " , if2name ) ;
registry_par - > notch_filter = ( u8 ) rtw_notch_filter ;
2014-11-16 00:18:30 +00:00
return _SUCCESS ;
2013-05-08 21:45:39 +00:00
}
static int rtw_net_set_mac_address ( struct net_device * pnetdev , void * p )
{
2013-07-27 01:08:39 +00:00
struct adapter * padapter = ( struct adapter * ) rtw_netdev_priv ( pnetdev ) ;
2013-05-08 21:45:39 +00:00
struct sockaddr * addr = p ;
2013-05-19 04:28:07 +00:00
2013-08-11 02:53:06 +00:00
if ( ! padapter - > bup )
2013-10-19 17:45:47 +00:00
memcpy ( padapter - > eeprompriv . mac_addr , addr - > sa_data , ETH_ALEN ) ;
2013-05-08 21:45:39 +00:00
return 0 ;
}
static struct net_device_stats * rtw_net_get_stats ( struct net_device * pnetdev )
{
2013-07-27 01:08:39 +00:00
struct adapter * padapter = ( struct adapter * ) rtw_netdev_priv ( pnetdev ) ;
2013-05-08 21:45:39 +00:00
struct xmit_priv * pxmitpriv = & ( padapter - > xmitpriv ) ;
struct recv_priv * precvpriv = & ( padapter - > recvpriv ) ;
2013-08-11 02:53:06 +00:00
padapter - > stats . tx_packets = pxmitpriv - > tx_pkts ; /* pxmitpriv->tx_pkts++; */
padapter - > stats . rx_packets = precvpriv - > rx_pkts ; /* precvpriv->rx_pkts++; */
2013-05-08 21:45:39 +00:00
padapter - > stats . tx_dropped = pxmitpriv - > tx_drop ;
padapter - > stats . rx_dropped = precvpriv - > rx_drop ;
padapter - > stats . tx_bytes = pxmitpriv - > tx_bytes ;
padapter - > stats . rx_bytes = precvpriv - > rx_bytes ;
return & padapter - > stats ;
}
/*
* AC to queue mapping
*
* AC_VO - > queue 0
* AC_VI - > queue 1
* AC_BE - > queue 2
* AC_BK - > queue 3
*/
static const u16 rtw_1d_to_queue [ 8 ] = { 2 , 3 , 3 , 2 , 1 , 1 , 0 , 0 } ;
/* Given a data frame determine the 802.1p/1d tag to use. */
2013-06-03 19:52:18 +00:00
static unsigned int rtw_classify8021d ( struct sk_buff * skb )
2013-05-08 21:45:39 +00:00
{
unsigned int dscp ;
/* skb->priority values from 256->263 are magic values to
* directly indicate a specific 802.1 d priority . This is used
* to allow 802.1 d priority to be passed directly in from VLAN
* tags , etc .
*/
if ( skb - > priority > = 256 & & skb - > priority < = 263 )
return skb - > priority - 256 ;
switch ( skb - > protocol ) {
case htons ( ETH_P_IP ) :
dscp = ip_hdr ( skb ) - > tos & 0xfc ;
break ;
default :
return 0 ;
}
return dscp > > 5 ;
}
2014-11-16 00:18:30 +00:00
static u16 rtw_select_queue ( struct net_device * dev , struct sk_buff * skb ,
void * accel_priv , select_queue_fallback_t fallback )
2013-05-08 21:45:39 +00:00
{
2013-07-27 01:08:39 +00:00
struct adapter * padapter = rtw_netdev_priv ( dev ) ;
2013-05-08 21:45:39 +00:00
struct mlme_priv * pmlmepriv = & padapter - > mlmepriv ;
skb - > priority = rtw_classify8021d ( skb ) ;
2013-05-09 04:04:25 +00:00
if ( pmlmepriv - > acm_mask ! = 0 )
2013-05-08 21:45:39 +00:00
skb - > priority = qos_acm ( pmlmepriv - > acm_mask , skb - > priority ) ;
return rtw_1d_to_queue [ skb - > priority ] ;
}
u16 rtw_recv_select_queue ( struct sk_buff * skb )
{
struct iphdr * piphdr ;
unsigned int dscp ;
2013-06-03 19:52:18 +00:00
__be16 eth_type ;
2013-05-08 21:45:39 +00:00
u32 priority ;
u8 * pdata = skb - > data ;
2013-10-19 17:45:47 +00:00
memcpy ( & eth_type , pdata + ( ETH_ALEN < < 1 ) , 2 ) ;
2013-05-08 21:45:39 +00:00
switch ( eth_type ) {
2013-05-26 02:17:38 +00:00
case htons ( ETH_P_IP ) :
piphdr = ( struct iphdr * ) ( pdata + ETH_HLEN ) ;
dscp = piphdr - > tos & 0xfc ;
priority = dscp > > 5 ;
break ;
default :
priority = 0 ;
2013-05-08 21:45:39 +00:00
}
return rtw_1d_to_queue [ priority ] ;
}
static const struct net_device_ops rtw_netdev_ops = {
. ndo_open = netdev_open ,
. ndo_stop = netdev_close ,
. ndo_start_xmit = rtw_xmit_entry ,
. ndo_select_queue = rtw_select_queue ,
. ndo_set_mac_address = rtw_net_set_mac_address ,
. ndo_get_stats = rtw_net_get_stats ,
. ndo_do_ioctl = rtw_ioctl ,
} ;
int rtw_init_netdev_name ( struct net_device * pnetdev , const char * ifname )
{
2013-05-09 04:04:25 +00:00
if ( dev_alloc_name ( pnetdev , ifname ) < 0 )
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_err_ , ( " dev_alloc_name, fail! \n " ) ) ;
2013-05-08 21:45:39 +00:00
netif_carrier_off ( pnetdev ) ;
return 0 ;
}
2013-10-18 03:25:27 +00:00
static const struct device_type wlan_type = {
. name = " wlan " ,
} ;
2013-07-27 01:08:39 +00:00
struct net_device * rtw_init_netdev ( struct adapter * old_padapter )
2013-05-08 21:45:39 +00:00
{
2013-07-27 01:08:39 +00:00
struct adapter * padapter ;
2014-11-16 00:18:30 +00:00
struct net_device * pnetdev = NULL ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " +init_net_dev \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-05-19 04:28:07 +00:00
if ( old_padapter ! = NULL )
2013-07-27 01:08:39 +00:00
pnetdev = rtw_alloc_etherdev_with_old_priv ( sizeof ( struct adapter ) , ( void * ) old_padapter ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
if ( ! pnetdev )
return NULL ;
2013-10-18 03:25:27 +00:00
pnetdev - > dev . type = & wlan_type ;
2013-05-08 21:45:39 +00:00
padapter = rtw_netdev_priv ( pnetdev ) ;
2013-05-19 04:28:07 +00:00
padapter - > pnetdev = pnetdev ;
2013-05-25 23:35:42 +00:00
DBG_88E ( " register rtw_netdev_ops to netdev_ops \n " ) ;
2013-05-08 21:45:39 +00:00
pnetdev - > netdev_ops = & rtw_netdev_ops ;
pnetdev - > watchdog_timeo = HZ * 3 ; /* 3 second timeout */
pnetdev - > wireless_handlers = ( struct iw_handler_def * ) & rtw_handlers_def ;
2013-08-11 02:53:06 +00:00
/* step 2. */
2013-05-19 04:28:07 +00:00
loadparam ( padapter , pnetdev ) ;
2013-05-08 21:45:39 +00:00
return pnetdev ;
}
2013-07-27 01:08:39 +00:00
u32 rtw_start_drv_threads ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
u32 _status = _SUCCESS ;
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " +rtw_start_drv_threads \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-07-12 03:50:49 +00:00
padapter - > cmdThread = kthread_run ( rtw_cmd_thread , padapter , " RTW_CMD_THREAD " ) ;
2013-08-11 02:53:06 +00:00
if ( IS_ERR ( padapter - > cmdThread ) )
2013-07-12 03:50:49 +00:00
_status = _FAIL ;
else
2013-08-11 02:53:06 +00:00
_rtw_down_sema ( & padapter - > cmdpriv . terminate_cmdthread_sema ) ; /* wait for cmd_thread to run */
2013-05-08 21:45:39 +00:00
return _status ;
}
2013-08-11 02:53:06 +00:00
void rtw_stop_drv_threads ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " +rtw_stop_drv_threads \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
/* Below is to termindate rtw_cmd_thread & event_thread... */
2014-11-16 00:18:30 +00:00
up ( & padapter - > cmdpriv . cmd_queue_sema ) ;
2013-07-12 03:50:49 +00:00
if ( padapter - > cmdThread )
_rtw_down_sema ( & padapter - > cmdpriv . terminate_cmdthread_sema ) ;
2013-05-08 21:45:39 +00:00
}
2013-07-27 01:08:39 +00:00
static u8 rtw_init_default_value ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-08-11 02:53:06 +00:00
struct registry_priv * pregistrypriv = & padapter - > registrypriv ;
2013-05-08 21:45:39 +00:00
struct xmit_priv * pxmitpriv = & padapter - > xmitpriv ;
2013-08-11 02:53:06 +00:00
struct mlme_priv * pmlmepriv = & padapter - > mlmepriv ;
2013-05-08 21:45:39 +00:00
struct security_priv * psecuritypriv = & padapter - > securitypriv ;
2013-08-11 02:53:06 +00:00
/* xmit_priv */
2013-05-08 21:45:39 +00:00
pxmitpriv - > vcs_setting = pregistrypriv - > vrtl_carrier_sense ;
pxmitpriv - > vcs = pregistrypriv - > vcs_type ;
pxmitpriv - > vcs_type = pregistrypriv - > vcs_type ;
pxmitpriv - > frag_len = pregistrypriv - > frag_thresh ;
2013-05-19 04:28:07 +00:00
2013-08-11 02:53:06 +00:00
/* mlme_priv */
pmlmepriv - > scan_interval = SCAN_INTERVAL ; /* 30*2 sec = 60sec */
2013-05-08 21:45:39 +00:00
pmlmepriv - > scan_mode = SCAN_ACTIVE ;
2013-08-11 02:53:06 +00:00
/* ht_priv */
pmlmepriv - > htpriv . ampdu_enable = false ; /* set to disabled */
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
/* security_priv */
2013-05-08 21:45:39 +00:00
psecuritypriv - > binstallGrpkey = _FAIL ;
2013-08-11 02:53:06 +00:00
psecuritypriv - > sw_encrypt = pregistrypriv - > software_encrypt ;
psecuritypriv - > sw_decrypt = pregistrypriv - > software_decrypt ;
psecuritypriv - > dot11AuthAlgrthm = dot11AuthAlgrthm_Open ; /* open system */
2013-05-08 21:45:39 +00:00
psecuritypriv - > dot11PrivacyAlgrthm = _NO_PRIVACY_ ;
psecuritypriv - > dot11PrivacyKeyIndex = 0 ;
psecuritypriv - > dot118021XGrpPrivacy = _NO_PRIVACY_ ;
psecuritypriv - > dot118021XGrpKeyid = 1 ;
psecuritypriv - > ndisauthtype = Ndis802_11AuthModeOpen ;
psecuritypriv - > ndisencryptstatus = Ndis802_11WEPDisabled ;
2013-05-19 04:28:07 +00:00
2013-08-11 02:53:06 +00:00
/* registry_priv */
2013-05-19 04:28:07 +00:00
rtw_init_registrypriv_dev_network ( padapter ) ;
2013-05-08 21:45:39 +00:00
rtw_update_registrypriv_dev_network ( padapter ) ;
2013-08-11 02:53:06 +00:00
/* hal_priv */
2013-05-08 21:45:39 +00:00
rtw_hal_def_value_init ( padapter ) ;
2013-08-11 02:53:06 +00:00
/* misc. */
2013-05-26 03:02:10 +00:00
padapter - > bReadPortCancel = false ;
padapter - > bWritePortCancel = false ;
2013-05-08 21:45:39 +00:00
padapter - > bRxRSSIDisplay = 0 ;
padapter - > bNotifyChannelChange = 0 ;
2014-11-16 00:18:30 +00:00
return _SUCCESS ;
2013-05-08 21:45:39 +00:00
}
2013-07-27 01:08:39 +00:00
u8 rtw_reset_drv_sw ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-08-11 02:53:06 +00:00
struct mlme_priv * pmlmepriv = & padapter - > mlmepriv ;
2013-05-08 21:45:39 +00:00
struct pwrctrl_priv * pwrctrlpriv = & padapter - > pwrctrlpriv ;
2013-08-11 02:53:06 +00:00
/* hal_priv */
2013-05-08 21:45:39 +00:00
rtw_hal_def_value_init ( padapter ) ;
2013-05-26 03:02:10 +00:00
padapter - > bReadPortCancel = false ;
padapter - > bWritePortCancel = false ;
2013-05-08 21:45:39 +00:00
padapter - > bRxRSSIDisplay = 0 ;
2013-08-11 02:53:06 +00:00
pmlmepriv - > scan_interval = SCAN_INTERVAL ; /* 30*2 sec = 60sec */
2013-05-08 21:45:39 +00:00
padapter - > xmitpriv . tx_pkts = 0 ;
padapter - > recvpriv . rx_pkts = 0 ;
2013-05-26 03:02:10 +00:00
pmlmepriv - > LinkDetectInfo . bBusyTraffic = false ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
_clr_fwstate_ ( pmlmepriv , _FW_UNDER_SURVEY | _FW_UNDER_LINKING ) ;
2014-11-16 00:18:30 +00:00
rtw_hal_sreset_init ( padapter ) ;
2013-05-08 21:45:39 +00:00
pwrctrlpriv - > pwr_state_check_cnts = 0 ;
2013-08-11 02:53:06 +00:00
/* mlmeextpriv */
padapter - > mlmeextpriv . sitesurvey_res . state = SCAN_DISABLE ;
2013-05-08 21:45:39 +00:00
rtw_set_signal_stat_timer ( & padapter - > recvpriv ) ;
2014-11-16 00:18:30 +00:00
return _SUCCESS ;
2013-05-08 21:45:39 +00:00
}
2013-07-27 01:08:39 +00:00
u8 rtw_init_drv_sw ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-08-11 02:53:06 +00:00
u8 ret8 = _SUCCESS ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " +rtw_init_drv_sw \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 02:17:38 +00:00
if ( ( rtw_init_cmd_priv ( & padapter - > cmdpriv ) ) = = _FAIL ) {
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_err_ , ( " \n Can't init cmd_priv \n " ) ) ;
ret8 = _FAIL ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-19 04:28:07 +00:00
2013-08-11 02:53:06 +00:00
padapter - > cmdpriv . padapter = padapter ;
2013-05-19 04:28:07 +00:00
2013-05-26 02:17:38 +00:00
if ( rtw_init_mlme_priv ( padapter ) = = _FAIL ) {
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_err_ , ( " \n Can't init mlme_priv \n " ) ) ;
ret8 = _FAIL ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-26 02:17:38 +00:00
if ( init_mlme_ext_priv ( padapter ) = = _FAIL ) {
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_err_ , ( " \n Can't init mlme_ext_priv \n " ) ) ;
ret8 = _FAIL ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-26 02:17:38 +00:00
if ( _rtw_init_xmit_priv ( & padapter - > xmitpriv , padapter ) = = _FAIL ) {
2013-05-25 23:35:42 +00:00
DBG_88E ( " Can't _rtw_init_xmit_priv \n " ) ;
2013-08-11 02:53:06 +00:00
ret8 = _FAIL ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-19 04:28:07 +00:00
2013-05-26 02:17:38 +00:00
if ( _rtw_init_recv_priv ( & padapter - > recvpriv , padapter ) = = _FAIL ) {
2013-05-25 23:35:42 +00:00
DBG_88E ( " Can't _rtw_init_recv_priv \n " ) ;
2013-08-11 02:53:06 +00:00
ret8 = _FAIL ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-26 02:17:38 +00:00
if ( _rtw_init_sta_priv ( & padapter - > stapriv ) = = _FAIL ) {
2013-05-25 23:35:42 +00:00
DBG_88E ( " Can't _rtw_init_sta_priv \n " ) ;
2013-08-11 02:53:06 +00:00
ret8 = _FAIL ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-19 04:28:07 +00:00
padapter - > stapriv . padapter = padapter ;
2013-05-08 21:45:39 +00:00
rtw_init_bcmc_stainfo ( padapter ) ;
2013-05-19 04:28:07 +00:00
rtw_init_pwrctrl_priv ( padapter ) ;
2013-05-08 21:45:39 +00:00
ret8 = rtw_init_default_value ( padapter ) ;
rtw_hal_dm_init ( padapter ) ;
rtw_hal_sw_led_init ( padapter ) ;
rtw_hal_sreset_init ( padapter ) ;
2014-11-16 00:18:30 +00:00
spin_lock_init ( & padapter - > br_ext_lock ) ;
2013-05-08 21:45:39 +00:00
exit :
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " -rtw_init_drv_sw \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
return ret8 ;
}
2013-07-27 01:08:39 +00:00
void rtw_cancel_all_timer ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " +rtw_cancel_all_timer \n " ) ) ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
del_timer_sync ( & padapter - > mlmepriv . assoc_timer ) ;
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " rtw_cancel_all_timer:cancel association timer complete! \n " ) ) ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
del_timer_sync ( & padapter - > mlmepriv . scan_to_timer ) ;
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " rtw_cancel_all_timer:cancel scan_to_timer! \n " ) ) ;
2013-05-19 04:28:07 +00:00
2014-11-16 00:18:30 +00:00
del_timer_sync ( & padapter - > mlmepriv . dynamic_chk_timer ) ;
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " rtw_cancel_all_timer:cancel dynamic_chk_timer! \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
/* cancel sw led timer */
2013-05-08 21:45:39 +00:00
rtw_hal_sw_led_deinit ( padapter ) ;
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " rtw_cancel_all_timer:cancel DeInitSwLeds! \n " ) ) ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
del_timer_sync ( & padapter - > pwrctrlpriv . pwr_state_check_timer ) ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
del_timer_sync ( & padapter - > recvpriv . signal_stat_timer ) ;
2013-05-08 21:45:39 +00:00
}
2013-07-27 01:08:39 +00:00
u8 rtw_free_drv_sw ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " ==>rtw_free_drv_sw " ) ) ;
2013-05-08 21:45:39 +00:00
free_mlme_ext_priv ( & padapter - > mlmeextpriv ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
rtw_free_mlme_priv ( & padapter - > mlmepriv ) ;
_rtw_free_xmit_priv ( & padapter - > xmitpriv ) ;
2013-05-19 04:28:07 +00:00
2013-08-11 02:53:06 +00:00
_rtw_free_sta_priv ( & padapter - > stapriv ) ; /* will free bcmc_stainfo here */
2013-05-19 04:28:07 +00:00
_rtw_free_recv_priv ( & padapter - > recvpriv ) ;
2013-05-08 21:45:39 +00:00
rtw_hal_free_data ( padapter ) ;
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " <== rtw_free_drv_sw \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
/* free the old_pnetdev */
2013-05-09 04:04:25 +00:00
if ( padapter - > rereg_nd_name_priv . old_pnetdev ) {
2013-05-08 21:45:39 +00:00
free_netdev ( padapter - > rereg_nd_name_priv . old_pnetdev ) ;
padapter - > rereg_nd_name_priv . old_pnetdev = NULL ;
2013-05-19 04:28:07 +00:00
}
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
mutex_destroy ( & padapter - > hw_init_mutex ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " -rtw_free_drv_sw \n " ) ) ;
2013-05-08 21:45:39 +00:00
return _SUCCESS ;
}
int _netdev_open ( struct net_device * pnetdev )
{
2013-05-19 04:28:07 +00:00
uint status ;
2013-07-27 01:08:39 +00:00
struct adapter * padapter = ( struct adapter * ) rtw_netdev_priv ( pnetdev ) ;
2013-05-08 21:45:39 +00:00
struct pwrctrl_priv * pwrctrlpriv = & padapter - > pwrctrlpriv ;
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " +88eu_drv - dev_open \n " ) ) ;
DBG_88E ( " +88eu_drv - drv_open, bup =%d \n " , padapter - > bup ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
if ( pwrctrlpriv - > ps_flag ) {
2013-05-26 03:02:10 +00:00
padapter - > net_closed = false ;
2013-05-08 21:45:39 +00:00
goto netdev_open_normal_process ;
}
2013-08-11 02:53:06 +00:00
if ( ! padapter - > bup ) {
2013-05-26 03:02:10 +00:00
padapter - > bDriverStopped = false ;
padapter - > bSurpriseRemoved = false ;
2013-05-08 21:45:39 +00:00
status = rtw_hal_init ( padapter ) ;
2013-08-11 02:53:06 +00:00
if ( status = = _FAIL ) {
RT_TRACE ( _module_os_intfs_c_ , _drv_err_ , ( " rtl88eu_hal_init(): Can't init h/w! \n " ) ) ;
2013-05-08 21:45:39 +00:00
goto netdev_open_error ;
}
2013-05-19 04:28:07 +00:00
2013-11-29 22:10:20 +00:00
pr_info ( " MAC Address = %pM \n " , pnetdev - > dev_addr ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
status = rtw_start_drv_threads ( padapter ) ;
if ( status = = _FAIL ) {
2013-05-26 02:17:38 +00:00
pr_info ( " Initialize driver software resource Failed! \n " ) ;
2013-05-19 04:28:07 +00:00
goto netdev_open_error ;
2013-05-08 21:45:39 +00:00
}
2013-05-26 02:17:38 +00:00
if ( init_hw_mlme_ext ( padapter ) = = _FAIL ) {
pr_info ( " can't init mlme_ext_priv \n " ) ;
2013-05-08 21:45:39 +00:00
goto netdev_open_error ;
}
2013-05-09 04:04:25 +00:00
if ( padapter - > intf_start )
2013-05-08 21:45:39 +00:00
padapter - > intf_start ( padapter ) ;
rtw_proc_init_one ( pnetdev ) ;
rtw_led_control ( padapter , LED_CTL_NO_LINK ) ;
2013-05-26 03:02:10 +00:00
padapter - > bup = true ;
2013-05-08 21:45:39 +00:00
}
2013-05-26 03:02:10 +00:00
padapter - > net_closed = false ;
2013-05-08 21:45:39 +00:00
_set_timer ( & padapter - > mlmepriv . dynamic_chk_timer , 2000 ) ;
2013-05-26 03:02:10 +00:00
padapter - > pwrctrlpriv . bips_processing = false ;
2013-05-08 21:45:39 +00:00
rtw_set_pwr_state_check_timer ( & padapter - > pwrctrlpriv ) ;
2013-05-09 04:04:25 +00:00
if ( ! rtw_netif_queue_stopped ( pnetdev ) )
2014-11-16 00:18:30 +00:00
netif_tx_start_all_queues ( pnetdev ) ;
2013-05-08 21:45:39 +00:00
else
2014-11-16 00:18:30 +00:00
netif_tx_wake_all_queues ( pnetdev ) ;
2013-05-08 21:45:39 +00:00
netdev_open_normal_process :
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " -88eu_drv - dev_open \n " ) ) ;
DBG_88E ( " -88eu_drv - drv_open, bup =%d \n " , padapter - > bup ) ;
2013-05-08 21:45:39 +00:00
return 0 ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
netdev_open_error :
2013-05-26 03:02:10 +00:00
padapter - > bup = false ;
2013-05-19 04:28:07 +00:00
netif_carrier_off ( pnetdev ) ;
2014-11-16 00:18:30 +00:00
netif_tx_stop_all_queues ( pnetdev ) ;
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_err_ , ( " -88eu_drv - dev_open, fail! \n " ) ) ;
DBG_88E ( " -88eu_drv - drv_open fail, bup =%d \n " , padapter - > bup ) ;
2013-05-26 02:17:38 +00:00
return - 1 ;
2013-05-08 21:45:39 +00:00
}
int netdev_open ( struct net_device * pnetdev )
{
int ret ;
2013-07-27 01:08:39 +00:00
struct adapter * padapter = ( struct adapter * ) rtw_netdev_priv ( pnetdev ) ;
2013-05-19 04:28:07 +00:00
2014-11-16 00:18:30 +00:00
_enter_critical_mutex ( & padapter - > hw_init_mutex , NULL ) ;
2013-05-08 21:45:39 +00:00
ret = _netdev_open ( pnetdev ) ;
2014-11-16 00:18:30 +00:00
mutex_unlock ( & padapter - > hw_init_mutex ) ;
2013-05-08 21:45:39 +00:00
return ret ;
}
2013-07-27 01:08:39 +00:00
static int ips_netdrv_open ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
int status = _SUCCESS ;
2013-05-26 03:02:10 +00:00
padapter - > net_closed = false ;
2013-08-11 02:53:06 +00:00
DBG_88E ( " ===> %s......... \n " , __func__ ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
padapter - > bDriverStopped = false ;
padapter - > bSurpriseRemoved = false ;
2013-05-08 21:45:39 +00:00
status = rtw_hal_init ( padapter ) ;
2013-08-11 02:53:06 +00:00
if ( status = = _FAIL ) {
RT_TRACE ( _module_os_intfs_c_ , _drv_err_ , ( " ips_netdrv_open(): Can't init h/w! \n " ) ) ;
2013-05-08 21:45:39 +00:00
goto netdev_open_error ;
}
2013-05-09 04:04:25 +00:00
if ( padapter - > intf_start )
2013-05-08 21:45:39 +00:00
padapter - > intf_start ( padapter ) ;
rtw_set_pwr_state_check_timer ( & padapter - > pwrctrlpriv ) ;
2013-08-11 02:53:06 +00:00
_set_timer ( & padapter - > mlmepriv . dynamic_chk_timer , 5000 ) ;
2013-05-08 21:45:39 +00:00
return _SUCCESS ;
netdev_open_error :
2013-08-11 02:53:06 +00:00
DBG_88E ( " -ips_netdrv_open - drv_open failure, bup =%d \n " , padapter - > bup ) ;
2013-05-08 21:45:39 +00:00
return _FAIL ;
}
2013-07-27 01:08:39 +00:00
int rtw_ips_pwr_up ( struct adapter * padapter )
2013-05-19 04:28:07 +00:00
{
2013-05-08 21:45:39 +00:00
int result ;
2014-11-16 00:18:30 +00:00
u32 start_time = jiffies ;
2013-05-25 23:35:42 +00:00
DBG_88E ( " ===> rtw_ips_pwr_up.............. \n " ) ;
2013-05-08 21:45:39 +00:00
rtw_reset_drv_sw ( padapter ) ;
result = ips_netdrv_open ( padapter ) ;
rtw_led_control ( padapter , LED_CTL_NO_LINK ) ;
2013-05-19 04:28:07 +00:00
2013-05-25 23:35:42 +00:00
DBG_88E ( " <=== rtw_ips_pwr_up.............. in %dms \n " , rtw_get_passing_time_ms ( start_time ) ) ;
2013-05-08 21:45:39 +00:00
return result ;
}
2013-07-27 01:08:39 +00:00
void rtw_ips_pwr_down ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2014-11-16 00:18:30 +00:00
u32 start_time = jiffies ;
2013-05-25 23:35:42 +00:00
DBG_88E ( " ===> rtw_ips_pwr_down................... \n " ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
padapter - > net_closed = true ;
2013-05-08 21:45:39 +00:00
rtw_led_control ( padapter , LED_CTL_POWER_OFF ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
rtw_ips_dev_unload ( padapter ) ;
2013-05-25 23:35:42 +00:00
DBG_88E ( " <=== rtw_ips_pwr_down..................... in %dms \n " , rtw_get_passing_time_ms ( start_time ) ) ;
2013-05-08 21:45:39 +00:00
}
2013-05-26 02:17:38 +00:00
2013-07-27 01:08:39 +00:00
void rtw_ips_dev_unload ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-08-11 02:53:06 +00:00
DBG_88E ( " ====> %s... \n " , __func__ ) ;
2013-05-08 21:45:39 +00:00
2013-06-03 19:52:18 +00:00
rtw_hal_set_hwreg ( padapter , HW_VAR_FIFO_CLEARN_UP , NULL ) ;
2013-05-08 21:45:39 +00:00
2013-05-09 04:04:25 +00:00
if ( padapter - > intf_stop )
2013-05-08 21:45:39 +00:00
padapter - > intf_stop ( padapter ) ;
2013-08-11 02:53:06 +00:00
/* s5. */
if ( ! padapter - > bSurpriseRemoved )
2013-05-08 21:45:39 +00:00
rtw_hal_deinit ( padapter ) ;
}
2013-08-11 02:53:06 +00:00
int pm_netdev_open ( struct net_device * pnetdev , u8 bnormal )
2013-05-08 21:45:39 +00:00
{
int status ;
2013-08-11 02:53:06 +00:00
if ( bnormal )
2013-05-08 21:45:39 +00:00
status = netdev_open ( pnetdev ) ;
else
2013-08-11 02:53:06 +00:00
status = ( _SUCCESS = = ips_netdrv_open ( ( struct adapter * ) rtw_netdev_priv ( pnetdev ) ) ) ? ( 0 ) : ( - 1 ) ;
2013-05-08 21:45:39 +00:00
return status ;
}
2013-10-19 17:45:47 +00:00
int netdev_close ( struct net_device * pnetdev )
2013-05-08 21:45:39 +00:00
{
2013-07-27 01:08:39 +00:00
struct adapter * padapter = ( struct adapter * ) rtw_netdev_priv ( pnetdev ) ;
2014-11-16 00:18:30 +00:00
struct hal_data_8188e * rtlhal = GET_HAL_DATA ( padapter ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " +88eu_drv - drv_close \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
if ( padapter - > pwrctrlpriv . bInternalAutoSuspend ) {
2013-05-09 04:04:25 +00:00
if ( padapter - > pwrctrlpriv . rf_pwrstate = = rf_off )
2013-05-26 03:02:10 +00:00
padapter - > pwrctrlpriv . ps_flag = true ;
2013-05-08 21:45:39 +00:00
}
2013-05-26 03:02:10 +00:00
padapter - > net_closed = true ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
if ( padapter - > pwrctrlpriv . rf_pwrstate = = rf_on ) {
DBG_88E ( " (2)88eu_drv - drv_close, bup =%d, hw_init_completed =%d \n " ,
padapter - > bup , padapter - > hw_init_completed ) ;
2013-05-08 21:45:39 +00:00
2013-08-11 02:53:06 +00:00
/* s1. */
2013-05-26 02:17:38 +00:00
if ( pnetdev ) {
2013-05-08 21:45:39 +00:00
if ( ! rtw_netif_queue_stopped ( pnetdev ) )
2014-11-16 00:18:30 +00:00
netif_tx_stop_all_queues ( pnetdev ) ;
2013-05-08 21:45:39 +00:00
}
2013-08-11 02:53:06 +00:00
/* s2. */
2013-05-08 21:45:39 +00:00
LeaveAllPowerSaveMode ( padapter ) ;
2013-05-26 03:02:10 +00:00
rtw_disassoc_cmd ( padapter , 500 , false ) ;
2013-08-11 02:53:06 +00:00
/* s2-2. indicate disconnect to os */
2013-05-08 21:45:39 +00:00
rtw_indicate_disconnect ( padapter ) ;
2013-08-11 02:53:06 +00:00
/* s2-3. */
2013-05-08 21:45:39 +00:00
rtw_free_assoc_resources ( padapter , 1 ) ;
2013-08-11 02:53:06 +00:00
/* s2-4. */
rtw_free_network_queue ( padapter , true ) ;
/* Close LED */
2013-05-08 21:45:39 +00:00
rtw_led_control ( padapter , LED_CTL_POWER_OFF ) ;
}
2014-11-16 00:18:30 +00:00
kfree ( rtlhal - > pfirmware ) ;
rtlhal - > pfirmware = NULL ;
2014-02-14 16:17:29 +00:00
2013-08-11 02:53:06 +00:00
RT_TRACE ( _module_os_intfs_c_ , _drv_info_ , ( " -88eu_drv - drv_close \n " ) ) ;
DBG_88E ( " -88eu_drv - drv_close, bup =%d \n " , padapter - > bup ) ;
2013-05-08 21:45:39 +00:00
return 0 ;
2013-05-19 04:28:07 +00:00
}