2013-05-08 21:45:39 +00:00
/******************************************************************************
*
* Copyright ( c ) 2007 - 2012 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 _RTW_IOCTL_SET_C_
# include <osdep_service.h>
# include <drv_types.h>
# include <rtw_ioctl_set.h>
# include <hal_intf.h>
2013-07-27 01:08:39 +00:00
extern void indicate_wx_scan_complete_event ( struct adapter * padapter ) ;
2013-05-08 21:45:39 +00:00
# define IS_MAC_ADDRESS_BROADCAST(addr) \
2013-07-29 05:29:55 +00:00
( \
( ( addr [ 0 ] = = 0xff ) & & ( addr [ 1 ] = = 0xff ) & & \
2013-05-08 21:45:39 +00:00
( addr [ 2 ] = = 0xff ) & & ( addr [ 3 ] = = 0xff ) & & \
2013-07-29 05:29:55 +00:00
( addr [ 4 ] = = 0xff ) & & ( addr [ 5 ] = = 0xff ) ) ? true : false \
2013-05-08 21:45:39 +00:00
)
2013-07-29 05:29:55 +00:00
u8 rtw_do_join ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-07-25 14:49:25 +00:00
struct list_head * plist , * phead ;
2013-07-29 05:29:55 +00:00
u8 * pibss = NULL ;
2013-05-08 21:45:39 +00:00
struct mlme_priv * pmlmepriv = & ( padapter - > mlmepriv ) ;
2013-07-24 22:55:38 +00:00
struct __queue * queue = & ( pmlmepriv - > scanned_queue ) ;
2013-07-29 05:29:55 +00:00
u8 ret = _SUCCESS ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
spin_lock_bh ( & ( pmlmepriv - > scanned_queue . lock ) ) ;
2013-05-08 21:45:39 +00:00
phead = get_list_head ( queue ) ;
2014-11-16 00:18:30 +00:00
plist = phead - > next ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " \n rtw_do_join: phead = %p; plist = %p \n \n \n " , phead , plist ) ) ;
2013-05-08 21:45:39 +00:00
pmlmepriv - > cur_network . join_res = - 2 ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
set_fwstate ( pmlmepriv , _FW_UNDER_LINKING ) ;
pmlmepriv - > pscanned = plist ;
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = true ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
if ( list_empty ( & queue - > queue ) ) {
spin_unlock_bh ( & ( pmlmepriv - > scanned_queue . lock ) ) ;
2013-05-08 21:45:39 +00:00
_clr_fwstate_ ( pmlmepriv , _FW_UNDER_LINKING ) ;
2013-05-19 04:28:07 +00:00
2013-07-09 22:38:46 +00:00
/* when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty */
/* we try to issue sitesurvey firstly */
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
if ( ! pmlmepriv - > LinkDetectInfo . bBusyTraffic | |
pmlmepriv - > to_roaming > 0 ) {
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " rtw_do_join(): site survey if scanned_queue is empty \n . " ) ) ;
2013-07-09 22:38:46 +00:00
/* submit site_survey_cmd */
2013-07-29 05:29:55 +00:00
ret = rtw_sitesurvey_cmd ( padapter , & pmlmepriv - > assoc_ssid , 1 , NULL , 0 ) ;
if ( _SUCCESS ! = ret ) {
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = false ;
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " rtw_do_join(): site survey return error \n . " ) ) ;
2013-05-08 21:45:39 +00:00
}
2013-07-13 03:38:53 +00:00
} else {
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = false ;
2013-05-08 21:45:39 +00:00
ret = _FAIL ;
}
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
goto exit ;
2013-07-13 03:38:53 +00:00
} else {
2013-05-08 21:45:39 +00:00
int select_ret ;
2013-07-29 05:29:55 +00:00
2014-11-16 00:18:30 +00:00
spin_unlock_bh ( & ( pmlmepriv - > scanned_queue . lock ) ) ;
2013-07-29 05:29:55 +00:00
select_ret = rtw_select_and_join_from_scanned_queue ( pmlmepriv ) ;
if ( select_ret = = _SUCCESS ) {
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = false ;
2013-05-08 21:45:39 +00:00
_set_timer ( & pmlmepriv - > assoc_timer , MAX_JOIN_TIMEOUT ) ;
2013-07-13 03:38:53 +00:00
} else {
2013-07-29 05:29:55 +00:00
if ( check_fwstate ( pmlmepriv , WIFI_ADHOC_STATE ) = = true ) {
2013-07-09 22:38:46 +00:00
/* submit createbss_cmd to change to a ADHOC_MASTER */
2013-05-08 21:45:39 +00:00
2013-07-09 22:38:46 +00:00
/* pmlmepriv->lock has been acquired by caller... */
2013-07-24 02:31:04 +00:00
struct wlan_bssid_ex * pdev_network = & ( padapter - > registrypriv . dev_network ) ;
2013-05-08 21:45:39 +00:00
pmlmepriv - > fw_state = WIFI_ADHOC_MASTER_STATE ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
pibss = padapter - > registrypriv . dev_network . MacAddress ;
2014-11-28 17:08:37 +00:00
memset ( & pdev_network - > Ssid , 0 , sizeof ( struct ndis_802_11_ssid ) ) ;
2013-10-19 17:45:47 +00:00
memcpy ( & pdev_network - > Ssid , & pmlmepriv - > assoc_ssid , sizeof ( struct ndis_802_11_ssid ) ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
rtw_update_registrypriv_dev_network ( padapter ) ;
rtw_generate_random_ibss ( pibss ) ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
if ( rtw_createbss_cmd ( padapter ) ! = _SUCCESS ) {
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " ***Error =>do_goin: rtw_createbss_cmd status FAIL*** \n " ) ) ;
2013-05-26 03:02:10 +00:00
ret = false ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = false ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ ,
( " ***Error => rtw_select_and_join_from_scanned_queue FAIL under STA_Mode*** \n " ) ) ;
} else {
2013-07-09 22:38:46 +00:00
/* can't associate ; reset under-linking */
2013-05-08 21:45:39 +00:00
_clr_fwstate_ ( pmlmepriv , _FW_UNDER_LINKING ) ;
2013-07-09 22:38:46 +00:00
/* when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue */
/* we try to issue sitesurvey firstly */
2013-07-29 05:29:55 +00:00
if ( ! pmlmepriv - > LinkDetectInfo . bBusyTraffic | |
pmlmepriv - > to_roaming > 0 ) {
ret = rtw_sitesurvey_cmd ( padapter , & pmlmepriv - > assoc_ssid , 1 , NULL , 0 ) ;
if ( _SUCCESS ! = ret ) {
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = false ;
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " do_join(): site survey return error \n . " ) ) ;
2013-05-08 21:45:39 +00:00
}
2013-07-13 03:38:53 +00:00
} else {
2013-05-08 21:45:39 +00:00
ret = _FAIL ;
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = false ;
2013-05-08 21:45:39 +00:00
}
}
}
}
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
exit :
2013-05-19 04:28:07 +00:00
return ret ;
2013-05-08 21:45:39 +00:00
}
2013-07-29 05:29:55 +00:00
u8 rtw_set_802_11_bssid ( struct adapter * padapter , u8 * bssid )
2013-05-19 04:28:07 +00:00
{
2013-07-29 05:29:55 +00:00
u8 status = _SUCCESS ;
2013-05-08 21:45:39 +00:00
u32 cur_time = 0 ;
struct mlme_priv * pmlmepriv = & padapter - > mlmepriv ;
2013-05-19 04:28:07 +00:00
2013-05-25 23:35:42 +00:00
DBG_88E_LEVEL ( _drv_info_ , " set bssid:%pM \n " , bssid ) ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( ( bssid [ 0 ] = = 0x00 & & bssid [ 1 ] = = 0x00 & & bssid [ 2 ] = = 0x00 & &
bssid [ 3 ] = = 0x00 & & bssid [ 4 ] = = 0x00 & & bssid [ 5 ] = = 0x00 ) | |
( bssid [ 0 ] = = 0xFF & & bssid [ 1 ] = = 0xFF & & bssid [ 2 ] = = 0xFF & &
bssid [ 3 ] = = 0xFF & & bssid [ 4 ] = = 0xFF & & bssid [ 5 ] = = 0xFF ) ) {
2013-05-08 21:45:39 +00:00
status = _FAIL ;
goto exit ;
}
2013-05-19 04:28:07 +00:00
2014-11-16 00:18:30 +00:00
spin_lock_bh ( & pmlmepriv - > lock ) ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
DBG_88E ( " Set BSSID under fw_state = 0x%08x \n " , get_fwstate ( pmlmepriv ) ) ;
if ( check_fwstate ( pmlmepriv , _FW_UNDER_SURVEY ) = = true )
2013-05-08 21:45:39 +00:00
goto handle_tkip_countermeasure ;
2013-07-29 05:29:55 +00:00
else if ( check_fwstate ( pmlmepriv , _FW_UNDER_LINKING ) )
2013-05-08 21:45:39 +00:00
goto release_mlme_lock ;
2013-07-29 05:29:55 +00:00
if ( check_fwstate ( pmlmepriv , _FW_LINKED | WIFI_ADHOC_MASTER_STATE ) ) {
2013-05-08 21:45:39 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " set_bssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE \n " ) ) ;
2014-11-16 00:18:30 +00:00
if ( ! memcmp ( & pmlmepriv - > cur_network . network . MacAddress , bssid , ETH_ALEN ) ) {
2013-05-26 03:02:10 +00:00
if ( check_fwstate ( pmlmepriv , WIFI_STATION_STATE ) = = false )
2013-07-09 22:38:46 +00:00
goto release_mlme_lock ; /* it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
2013-05-08 21:45:39 +00:00
} else {
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " Set BSSID not the same bssid \n " ) ) ;
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " set_bssid =%pM \n " , ( bssid ) ) ) ;
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " cur_bssid =%pM \n " , ( pmlmepriv - > cur_network . network . MacAddress ) ) ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
rtw_disassoc_cmd ( padapter , 0 , true ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
if ( check_fwstate ( pmlmepriv , _FW_LINKED ) = = true )
2013-05-08 21:45:39 +00:00
rtw_indicate_disconnect ( padapter ) ;
rtw_free_assoc_resources ( padapter , 1 ) ;
2013-05-26 03:02:10 +00:00
if ( ( check_fwstate ( pmlmepriv , WIFI_ADHOC_MASTER_STATE ) = = true ) ) {
2013-05-08 21:45:39 +00:00
_clr_fwstate_ ( pmlmepriv , WIFI_ADHOC_MASTER_STATE ) ;
set_fwstate ( pmlmepriv , WIFI_ADHOC_STATE ) ;
2013-05-19 04:28:07 +00:00
}
2013-05-08 21:45:39 +00:00
}
}
handle_tkip_countermeasure :
2013-07-09 22:38:46 +00:00
/* should we add something here...? */
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( padapter - > securitypriv . btkip_countermeasure ) {
2014-11-16 00:18:30 +00:00
cur_time = jiffies ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( ( cur_time - padapter - > securitypriv . btkip_countermeasure_time ) > 60 * HZ ) {
2013-05-26 03:02:10 +00:00
padapter - > securitypriv . btkip_countermeasure = false ;
2013-05-08 21:45:39 +00:00
padapter - > securitypriv . btkip_countermeasure_time = 0 ;
2013-07-29 05:29:55 +00:00
} else {
2013-05-08 21:45:39 +00:00
status = _FAIL ;
goto release_mlme_lock ;
}
}
2013-10-19 17:45:47 +00:00
memcpy ( & pmlmepriv - > assoc_bssid , bssid , ETH_ALEN ) ;
2013-07-29 05:29:55 +00:00
pmlmepriv - > assoc_by_bssid = true ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( check_fwstate ( pmlmepriv , _FW_UNDER_SURVEY ) )
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = true ;
2013-07-29 05:29:55 +00:00
else
2013-05-08 21:45:39 +00:00
status = rtw_do_join ( padapter ) ;
release_mlme_lock :
2014-11-16 00:18:30 +00:00
spin_unlock_bh ( & pmlmepriv - > lock ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
exit :
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ ,
2013-07-29 05:29:55 +00:00
( " rtw_set_802_11_bssid: status=%d \n " , status ) ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
return status ;
}
2013-07-29 05:29:55 +00:00
u8 rtw_set_802_11_ssid ( struct adapter * padapter , struct ndis_802_11_ssid * ssid )
2013-05-19 04:28:07 +00:00
{
2013-05-08 21:45:39 +00:00
u8 status = _SUCCESS ;
u32 cur_time = 0 ;
struct mlme_priv * pmlmepriv = & padapter - > mlmepriv ;
struct wlan_network * pnetwork = & pmlmepriv - > cur_network ;
2013-05-19 04:28:07 +00:00
2013-05-25 23:35:42 +00:00
DBG_88E_LEVEL ( _drv_info_ , " set ssid [%s] fw_state=0x%08x \n " ,
2013-07-29 05:29:55 +00:00
ssid - > Ssid , get_fwstate ( pmlmepriv ) ) ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( ! padapter - > hw_init_completed ) {
2013-05-08 21:45:39 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ ,
2013-07-29 05:29:55 +00:00
( " set_ssid: hw_init_completed == false =>exit!!! \n " ) ) ;
2013-05-08 21:45:39 +00:00
status = _FAIL ;
goto exit ;
}
2013-05-19 04:28:07 +00:00
2014-11-16 00:18:30 +00:00
spin_lock_bh ( & pmlmepriv - > lock ) ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
DBG_88E ( " Set SSID under fw_state = 0x%08x \n " , get_fwstate ( pmlmepriv ) ) ;
2014-11-16 00:18:30 +00:00
if ( check_fwstate ( pmlmepriv , _FW_UNDER_SURVEY ) = = true )
2013-05-08 21:45:39 +00:00
goto handle_tkip_countermeasure ;
2014-11-16 00:18:30 +00:00
else if ( check_fwstate ( pmlmepriv , _FW_UNDER_LINKING ) = = true )
2013-05-08 21:45:39 +00:00
goto release_mlme_lock ;
2013-07-29 05:29:55 +00:00
if ( check_fwstate ( pmlmepriv , _FW_LINKED | WIFI_ADHOC_MASTER_STATE ) ) {
2013-05-08 21:45:39 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ ,
( " set_ssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE \n " ) ) ;
if ( ( pmlmepriv - > assoc_ssid . SsidLength = = ssid - > SsidLength ) & &
2014-11-16 00:18:30 +00:00
( ! memcmp ( & pmlmepriv - > assoc_ssid . Ssid , ssid - > Ssid , ssid - > SsidLength ) ) ) {
2013-07-29 05:29:55 +00:00
if ( ( check_fwstate ( pmlmepriv , WIFI_STATION_STATE ) = = false ) ) {
2013-05-08 21:45:39 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ ,
2013-07-29 05:29:55 +00:00
( " Set SSID is the same ssid, fw_state = 0x%08x \n " ,
2013-05-08 21:45:39 +00:00
get_fwstate ( pmlmepriv ) ) ) ;
2013-07-29 05:29:55 +00:00
if ( ! rtw_is_same_ibss ( padapter , pnetwork ) ) {
2013-07-09 22:38:46 +00:00
/* if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again */
2013-05-26 03:02:10 +00:00
rtw_disassoc_cmd ( padapter , 0 , true ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
if ( check_fwstate ( pmlmepriv , _FW_LINKED ) = = true )
2013-05-08 21:45:39 +00:00
rtw_indicate_disconnect ( padapter ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
rtw_free_assoc_resources ( padapter , 1 ) ;
2013-05-26 03:02:10 +00:00
if ( check_fwstate ( pmlmepriv , WIFI_ADHOC_MASTER_STATE ) = = true ) {
2013-05-08 21:45:39 +00:00
_clr_fwstate_ ( pmlmepriv , WIFI_ADHOC_MASTER_STATE ) ;
set_fwstate ( pmlmepriv , WIFI_ADHOC_STATE ) ;
}
2013-07-20 02:25:11 +00:00
} else {
2013-07-09 22:38:46 +00:00
goto release_mlme_lock ; /* it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
2013-05-08 21:45:39 +00:00
}
2013-07-20 02:25:11 +00:00
} else {
2013-05-08 21:45:39 +00:00
rtw_lps_ctrl_wk_cmd ( padapter , LPS_CTRL_JOINBSS , 1 ) ;
}
2013-07-20 02:25:11 +00:00
} else {
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " Set SSID not the same ssid \n " ) ) ;
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " set_ssid =[%s] len = 0x%x \n " , ssid - > Ssid , ( unsigned int ) ssid - > SsidLength ) ) ;
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " assoc_ssid =[%s] len = 0x%x \n " , pmlmepriv - > assoc_ssid . Ssid , ( unsigned int ) pmlmepriv - > assoc_ssid . SsidLength ) ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
rtw_disassoc_cmd ( padapter , 0 , true ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
if ( check_fwstate ( pmlmepriv , _FW_LINKED ) = = true )
2013-05-08 21:45:39 +00:00
rtw_indicate_disconnect ( padapter ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
rtw_free_assoc_resources ( padapter , 1 ) ;
2013-05-26 03:02:10 +00:00
if ( check_fwstate ( pmlmepriv , WIFI_ADHOC_MASTER_STATE ) = = true ) {
2013-05-08 21:45:39 +00:00
_clr_fwstate_ ( pmlmepriv , WIFI_ADHOC_MASTER_STATE ) ;
set_fwstate ( pmlmepriv , WIFI_ADHOC_STATE ) ;
}
2013-05-19 04:28:07 +00:00
}
2013-05-08 21:45:39 +00:00
}
handle_tkip_countermeasure :
2013-07-29 05:29:55 +00:00
if ( padapter - > securitypriv . btkip_countermeasure ) {
2014-11-16 00:18:30 +00:00
cur_time = jiffies ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( ( cur_time - padapter - > securitypriv . btkip_countermeasure_time ) > 60 * HZ ) {
2013-05-26 03:02:10 +00:00
padapter - > securitypriv . btkip_countermeasure = false ;
2013-05-08 21:45:39 +00:00
padapter - > securitypriv . btkip_countermeasure_time = 0 ;
2013-07-29 05:29:55 +00:00
} else {
2013-05-08 21:45:39 +00:00
status = _FAIL ;
goto release_mlme_lock ;
}
}
2013-10-19 17:45:47 +00:00
memcpy ( & pmlmepriv - > assoc_ssid , ssid , sizeof ( struct ndis_802_11_ssid ) ) ;
2013-07-29 05:29:55 +00:00
pmlmepriv - > assoc_by_bssid = false ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
if ( check_fwstate ( pmlmepriv , _FW_UNDER_SURVEY ) = = true )
2013-05-26 03:02:10 +00:00
pmlmepriv - > to_join = true ;
2014-11-16 00:18:30 +00:00
else
2013-05-08 21:45:39 +00:00
status = rtw_do_join ( padapter ) ;
release_mlme_lock :
2014-11-16 00:18:30 +00:00
spin_unlock_bh ( & pmlmepriv - > lock ) ;
2013-05-08 21:45:39 +00:00
exit :
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ ,
2013-07-29 05:29:55 +00:00
( " -rtw_set_802_11_ssid: status =%d \n " , status ) ) ;
2013-05-08 21:45:39 +00:00
return status ;
}
2013-07-29 05:29:55 +00:00
u8 rtw_set_802_11_infrastructure_mode ( struct adapter * padapter ,
2013-07-24 02:31:04 +00:00
enum ndis_802_11_network_infra networktype )
2013-05-08 21:45:39 +00:00
{
struct mlme_priv * pmlmepriv = & padapter - > mlmepriv ;
struct wlan_network * cur_network = & pmlmepriv - > cur_network ;
2013-07-29 05:29:55 +00:00
enum ndis_802_11_network_infra * pold_state = & ( cur_network - > network . InfrastructureMode ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_notice_ ,
( " +rtw_set_802_11_infrastructure_mode: old =%d new =%d fw_state = 0x%08x \n " ,
2013-05-08 21:45:39 +00:00
* pold_state , networktype , get_fwstate ( pmlmepriv ) ) ) ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
if ( * pold_state ! = networktype ) {
2014-11-16 00:18:30 +00:00
spin_lock_bh ( & pmlmepriv - > lock ) ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " change mode! " ) ) ;
/* DBG_88E("change mode, old_mode =%d, new_mode =%d, fw_state = 0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( * pold_state = = Ndis802_11APMode ) {
2013-07-09 22:38:46 +00:00
/* change to other mode from Ndis802_11APMode */
2013-05-08 21:45:39 +00:00
cur_network - > join_res = - 1 ;
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
stop_ap_mode ( padapter ) ;
# endif
}
2013-07-29 05:29:55 +00:00
if ( ( check_fwstate ( pmlmepriv , _FW_LINKED ) ) | |
( * pold_state = = Ndis802_11IBSS ) )
2013-05-26 03:02:10 +00:00
rtw_disassoc_cmd ( padapter , 0 , true ) ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( ( check_fwstate ( pmlmepriv , _FW_LINKED ) ) | |
( check_fwstate ( pmlmepriv , WIFI_ADHOC_MASTER_STATE ) ) )
2013-05-08 21:45:39 +00:00
rtw_free_assoc_resources ( padapter , 1 ) ;
2013-07-29 05:29:55 +00:00
if ( ( * pold_state = = Ndis802_11Infrastructure ) | | ( * pold_state = = Ndis802_11IBSS ) ) {
2013-05-26 03:02:10 +00:00
if ( check_fwstate ( pmlmepriv , _FW_LINKED ) = = true )
2014-11-16 00:18:30 +00:00
rtw_indicate_disconnect ( padapter ) ; /* will clr Linked_state; before this function, we must have checked whether issue dis-assoc_cmd or not */
2013-05-08 21:45:39 +00:00
}
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
* pold_state = networktype ;
_clr_fwstate_ ( pmlmepriv , ~ WIFI_NULL_STATE ) ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
switch ( networktype ) {
case Ndis802_11IBSS :
set_fwstate ( pmlmepriv , WIFI_ADHOC_STATE ) ;
break ;
case Ndis802_11Infrastructure :
set_fwstate ( pmlmepriv , WIFI_STATION_STATE ) ;
break ;
case Ndis802_11APMode :
set_fwstate ( pmlmepriv , WIFI_AP_STATE ) ;
2013-10-19 17:45:47 +00:00
# ifdef CONFIG_88EU_AP_MODE
2013-07-29 05:29:55 +00:00
start_ap_mode ( padapter ) ;
2013-05-19 04:28:07 +00:00
# endif
2013-07-29 05:29:55 +00:00
break ;
case Ndis802_11AutoUnknown :
case Ndis802_11InfrastructureMax :
break ;
2013-05-08 21:45:39 +00:00
}
2014-11-16 00:18:30 +00:00
spin_unlock_bh ( & pmlmepriv - > lock ) ;
2013-05-08 21:45:39 +00:00
}
2013-05-26 03:02:10 +00:00
return true ;
2013-05-08 21:45:39 +00:00
}
2013-07-27 01:08:39 +00:00
u8 rtw_set_802_11_disassociate ( struct adapter * padapter )
2013-05-08 21:45:39 +00:00
{
2013-07-29 05:29:55 +00:00
struct mlme_priv * pmlmepriv = & padapter - > mlmepriv ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
spin_lock_bh ( & pmlmepriv - > lock ) ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( check_fwstate ( pmlmepriv , _FW_LINKED ) ) {
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ ,
( " MgntActrtw_set_802_11_disassociate: rtw_indicate_disconnect \n " ) ) ;
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
rtw_disassoc_cmd ( padapter , 0 , true ) ;
2013-05-08 21:45:39 +00:00
rtw_indicate_disconnect ( padapter ) ;
2013-05-19 04:28:07 +00:00
rtw_free_assoc_resources ( padapter , 1 ) ;
rtw_pwr_wakeup ( padapter ) ;
2013-05-08 21:45:39 +00:00
}
2014-11-16 00:18:30 +00:00
spin_unlock_bh ( & pmlmepriv - > lock ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
2013-05-26 03:02:10 +00:00
return true ;
2013-05-08 21:45:39 +00:00
}
2013-07-29 05:29:55 +00:00
u8 rtw_set_802_11_bssid_list_scan ( struct adapter * padapter , struct ndis_802_11_ssid * pssid , int ssid_max_num )
2013-05-19 04:28:07 +00:00
{
2013-07-29 05:29:55 +00:00
struct mlme_priv * pmlmepriv = & padapter - > mlmepriv ;
u8 res = true ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " +rtw_set_802_11_bssid_list_scan(), fw_state =%x \n " , get_fwstate ( pmlmepriv ) ) ) ;
2013-05-08 21:45:39 +00:00
if ( padapter = = NULL ) {
2013-07-29 05:29:55 +00:00
res = false ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-07-29 05:29:55 +00:00
if ( ! padapter - > hw_init_completed ) {
2013-05-26 03:02:10 +00:00
res = false ;
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " \n === rtw_set_802_11_bssid_list_scan:hw_init_completed == false === \n " ) ) ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
if ( ( check_fwstate ( pmlmepriv , _FW_UNDER_SURVEY | _FW_UNDER_LINKING ) ) | |
( pmlmepriv - > LinkDetectInfo . bBusyTraffic ) ) {
2013-07-09 22:38:46 +00:00
/* Scan or linking is in progress, do nothing. */
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " rtw_set_802_11_bssid_list_scan fail since fw_state = %x \n " , get_fwstate ( pmlmepriv ) ) ) ;
2013-05-26 03:02:10 +00:00
res = true ;
2013-05-08 21:45:39 +00:00
2014-11-16 00:18:30 +00:00
if ( check_fwstate ( pmlmepriv ,
( _FW_UNDER_SURVEY | _FW_UNDER_LINKING ) ) = = true )
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " \n ###_FW_UNDER_SURVEY|_FW_UNDER_LINKING \n \n " ) ) ;
2014-11-16 00:18:30 +00:00
else
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " \n ###pmlmepriv->sitesurveyctrl.traffic_busy == true \n \n " ) ) ;
2014-11-16 00:18:30 +00:00
2013-05-19 04:28:07 +00:00
} else {
2013-05-08 21:45:39 +00:00
if ( rtw_is_scan_deny ( padapter ) ) {
2013-05-25 23:35:42 +00:00
DBG_88E ( FUNC_ADPT_FMT " : scan deny \n " , FUNC_ADPT_ARG ( padapter ) ) ;
2013-05-08 21:45:39 +00:00
indicate_wx_scan_complete_event ( padapter ) ;
return _SUCCESS ;
}
2013-05-19 04:28:07 +00:00
2014-11-16 00:18:30 +00:00
spin_lock_bh ( & pmlmepriv - > lock ) ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
res = rtw_sitesurvey_cmd ( padapter , pssid , ssid_max_num , NULL , 0 ) ;
2013-05-19 04:28:07 +00:00
2014-11-16 00:18:30 +00:00
spin_unlock_bh ( & pmlmepriv - > lock ) ;
2013-05-08 21:45:39 +00:00
}
exit :
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
2013-05-19 04:28:07 +00:00
return res ;
2013-05-08 21:45:39 +00:00
}
2013-07-29 05:29:55 +00:00
u8 rtw_set_802_11_authentication_mode ( struct adapter * padapter , enum ndis_802_11_auth_mode authmode )
2013-05-08 21:45:39 +00:00
{
struct security_priv * psecuritypriv = & padapter - > securitypriv ;
int res ;
u8 ret ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " set_802_11_auth.mode(): mode =%x \n " , authmode ) ) ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
psecuritypriv - > ndisauthtype = authmode ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ ,
( " rtw_set_802_11_authentication_mode:psecuritypriv->ndisauthtype=%d " ,
psecuritypriv - > ndisauthtype ) ) ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
if ( psecuritypriv - > ndisauthtype > 3 )
psecuritypriv - > dot11AuthAlgrthm = dot11AuthAlgrthm_8021X ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
res = rtw_set_auth ( padapter , psecuritypriv ) ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
if ( res = = _SUCCESS )
ret = true ;
2013-05-08 21:45:39 +00:00
else
2013-07-29 05:29:55 +00:00
ret = false ;
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
return ret ;
}
2013-07-29 05:29:55 +00:00
u8 rtw_set_802_11_add_wep ( struct adapter * padapter , struct ndis_802_11_wep * wep )
{
int keyid , res ;
struct security_priv * psecuritypriv = & ( padapter - > securitypriv ) ;
u8 ret = _SUCCESS ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
keyid = wep - > KeyIndex & 0x3fffffff ;
2013-05-08 21:45:39 +00:00
2013-09-05 17:26:29 +00:00
if ( keyid > = 4 ) {
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_err_ , ( " MgntActrtw_set_802_11_add_wep:keyid>4 =>fail \n " ) ) ;
ret = false ;
2013-05-08 21:45:39 +00:00
goto exit ;
}
2013-05-19 04:28:07 +00:00
2013-06-21 18:41:29 +00:00
switch ( wep - > KeyLength ) {
case 5 :
2013-07-29 05:29:55 +00:00
psecuritypriv - > dot11PrivacyAlgrthm = _WEP40_ ;
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " MgntActrtw_set_802_11_add_wep:wep->KeyLength = 5 \n " ) ) ;
2013-06-21 18:41:29 +00:00
break ;
case 13 :
2013-07-29 05:29:55 +00:00
psecuritypriv - > dot11PrivacyAlgrthm = _WEP104_ ;
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " MgntActrtw_set_802_11_add_wep:wep->KeyLength = 13 \n " ) ) ;
2013-06-21 18:41:29 +00:00
break ;
default :
2013-07-29 05:29:55 +00:00
psecuritypriv - > dot11PrivacyAlgrthm = _NO_PRIVACY_ ;
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ , ( " MgntActrtw_set_802_11_add_wep:wep->KeyLength!= 5 or 13 \n " ) ) ;
2013-06-21 18:41:29 +00:00
break ;
2013-05-08 21:45:39 +00:00
}
2013-06-21 18:41:29 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ ,
2014-11-16 00:18:30 +00:00
( " rtw_set_802_11_add_wep:before memcpy, wep->KeyLength = 0x%x wep->KeyIndex = 0x%x keyid =%x \n " ,
2013-07-29 05:29:55 +00:00
wep - > KeyLength , wep - > KeyIndex , keyid ) ) ;
2013-05-08 21:45:39 +00:00
2013-10-19 17:45:47 +00:00
memcpy ( & ( psecuritypriv - > dot11DefKey [ keyid ] . skey [ 0 ] ) , & ( wep - > KeyMaterial ) , wep - > KeyLength ) ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
psecuritypriv - > dot11DefKeylen [ keyid ] = wep - > KeyLength ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
psecuritypriv - > dot11PrivacyKeyIndex = keyid ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
RT_TRACE ( _module_rtl871x_ioctl_set_c_ , _drv_info_ ,
( " rtw_set_802_11_add_wep:security key material : %x %x %x %x %x %x %x %x %x %x %x %x %x \n " ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 0 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 1 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 2 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 3 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 4 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 5 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 6 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 7 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 8 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 9 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 10 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 11 ] ,
psecuritypriv - > dot11DefKey [ keyid ] . skey [ 12 ] ) ) ;
res = rtw_set_key ( padapter , psecuritypriv , keyid , 1 ) ;
if ( res = = _FAIL )
ret = false ;
2013-05-08 21:45:39 +00:00
exit :
2013-06-21 18:41:29 +00:00
return ret ;
2013-05-08 21:45:39 +00:00
}
/*
2013-05-19 04:28:07 +00:00
* rtw_get_cur_max_rate -
2013-07-27 01:08:39 +00:00
* @ adapter : pointer to struct adapter structure
2013-05-19 04:28:07 +00:00
*
2013-05-08 21:45:39 +00:00
* Return 0 or 100 Kbps
*/
2013-07-27 01:08:39 +00:00
u16 rtw_get_cur_max_rate ( struct adapter * adapter )
2013-05-08 21:45:39 +00:00
{
int i = 0 ;
u8 * p ;
u16 rate = 0 , max_rate = 0 ;
struct mlme_ext_priv * pmlmeext = & adapter - > mlmeextpriv ;
struct mlme_ext_info * pmlmeinfo = & ( pmlmeext - > mlmext_info ) ;
struct registry_priv * pregistrypriv = & adapter - > registrypriv ;
struct mlme_priv * pmlmepriv = & adapter - > mlmepriv ;
2013-07-24 02:31:04 +00:00
struct wlan_bssid_ex * pcur_bss = & pmlmepriv - > cur_network . network ;
2013-05-08 21:45:39 +00:00
struct rtw_ieee80211_ht_cap * pht_capie ;
u8 rf_type = 0 ;
2013-07-29 05:29:55 +00:00
u8 bw_40MHz = 0 , short_GI_20 = 0 , short_GI_40 = 0 ;
u16 mcs_rate = 0 ;
2013-05-19 04:28:07 +00:00
u32 ht_ielen = 0 ;
2013-05-08 21:45:39 +00:00
2013-07-29 05:29:55 +00:00
if ( adapter - > registrypriv . mp_mode = = 1 ) {
if ( check_fwstate ( pmlmepriv , WIFI_MP_STATE ) )
2013-05-08 21:45:39 +00:00
return 0 ;
}
2013-07-29 05:29:55 +00:00
if ( ( ! check_fwstate ( pmlmepriv , _FW_LINKED ) ) & &
( ! check_fwstate ( pmlmepriv , WIFI_ADHOC_MASTER_STATE ) ) )
2013-05-08 21:45:39 +00:00
return 0 ;
if ( pmlmeext - > cur_wireless_mode & ( WIRELESS_11_24N | WIRELESS_11_5N ) ) {
p = rtw_get_ie ( & pcur_bss - > IEs [ 12 ] , _HT_CAPABILITY_IE_ , & ht_ielen , pcur_bss - > IELength - 12 ) ;
2013-07-29 05:29:55 +00:00
if ( p & & ht_ielen > 0 ) {
2013-05-08 21:45:39 +00:00
pht_capie = ( struct rtw_ieee80211_ht_cap * ) ( p + 2 ) ;
2013-05-19 04:28:07 +00:00
2013-10-19 17:45:47 +00:00
memcpy ( & mcs_rate , pht_capie - > supp_mcs_set , 2 ) ;
2013-05-08 21:45:39 +00:00
2013-07-09 22:38:46 +00:00
/* cur_bwmod is updated by beacon, pmlmeinfo is updated by association response */
2013-07-29 05:29:55 +00:00
bw_40MHz = ( pmlmeext - > cur_bwmode & & ( HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo - > HT_info . infos [ 0 ] ) ) ? 1 : 0 ;
2013-05-19 04:28:07 +00:00
2013-07-29 05:29:55 +00:00
short_GI_20 = ( le16_to_cpu ( pmlmeinfo - > HT_caps . u . HT_cap_element . HT_caps_info ) & IEEE80211_HT_CAP_SGI_20 ) ? 1 : 0 ;
short_GI_40 = ( le16_to_cpu ( pmlmeinfo - > HT_caps . u . HT_cap_element . HT_caps_info ) & IEEE80211_HT_CAP_SGI_40 ) ? 1 : 0 ;
2013-05-08 21:45:39 +00:00
rtw_hal_get_hwreg ( adapter , HW_VAR_RF_TYPE , ( u8 * ) ( & rf_type ) ) ;
max_rate = rtw_mcs_rate (
rf_type ,
2013-05-19 04:28:07 +00:00
bw_40MHz & ( pregistrypriv - > cbw40_enable ) ,
2013-05-08 21:45:39 +00:00
short_GI_20 ,
short_GI_40 ,
pmlmeinfo - > HT_caps . u . HT_cap_element . MCS_rate
) ;
}
2013-07-29 05:29:55 +00:00
} else {
while ( ( pcur_bss - > SupportedRates [ i ] ! = 0 ) & & ( pcur_bss - > SupportedRates [ i ] ! = 0xFF ) ) {
2013-05-08 21:45:39 +00:00
rate = pcur_bss - > SupportedRates [ i ] & 0x7F ;
2013-07-29 05:29:55 +00:00
if ( rate > max_rate )
2013-05-08 21:45:39 +00:00
max_rate = rate ;
i + + ;
}
2013-05-19 04:28:07 +00:00
2013-05-08 21:45:39 +00:00
max_rate = max_rate * 10 / 2 ;
}
return max_rate ;
}
/*
2013-05-19 04:28:07 +00:00
* rtw_set_country -
2013-07-27 01:08:39 +00:00
* @ adapter : pointer to struct adapter structure
2013-05-08 21:45:39 +00:00
* @ country_code : string of country code
2013-05-19 04:28:07 +00:00
*
2013-05-08 21:45:39 +00:00
* Return _SUCCESS or _FAIL
*/
2013-07-27 01:08:39 +00:00
int rtw_set_country ( struct adapter * adapter , const char * country_code )
2013-05-08 21:45:39 +00:00
{
int channel_plan = RT_CHANNEL_DOMAIN_WORLD_WIDE_5G ;
2013-05-25 23:35:42 +00:00
DBG_88E ( " %s country_code:%s \n " , __func__ , country_code ) ;
2013-05-08 21:45:39 +00:00
2013-07-09 22:38:46 +00:00
/* TODO: should have a table to match country code and RT_CHANNEL_DOMAIN */
/* TODO: should consider 2-character and 3-character country code */
2013-05-09 04:04:25 +00:00
if ( 0 = = strcmp ( country_code , " US " ) )
2013-05-08 21:45:39 +00:00
channel_plan = RT_CHANNEL_DOMAIN_FCC ;
2013-05-09 04:04:25 +00:00
else if ( 0 = = strcmp ( country_code , " EU " ) )
2013-05-08 21:45:39 +00:00
channel_plan = RT_CHANNEL_DOMAIN_ETSI ;
2013-05-09 04:04:25 +00:00
else if ( 0 = = strcmp ( country_code , " JP " ) )
2013-05-08 21:45:39 +00:00
channel_plan = RT_CHANNEL_DOMAIN_MKK ;
2013-05-09 04:04:25 +00:00
else if ( 0 = = strcmp ( country_code , " CN " ) )
2013-05-08 21:45:39 +00:00
channel_plan = RT_CHANNEL_DOMAIN_CHINA ;
else
2013-05-25 23:35:42 +00:00
DBG_88E ( " %s unknown country_code:%s \n " , __func__ , country_code ) ;
2013-05-19 04:28:07 +00:00
2014-11-16 00:18:30 +00:00
return rtw_set_chplan_cmd ( adapter , channel_plan , 1 ) ;
2013-05-08 21:45:39 +00:00
}