u8 rtw_createbss_cmd(struct adapter *padapter) { struct cmd_obj *pcmd; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; u8 res = _SUCCESS; rtw_led_control(padapter, LED_CTL_START_TO_LINK); if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for Any SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); else RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (pcmd == NULL) { res = _FAIL; goto exit; } INIT_LIST_HEAD(&pcmd->list); pcmd->cmdcode = _CreateBss_CMD_; pcmd->parmbuf = (unsigned char *)pdev_network; pcmd->cmdsz = get_wlan_bssid_ex_sz((struct wlan_bssid_ex *)pdev_network); pcmd->rsp = NULL; pcmd->rspsz = 0; pdev_network->Length = pcmd->cmdsz; res = rtw_enqueue_cmd(pcmdpriv, pcmd); exit: return res; }
int rtw_hw_suspend23a(struct rtw_adapter *padapter) { struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct net_device *pnetdev = padapter->pnetdev; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) { DBG_8723A("padapter->bup =%d bDriverStopped =%d bSurpriseRemoved = %d\n", padapter->bup, padapter->bDriverStopped, padapter->bSurpriseRemoved); goto error_exit; } if (padapter) { /* system suspend */ LeaveAllPowerSaveMode23a(padapter); DBG_8723A("==> rtw_hw_suspend23a\n"); down(&pwrpriv->lock); pwrpriv->bips_processing = true; /* padapter->net_closed = true; */ /* s1. */ if (pnetdev) { netif_carrier_off(pnetdev); netif_tx_stop_all_queues(pnetdev); } /* s2. */ rtw_disassoc_cmd23a(padapter, 500, false); /* s2-2. indicate disconnect to os */ /* rtw_indicate_disconnect23a(padapter); */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { _clr_fwstate_(pmlmepriv, _FW_LINKED); rtw_led_control(padapter, LED_CTL_NO_LINK); rtw_os_indicate_disconnect23a(padapter); /* donnot enqueue cmd */ rtw_lps_ctrl_wk_cmd23a(padapter, LPS_CTRL_DISCONNECT, 0); } /* s2-3. */ rtw_free_assoc_resources23a(padapter, 1); /* s2-4. */ rtw_free_network_queue23a(padapter); rtw_ips_dev_unload23a(padapter); pwrpriv->rf_pwrstate = rf_off; pwrpriv->bips_processing = false; up(&pwrpriv->lock); } else { goto error_exit; } return 0; error_exit: DBG_8723A("%s, failed\n", __func__); return -1; }
uint rtw_hal_deinit(_adapter *padapter) { uint status = _SUCCESS; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); int i; _func_enter_; status = padapter->HalFunc.hal_deinit(padapter); if(status == _SUCCESS){ rtw_led_control(padapter, LED_CTL_POWER_OFF); for (i = 0; i<dvobj->iface_nums; i++) { padapter = dvobj->padapters[i]; padapter->hw_init_completed = _FALSE; } } else { DBG_871X("\n rtw_hal_deinit: hal_init fail\n"); } _func_exit_; return status; }
uint rtw_hal_init(_adapter *padapter) { uint status = _SUCCESS; #ifdef CONFIG_DUALMAC_CONCURRENT if(padapter->hw_init_completed == _TRUE) { DBG_871X("rtw_hal_init: hw_init_completed == _TRUE\n"); return status; } // before init mac0, driver must init mac1 first to avoid usb rx error. if((padapter->pbuddy_adapter != NULL) && (padapter->DualMacConcurrent == _TRUE) && (padapter->adapter_type == PRIMARY_ADAPTER)) { if(padapter->pbuddy_adapter->hw_init_completed == _TRUE) { DBG_871X("rtw_hal_init: pbuddy_adapter hw_init_completed == _TRUE\n"); } else { status = padapter->HalFunc.hal_init(padapter->pbuddy_adapter); if(status == _SUCCESS){ padapter->pbuddy_adapter->hw_init_completed = _TRUE; } else{ padapter->pbuddy_adapter->hw_init_completed = _FALSE; RT_TRACE(_module_hal_init_c_,_drv_err_,("rtw_hal_init: hal__init fail(pbuddy_adapter)\n")); DBG_871X("rtw_hal_init: hal__init fail(pbuddy_adapter)\n"); return status; } } } #endif padapter->hw_init_completed=_FALSE; status = padapter->HalFunc.hal_init(padapter); if(status == _SUCCESS){ padapter->hw_init_completed = _TRUE; if (padapter->registrypriv.notch_filter == 1) rtw_hal_notch_filter(padapter, 1); rtw_hal_reset_security_engine(padapter); rtw_led_control(padapter, LED_CTL_POWER_ON); } else{ padapter->hw_init_completed = _FALSE; DBG_871X("rtw_hal_init: hal__init fail\n"); } RT_TRACE(_module_hal_init_c_,_drv_err_,("-rtl871x_hal_init:status=0x%x\n",status)); return status; }
//extern int rfpwrstate_check(_adapter *padapter); static int netdev_close(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - drv_close\n")); if(padapter->pwrctrlpriv.bInternalAutoSuspend == _TRUE) { //rfpwrstate_check(padapter); if(padapter->pwrctrlpriv.rf_pwrstate == rf_off) padapter->pwrctrlpriv.ps_flag = _TRUE; } padapter->net_closed = _TRUE; /* if(!padapter->hw_init_completed) { DBG_8192C("(1)871x_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); padapter->bDriverStopped = _TRUE; rtw_dev_unload(padapter); } else*/ if(padapter->pwrctrlpriv.rf_pwrstate == rf_on){ DBG_8192C("(2)871x_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); //s1. if(pnetdev) { if (!netif_queue_stopped(pnetdev)) netif_stop_queue(pnetdev); } #ifndef CONFIG_ANDROID //s2. //s2-1. issue rtw_disassoc_cmd to fw rtw_disassoc_cmd(padapter); //s2-2. indicate disconnect to os rtw_indicate_disconnect(padapter); //s2-3. rtw_free_assoc_resources(padapter); //s2-4. rtw_free_network_queue(padapter,_TRUE); #endif // Close LED rtw_led_control(padapter, LED_CTL_POWER_OFF); } RT_TRACE(_module_os_intfs_c_,_drv_info_,("-871x_drv - drv_close\n")); DBG_8192C("-871x_drv - drv_close, bup=%d\n", padapter->bup); return 0; }
void rtw_ips_pwr_down(struct adapter *padapter) { u32 start_time = jiffies; DBG_88E("===> rtw_ips_pwr_down...................\n"); padapter->net_closed = true; rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_ips_dev_unload(padapter); DBG_88E("<=== rtw_ips_pwr_down..................... in %dms\n", rtw_get_passing_time_ms(start_time)); }
int rtw_ips_pwr_up(_adapter *padapter) { int result; u32 start_time = rtw_get_current_time(); DBG_8192C("===> rtw_ips_pwr_up..............\n"); rtw_reset_drv_sw(padapter); result = ips_netdrv_open(padapter); rtw_led_control(padapter, LED_CTL_NO_LINK); DBG_8192C("<=== rtw_ips_pwr_up.............. in %dms\n", rtw_get_passing_time_ms(start_time)); return result; }
void rtw_ips_pwr_down(struct adapter *padapter) { unsigned long start_time = jiffies; DBG_88E("===> rtw_ips_pwr_down...................\n"); padapter->net_closed = true; rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_ips_dev_unload(padapter); DBG_88E("<=== rtw_ips_pwr_down..................... in %dms\n", jiffies_to_msecs(jiffies - start_time)); }
void rtw_ips_pwr_down(_adapter *padapter) { u32 start_time = rtw_get_current_time(); DBG_8192C("===> rtw_ips_pwr_down...................\n"); padapter->bCardDisableWOHSM = _TRUE; padapter->net_closed = _TRUE; rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_ips_dev_unload(padapter); padapter->bCardDisableWOHSM = _FALSE; DBG_8192C("<=== rtw_ips_pwr_down..................... in %dms\n", rtw_get_passing_time_ms(start_time)); }
void rtw_ips_pwr_down(struct adapter *padapter) { u32 start_time = rtw_get_current_time(); DBG_88E("===> rtw_ips_pwr_down...................\n"); padapter->bCardDisableWOHSM = true; padapter->net_closed = true; rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_ips_dev_unload(padapter); padapter->bCardDisableWOHSM = false; DBG_88E("<=== rtw_ips_pwr_down..................... in %dms\n", rtw_get_passing_time_ms(start_time)); }
int netdev_close(struct net_device *pnetdev) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - drv_close\n")); if (padapter->pwrctrlpriv.bInternalAutoSuspend) { if (padapter->pwrctrlpriv.rf_pwrstate == rf_off) padapter->pwrctrlpriv.ps_flag = true; } padapter->net_closed = true; 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); /* s1. */ if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_stop_queue(pnetdev); } /* s2. */ LeaveAllPowerSaveMode(padapter); rtw_disassoc_cmd(padapter, 500, false); /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect(padapter); /* s2-3. */ rtw_free_assoc_resources(padapter, 1); /* s2-4. */ rtw_free_network_queue(padapter, true); /* Close LED */ rtw_led_control(padapter, LED_CTL_POWER_OFF); } nat25_db_cleanup(padapter); #ifdef CONFIG_88EU_P2P rtw_p2p_enable(padapter, P2P_ROLE_DISABLE); #endif /* CONFIG_88EU_P2P */ kfree(dvobj->firmware.szFwBuffer); dvobj->firmware.szFwBuffer = NULL; RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n")); DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup); return 0; }
int rtw_ips_pwr_up(struct adapter *padapter) { int result; unsigned long start_time = jiffies; DBG_88E("===> rtw_ips_pwr_up..............\n"); rtw_reset_drv_sw(padapter); result = ips_netdrv_open(padapter); rtw_led_control(padapter, LED_CTL_NO_LINK); DBG_88E("<=== rtw_ips_pwr_up.............. in %dms\n", jiffies_to_msecs(jiffies - start_time)); return result; }
void rtw_ips_pwr_down23a(struct rtw_adapter *padapter) { unsigned long start_time = jiffies; DBG_8723A("===> rtw_ips_pwr_down23a...................\n"); padapter->bCardDisableWOHSM = true; padapter->net_closed = true; rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_ips_dev_unload23a(padapter); padapter->bCardDisableWOHSM = false; DBG_8723A("<=== rtw_ips_pwr_down23a..................... in %dms\n", jiffies_to_msecs(jiffies - start_time)); }
int netdev_close(struct net_device *pnetdev) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct hal_data_8188e *rtlhal = GET_HAL_DATA(padapter); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - drv_close\n")); if (padapter->pwrctrlpriv.bInternalAutoSuspend) { if (padapter->pwrctrlpriv.rf_pwrstate == rf_off) padapter->pwrctrlpriv.ps_flag = true; } padapter->net_closed = true; 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); /* s1. */ if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) netif_tx_stop_all_queues(pnetdev); } /* s2. */ LeaveAllPowerSaveMode(padapter); rtw_disassoc_cmd(padapter, 500, false); /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect(padapter); /* s2-3. */ rtw_free_assoc_resources(padapter, 1); /* s2-4. */ rtw_free_network_queue(padapter, true); /* Close LED */ rtw_led_control(padapter, LED_CTL_POWER_OFF); } kfree(rtlhal->pfirmware); rtlhal->pfirmware = NULL; RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n")); DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup); return 0; }
uint rtw_hal_init(_adapter *padapter) { uint status = _SUCCESS; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); int i; status = padapter->HalFunc.hal_init(padapter); if(status == _SUCCESS){ for (i = 0; i<dvobj->iface_nums; i++) dvobj->padapters[i]->hw_init_completed = _TRUE; if (padapter->registrypriv.notch_filter == 1) rtw_hal_notch_filter(padapter, 1); rtw_hal_reset_security_engine(padapter); for (i = 0; i<dvobj->iface_nums; i++) rtw_sec_restore_wep_key(dvobj->padapters[i]); rtw_led_control(padapter, LED_CTL_POWER_ON); init_hw_mlme_ext(padapter); rtw_hal_init_opmode(padapter); #ifdef CONFIG_RF_GAIN_OFFSET rtw_bb_rf_gain_offset(padapter); #endif //CONFIG_RF_GAIN_OFFSET } else{ for (i = 0; i<dvobj->iface_nums; i++) dvobj->padapters[i]->hw_init_completed = _FALSE; DBG_871X("rtw_hal_init: hal__init fail\n"); } RT_TRACE(_module_hal_init_c_,_drv_err_,("-rtl871x_hal_init:status=0x%x\n",status)); return status; }
uint rtw_hal_deinit(_adapter *padapter) { uint status = _SUCCESS; _func_enter_; status = padapter->HalFunc.hal_deinit(padapter); if(status == _SUCCESS){ rtw_led_control(padapter, LED_CTL_POWER_OFF); padapter->hw_init_completed = _FALSE; } else { DBG_871X("\n rtw_hal_deinit: hal_init fail\n"); } _func_exit_; return status; }
static int netdev_close(struct net_device *pnetdev) { struct rtw_adapter *padapter = netdev_priv(pnetdev); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+871x_drv - drv_close\n")); padapter->net_closed = true; if (padapter->pwrctrlpriv.rf_pwrstate == rf_on) { DBG_8723A("(2)871x_drv - drv_close, bup =%d, " "hw_init_completed =%d\n", padapter->bup, padapter->hw_init_completed); /* s1. */ if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) netif_tx_stop_all_queues(pnetdev); } /* s2. */ LeaveAllPowerSaveMode23a(padapter); rtw_disassoc_cmd23a(padapter, 500, false); /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect23a(padapter); /* s2-3. */ rtw_free_assoc_resources23a(padapter, 1); /* s2-4. */ rtw_free_network_queue23a(padapter); /* Close LED */ rtw_led_control(padapter, LED_CTL_POWER_OFF); } rtw_scan_abort23a(padapter); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-871x_drv - drv_close\n")); DBG_8723A("-871x_drv - drv_close, bup =%d\n", padapter->bup); return 0; }
uint rtw_hal_deinit(_adapter *padapter) { uint status = _SUCCESS; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); int i; _func_enter_; status = padapter->HalFunc.hal_deinit(padapter); if(status == _SUCCESS){ rtw_led_control(padapter, LED_CTL_POWER_OFF); pHalData->hw_init_completed = _FALSE; } else { DBG_871X("\n rtw_hal_deinit: hal_init fail\n"); } _func_exit_; return status; }
static int rtw_gspi_suspend(struct spi_device *spi, pm_message_t mesg) { struct dvobj_priv *dvobj = spi_get_drvdata(spi); PADAPTER padapter = dvobj->if1; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct net_device *pnetdev = padapter->pnetdev; int ret = 0; u32 start_time = rtw_get_current_time(); _func_enter_; DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); pwrpriv->bInSuspend = _TRUE; while (pwrpriv->bips_processing == _TRUE) rtw_msleep_os(1); if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) { DBG_871X("%s bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", __FUNCTION__ ,padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); goto exit; } rtw_cancel_all_timer(padapter); LeaveAllPowerSaveMode(padapter); //padapter->net_closed = _TRUE; //s1. if(pnetdev) { netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); } #ifdef CONFIG_WOWLAN padapter->pwrctrlpriv.bSupportRemoteWakeup=_TRUE; #else //s2. //s2-1. issue rtw_disassoc_cmd to fw disconnect_hdl(padapter, NULL); //rtw_disassoc_cmd(padapter); #endif #ifdef CONFIG_LAYER2_ROAMING_RESUME if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) ) { DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n",__FUNCTION__, pmlmepriv->cur_network.network.Ssid.Ssid, MAC_ARG(pmlmepriv->cur_network.network.MacAddress), pmlmepriv->cur_network.network.Ssid.SsidLength, pmlmepriv->assoc_ssid.SsidLength); pmlmepriv->to_roaming = 1; } #endif //s2-2. indicate disconnect to os rtw_indicate_disconnect(padapter); //s2-3. rtw_free_assoc_resources(padapter, 1); //s2-4. rtw_free_network_queue(padapter, _TRUE); rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_dev_unload(padapter); if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) rtw_indicate_scan_done(padapter, 1); if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) rtw_indicate_disconnect(padapter); // interface deinit gspi_deinit(dvobj); RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("%s: deinit GSPI complete!\n", __FUNCTION__)); rtw_wifi_gpio_wlan_ctrl(WLAN_PWDN_OFF); rtw_mdelay_os(1); exit: DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__ , ret, rtw_get_passing_time_ms(start_time)); _func_exit_; return ret; }
int _netdev_open(struct net_device *pnetdev) { uint status; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - dev_open\n")); DBG_8192C("+871x_drv - drv_open, bup=%d\n", padapter->bup); if(pwrctrlpriv->ps_flag == _TRUE){ padapter->net_closed = _FALSE; goto netdev_open_normal_process; } if(padapter->bup == _FALSE) { padapter->bDriverStopped = _FALSE; padapter->bSurpriseRemoved = _FALSE; padapter->bCardDisableWOHSM = _FALSE; status = rtw_hal_init(padapter); if (status ==_FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("rtl871x_hal_init(): Can't init h/w!\n")); goto netdev_open_error; } DBG_8192C("MAC Address = "MAC_FMT"\n", MAC_ARG(pnetdev->dev_addr)); status=rtw_start_drv_threads(padapter); if(status ==_FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("Initialize driver software resource Failed!\n")); goto netdev_open_error; } if (init_hw_mlme_ext(padapter) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("can't init mlme_ext_priv\n")); goto netdev_open_error; } #ifdef CONFIG_DRVEXT_MODULE init_drvext(padapter); #endif if(padapter->intf_start) { padapter->intf_start(padapter); } #ifdef CONFIG_PROC_DEBUG #ifndef RTK_DMP_PLATFORM rtw_proc_init_one(pnetdev); #endif #endif #ifdef CONFIG_IOCTL_CFG80211 rtw_cfg80211_init_wiphy(padapter); #endif rtw_led_control(padapter, LED_CTL_NO_LINK); padapter->bup = _TRUE; } padapter->net_closed = _FALSE; _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); if(( pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE ) ||(padapter->pwrctrlpriv.bHWPwrPindetect)) { padapter->pwrctrlpriv.bips_processing = _FALSE; rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); } //netif_carrier_on(pnetdev);//call this func when rtw_joinbss_event_callback return success if(!netif_queue_stopped(pnetdev)) netif_start_queue(pnetdev); else netif_wake_queue(pnetdev); #ifdef CONFIG_BR_EXT #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) rcu_read_lock(); #endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) //if(check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == _TRUE) { //struct net_bridge *br = pnetdev->br_port->br;//->dev->dev_addr; #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) if (pnetdev->br_port) #else // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) if (rcu_dereference(padapter->pnetdev->rx_handler_data)) #endif // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) { struct net_device *br_netdev; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) br_netdev = dev_get_by_name(CONFIG_BR_EXT_BRNAME); #else // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) struct net *devnet = NULL; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) devnet = pnetdev->nd_net; #else // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) devnet = dev_net(pnetdev); #endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) br_netdev = dev_get_by_name(devnet, CONFIG_BR_EXT_BRNAME); #endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) if (br_netdev) { memcpy(padapter->br_mac, br_netdev->dev_addr, ETH_ALEN); dev_put(br_netdev); } else printk("%s()-%d: dev_get_by_name(%s) failed!", __FUNCTION__, __LINE__, CONFIG_BR_EXT_BRNAME); } padapter->ethBrExtInfo.addPPPoETag = 1; } #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) rcu_read_unlock(); #endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) #endif // CONFIG_BR_EXT netdev_open_normal_process: RT_TRACE(_module_os_intfs_c_,_drv_info_,("-871x_drv - dev_open\n")); DBG_8192C("-871x_drv - drv_open, bup=%d\n", padapter->bup); return 0; netdev_open_error: padapter->bup = _FALSE; netif_carrier_off(pnetdev); netif_stop_queue(pnetdev); RT_TRACE(_module_os_intfs_c_,_drv_err_,("-871x_drv - dev_open, fail!\n")); DBG_8192C("-871x_drv - drv_open fail, bup=%d\n", padapter->bup); return (-1); }
u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) { u8 res = _SUCCESS; uint t_len = 0; struct wlan_bssid_ex *psecnetwork; struct cmd_obj *pcmd; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; enum ndis_802_11_network_infra ndis_network_mode = pnetwork->network.InfrastructureMode; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); rtw_led_control(padapter, LED_CTL_START_TO_LINK); if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any SSid\n")); else RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (!pcmd) { res = _FAIL; goto exit; } /* for IEs is fix buf size */ t_len = sizeof(struct wlan_bssid_ex); /* for hidden ap to set fw_state here */ if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) { switch (ndis_network_mode) { case Ndis802_11IBSS: set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); break; case Ndis802_11Infrastructure: set_fwstate(pmlmepriv, WIFI_STATION_STATE); break; case Ndis802_11APMode: case Ndis802_11AutoUnknown: case Ndis802_11InfrastructureMax: break; } } psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; if (psecnetwork == NULL) { kfree(pcmd); res = _FAIL; RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd :psecnetwork == NULL!!!\n")); goto exit; } memset(psecnetwork, 0, t_len); memcpy(psecnetwork, &pnetwork->network, get_wlan_bssid_ex_sz(&pnetwork->network)); psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength; if ((psecnetwork->IELength-12) < (256-1)) memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12); else memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); psecnetwork->IELength = 0; /* Added by Albert 2009/02/18 */ /* If the driver wants to use the bssid to create the connection. */ /* If not, we have to copy the connecting AP's MAC address to it so that */ /* the driver just has the bssid information for PMKIDList searching. */ if (!pmlmepriv->assoc_by_bssid) memcpy(&pmlmepriv->assoc_bssid[0], &pnetwork->network.MacAddress[0], ETH_ALEN); psecnetwork->IELength = rtw_restruct_sec_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength); pqospriv->qos_option = 0; if (pregistrypriv->wmm_enable) { u32 tmp_len; tmp_len = rtw_restruct_wmm_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength, psecnetwork->IELength); if (psecnetwork->IELength != tmp_len) { psecnetwork->IELength = tmp_len; pqospriv->qos_option = 1; /* There is WMM IE in this corresp. beacon */ } else { pqospriv->qos_option = 0;/* There is no WMM IE in this corresp. beacon */ } } phtpriv->ht_option = false; if (pregistrypriv->ht_enable) { /* * Added by Albert 2010/06/23 * For the WEP mode, we will use the bg mode to do * the connection to avoid some IOT issue. * Especially for Realtek 8192u SoftAP. */ if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) { /* rtw_restructure_ht_ie */ rtw_restructure_ht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], pnetwork->network.IELength, &psecnetwork->IELength); } } pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->network.IEs, pnetwork->network.IELength); if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_TENDA) padapter->pwrctrlpriv.smart_ps = 0; else padapter->pwrctrlpriv.smart_ps = padapter->registrypriv.smart_ps; DBG_88E("%s: smart_ps =%d\n", __func__, padapter->pwrctrlpriv.smart_ps); pcmd->cmdsz = get_wlan_bssid_ex_sz(psecnetwork);/* get cmdsz before endian conversion */ INIT_LIST_HEAD(&pcmd->list); pcmd->cmdcode = _JoinBss_CMD_;/* GEN_CMD_CODE(_JoinBss) */ pcmd->parmbuf = (unsigned char *)psecnetwork; pcmd->rsp = NULL; pcmd->rspsz = 0; res = rtw_enqueue_cmd(pcmdpriv, pcmd); exit: return res; }
static int netdev_open(struct net_device *pnetdev) { uint status; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - dev_open\n")); DBG_8192C("+871x_drv - drv_open, bup=%d\n", padapter->bup); if(pwrctrlpriv->ps_flag == _TRUE){ padapter->net_closed = _FALSE; goto netdev_open_normal_process; } if(padapter->bup == _FALSE) { padapter->bDriverStopped = _FALSE; padapter->bSurpriseRemoved = _FALSE; padapter->bCardDisableWOHSM = _FALSE; status = rtw_hal_init(padapter); if (status ==_FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("rtl871x_hal_init(): Can't init h/w!\n")); goto netdev_open_error; } DBG_8192C("MAC Address = "MAC_FMT"\n", MAC_ARG(pnetdev->dev_addr)); status=rtw_start_drv_threads(padapter); if(status ==_FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("Initialize driver software resource Failed!\n")); goto netdev_open_error; } if (init_hw_mlme_ext(padapter) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("can't init mlme_ext_priv\n")); goto netdev_open_error; } #ifdef CONFIG_DRVEXT_MODULE init_drvext(padapter); #endif if(padapter->intf_start) { padapter->intf_start(padapter); } #ifdef CONFIG_PROC_DEBUG #ifndef RTK_DMP_PLATFORM rtw_proc_init_one(pnetdev); #endif #endif rtw_led_control(padapter, LED_CTL_NO_LINK); padapter->bup = _TRUE; } padapter->net_closed = _FALSE; _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); if(( pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE ) ||(padapter->pwrctrlpriv.bHWPwrPindetect)) { padapter->pwrctrlpriv.bips_processing = _FALSE; rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); } //netif_carrier_on(pnetdev);//call this func when rtw_joinbss_event_callback return success if(!netif_queue_stopped(pnetdev)) netif_start_queue(pnetdev); else netif_wake_queue(pnetdev); netdev_open_normal_process: RT_TRACE(_module_os_intfs_c_,_drv_info_,("-871x_drv - dev_open\n")); DBG_8192C("-871x_drv - drv_open, bup=%d\n", padapter->bup); return 0; netdev_open_error: padapter->bup = _FALSE; netif_carrier_off(pnetdev); netif_stop_queue(pnetdev); RT_TRACE(_module_os_intfs_c_,_drv_err_,("-871x_drv - dev_open, fail!\n")); DBG_8192C("-871x_drv - drv_open fail, bup=%d\n", padapter->bup); return (-1); }
/* rtw_sitesurvey_cmd(~) ### NOTE:#### (!!!!) MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock */ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num) { u8 res = _FAIL; struct cmd_obj *ph2c; struct sitesurvey_parm *psurveyPara; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if (check_fwstate(pmlmepriv, _FW_LINKED) == true) rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) return _FAIL; psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); if (psurveyPara == NULL) { kfree(ph2c); return _FAIL; } rtw_free_network_queue(padapter, false); RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("%s: flush network queue\n", __func__)); init_h2fwcmd_w_parm_no_rsp(ph2c, psurveyPara, GEN_CMD_CODE(_SiteSurvey)); /* psurveyPara->bsslimit = 48; */ psurveyPara->scan_mode = pmlmepriv->scan_mode; /* prepare ssid list */ if (ssid) { int i; for (i = 0; i < ssid_num && i < RTW_SSID_SCAN_AMOUNT; i++) { if (ssid[i].SsidLength) { memcpy(&psurveyPara->ssid[i], &ssid[i], sizeof(struct ndis_802_11_ssid)); psurveyPara->ssid_num++; } } } /* prepare channel list */ if (ch) { int i; for (i = 0; i < ch_num && i < RTW_CHANNEL_SCAN_AMOUNT; i++) { if (ch[i].hw_value && !(ch[i].flags & RTW_IEEE80211_CHAN_DISABLED)) { memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel)); psurveyPara->ch_num++; } } } set_fwstate(pmlmepriv, _FW_UNDER_SURVEY); res = rtw_enqueue_cmd(pcmdpriv, ph2c); if (res == _SUCCESS) { pmlmepriv->scan_start_time = jiffies; mod_timer(&pmlmepriv->scan_to_timer, jiffies + msecs_to_jiffies(SCANNING_TIMEOUT)); rtw_led_control(padapter, LED_CTL_SITE_SURVEY); pmlmepriv->scan_interval = SCAN_INTERVAL;/* 30*2 sec = 60sec */ } else { _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } return res; }
int _netdev_open(struct net_device *pnetdev) { uint status; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - dev_open\n")); DBG_88E("+88eu_drv - drv_open, bup =%d\n", padapter->bup); if (pwrctrlpriv->ps_flag) { padapter->net_closed = false; goto netdev_open_normal_process; } if (!padapter->bup) { padapter->bDriverStopped = false; padapter->bSurpriseRemoved = false; status = rtw_hal_init(padapter); if (status == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, ("rtl88eu_hal_init(): Can't init h/w!\n")); goto netdev_open_error; } pr_info("MAC Address = %pM\n", pnetdev->dev_addr); status = rtw_start_drv_threads(padapter); if (status == _FAIL) { pr_info("Initialize driver software resource Failed!\n"); goto netdev_open_error; } if (init_hw_mlme_ext(padapter) == _FAIL) { pr_info("can't init mlme_ext_priv\n"); goto netdev_open_error; } if (padapter->intf_start) padapter->intf_start(padapter); rtw_proc_init_one(pnetdev); rtw_led_control(padapter, LED_CTL_NO_LINK); padapter->bup = true; } padapter->net_closed = false; _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); padapter->pwrctrlpriv.bips_processing = false; rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); if (!rtw_netif_queue_stopped(pnetdev)) netif_tx_start_all_queues(pnetdev); else netif_tx_wake_all_queues(pnetdev); netdev_open_normal_process: RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - dev_open\n")); DBG_88E("-88eu_drv - drv_open, bup =%d\n", padapter->bup); return 0; netdev_open_error: padapter->bup = false; netif_carrier_off(pnetdev); netif_tx_stop_all_queues(pnetdev); 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); return -1; }
static int rtw_sdio_suspend(struct device *dev) { struct sdio_func *func =dev_to_sdio_func(dev); struct dvobj_priv *psdpriv = sdio_get_drvdata(func); _adapter *padapter = psdpriv->padapter; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct net_device *pnetdev = padapter->pnetdev; int ret = 0; u32 start_time = rtw_get_current_time(); _func_enter_; DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) { DBG_871X("%s bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", __FUNCTION__ ,padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); goto exit; } pwrpriv->bInSuspend = _TRUE; rtw_cancel_all_timer(padapter); LeaveAllPowerSaveMode(padapter); //padapter->net_closed = _TRUE; //s1. if(pnetdev) { netif_carrier_off(pnetdev); netif_stop_queue(pnetdev); } #ifdef CONFIG_WOWLAN padapter->pwrctrlpriv.bSupportWakeOnWlan=_TRUE; #else //s2. //s2-1. issue rtw_disassoc_cmd to fw disconnect_hdl(padapter, NULL); //rtw_disassoc_cmd(padapter); #endif #ifdef CONFIG_LAYER2_ROAMING_RESUME if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) ) { DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n",__FUNCTION__, pmlmepriv->cur_network.network.Ssid.Ssid, MAC_ARG(pmlmepriv->cur_network.network.MacAddress), pmlmepriv->cur_network.network.Ssid.SsidLength, pmlmepriv->assoc_ssid.SsidLength); pmlmepriv->to_roaming = 1; } #endif //s2-2. indicate disconnect to os rtw_indicate_disconnect(padapter); //s2-3. rtw_free_assoc_resources(padapter, 1); //s2-4. rtw_free_network_queue(padapter, _TRUE); rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_dev_unload(padapter); exit: DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__ , ret, rtw_get_passing_time_ms(start_time)); /*depends on sunxi power control */ #if defined(CONFIG_MMC_SUNXI_POWER_CONTROL) // sunximmc_rescan_card(SDIOID, 0); // rtl8723as_sdio_poweroff(); printk("[rtl8723as] %s: suspend end.\n", __FUNCTION__); #endif _func_exit_; return ret; }
uint rtw_hal_init(_adapter *padapter) { uint status = _SUCCESS; struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); int i; #ifdef CONFIG_DUALMAC_CONCURRENT if(padapter->hw_init_completed == _TRUE) { DBG_871X("rtw_hal_init: hw_init_completed == _TRUE\n"); return status; } // before init mac0, driver must init mac1 first to avoid usb rx error. if((padapter->pbuddy_adapter != NULL) && (padapter->DualMacConcurrent == _TRUE) && (padapter->adapter_type == PRIMARY_ADAPTER)) { if(padapter->pbuddy_adapter->hw_init_completed == _TRUE) { DBG_871X("rtw_hal_init: pbuddy_adapter hw_init_completed == _TRUE\n"); } else { status = padapter->HalFunc.hal_init(padapter->pbuddy_adapter); if(status == _SUCCESS) { padapter->pbuddy_adapter->hw_init_completed = _TRUE; } else { padapter->pbuddy_adapter->hw_init_completed = _FALSE; RT_TRACE(_module_hal_init_c_,_drv_err_,("rtw_hal_init: hal__init fail(pbuddy_adapter)\n")); DBG_871X("rtw_hal_init: hal__init fail(pbuddy_adapter)\n"); return status; } } } #endif status = padapter->HalFunc.hal_init(padapter); if(status == _SUCCESS) { for (i = 0; i<dvobj->iface_nums; i++) dvobj->padapters[i]->hw_init_completed = _TRUE; if (padapter->registrypriv.notch_filter == 1) rtw_hal_notch_filter(padapter, 1); rtw_hal_reset_security_engine(padapter); for (i = 0; i<dvobj->iface_nums; i++) rtw_sec_restore_wep_key(dvobj->padapters[i]); rtw_led_control(padapter, LED_CTL_POWER_ON); init_hw_mlme_ext(padapter); rtw_hal_init_opmode(padapter); #ifdef CONFIG_RF_GAIN_OFFSET rtw_bb_rf_gain_offset(padapter); #endif //CONFIG_RF_GAIN_OFFSET } else { for (i = 0; i<dvobj->iface_nums; i++) dvobj->padapters[i]->hw_init_completed = _FALSE; DBG_871X("rtw_hal_init: hal__init fail\n"); } RT_TRACE(_module_hal_init_c_,_drv_err_,("-rtl871x_hal_init:status=0x%x\n",status)); return status; }
void netdev_br_init(struct net_device *netdev) { struct adapter *adapter = (struct adapter *)rtw_netdev_priv(netdev); rcu_read_lock(); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) if (rcu_dereference(adapter->pnetdev->rx_handler_data)) { #else if (rcu_dereference(adapter->pnetdev->br_port)) { #endif struct net_device *br_netdev; struct net *devnet = NULL; devnet = dev_net(netdev); br_netdev = dev_get_by_name(devnet, CONFIG_BR_EXT_BRNAME); if (br_netdev) { memcpy(adapter->br_mac, br_netdev->dev_addr, ETH_ALEN); dev_put(br_netdev); } else { pr_info("%s()-%d: dev_get_by_name(%s) failed!", __func__, __LINE__, CONFIG_BR_EXT_BRNAME); } } adapter->ethBrExtInfo.addPPPoETag = 1; rcu_read_unlock(); } int _netdev_open(struct net_device *pnetdev) { uint status; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - dev_open\n")); DBG_88E("+88eu_drv - drv_open, bup =%d\n", padapter->bup); if (pwrctrlpriv->ps_flag) { padapter->net_closed = false; goto netdev_open_normal_process; } if (!padapter->bup) { padapter->bDriverStopped = false; padapter->bSurpriseRemoved = false; padapter->bCardDisableWOHSM = false; status = rtw_hal_init(padapter); if (status == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, ("rtl88eu_hal_init(): Can't init h/w!\n")); goto netdev_open_error; } pr_info("MAC Address = %pM\n", pnetdev->dev_addr); status = rtw_start_drv_threads(padapter); if (status == _FAIL) { pr_info("Initialize driver software resource Failed!\n"); goto netdev_open_error; } if (init_hw_mlme_ext(padapter) == _FAIL) { pr_info("can't init mlme_ext_priv\n"); goto netdev_open_error; } if (padapter->intf_start) padapter->intf_start(padapter); rtw_proc_init_one(pnetdev); rtw_led_control(padapter, LED_CTL_NO_LINK); padapter->bup = true; } padapter->net_closed = false; _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); padapter->pwrctrlpriv.bips_processing = false; rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_start_queue(pnetdev); else rtw_netif_wake_queue(pnetdev); netdev_br_init(pnetdev); netdev_open_normal_process: RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - dev_open\n")); DBG_88E("-88eu_drv - drv_open, bup =%d\n", padapter->bup); return 0; netdev_open_error: padapter->bup = false; netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); 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); return -1; }
//extern int rfpwrstate_check(_adapter *padapter); static int netdev_close(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - drv_close\n")); if(padapter->pwrctrlpriv.bInternalAutoSuspend == _TRUE) { //rfpwrstate_check(padapter); if(padapter->pwrctrlpriv.rf_pwrstate == rf_off) padapter->pwrctrlpriv.ps_flag = _TRUE; } padapter->net_closed = _TRUE; /* if(!padapter->hw_init_completed) { DBG_8192C("(1)871x_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); padapter->bDriverStopped = _TRUE; rtw_dev_unload(padapter); } else*/ if(padapter->pwrctrlpriv.rf_pwrstate == rf_on){ DBG_8192C("(2)871x_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); //s1. if(pnetdev) { if (!netif_queue_stopped(pnetdev)) netif_stop_queue(pnetdev); } #ifndef CONFIG_ANDROID //s2. //s2-1. issue rtw_disassoc_cmd to fw rtw_disassoc_cmd(padapter); //s2-2. indicate disconnect to os rtw_indicate_disconnect(padapter); //s2-3. rtw_free_assoc_resources(padapter, 1); //s2-4. rtw_free_network_queue(padapter,_TRUE); #endif // Close LED rtw_led_control(padapter, LED_CTL_POWER_OFF); } #ifdef CONFIG_BR_EXT //if (OPMODE & (WIFI_STATION_STATE | WIFI_ADHOC_STATE)) { //void nat25_db_cleanup(_adapter *priv); nat25_db_cleanup(padapter); } #endif // CONFIG_BR_EXT #ifdef CONFIG_P2P #ifdef CONFIG_IOCTL_CFG80211 if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled == _TRUE) wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = _FALSE; #endif rtw_p2p_enable(padapter, P2P_ROLE_DISABLE); #endif //CONFIG_P2P #ifdef CONFIG_IOCTL_CFG80211 DBG_871X("call rtw_indicate_scan_done when drv_close\n"); rtw_indicate_scan_done(padapter, _TRUE); padapter->rtw_wdev->iftype = NL80211_IFTYPE_MONITOR; //set this at the end #endif RT_TRACE(_module_os_intfs_c_,_drv_info_,("-871x_drv - drv_close\n")); DBG_8192C("-871x_drv - drv_close, bup=%d\n", padapter->bup); return 0; }
int netdev_open23a(struct net_device *pnetdev) { struct rtw_adapter *padapter = netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv; int ret = 0; int status; RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+871x_drv - dev_open\n")); DBG_8723A("+871x_drv - drv_open, bup =%d\n", padapter->bup); mutex_lock(&adapter_to_dvobj(padapter)->hw_init_mutex); pwrctrlpriv = &padapter->pwrctrlpriv; if (pwrctrlpriv->ps_flag) { padapter->net_closed = false; goto netdev_open23a_normal_process; } if (!padapter->bup) { padapter->bDriverStopped = false; padapter->bSurpriseRemoved = false; padapter->bCardDisableWOHSM = false; status = rtw_hal_init23a(padapter); if (status == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, ("rtl871x_hal_init(): Can't init h/w!\n")); goto netdev_open23a_error; } DBG_8723A("MAC Address = "MAC_FMT"\n", MAC_ARG(pnetdev->dev_addr)); if (init_hw_mlme_ext23a(padapter) == _FAIL) { DBG_8723A("can't init mlme_ext_priv\n"); goto netdev_open23a_error; } rtl8723au_inirp_init(padapter); rtw_cfg80211_init_wiphy(padapter); rtw_led_control(padapter, LED_CTL_NO_LINK); padapter->bup = true; } padapter->net_closed = false; mod_timer(&padapter->mlmepriv.dynamic_chk_timer, jiffies + msecs_to_jiffies(2000)); padapter->pwrctrlpriv.bips_processing = false; rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); /* netif_carrier_on(pnetdev);call this func when rtw23a_joinbss_event_cb return success */ if (!rtw_netif_queue_stopped(pnetdev)) netif_tx_start_all_queues(pnetdev); else netif_tx_wake_all_queues(pnetdev); netdev_open23a_normal_process: RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-871x_drv - dev_open\n")); DBG_8723A("-871x_drv - drv_open, bup =%d\n", padapter->bup); exit: mutex_unlock(&adapter_to_dvobj(padapter)->hw_init_mutex); return ret; netdev_open23a_error: padapter->bup = false; netif_carrier_off(pnetdev); netif_tx_stop_all_queues(pnetdev); RT_TRACE(_module_os_intfs_c_, _drv_err_, ("-871x_drv - dev_open, fail!\n")); DBG_8723A("-871x_drv - drv_open fail, bup =%d\n", padapter->bup); ret = -1; goto exit; }