diff options
Diffstat (limited to 'drivers/staging/r8188eu/core/rtw_ap.c')
-rw-r--r-- | drivers/staging/r8188eu/core/rtw_ap.c | 607 |
1 files changed, 8 insertions, 599 deletions
diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c index 1c07ad28b242..c78feeb9c862 100644 --- a/drivers/staging/r8188eu/core/rtw_ap.c +++ b/drivers/staging/r8188eu/core/rtw_ap.c @@ -7,8 +7,7 @@ #include "../include/drv_types.h" #include "../include/wifi.h" #include "../include/ieee80211.h" - -#ifdef CONFIG_88EU_AP_MODE +#include "../include/rtl8188e_cmd.h" void init_mlme_ap_info(struct adapter *padapter) { @@ -19,7 +18,7 @@ void init_mlme_ap_info(struct adapter *padapter) spin_lock_init(&pmlmepriv->bcn_update_lock); /* for ACL */ - _rtw_init_queue(&pacl_list->acl_node_q); + rtw_init_queue(&pacl_list->acl_node_q); start_ap_mode(padapter); } @@ -343,7 +342,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) } /* n mode ra_bitmap */ if (psta_ht->ht_option) { - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + GetHwReg8188EU(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); if (rf_type == RF_2T2R) limit = 16;/* 2R */ else @@ -393,7 +392,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) /* bitmap[28:31]= Rate Adaptive id */ /* arg[0:4] = macid */ /* arg[5] = Short GI */ - rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, rssi_level); + rtl8188e_Add_RateATid(padapter, tx_ra_bitmap, arg, rssi_level); if (shortGIrate) init_rate |= BIT(6); @@ -453,7 +452,7 @@ void update_bmc_sta(struct adapter *padapter) init_rate = get_highest_rate_idx(tx_ra_bitmap & 0x0fffffff) & 0x3f; /* ap mode */ - rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, true); + rtl8188e_SetHalODMVar(padapter, HAL_ODM_STA_INFO, psta, true); { u8 arg = 0; @@ -467,7 +466,7 @@ void update_bmc_sta(struct adapter *padapter) /* bitmap[28:31]= Rate Adaptive id */ /* arg[0:4] = macid */ /* arg[5] = Short GI */ - rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, 0); + rtl8188e_Add_RateATid(padapter, tx_ra_bitmap, arg, 0); } /* set ra_id, init_rate */ psta->raid = raid; @@ -505,7 +504,7 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) DBG_88E("%s\n", __func__); /* ap mode */ - rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, true); + rtl8188e_SetHalODMVar(padapter, HAL_ODM_STA_INFO, psta, true); if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) psta->ieee8021x_blocked = true; @@ -558,550 +557,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) spin_unlock_bh(&psta->lock); } -static void update_hw_ht_param(struct adapter *padapter) -{ - unsigned char max_AMPDU_len; - unsigned char min_MPDU_spacing; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - - DBG_88E("%s\n", __func__); - - /* handle A-MPDU parameter field */ - /* - AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k - AMPDU_para [4:2]:Min MPDU Start Spacing - */ - max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03; - - min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2; - - rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing)); - - rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len)); - - /* */ - /* Config SM Power Save setting */ - /* */ - pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2; - if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) - DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__); -} - -static void start_bss_network(struct adapter *padapter, u8 *pbuf) -{ - u8 *p; - u8 val8, cur_channel, cur_bwmode, cur_ch_offset; - u16 bcn_interval; - u32 acparm; - int ie_len; - struct registry_priv *pregpriv = &padapter->registrypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network; - struct HT_info_element *pht_info = NULL; -#ifdef CONFIG_88EU_P2P - struct wifidirect_info *pwdinfo = &padapter->wdinfo; -#endif /* CONFIG_88EU_P2P */ - - bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod; - cur_channel = pnetwork->Configuration.DSConfig; - cur_bwmode = HT_CHANNEL_WIDTH_20; - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - - /* check if there is wps ie, */ - /* if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd, */ - /* and at first time the security ie (RSN/WPA IE) will not include in beacon. */ - if (!rtw_get_wps_ie(pnetwork->IEs + _FIXED_IE_LENGTH_, pnetwork->IELength - _FIXED_IE_LENGTH_, NULL, NULL)) - pmlmeext->bstart_bss = true; - - /* todo: update wmm, ht cap */ - if (pmlmepriv->qospriv.qos_option) - pmlmeinfo->WMM_enable = true; - if (pmlmepriv->htpriv.ht_option) { - pmlmeinfo->WMM_enable = true; - pmlmeinfo->HT_enable = true; - - update_hw_ht_param(padapter); - } - - if (pmlmepriv->cur_network.join_res != true) { /* setting only at first time */ - /* WEP Key will be set before this function, do not clear CAM. */ - if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && - (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_)) - flush_all_cam_entry(padapter); /* clear CAM */ - } - - /* set MSR to AP_Mode */ - Set_MSR(padapter, _HW_STATE_AP_); - - /* Set BSSID REG */ - rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pnetwork->MacAddress); - - /* Set EDCA param reg */ - acparm = 0x002F3217; /* VO */ - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acparm)); - acparm = 0x005E4317; /* VI */ - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acparm)); - acparm = 0x005ea42b; - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acparm)); - acparm = 0x0000A444; /* BK */ - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm)); - - /* Set Security */ - val8 = (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) ? 0xcc : 0xcf; - rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); - - /* Beacon Control related register */ - rtw_hal_set_hwreg(padapter, HW_VAR_BEACON_INTERVAL, (u8 *)(&bcn_interval)); - - UpdateBrateTbl(padapter, pnetwork->SupportedRates); - rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates); - - if (!pmlmepriv->cur_network.join_res) { /* setting only at first time */ - /* turn on all dynamic functions */ - Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, true); - } - /* set channel, bwmode */ - p = rtw_get_ie((pnetwork->IEs + sizeof(struct ndis_802_11_fixed_ie)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(struct ndis_802_11_fixed_ie))); - if (p && ie_len) { - pht_info = (struct HT_info_element *)(p + 2); - - if ((pregpriv->cbw40_enable) && (pht_info->infos[0] & BIT(2))) { - /* switch to the 40M Hz mode */ - cur_bwmode = HT_CHANNEL_WIDTH_40; - switch (pht_info->infos[0] & 0x3) { - case 1: - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; - break; - case 3: - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; - break; - default: - cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - break; - } - } - } - /* TODO: need to judge the phy parameters on concurrent mode for single phy */ - set_channel_bwmode(padapter, cur_channel, cur_ch_offset, cur_bwmode); - - DBG_88E("CH =%d, BW =%d, offset =%d\n", cur_channel, cur_bwmode, cur_ch_offset); - - /* */ - pmlmeext->cur_channel = cur_channel; - pmlmeext->cur_bwmode = cur_bwmode; - pmlmeext->cur_ch_offset = cur_ch_offset; - pmlmeext->cur_wireless_mode = pmlmepriv->cur_network.network_type; - - /* update cur_wireless_mode */ - update_wireless_mode(padapter); - - /* udpate capability after cur_wireless_mode updated */ - update_capinfo(padapter, rtw_get_capability((struct wlan_bssid_ex *)pnetwork)); - - /* let pnetwork_mlmeext == pnetwork_mlme. */ - memcpy(pnetwork_mlmeext, pnetwork, pnetwork->Length); - -#ifdef CONFIG_88EU_P2P - memcpy(pwdinfo->p2p_group_ssid, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength); - pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength; -#endif /* CONFIG_88EU_P2P */ - - if (pmlmeext->bstart_bss) { - update_beacon(padapter, _TIM_IE_, NULL, false); - - /* issue beacon frame */ - if (send_beacon(padapter) == _FAIL) - DBG_88E("issue_beacon, fail!\n"); - } - - /* update bc/mc sta_info */ - update_bmc_sta(padapter); -} - -int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) -{ - int ret = _SUCCESS; - u8 *p; - u8 *pHT_caps_ie = NULL; - u8 *pHT_info_ie = NULL; - struct sta_info *psta = NULL; - u16 cap, ht_cap = false; - uint ie_len = 0; - int group_cipher, pairwise_cipher; - u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX]; - int supportRateNum = 0; - u8 OUI1[] = {0x00, 0x50, 0xf2, 0x01}; - u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct wlan_bssid_ex *pbss_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network; - u8 *ie = pbss_network->IEs; - - /* SSID */ - /* Supported rates */ - /* DS Params */ - /* WLAN_EID_COUNTRY */ - /* ERP Information element */ - /* Extended supported rates */ - /* WPA/WPA2 */ - /* Wi-Fi Wireless Multimedia Extensions */ - /* ht_capab, ht_oper */ - /* WPS IE */ - - DBG_88E("%s, len =%d\n", __func__, len); - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return _FAIL; - - if (len > MAX_IE_SZ) - return _FAIL; - - pbss_network->IELength = len; - - memset(ie, 0, MAX_IE_SZ); - - memcpy(ie, pbuf, pbss_network->IELength); - - if (pbss_network->InfrastructureMode != Ndis802_11APMode) - return _FAIL; - - pbss_network->Rssi = 0; - - memcpy(pbss_network->MacAddress, myid(&padapter->eeprompriv), ETH_ALEN); - - /* beacon interval */ - p = rtw_get_beacon_interval_from_ie(ie);/* 8: TimeStamp, 2: Beacon Interval 2:Capability */ - pbss_network->Configuration.BeaconPeriod = get_unaligned_le16(p); - - /* capability */ - cap = get_unaligned_le16(ie); - - /* SSID */ - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if (p && ie_len > 0) { - memset(&pbss_network->Ssid, 0, sizeof(struct ndis_802_11_ssid)); - memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len); - pbss_network->Ssid.SsidLength = ie_len; - } - - /* channel */ - channel = 0; - pbss_network->Configuration.Length = 0; - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _DSSET_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if (p && ie_len > 0) - channel = *(p + 2); - - pbss_network->Configuration.DSConfig = channel; - - memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX); - /* get supported rates */ - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if (p) { - memcpy(supportRate, p + 2, ie_len); - supportRateNum = ie_len; - } - - /* get ext_supported rates */ - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_); - if (p) { - memcpy(supportRate + supportRateNum, p + 2, ie_len); - supportRateNum += ie_len; - } - - network_type = rtw_check_network_type(supportRate, supportRateNum, channel); - - rtw_set_supported_rate(pbss_network->SupportedRates, network_type); - - /* parsing ERP_IE */ - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if (p && ie_len > 0) - ERP_IE_handler(padapter, (struct ndis_802_11_var_ie *)p); - - /* update privacy/security */ - if (cap & BIT(4)) - pbss_network->Privacy = 1; - else - pbss_network->Privacy = 0; - - psecuritypriv->wpa_psk = 0; - - /* wpa2 */ - group_cipher = 0; - pairwise_cipher = 0; - psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_; - psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_; - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if (p && ie_len > 0) { - if (rtw_parse_wpa2_ie(p, ie_len + 2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - - psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */ - psecuritypriv->wpa_psk |= BIT(1); - - psecuritypriv->wpa2_group_cipher = group_cipher; - psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher; - } - } - /* wpa */ - ie_len = 0; - group_cipher = 0; - pairwise_cipher = 0; - psecuritypriv->wpa_group_cipher = _NO_PRIVACY_; - psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_; - for (p = ie + _BEACON_IE_OFFSET_;; p += (ie_len + 2)) { - p = rtw_get_ie(p, _SSN_IE_1_, &ie_len, - (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); - if ((p) && (!memcmp(p + 2, OUI1, 4))) { - if (rtw_parse_wpa_ie(p, ie_len + 2, &group_cipher, - &pairwise_cipher, NULL) == _SUCCESS) { - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - - psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */ - - psecuritypriv->wpa_psk |= BIT(0); - - psecuritypriv->wpa_group_cipher = group_cipher; - psecuritypriv->wpa_pairwise_cipher = pairwise_cipher; - } - break; - } - if (!p || ie_len == 0) - break; - } - - /* wmm */ - ie_len = 0; - pmlmepriv->qospriv.qos_option = 0; - if (pregistrypriv->wmm_enable) { - for (p = ie + _BEACON_IE_OFFSET_;; p += (ie_len + 2)) { - p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, - (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); - if ((p) && !memcmp(p + 2, WMM_PARA_IE, 6)) { - pmlmepriv->qospriv.qos_option = 1; - - *(p + 8) |= BIT(7);/* QoS Info, support U-APSD */ - - /* disable all ACM bits since the WMM admission control is not supported */ - *(p + 10) &= ~BIT(4); /* BE */ - *(p + 14) &= ~BIT(4); /* BK */ - *(p + 18) &= ~BIT(4); /* VI */ - *(p + 22) &= ~BIT(4); /* VO */ - break; - } - - if (!p || ie_len == 0) - break; - } - } - /* parsing HT_CAP_IE */ - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, - (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if (p && ie_len > 0) { - u8 rf_type; - struct ieee80211_ht_cap *pht_cap = (struct ieee80211_ht_cap *)(p + 2); - - pHT_caps_ie = p; - ht_cap = true; - network_type |= WIRELESS_11_24N; - - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - - if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) || - (psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) - pht_cap->ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_DENSITY & (0x07 << 2)); - else - pht_cap->ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_DENSITY & 0x00); - - /* set Max Rx AMPDU size to 64K */ - pht_cap->ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_FACTOR & 0x03); - - if (rf_type == RF_1T1R) { - pht_cap->mcs.rx_mask[0] = 0xff; - pht_cap->mcs.rx_mask[1] = 0x0; - } - memcpy(&pmlmepriv->htpriv.ht_cap, p + 2, ie_len); - } - - /* parsing HT_INFO_IE */ - p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, - (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if (p && ie_len > 0) - pHT_info_ie = p; - switch (network_type) { - case WIRELESS_11B: - pbss_network->NetworkTypeInUse = Ndis802_11DS; - break; - case WIRELESS_11G: - case WIRELESS_11BG: - case WIRELESS_11G_24N: - case WIRELESS_11BG_24N: - pbss_network->NetworkTypeInUse = Ndis802_11OFDM24; - break; - default: - pbss_network->NetworkTypeInUse = Ndis802_11OFDM24; - break; - } - - pmlmepriv->cur_network.network_type = network_type; - - pmlmepriv->htpriv.ht_option = false; - - if ((psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_TKIP) || - (psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_TKIP)) { - /* todo: */ - /* ht_cap = false; */ - } - - /* ht_cap */ - if (pregistrypriv->ht_enable && ht_cap) { - pmlmepriv->htpriv.ht_option = true; - pmlmepriv->qospriv.qos_option = 1; - - if (pregistrypriv->ampdu_enable == 1) - pmlmepriv->htpriv.ampdu_enable = true; - HT_caps_handler(padapter, (struct ndis_802_11_var_ie *)pHT_caps_ie); - - HT_info_handler(padapter, (struct ndis_802_11_var_ie *)pHT_info_ie); - } - - pbss_network->Length = get_wlan_bssid_ex_sz((struct wlan_bssid_ex *)pbss_network); - - /* issue beacon to start bss network */ - start_bss_network(padapter, (u8 *)pbss_network); - - /* alloc sta_info for ap itself */ - psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress); - if (!psta) { - psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress); - if (!psta) - return _FAIL; - } - - /* fix bug of flush_cam_entry at STOP AP mode */ - psta->state |= WIFI_AP_STATE; - rtw_indicate_connect(padapter); - pmlmepriv->cur_network.join_res = true;/* for check if already set beacon */ - return ret; -} - -void rtw_set_macaddr_acl(struct adapter *padapter, int mode) -{ - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - - DBG_88E("%s, mode =%d\n", __func__, mode); - - pacl_list->mode = mode; -} - -int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) -{ - struct list_head *plist, *phead; - u8 added = false; - int i, ret = 0; - struct rtw_wlan_acl_node *paclnode; - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - struct __queue *pacl_node_q = &pacl_list->acl_node_q; - - DBG_88E("%s(acl_num =%d) =%pM\n", __func__, pacl_list->num, (addr)); - - if ((NUM_ACL - 1) < pacl_list->num) - return -1; - - spin_lock_bh(&pacl_node_q->lock); - - phead = get_list_head(pacl_node_q); - plist = phead->next; - - while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - plist = plist->next; - - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { - if (paclnode->valid) { - added = true; - DBG_88E("%s, sta has been added\n", __func__); - break; - } - } - } - - spin_unlock_bh(&pacl_node_q->lock); - - if (added) - return ret; - - spin_lock_bh(&pacl_node_q->lock); - - for (i = 0; i < NUM_ACL; i++) { - paclnode = &pacl_list->aclnode[i]; - - if (!paclnode->valid) { - INIT_LIST_HEAD(&paclnode->list); - - memcpy(paclnode->addr, addr, ETH_ALEN); - - paclnode->valid = true; - - list_add_tail(&paclnode->list, get_list_head(pacl_node_q)); - - pacl_list->num++; - - break; - } - } - - DBG_88E("%s, acl_num =%d\n", __func__, pacl_list->num); - - spin_unlock_bh(&pacl_node_q->lock); - - return ret; -} - -int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) -{ - struct list_head *plist, *phead; - int ret = 0; - struct rtw_wlan_acl_node *paclnode; - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - struct __queue *pacl_node_q = &pacl_list->acl_node_q; - - DBG_88E("%s(acl_num =%d) =%pM\n", __func__, pacl_list->num, (addr)); - - spin_lock_bh(&pacl_node_q->lock); - - phead = get_list_head(pacl_node_q); - plist = phead->next; - - while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - plist = plist->next; - - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { - if (paclnode->valid) { - paclnode->valid = false; - - list_del_init(&paclnode->list); - - pacl_list->num--; - } - } - } - - spin_unlock_bh(&pacl_node_q->lock); - - DBG_88E("%s, acl_num =%d\n", __func__, pacl_list->num); - return ret; -} - static void update_bcn_fixed_ie(struct adapter *padapter) { DBG_88E("%s\n", __func__); @@ -1289,7 +744,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) /* op_mode -Set to 0 (HT pure) under the followign conditions +Set to 0 (HT pure) under the following conditions - all STAs in the BSS are 20/40 MHz HT in 20/40 MHz BSS or - all STAs in the BSS are 20 MHz HT in 20 MHz BSS Set to 1 (HT non-member protection) if there may be non-HT STAs @@ -1633,41 +1088,6 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, return beacon_updated; } -int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) -{ - struct list_head *phead, *plist; - int ret = 0; - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE) - return ret; - - DBG_88E(FUNC_NDEV_FMT" with ch:%u, offset:%u\n", - FUNC_NDEV_ARG(padapter->pnetdev), new_ch, ch_offset); - - spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - plist = phead->next; - - /* for each sta in asoc_queue */ - while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - plist = plist->next; - - issue_action_spct_ch_switch(padapter, psta->hwaddr, new_ch, ch_offset); - psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); - - issue_action_spct_ch_switch(padapter, bc_addr, new_ch, ch_offset); - - return ret; -} - int rtw_sta_flush(struct adapter *padapter) { struct list_head *phead, *plist; @@ -1736,15 +1156,6 @@ void sta_info_update(struct adapter *padapter, struct sta_info *psta) update_sta_info_apmode(padapter, psta); } -/* called >= TSR LEVEL for USB or SDIO Interface*/ -void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta) -{ - if (psta->state & _FW_LINKED) { - /* add ratid */ - add_RATid(padapter, psta, 0);/* DM_RATR_STA_INIT */ - } -} - void start_ap_mode(struct adapter *padapter) { int i; @@ -1846,5 +1257,3 @@ void stop_ap_mode(struct adapter *padapter) rtw_free_mlme_priv_ie_data(pmlmepriv); } - -#endif /* CONFIG_88EU_AP_MODE */ |