From 0b659bd5918411748dc4966abbbf864b188debc2 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sat, 5 May 2018 14:08:13 -0500 Subject: [PATCH] rtl8188eu: Fix problem where device is not up on module load Signed-off-by: Larry Finger --- hal/usb_halinit.c | 83 +++++++++++++++-------------------------- os_dep/ioctl_cfg80211.c | 2 +- os_dep/os_intfs.c | 17 ++++++--- 3 files changed, 43 insertions(+), 59 deletions(-) diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index 67dcf19..e56c505 100644 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -3149,69 +3149,52 @@ static void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rss struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); if (mac_id >= NUM_STA) /* CAM_SIZE */ - { return; - } psta = pmlmeinfo->FW_sta_info[mac_id].psta; if (psta == NULL) - { return; - } - switch (mac_id) - { - case 0:/* for infra mode */ - supportRateNum = rtw_get_rateset_len(cur_network->SupportedRates); - networkType = judge_network_type(padapter, cur_network->SupportedRates, supportRateNum) & 0xf; - /* pmlmeext->cur_wireless_mode = networkType; */ - raid = networktype_to_raid(networkType); + switch (mac_id) { + case 0:/* for infra mode */ + supportRateNum = rtw_get_rateset_len(cur_network->SupportedRates); + networkType = judge_network_type(padapter, cur_network->SupportedRates, supportRateNum) & 0xf; + /* pmlmeext->cur_wireless_mode = networkType; */ + raid = networktype_to_raid(networkType); - mask = update_supported_rate(cur_network->SupportedRates, supportRateNum); - mask |= (pmlmeinfo->HT_enable)? update_MSC_rate(&(pmlmeinfo->HT_caps)): 0; + mask = update_supported_rate(cur_network->SupportedRates, supportRateNum); + mask |= (pmlmeinfo->HT_enable)? update_MSC_rate(&(pmlmeinfo->HT_caps)): 0; + if (support_short_GI(padapter, &(pmlmeinfo->HT_caps))) + shortGIrate = true; + break; + case 1:/* for broadcast/multicast */ + supportRateNum = rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates); + if (pmlmeext->cur_wireless_mode & WIRELESS_11B) + networkType = WIRELESS_11B; + else + networkType = WIRELESS_11G; + raid = networktype_to_raid(networkType); + mask = update_basic_rate(cur_network->SupportedRates, supportRateNum); + break; + default: /* for each sta in IBSS */ + supportRateNum = rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates); + networkType = judge_network_type(padapter, pmlmeinfo->FW_sta_info[mac_id].SupportedRates, supportRateNum) & 0xf; + /* pmlmeext->cur_wireless_mode = networkType; */ + raid = networktype_to_raid(networkType); + mask = update_supported_rate(cur_network->SupportedRates, supportRateNum); - if (support_short_GI(padapter, &(pmlmeinfo->HT_caps))) - { - shortGIrate = true; - } + /* todo: support HT in IBSS */ - break; - - case 1:/* for broadcast/multicast */ - supportRateNum = rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates); - if (pmlmeext->cur_wireless_mode & WIRELESS_11B) - networkType = WIRELESS_11B; - else - networkType = WIRELESS_11G; - raid = networktype_to_raid(networkType); - mask = update_basic_rate(cur_network->SupportedRates, supportRateNum); - - - break; - - default: /* for each sta in IBSS */ - supportRateNum = rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates); - networkType = judge_network_type(padapter, pmlmeinfo->FW_sta_info[mac_id].SupportedRates, supportRateNum) & 0xf; - /* pmlmeext->cur_wireless_mode = networkType; */ - raid = networktype_to_raid(networkType); - mask = update_supported_rate(cur_network->SupportedRates, supportRateNum); - - /* todo: support HT in IBSS */ - - break; + break; } rate_bitmap = ODM_Get_Rate_Bitmap(&pHalData->odmpriv,mac_id,mask,rssi_level); - pr_info("%s => mac_id:%d, networkType:0x%02x, mask:0x%08x\n\t ==> rssi_level:%d, rate_bitmap:0x%08x\n", - __FUNCTION__,mac_id,networkType,mask,rssi_level,rate_bitmap); - mask &= rate_bitmap; init_rate = get_highest_rate_idx(mask)&0x3f; - if (pHalData->fw_ractrl == true) - { + if (pHalData->fw_ractrl == true) { u8 arg = 0; arg = mac_id&0x1f;/* MACID */ @@ -3231,13 +3214,8 @@ static void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rss RateMask[4] = macId | (bShortGI?0x20:0x00) | 0x80; */ rtl8188e_set_raid_cmd(padapter, mask); - - } - else - { - + } else { #if (RATE_ADAPTIVE_SUPPORT == 1) - ODM_RA_UpdateRateInfo_8188E( &(pHalData->odmpriv), mac_id, @@ -3249,7 +3227,6 @@ static void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rss #endif } - /* set ra_id */ psta->raid = raid; psta->init_rate = init_rate; diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index 1002b4a..7bfd6ff 100644 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -5059,7 +5059,7 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) wdev->wiphy = wiphy; wdev->netdev = pnetdev; /* wdev->iftype = NL80211_IFTYPE_STATION; */ - wdev->iftype = NL80211_IFTYPE_MONITOR; /* for rtw_setopmode_cmd() in cfg80211_rtw_change_iface() */ + wdev->iftype = NL80211_IFTYPE_STATION; /* for rtw_setopmode_cmd() in cfg80211_rtw_change_iface() */ padapter->rtw_wdev = wdev; pnetdev->ieee80211_ptr = wdev; diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index e2a08a3..7d712fa 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -603,25 +603,32 @@ void rtw_unregister_netdevs(struct dvobj_priv *dvobj) { int i; struct adapter *padapter = NULL; + struct net_device *pnetdev = NULL; - for (i=0;iiface_nums;i++) - { - struct net_device *pnetdev = NULL; + if (!dvobj || dvobj->iface_nums == 0) + return; + for (i=0;iiface_nums;i++) { padapter = dvobj->padapters[i]; if (padapter == NULL) continue; pnetdev = padapter->pnetdev; + if (!pnetdev) + continue; - if ((padapter->DriverState != DRIVER_DISAPPEAR) && pnetdev) { + if (padapter->DriverState != DRIVER_DISAPPEAR) { + struct wireless_dev *wdev = padapter->rtw_wdev; + wdev->current_bss = NULL; + pnetdev->reg_state = NETREG_REGISTERED; unregister_netdev(pnetdev); /* will call netdev_close() */ rtw_proc_remove_one(pnetdev); } - rtw_wdev_unregister(padapter->rtw_wdev); + if (padapter->rtw_wdev) + rtw_wdev_unregister(padapter->rtw_wdev); } }