rtl8188eu: Fix problem where device is not up on module load

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2018-05-05 14:08:13 -05:00
parent bc8ca96401
commit 0b659bd591
3 changed files with 43 additions and 59 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;i<dvobj->iface_nums;i++)
{
struct net_device *pnetdev = NULL;
if (!dvobj || dvobj->iface_nums == 0)
return;
for (i=0;i<dvobj->iface_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);
}
}