static int netdev_open(struct net_device *pnetdev) { uint status; _adapter *padapter = (_adapter *)netdev_priv(pnetdev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - dev_open\n")); printk("+8192cu_drv - drv_open, bup=%d\n", padapter->bup); 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; } if ( rtw_initmac == NULL ) // Use the mac address stored in the Efuse { _rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); } else { // Use the user specifiy mac address. // Commented by Albert 2010/07/19 // The "myid" function will get the wifi mac address from eeprompriv structure instead of netdev structure. // So, we have to overwrite the mac_addr stored in the eeprompriv structure. // In this case, the real mac address won't be used anymore. // So that, the eeprompriv.mac_addr should store the mac which users specify. _rtw_memcpy( padapter->eeprompriv.mac_addr, pnetdev->dev_addr, ETH_ALEN ); } printk("MAC Address = %x-%x-%x-%x-%x-%x\n", pnetdev->dev_addr[0], pnetdev->dev_addr[1], pnetdev->dev_addr[2], pnetdev->dev_addr[3], pnetdev->dev_addr[4], pnetdev->dev_addr[5]); 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_mlme_ext_priv(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 #ifdef CONFIG_USB_HCI if(pHalData->hal_ops.inirp_init == NULL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("Initialize dvobjpriv.inirp_init error!!!\n")); goto netdev_open_error; } else { pHalData->hal_ops.inirp_init(padapter); } #endif #ifdef CONFIG_PROC_DEBUG rtw_proc_init_one(pnetdev); #endif padapter->bup = _TRUE; padapter->ledpriv.LedControlHandler(padapter, LED_CTL_POWER_ON); } padapter->net_closed = _FALSE; if(( pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE ) ||(padapter->pwrctrlpriv.bHWPwrPindetect)) { padapter->pwrctrlpriv.bips_processing = _FALSE; _set_timer(&padapter->pwrctrlpriv.pwr_state_check_timer, padapter->pwrctrlpriv.pwr_state_check_inverval); } //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); RT_TRACE(_module_os_intfs_c_,_drv_info_,("-871x_drv - dev_open\n")); printk("-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")); printk("-871x_drv - drv_open fail, bup=%d\n", padapter->bup); return (-1); }
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); }
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 u8 _rtw_mi_start_drv_threads(_adapter *adapter, void *data) { rtw_start_drv_threads(adapter); return _TRUE; }
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; }
int _netdev_open(struct net_device *ndev) { uint status; struct rtl_priv *rtlpriv = rtl_priv(ndev); struct pwrctrl_priv *pwrctrlpriv = &rtlpriv->pwrctrlpriv; DBG_871X("+871x_drv - drv_open, bup=%d\n", rtlpriv->bup); if (pwrctrlpriv->ps_flag == _TRUE) { rtlpriv->net_closed = _FALSE; goto netdev_open_normal_process; } if (rtlpriv->bup == _FALSE) { rtlpriv->bDriverStopped = _FALSE; rtlpriv->bSurpriseRemoved = _FALSE; rtlpriv->bCardDisableWOHSM = _FALSE; status = rtw_hal_init(rtlpriv); if (status == _FAIL) { goto netdev_open_error; } DBG_871X("MAC Address = "MAC_FMT"\n", MAC_ARG(ndev->dev_addr)); status = rtw_start_drv_threads(rtlpriv); if (status == _FAIL) { DBG_871X("Initialize driver software resource Failed!\n"); goto netdev_open_error; } if (init_hw_mlme_ext(rtlpriv) == _FAIL) { DBG_871X("can't init mlme_ext_priv\n"); goto netdev_open_error; } if (rtlpriv->intf_start) { rtlpriv->intf_start(rtlpriv); } rtw_hal_led_control(rtlpriv, LED_CTL_NO_LINK); rtlpriv->bup = _TRUE; } rtlpriv->net_closed = _FALSE; _set_timer(&rtlpriv->mlmepriv.dynamic_chk_timer, 2000); rtlpriv->pwrctrlpriv.bips_processing = _FALSE; rtw_set_pwr_state_check_timer(&rtlpriv->pwrctrlpriv); /* * netif_carrier_on(ndev);//call this func when rtw_joinbss_event_callback return success */ if (!rtw_netif_queue_stopped(ndev)) rtw_netif_start_queue(ndev); else rtw_netif_wake_queue(ndev); netdev_open_normal_process: DBG_871X("-871x_drv - drv_open, bup=%d\n", rtlpriv->bup); return 0; netdev_open_error: rtlpriv->bup = _FALSE; netif_carrier_off(ndev); rtw_netif_stop_queue(ndev); DBG_871X("-871x_drv - drv_open fail, bup=%d\n", rtlpriv->bup); return (-1); }
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); }