2022-06-08 23:46:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/* Copyright(c) 2007 - 2012 Realtek Corporation. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
#define _RTW_AP_C_
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
#include "../include/osdep_service.h"
|
|
|
|
#include "../include/drv_types.h"
|
|
|
|
#include "../include/wifi.h"
|
|
|
|
#include "../include/ieee80211.h"
|
|
|
|
#include "../include/rtl8188e_cmd.h"
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void init_mlme_ap_info(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
|
|
|
|
2014-11-28 17:14:29 +00:00
|
|
|
spin_lock_init(&pmlmepriv->bcn_update_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* for ACL */
|
2022-06-08 23:46:35 +00:00
|
|
|
rtw_init_queue(&pacl_list->acl_node_q);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
start_ap_mode(padapter);
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void free_mlme_ap_info(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-27 17:51:59 +00:00
|
|
|
struct sta_info *psta = NULL;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
pmlmepriv->update_bcn = false;
|
|
|
|
pmlmeext->bstart_bss = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
rtw_sta_flush(padapter);
|
|
|
|
|
|
|
|
pmlmeinfo->state = _HW_STATE_NOLINK_;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* free_assoc_sta_resources */
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_free_all_stainfo(padapter);
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* free bc/mc sta_info */
|
2013-05-19 04:28:07 +00:00
|
|
|
psta = rtw_get_bcmc_stainfo(padapter);
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_free_stainfo(padapter, psta);
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
static void update_BCNTIM(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
|
|
|
struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;
|
2013-05-19 04:28:07 +00:00
|
|
|
unsigned char *pie = pnetwork_mlmeext->IEs;
|
2022-06-08 23:46:35 +00:00
|
|
|
u8 *p, *dst_ie, *premainder_ie = NULL;
|
|
|
|
u8 *pbackup_remainder_ie = NULL;
|
|
|
|
__le16 tim_bitmap_le;
|
|
|
|
uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* update TIM IE */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen,
|
|
|
|
pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
|
|
|
|
if (p && tim_ielen > 0) {
|
|
|
|
tim_ielen += 2;
|
|
|
|
premainder_ie = p + tim_ielen;
|
|
|
|
tim_ie_offset = (int)(p - pie);
|
|
|
|
remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen;
|
|
|
|
/* append TIM IE from dst_ie offset */
|
|
|
|
dst_ie = p;
|
|
|
|
} else {
|
|
|
|
tim_ielen = 0;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
/* calculate head_len */
|
|
|
|
offset = _FIXED_IE_LENGTH_;
|
|
|
|
offset += pnetwork_mlmeext->Ssid.SsidLength + 2;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
/* get supported rates len */
|
|
|
|
p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_,
|
|
|
|
&tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
|
|
|
|
if (p)
|
|
|
|
offset += tmp_len + 2;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
/* DS Parameter Set IE, len = 3 */
|
|
|
|
offset += 3;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
premainder_ie = pie + offset;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
remainder_ielen = pnetwork_mlmeext->IELength - offset - tim_ielen;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
/* append TIM IE from offset */
|
|
|
|
dst_ie = pie + offset;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if (remainder_ielen > 0) {
|
2022-06-08 23:46:35 +00:00
|
|
|
pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC);
|
2013-05-19 04:28:07 +00:00
|
|
|
if (pbackup_remainder_ie && premainder_ie)
|
2013-10-19 17:45:47 +00:00
|
|
|
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2022-06-08 23:46:35 +00:00
|
|
|
*dst_ie++ = _TIM_IE_;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
if ((pstapriv->tim_bitmap & 0xff00) && (pstapriv->tim_bitmap & 0x00fc))
|
|
|
|
tim_ielen = 5;
|
|
|
|
else
|
|
|
|
tim_ielen = 4;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
*dst_ie++ = tim_ielen;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
*dst_ie++ = 0;/* DTIM count */
|
|
|
|
*dst_ie++ = 1;/* DTIM period */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
if (pstapriv->tim_bitmap & BIT(0))/* for bc/mc frames */
|
|
|
|
*dst_ie++ = BIT(0);/* bitmap ctrl */
|
|
|
|
else
|
|
|
|
*dst_ie++ = 0;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
if (tim_ielen == 4) {
|
|
|
|
*dst_ie++ = *(u8 *)&tim_bitmap_le;
|
|
|
|
} else if (tim_ielen == 5) {
|
|
|
|
memcpy(dst_ie, &tim_bitmap_le, 2);
|
|
|
|
dst_ie += 2;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* copy remainder IE */
|
2013-06-03 19:52:18 +00:00
|
|
|
if (pbackup_remainder_ie) {
|
2013-10-19 17:45:47 +00:00
|
|
|
memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-10-19 17:45:47 +00:00
|
|
|
kfree(pbackup_remainder_ie);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
offset = (uint)(dst_ie - pie);
|
2022-06-08 23:46:35 +00:00
|
|
|
pnetwork_mlmeext->IELength = offset + remainder_ielen;
|
|
|
|
|
|
|
|
set_tx_beacon_cmd(padapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
static u8 chk_sta_is_alive(struct sta_info *psta)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-05-26 03:02:10 +00:00
|
|
|
u8 ret = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if ((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) ==
|
|
|
|
(psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts))
|
|
|
|
;
|
2013-05-19 04:28:07 +00:00
|
|
|
else
|
2013-05-26 03:02:10 +00:00
|
|
|
ret = true;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
sta_update_last_rx_pkts(psta);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void expire_timeout_chk(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-25 14:49:25 +00:00
|
|
|
struct list_head *phead, *plist;
|
2013-10-19 17:45:47 +00:00
|
|
|
u8 updated = 0;
|
2013-07-27 17:51:59 +00:00
|
|
|
struct sta_info *psta = NULL;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
u8 chk_alive_num = 0;
|
|
|
|
char chk_alive_list[NUM_STA];
|
|
|
|
int i;
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->auth_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
phead = &pstapriv->auth_list;
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = phead->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* check auth_queue */
|
2014-12-13 21:06:22 +00:00
|
|
|
while (phead != plist) {
|
2014-12-13 16:40:44 +00:00
|
|
|
psta = container_of(plist, struct sta_info, auth_list);
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = plist->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if (psta->expire_to > 0) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->expire_to--;
|
2013-06-03 19:52:18 +00:00
|
|
|
if (psta->expire_to == 0) {
|
2014-12-13 21:06:22 +00:00
|
|
|
list_del_init(&psta->auth_list);
|
2013-05-19 04:28:07 +00:00
|
|
|
pstapriv->auth_list_cnt--;
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->auth_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_free_stainfo(padapter, psta);
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->auth_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->auth_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
psta = NULL;
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->asoc_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
phead = &pstapriv->asoc_list;
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = phead->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* check asoc_queue */
|
2014-12-13 21:06:22 +00:00
|
|
|
while (phead != plist) {
|
2014-12-13 16:40:44 +00:00
|
|
|
psta = container_of(plist, struct sta_info, asoc_list);
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = plist->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (chk_sta_is_alive(psta) || !psta->expire_to) {
|
|
|
|
psta->expire_to = pstapriv->expire_to;
|
|
|
|
psta->keep_alive_trycnt = 0;
|
|
|
|
psta->under_exist_checking = 0;
|
|
|
|
} else {
|
|
|
|
psta->expire_to--;
|
|
|
|
}
|
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if (psta->expire_to <= 0) {
|
2013-05-19 04:28:07 +00:00
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if (padapter->registrypriv.wifi_spec == 1) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->expire_to = pstapriv->expire_to;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psta->state & WIFI_SLEEP_STATE) {
|
|
|
|
if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE)) {
|
2013-11-29 22:10:20 +00:00
|
|
|
/* to check if alive by another methods if station is at ps mode. */
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->expire_to = pstapriv->expire_to;
|
|
|
|
psta->state |= WIFI_STA_ALIVE_CHK_STATE;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* to update bcn with tim_bitmap for this station */
|
2013-05-19 04:28:07 +00:00
|
|
|
pstapriv->tim_bitmap |= BIT(psta->aid);
|
2013-05-26 03:02:10 +00:00
|
|
|
update_beacon(padapter, _TIM_IE_, NULL, false);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (!pmlmeext->active_keep_alive_check)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pmlmeext->active_keep_alive_check) {
|
|
|
|
int stainfo_offset;
|
|
|
|
|
|
|
|
stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
|
2013-07-27 17:51:59 +00:00
|
|
|
if (stainfo_offset_valid(stainfo_offset))
|
2013-05-19 04:28:07 +00:00
|
|
|
chk_alive_list[chk_alive_num++] = stainfo_offset;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-12-13 21:06:22 +00:00
|
|
|
list_del_init(&psta->asoc_list);
|
2013-05-19 04:28:07 +00:00
|
|
|
pstapriv->asoc_list_cnt--;
|
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
|
2013-06-03 19:52:18 +00:00
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
/* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */
|
2022-06-08 23:46:35 +00:00
|
|
|
if (psta->sleepq_len > (NR_XMITFRAME / pstapriv->asoc_list_cnt) &&
|
|
|
|
padapter->xmitpriv.free_xmitframe_cnt < (NR_XMITFRAME / pstapriv->asoc_list_cnt / 2)) {
|
2013-05-19 04:28:07 +00:00
|
|
|
wakeup_sta_to_xmit(padapter, psta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if (chk_alive_num) {
|
2013-07-27 17:51:59 +00:00
|
|
|
u8 backup_oper_channel = 0;
|
2013-06-03 19:52:18 +00:00
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
/* switch to correct channel of current network before issue keep-alive frames */
|
|
|
|
if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
|
|
|
|
backup_oper_channel = rtw_get_oper_ch(padapter);
|
|
|
|
SelectChannel(padapter, pmlmeext->cur_channel);
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
/* issue null data to check sta alive*/
|
|
|
|
for (i = 0; i < chk_alive_num; i++) {
|
|
|
|
int ret = _FAIL;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if (psta->state & WIFI_SLEEP_STATE)
|
|
|
|
ret = issue_nulldata(padapter, psta->hwaddr, 0, 1, 50);
|
|
|
|
else
|
|
|
|
ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
psta->keep_alive_trycnt++;
|
|
|
|
if (ret == _SUCCESS) {
|
|
|
|
psta->expire_to = pstapriv->expire_to;
|
|
|
|
psta->keep_alive_trycnt = 0;
|
|
|
|
continue;
|
|
|
|
} else if (psta->keep_alive_trycnt <= 3) {
|
|
|
|
psta->expire_to = 1;
|
|
|
|
continue;
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
psta->keep_alive_trycnt = 0;
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->asoc_list_lock);
|
2014-12-13 21:06:22 +00:00
|
|
|
list_del_init(&psta->asoc_list);
|
2013-06-03 19:52:18 +00:00
|
|
|
pstapriv->asoc_list_cnt--;
|
|
|
|
updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
2013-06-03 19:52:18 +00:00
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (backup_oper_channel > 0) /* back to the original operation channel */
|
2013-06-03 19:52:18 +00:00
|
|
|
SelectChannel(padapter, backup_oper_channel);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
associated_clients_update(padapter, updated);
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
int i;
|
2013-07-27 17:51:59 +00:00
|
|
|
u32 init_rate = 0;
|
2013-05-26 03:02:10 +00:00
|
|
|
unsigned char sta_band = 0, raid, shortGIrate = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
unsigned char limit;
|
2013-07-27 17:51:59 +00:00
|
|
|
unsigned int tx_ra_bitmap = 0;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct ht_priv *psta_ht = NULL;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-07-24 02:31:04 +00:00
|
|
|
struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (psta)
|
|
|
|
psta_ht = &psta->htpriv;
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!(psta->state & _FW_LINKED))
|
|
|
|
return;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* b/g mode ra_bitmap */
|
2013-06-03 19:52:18 +00:00
|
|
|
for (i = 0; i < sizeof(psta->bssrateset); i++) {
|
2013-05-19 04:28:07 +00:00
|
|
|
if (psta->bssrateset[i])
|
2022-06-08 23:46:35 +00:00
|
|
|
tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i] & 0x7f);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-07-09 22:38:46 +00:00
|
|
|
/* n mode ra_bitmap */
|
2013-06-03 19:52:18 +00:00
|
|
|
if (psta_ht->ht_option) {
|
2022-06-08 23:46:35 +00:00
|
|
|
limit = 8; /* 1R */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
for (i = 0; i < limit; i++) {
|
2022-06-08 23:46:35 +00:00
|
|
|
if (psta_ht->ht_cap.mcs.rx_mask[i / 8] & BIT(i % 8))
|
|
|
|
tx_ra_bitmap |= BIT(i + 12);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* max short GI rate */
|
2013-05-19 04:28:07 +00:00
|
|
|
shortGIrate = psta_ht->sgi;
|
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (pcur_network->Configuration.DSConfig > 14) {
|
2022-06-08 23:46:35 +00:00
|
|
|
sta_band |= WIRELESS_INVALID;
|
2013-05-19 04:28:07 +00:00
|
|
|
} else {
|
|
|
|
if (tx_ra_bitmap & 0xffff000)
|
|
|
|
sta_band |= WIRELESS_11_24N | WIRELESS_11G | WIRELESS_11B;
|
|
|
|
else if (tx_ra_bitmap & 0xff0)
|
2013-07-27 17:51:59 +00:00
|
|
|
sta_band |= WIRELESS_11G | WIRELESS_11B;
|
2013-05-19 04:28:07 +00:00
|
|
|
else
|
|
|
|
sta_band |= WIRELESS_11B;
|
|
|
|
}
|
|
|
|
|
|
|
|
psta->wireless_mode = sta_band;
|
|
|
|
|
|
|
|
raid = networktype_to_raid(sta_band);
|
2022-06-08 23:46:35 +00:00
|
|
|
init_rate = get_highest_rate_idx(tx_ra_bitmap & 0x0fffffff) & 0x3f;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if (psta->aid < NUM_STA) {
|
2013-05-19 04:28:07 +00:00
|
|
|
u8 arg = 0;
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
arg = psta->mac_id & 0x1f;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
arg |= BIT(7);/* support entry 2~31 */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (shortGIrate)
|
2013-05-19 04:28:07 +00:00
|
|
|
arg |= BIT(5);
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
tx_ra_bitmap |= ((raid << 28) & 0xf0000000);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* bitmap[0:27] = tx_rate_bitmap */
|
|
|
|
/* bitmap[28:31]= Rate Adaptive id */
|
|
|
|
/* arg[0:4] = macid */
|
|
|
|
/* arg[5] = Short GI */
|
2022-06-08 23:46:35 +00:00
|
|
|
rtl8188e_Add_RateATid(padapter, tx_ra_bitmap, arg, rssi_level);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (shortGIrate)
|
2013-05-19 04:28:07 +00:00
|
|
|
init_rate |= BIT(6);
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* set ra_id, init_rate */
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->raid = raid;
|
|
|
|
psta->init_rate = init_rate;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-19 20:32:12 +00:00
|
|
|
void update_bmc_sta(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-27 17:51:59 +00:00
|
|
|
u32 init_rate = 0;
|
2013-05-19 04:28:07 +00:00
|
|
|
unsigned char network_type, raid;
|
|
|
|
int i, supportRateNum = 0;
|
2013-07-27 17:51:59 +00:00
|
|
|
unsigned int tx_ra_bitmap = 0;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-07-24 02:31:04 +00:00
|
|
|
struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_info *psta = rtw_get_bcmc_stainfo(padapter);
|
|
|
|
|
2013-06-03 19:52:18 +00:00
|
|
|
if (psta) {
|
2013-07-09 22:38:46 +00:00
|
|
|
psta->aid = 0;/* default set to 0 */
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->mac_id = psta->aid + 1;
|
|
|
|
|
|
|
|
psta->qos_option = 0;
|
2013-05-26 03:02:10 +00:00
|
|
|
psta->htpriv.ht_option = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
psta->ieee8021x_blocked = 0;
|
|
|
|
|
2014-12-13 04:43:35 +00:00
|
|
|
memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* prepare for add_RATid */
|
2013-07-27 17:51:59 +00:00
|
|
|
supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->SupportedRates);
|
|
|
|
network_type = rtw_check_network_type((u8 *)&pcur_network->SupportedRates, supportRateNum, 1);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-10-19 17:45:47 +00:00
|
|
|
memcpy(psta->bssrateset, &pcur_network->SupportedRates, supportRateNum);
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->bssratelen = supportRateNum;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* b/g mode ra_bitmap */
|
2013-06-03 19:52:18 +00:00
|
|
|
for (i = 0; i < supportRateNum; i++) {
|
2013-05-19 04:28:07 +00:00
|
|
|
if (psta->bssrateset[i])
|
2022-06-08 23:46:35 +00:00
|
|
|
tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i] & 0x7f);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (pcur_network->Configuration.DSConfig > 14) {
|
2022-06-08 23:46:35 +00:00
|
|
|
network_type = WIRELESS_INVALID;
|
2013-05-19 04:28:07 +00:00
|
|
|
} else {
|
2013-07-09 22:38:46 +00:00
|
|
|
/* force to b mode */
|
2013-05-19 04:28:07 +00:00
|
|
|
network_type = WIRELESS_11B;
|
|
|
|
tx_ra_bitmap = 0xf;
|
|
|
|
}
|
|
|
|
|
|
|
|
raid = networktype_to_raid(network_type);
|
2022-06-08 23:46:35 +00:00
|
|
|
init_rate = get_highest_rate_idx(tx_ra_bitmap & 0x0fffffff) & 0x3f;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* ap mode */
|
2022-06-08 23:46:35 +00:00
|
|
|
rtl8188e_SetHalODMVar(padapter, psta, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
u8 arg = 0;
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
arg = psta->mac_id & 0x1f;
|
2013-05-19 04:28:07 +00:00
|
|
|
arg |= BIT(7);
|
2022-06-08 23:46:35 +00:00
|
|
|
tx_ra_bitmap |= ((raid << 28) & 0xf0000000);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* bitmap[0:27] = tx_rate_bitmap */
|
|
|
|
/* bitmap[28:31]= Rate Adaptive id */
|
|
|
|
/* arg[0:4] = macid */
|
|
|
|
/* arg[5] = Short GI */
|
2022-06-08 23:46:35 +00:00
|
|
|
rtl8188e_Add_RateATid(padapter, tx_ra_bitmap, arg, 0);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-07-09 22:38:46 +00:00
|
|
|
/* set ra_id, init_rate */
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->raid = raid;
|
|
|
|
psta->init_rate = init_rate;
|
|
|
|
|
2014-11-19 20:32:12 +00:00
|
|
|
rtw_sta_media_status_rpt(padapter, psta, 1);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&psta->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->state = _FW_LINKED;
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&psta->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* notes: */
|
|
|
|
/* AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode */
|
|
|
|
/* MAC_ID = AID+1 for sta in ap/adhoc mode */
|
|
|
|
/* MAC_ID = 1 for bc/mc for sta/ap/adhoc */
|
|
|
|
/* MAC_ID = 0 for bssid for sta/ap/adhoc */
|
2013-07-27 17:51:59 +00:00
|
|
|
/* CAM_ID = 0~3 for default key, cmd_id = macid + 3, macid = aid+1; */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
|
|
|
|
struct ht_priv *phtpriv_sta = &psta->htpriv;
|
2014-12-13 03:50:54 +00:00
|
|
|
u16 sta_cap_info;
|
|
|
|
u16 ap_cap_info;
|
2013-07-27 15:56:06 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
psta->mac_id = psta->aid + 1;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* ap mode */
|
2022-06-08 23:46:35 +00:00
|
|
|
rtl8188e_SetHalODMVar(padapter, psta, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)
|
2013-05-26 03:02:10 +00:00
|
|
|
psta->ieee8021x_blocked = true;
|
2013-05-19 04:28:07 +00:00
|
|
|
else
|
2013-05-26 03:02:10 +00:00
|
|
|
psta->ieee8021x_blocked = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* update sta's cap */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* ERP */
|
2013-05-19 04:28:07 +00:00
|
|
|
VCS_update(padapter, psta);
|
2013-07-09 22:38:46 +00:00
|
|
|
/* HT related cap */
|
2013-06-03 19:52:18 +00:00
|
|
|
if (phtpriv_sta->ht_option) {
|
2013-07-09 22:38:46 +00:00
|
|
|
/* check if sta supports rx ampdu */
|
2013-05-19 04:28:07 +00:00
|
|
|
phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable;
|
2014-12-13 03:50:54 +00:00
|
|
|
sta_cap_info = le16_to_cpu(phtpriv_sta->ht_cap.cap_info);
|
|
|
|
ap_cap_info = le16_to_cpu(phtpriv_ap->ht_cap.cap_info);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* check if sta support s Short GI */
|
2014-12-13 03:50:54 +00:00
|
|
|
if ((sta_cap_info & ap_cap_info) &
|
2014-12-12 18:15:07 +00:00
|
|
|
(IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40))
|
2013-05-26 03:02:10 +00:00
|
|
|
phtpriv_sta->sgi = true;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* bwmode */
|
2022-06-08 23:46:35 +00:00
|
|
|
if ((sta_cap_info & ap_cap_info) & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
|
2013-05-19 04:28:07 +00:00
|
|
|
phtpriv_sta->bwmode = pmlmeext->cur_bwmode;
|
|
|
|
phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
|
|
|
|
}
|
2013-05-26 03:02:10 +00:00
|
|
|
psta->qos_option = true;
|
2013-06-03 19:52:18 +00:00
|
|
|
} else {
|
2013-05-26 03:02:10 +00:00
|
|
|
phtpriv_sta->ampdu_enable = false;
|
|
|
|
phtpriv_sta->sgi = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20;
|
|
|
|
phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
|
|
|
}
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* Rx AMPDU */
|
|
|
|
send_delba(padapter, 0, psta->hwaddr);/* recipient */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* TX AMPDU */
|
|
|
|
send_delba(padapter, 1, psta->hwaddr);/* originator */
|
|
|
|
phtpriv_sta->agg_enable_bitmap = 0x0;/* reset */
|
|
|
|
phtpriv_sta->candidate_tid_bitmap = 0x0;/* reset */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* todo: init other variables */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-13 04:43:35 +00:00
|
|
|
memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&psta->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->state |= _FW_LINKED;
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&psta->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
static void update_bcn_erpinfo_ie(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
|
|
|
struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network;
|
2013-05-19 04:28:07 +00:00
|
|
|
unsigned char *p, *ie = pnetwork->IEs;
|
|
|
|
u32 len = 0;
|
|
|
|
|
|
|
|
if (!pmlmeinfo->ERP_enable)
|
|
|
|
return;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* parsing ERP_IE */
|
2013-07-27 17:51:59 +00:00
|
|
|
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &len,
|
|
|
|
(pnetwork->IELength - _BEACON_IE_OFFSET_));
|
|
|
|
if (p && len > 0) {
|
|
|
|
struct ndis_802_11_var_ie *pIE = (struct ndis_802_11_var_ie *)p;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (pmlmepriv->num_sta_non_erp == 1)
|
2022-06-08 23:46:35 +00:00
|
|
|
pIE->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT | RTW_ERP_INFO_USE_PROTECTION;
|
2013-05-19 04:28:07 +00:00
|
|
|
else
|
2022-06-08 23:46:35 +00:00
|
|
|
pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT | RTW_ERP_INFO_USE_PROTECTION);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (pmlmepriv->num_sta_no_short_preamble > 0)
|
|
|
|
pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE;
|
|
|
|
else
|
|
|
|
pIE->data[0] &= ~(RTW_ERP_INFO_BARKER_PREAMBLE_MODE);
|
|
|
|
|
|
|
|
ERP_IE_handler(padapter, pIE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
static void update_bcn_wps_ie(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-27 17:51:59 +00:00
|
|
|
u8 *pwps_ie = NULL, *pwps_ie_src;
|
|
|
|
u8 *premainder_ie, *pbackup_remainder_ie = NULL;
|
|
|
|
uint wps_ielen = 0, wps_offset, remainder_ielen;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
|
|
|
struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network;
|
2013-05-19 04:28:07 +00:00
|
|
|
unsigned char *ie = pnetwork->IEs;
|
|
|
|
u32 ielen = pnetwork->IELength;
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
pwps_ie = rtw_get_wps_ie(ie + _FIXED_IE_LENGTH_, ielen - _FIXED_IE_LENGTH_, NULL, &wps_ielen);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
if (!pwps_ie || wps_ielen == 0)
|
2013-05-19 04:28:07 +00:00
|
|
|
return;
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
wps_offset = (uint)(pwps_ie - ie);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
premainder_ie = pwps_ie + wps_ielen;
|
|
|
|
|
|
|
|
remainder_ielen = ielen - wps_offset - wps_ielen;
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (remainder_ielen > 0) {
|
2022-06-08 23:46:35 +00:00
|
|
|
pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC);
|
2013-05-19 04:28:07 +00:00
|
|
|
if (pbackup_remainder_ie)
|
2013-10-19 17:45:47 +00:00
|
|
|
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pwps_ie_src = pmlmepriv->wps_beacon_ie;
|
2022-06-08 23:46:35 +00:00
|
|
|
if (!pwps_ie_src)
|
|
|
|
goto exit;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
|
2022-06-08 23:46:35 +00:00
|
|
|
if ((wps_offset + wps_ielen + 2 + remainder_ielen) <= MAX_IE_SZ) {
|
|
|
|
memcpy(pwps_ie, pwps_ie_src, wps_ielen + 2);
|
|
|
|
pwps_ie += (wps_ielen + 2);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (pbackup_remainder_ie)
|
2013-10-19 17:45:47 +00:00
|
|
|
memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* update IELength */
|
2022-06-08 23:46:35 +00:00
|
|
|
pnetwork->IELength = wps_offset + (wps_ielen + 2) + remainder_ielen;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
exit:
|
|
|
|
kfree(pbackup_remainder_ie);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2022-06-08 23:46:35 +00:00
|
|
|
if (!memcmp(WPS_OUI, oui, 4))
|
2013-05-19 04:28:07 +00:00
|
|
|
update_bcn_wps_ie(padapter);
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
struct mlme_priv *pmlmepriv;
|
|
|
|
struct mlme_ext_priv *pmlmeext;
|
|
|
|
|
|
|
|
if (!padapter)
|
|
|
|
return;
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
pmlmepriv = &padapter->mlmepriv;
|
|
|
|
pmlmeext = &padapter->mlmeextpriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (!pmlmeext->bstart_bss)
|
2013-05-19 04:28:07 +00:00
|
|
|
return;
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pmlmepriv->bcn_update_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
switch (ie_id) {
|
|
|
|
case _TIM_IE_:
|
|
|
|
update_BCNTIM(padapter);
|
|
|
|
break;
|
|
|
|
case _ERPINFO_IE_:
|
|
|
|
update_bcn_erpinfo_ie(padapter);
|
|
|
|
break;
|
|
|
|
case _VENDOR_SPECIFIC_IE_:
|
|
|
|
update_bcn_vendor_spec_ie(padapter, oui);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
pmlmepriv->update_bcn = true;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pmlmepriv->bcn_update_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (tx)
|
|
|
|
set_tx_beacon_cmd(padapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
op_mode
|
2022-06-08 23:46:35 +00:00
|
|
|
Set to 0 (HT pure) under the following conditions
|
2013-05-19 04:28:07 +00:00
|
|
|
- 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
|
|
|
|
in both the primary and the secondary channel
|
|
|
|
Set to 2 if only HT STAs are associated in BSS,
|
|
|
|
however and at least one 20 MHz HT STA is associated
|
|
|
|
Set to 3 (HT mixed mode) when one or more non-HT STAs are associated
|
|
|
|
(currently non-GF HT station is considered as non-HT STA also)
|
|
|
|
*/
|
2013-07-27 01:08:39 +00:00
|
|
|
static int rtw_ht_operation_update(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
u16 cur_op_mode, new_op_mode;
|
|
|
|
int op_mode_changes = 0;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv;
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (pmlmepriv->htpriv.ht_option)
|
2013-05-19 04:28:07 +00:00
|
|
|
return 0;
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) &&
|
|
|
|
pmlmepriv->num_sta_ht_no_gf) {
|
2013-05-19 04:28:07 +00:00
|
|
|
pmlmepriv->ht_op_mode |=
|
|
|
|
HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT;
|
|
|
|
op_mode_changes++;
|
|
|
|
} else if ((pmlmepriv->ht_op_mode &
|
2013-07-27 17:51:59 +00:00
|
|
|
HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) &&
|
2013-05-19 04:28:07 +00:00
|
|
|
pmlmepriv->num_sta_ht_no_gf == 0) {
|
|
|
|
pmlmepriv->ht_op_mode &=
|
|
|
|
~HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT;
|
|
|
|
op_mode_changes++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) &&
|
|
|
|
(pmlmepriv->num_sta_no_ht || pmlmepriv->olbc_ht)) {
|
|
|
|
pmlmepriv->ht_op_mode |= HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT;
|
|
|
|
op_mode_changes++;
|
|
|
|
} else if ((pmlmepriv->ht_op_mode &
|
|
|
|
HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) &&
|
|
|
|
(pmlmepriv->num_sta_no_ht == 0 && !pmlmepriv->olbc_ht)) {
|
|
|
|
pmlmepriv->ht_op_mode &=
|
|
|
|
~HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT;
|
|
|
|
op_mode_changes++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Note: currently we switch to the MIXED op mode if HT non-greenfield
|
|
|
|
* station is associated. Probably it's a theoretical case, since
|
|
|
|
* it looks like all known HT STAs support greenfield.
|
|
|
|
*/
|
|
|
|
new_op_mode = 0;
|
|
|
|
if (pmlmepriv->num_sta_no_ht ||
|
|
|
|
(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT))
|
|
|
|
new_op_mode = OP_MODE_MIXED;
|
2014-12-12 18:15:07 +00:00
|
|
|
else if ((le16_to_cpu(phtpriv_ap->ht_cap.cap_info) &
|
2022-06-08 23:46:35 +00:00
|
|
|
IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
|
2013-07-27 17:51:59 +00:00
|
|
|
pmlmepriv->num_sta_ht_20mhz)
|
2013-05-19 04:28:07 +00:00
|
|
|
new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED;
|
|
|
|
else if (pmlmepriv->olbc_ht)
|
|
|
|
new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS;
|
|
|
|
else
|
|
|
|
new_op_mode = OP_MODE_PURE;
|
|
|
|
|
|
|
|
cur_op_mode = pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_OP_MODE_MASK;
|
|
|
|
if (cur_op_mode != new_op_mode) {
|
|
|
|
pmlmepriv->ht_op_mode &= ~HT_INFO_OPERATION_MODE_OP_MODE_MASK;
|
|
|
|
pmlmepriv->ht_op_mode |= new_op_mode;
|
|
|
|
op_mode_changes++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return op_mode_changes;
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void associated_clients_update(struct adapter *padapter, u8 updated)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2022-06-08 23:46:35 +00:00
|
|
|
/* update associated stations cap. */
|
2013-07-27 17:51:59 +00:00
|
|
|
if (updated) {
|
2013-07-25 14:49:25 +00:00
|
|
|
struct list_head *phead, *plist;
|
2013-07-27 17:51:59 +00:00
|
|
|
struct sta_info *psta = NULL;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->asoc_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
phead = &pstapriv->asoc_list;
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = phead->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* check asoc_queue */
|
2014-12-13 21:06:22 +00:00
|
|
|
while (phead != plist) {
|
2014-12-13 16:40:44 +00:00
|
|
|
psta = container_of(plist, struct sta_info, asoc_list);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = plist->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
VCS_update(padapter, psta);
|
|
|
|
}
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called > TSR LEVEL for USB or SDIO Interface*/
|
2013-07-27 01:08:39 +00:00
|
|
|
void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-05-26 03:02:10 +00:00
|
|
|
u8 beacon_updated = false;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (!(psta->flags & WLAN_STA_SHORT_PREAMBLE)) {
|
|
|
|
if (!psta->no_short_preamble_set) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->no_short_preamble_set = 1;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_no_short_preamble++;
|
|
|
|
|
|
|
|
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
|
2013-07-27 17:51:59 +00:00
|
|
|
(pmlmepriv->num_sta_no_short_preamble == 1)) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, 0xFF, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-27 17:51:59 +00:00
|
|
|
} else {
|
|
|
|
if (psta->no_short_preamble_set) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->no_short_preamble_set = 0;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_no_short_preamble--;
|
|
|
|
|
|
|
|
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
|
2013-07-27 17:51:59 +00:00
|
|
|
(pmlmepriv->num_sta_no_short_preamble == 0)) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, 0xFF, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (psta->flags & WLAN_STA_NONERP) {
|
|
|
|
if (!psta->nonerp_set) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->nonerp_set = 1;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_non_erp++;
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (pmlmepriv->num_sta_non_erp == 1) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, _ERPINFO_IE_, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-27 17:51:59 +00:00
|
|
|
} else {
|
|
|
|
if (psta->nonerp_set) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->nonerp_set = 0;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_non_erp--;
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (pmlmepriv->num_sta_non_erp == 0) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, _ERPINFO_IE_, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT)) {
|
|
|
|
if (!psta->no_short_slot_time_set) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->no_short_slot_time_set = 1;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_no_short_slot_time++;
|
|
|
|
|
|
|
|
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
|
2013-07-27 17:51:59 +00:00
|
|
|
(pmlmepriv->num_sta_no_short_slot_time == 1)) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, 0xFF, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-27 17:51:59 +00:00
|
|
|
} else {
|
|
|
|
if (psta->no_short_slot_time_set) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->no_short_slot_time_set = 0;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_no_short_slot_time--;
|
|
|
|
|
|
|
|
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
|
2013-07-27 17:51:59 +00:00
|
|
|
(pmlmepriv->num_sta_no_short_slot_time == 0)) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, 0xFF, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (psta->flags & WLAN_STA_HT) {
|
2014-12-12 18:15:07 +00:00
|
|
|
u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (psta->no_ht_set) {
|
|
|
|
psta->no_ht_set = 0;
|
|
|
|
pmlmepriv->num_sta_no_ht--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ht_capab & IEEE80211_HT_CAP_GRN_FLD) == 0) {
|
|
|
|
if (!psta->no_ht_gf_set) {
|
|
|
|
psta->no_ht_gf_set = 1;
|
|
|
|
pmlmepriv->num_sta_ht_no_gf++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH_20_40) == 0) {
|
2013-05-19 04:28:07 +00:00
|
|
|
if (!psta->ht_20mhz_set) {
|
|
|
|
psta->ht_20mhz_set = 1;
|
|
|
|
pmlmepriv->num_sta_ht_20mhz++;
|
|
|
|
}
|
|
|
|
}
|
2013-07-27 17:51:59 +00:00
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
if (!psta->no_ht_set) {
|
|
|
|
psta->no_ht_set = 1;
|
|
|
|
pmlmepriv->num_sta_no_ht++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (rtw_ht_operation_update(padapter) > 0) {
|
2013-05-26 03:02:10 +00:00
|
|
|
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, false);
|
|
|
|
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
/* update associated stations cap. */
|
2013-05-19 04:28:07 +00:00
|
|
|
associated_clients_update(padapter, beacon_updated);
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-05-26 03:02:10 +00:00
|
|
|
u8 beacon_updated = false;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
if (!psta)
|
|
|
|
return beacon_updated;
|
|
|
|
|
|
|
|
if (psta->no_short_preamble_set) {
|
|
|
|
psta->no_short_preamble_set = 0;
|
|
|
|
pmlmepriv->num_sta_no_short_preamble--;
|
2013-07-27 17:51:59 +00:00
|
|
|
if (pmlmeext->cur_wireless_mode > WIRELESS_11B &&
|
|
|
|
pmlmepriv->num_sta_no_short_preamble == 0) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, 0xFF, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psta->nonerp_set) {
|
|
|
|
psta->nonerp_set = 0;
|
|
|
|
pmlmepriv->num_sta_non_erp--;
|
2013-07-27 17:51:59 +00:00
|
|
|
if (pmlmepriv->num_sta_non_erp == 0) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, _ERPINFO_IE_, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psta->no_short_slot_time_set) {
|
|
|
|
psta->no_short_slot_time_set = 0;
|
|
|
|
pmlmepriv->num_sta_no_short_slot_time--;
|
2013-07-27 17:51:59 +00:00
|
|
|
if (pmlmeext->cur_wireless_mode > WIRELESS_11B &&
|
|
|
|
pmlmepriv->num_sta_no_short_slot_time == 0) {
|
2013-05-26 03:02:10 +00:00
|
|
|
beacon_updated = true;
|
|
|
|
update_beacon(padapter, 0xFF, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psta->no_ht_gf_set) {
|
|
|
|
psta->no_ht_gf_set = 0;
|
|
|
|
pmlmepriv->num_sta_ht_no_gf--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psta->no_ht_set) {
|
|
|
|
psta->no_ht_set = 0;
|
|
|
|
pmlmepriv->num_sta_no_ht--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psta->ht_20mhz_set) {
|
|
|
|
psta->ht_20mhz_set = 0;
|
|
|
|
pmlmepriv->num_sta_ht_20mhz--;
|
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (rtw_ht_operation_update(padapter) > 0) {
|
2013-05-26 03:02:10 +00:00
|
|
|
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, false);
|
|
|
|
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
/* update associated stations cap. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
return beacon_updated;
|
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
|
|
|
|
bool active, u16 reason)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-05-26 03:02:10 +00:00
|
|
|
u8 beacon_updated = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
|
|
|
|
if (!psta)
|
|
|
|
return beacon_updated;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* tear down Rx AMPDU */
|
|
|
|
send_delba(padapter, 0, psta->hwaddr);/* recipient */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* tear down TX AMPDU */
|
|
|
|
send_delba(padapter, 1, psta->hwaddr);/* originator */
|
|
|
|
psta->htpriv.agg_enable_bitmap = 0x0;/* reset */
|
|
|
|
psta->htpriv.candidate_tid_bitmap = 0x0;/* reset */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (active)
|
2013-05-19 04:28:07 +00:00
|
|
|
issue_deauth(padapter, psta->hwaddr, reason);
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* clear cam entry / key */
|
2013-07-27 17:51:59 +00:00
|
|
|
rtw_clearstakey_cmd(padapter, (u8 *)psta, (u8)(psta->mac_id + 3), true);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&psta->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->state &= ~_FW_LINKED;
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&psta->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-20 18:18:13 +00:00
|
|
|
rtw_indicate_sta_disassoc_event(padapter, psta);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
report_del_sta_event(padapter, psta->hwaddr, reason);
|
|
|
|
|
|
|
|
beacon_updated = bss_cap_update_on_sta_leave(padapter, psta);
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_free_stainfo(padapter, psta);
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
return beacon_updated;
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
int rtw_sta_flush(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-25 14:49:25 +00:00
|
|
|
struct list_head *phead, *plist;
|
2013-07-27 17:51:59 +00:00
|
|
|
int ret = 0;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_info *psta = NULL;
|
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
2013-07-27 17:51:59 +00:00
|
|
|
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE)
|
2013-05-19 04:28:07 +00:00
|
|
|
return ret;
|
|
|
|
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->asoc_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
phead = &pstapriv->asoc_list;
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = phead->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* free sta asoc_queue */
|
2014-12-13 21:06:22 +00:00
|
|
|
while (phead != plist) {
|
2014-12-13 16:40:44 +00:00
|
|
|
psta = container_of(plist, struct sta_info, asoc_list);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = plist->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-13 21:06:22 +00:00
|
|
|
list_del_init(&psta->asoc_list);
|
2013-05-19 04:28:07 +00:00
|
|
|
pstapriv->asoc_list_cnt--;
|
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
|
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
associated_clients_update(padapter, true);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called > TSR LEVEL for USB or SDIO Interface*/
|
2013-07-27 01:08:39 +00:00
|
|
|
void sta_info_update(struct adapter *padapter, struct sta_info *psta)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
int flags = psta->flags;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* update wmm cap. */
|
2022-06-08 23:46:35 +00:00
|
|
|
if (WLAN_STA_WME & flags)
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->qos_option = 1;
|
|
|
|
else
|
|
|
|
psta->qos_option = 0;
|
|
|
|
|
|
|
|
if (pmlmepriv->qospriv.qos_option == 0)
|
|
|
|
psta->qos_option = 0;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* update 802.11n ht cap. */
|
2022-06-08 23:46:35 +00:00
|
|
|
if (WLAN_STA_HT & flags) {
|
2013-05-26 03:02:10 +00:00
|
|
|
psta->htpriv.ht_option = true;
|
2013-05-19 04:28:07 +00:00
|
|
|
psta->qos_option = 1;
|
2013-07-27 17:51:59 +00:00
|
|
|
} else {
|
2013-05-26 03:02:10 +00:00
|
|
|
psta->htpriv.ht_option = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (!pmlmepriv->htpriv.ht_option)
|
2013-05-26 03:02:10 +00:00
|
|
|
psta->htpriv.ht_option = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
update_sta_info_apmode(padapter, psta);
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void start_ap_mode(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
int i;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
pmlmepriv->update_bcn = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
pmlmeext->bstart_bss = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
pmlmepriv->num_sta_non_erp = 0;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_no_short_slot_time = 0;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_no_short_preamble = 0;
|
|
|
|
|
|
|
|
pmlmepriv->num_sta_ht_no_gf = 0;
|
|
|
|
pmlmepriv->num_sta_no_ht = 0;
|
|
|
|
pmlmepriv->num_sta_ht_20mhz = 0;
|
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
pmlmepriv->olbc = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
pmlmepriv->olbc_ht = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
pmlmepriv->ht_op_mode = 0;
|
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
for (i = 0; i < NUM_STA; i++)
|
2013-05-19 04:28:07 +00:00
|
|
|
pstapriv->sta_aid[i] = NULL;
|
|
|
|
|
|
|
|
pmlmepriv->wps_beacon_ie = NULL;
|
|
|
|
pmlmepriv->wps_probe_resp_ie = NULL;
|
|
|
|
pmlmepriv->wps_assoc_resp_ie = NULL;
|
|
|
|
|
|
|
|
pmlmepriv->p2p_beacon_ie = NULL;
|
|
|
|
pmlmepriv->p2p_probe_resp_ie = NULL;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* for ACL */
|
2022-06-08 23:46:35 +00:00
|
|
|
INIT_LIST_HEAD(&pacl_list->acl_node_q.queue);
|
2013-05-19 04:28:07 +00:00
|
|
|
pacl_list->num = 0;
|
|
|
|
pacl_list->mode = 0;
|
2013-07-27 17:51:59 +00:00
|
|
|
for (i = 0; i < NUM_ACL; i++) {
|
2014-12-13 05:13:40 +00:00
|
|
|
INIT_LIST_HEAD(&pacl_list->aclnode[i].list);
|
2013-05-26 03:02:10 +00:00
|
|
|
pacl_list->aclnode[i].valid = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void stop_ap_mode(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-25 14:49:25 +00:00
|
|
|
struct list_head *phead, *plist;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct rtw_wlan_acl_node *paclnode;
|
2013-07-27 17:51:59 +00:00
|
|
|
struct sta_info *psta = NULL;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2022-06-08 23:46:35 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
2013-07-27 17:51:59 +00:00
|
|
|
struct __queue *pacl_node_q = &pacl_list->acl_node_q;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
pmlmepriv->update_bcn = false;
|
|
|
|
pmlmeext->bstart_bss = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* reset and init security priv , this can refine with rtw_reset_securitypriv */
|
2014-12-13 04:43:35 +00:00
|
|
|
memset((unsigned char *)&padapter->securitypriv, 0, sizeof(struct security_priv));
|
2013-05-19 04:28:07 +00:00
|
|
|
padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
|
|
|
|
padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* for ACL */
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pacl_node_q->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
phead = get_list_head(pacl_node_q);
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = phead->next;
|
|
|
|
while (phead != plist) {
|
2014-12-13 16:40:44 +00:00
|
|
|
paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
|
2014-12-13 21:06:22 +00:00
|
|
|
plist = plist->next;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 17:51:59 +00:00
|
|
|
if (paclnode->valid) {
|
2013-05-26 03:02:10 +00:00
|
|
|
paclnode->valid = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-13 21:06:22 +00:00
|
|
|
list_del_init(&paclnode->list);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
pacl_list->num--;
|
|
|
|
}
|
|
|
|
}
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pacl_node_q->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
rtw_sta_flush(padapter);
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* free_assoc_sta_resources */
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_free_all_stainfo(padapter);
|
|
|
|
|
|
|
|
psta = rtw_get_bcmc_stainfo(padapter);
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_lock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_free_stainfo(padapter, psta);
|
2014-11-29 00:42:41 +00:00
|
|
|
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
rtw_init_bcmc_stainfo(padapter);
|
|
|
|
|
|
|
|
rtw_free_mlme_priv_ie_data(pmlmepriv);
|
|
|
|
}
|