2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
2014-12-19 06:59:46 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
#define _RTW_STA_MGT_C_
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#include <drv_conf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
#include <recv_osdep.h>
|
|
|
|
#include <xmit_osdep.h>
|
|
|
|
#include <mlme_osdep.h>
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <sta_info.h>
|
|
|
|
|
2015-08-15 04:12:02 +00:00
|
|
|
static void _rtw_init_stainfo(struct sta_info *psta)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-02-19 20:58:09 +00:00
|
|
|
memset((u8 *)psta, 0, sizeof (struct sta_info));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-03-10 16:18:03 +00:00
|
|
|
spin_lock_init(&psta->lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_init_listhead(&psta->list);
|
|
|
|
_rtw_init_listhead(&psta->hash_list);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_init_queue(&psta->sleep_q);
|
|
|
|
psta->sleepq_len = 0;
|
|
|
|
|
|
|
|
_rtw_init_sta_xmit_priv(&psta->sta_xmitpriv);
|
|
|
|
_rtw_init_sta_recv_priv(&psta->sta_recvpriv);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_AP_MODE
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_rtw_init_listhead(&psta->asoc_list);
|
|
|
|
|
|
|
|
_rtw_init_listhead(&psta->auth_list);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->expire_to = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->flags = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->capability = 0;
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
psta->bpairwise_key_installed = false;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
psta->nonerp_set = 0;
|
|
|
|
psta->no_short_slot_time_set = 0;
|
|
|
|
psta->no_short_preamble_set = 0;
|
|
|
|
psta->no_ht_gf_set = 0;
|
|
|
|
psta->no_ht_set = 0;
|
|
|
|
psta->ht_20mhz_set = 0;
|
|
|
|
|
|
|
|
psta->under_exist_checking = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->keep_alive_trycnt = 0;
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
#endif /* CONFIG_AP_MODE */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef DBG_TRX_STA_PKTS
|
2014-12-11 21:15:04 +00:00
|
|
|
psta->tx_be_cnt = 0;
|
|
|
|
psta->tx_bk_cnt = 0;
|
|
|
|
psta->tx_vi_cnt = 0;
|
|
|
|
psta->tx_vo_cnt = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
psta->rx_be_cnt = 0;
|
|
|
|
psta->rx_bk_cnt = 0;
|
|
|
|
psta->rx_vi_cnt = 0;
|
|
|
|
psta->rx_vo_cnt = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
|
|
|
|
{
|
|
|
|
struct sta_info *psta;
|
|
|
|
s32 i;
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pstapriv->pallocated_stainfo_buf = rtw_zvmalloc (sizeof(struct sta_info) * NUM_STA+ 4);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!pstapriv->pallocated_stainfo_buf)
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
|
2014-12-11 21:15:04 +00:00
|
|
|
((SIZE_PTR)(pstapriv->pallocated_stainfo_buf ) & 3);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_rtw_init_queue(&pstapriv->free_sta_queue);
|
|
|
|
|
2015-03-05 20:42:30 +00:00
|
|
|
spin_lock_init(&pstapriv->sta_hash_lock);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pstapriv->asoc_sta_count = 0;
|
|
|
|
_rtw_init_queue(&pstapriv->sleep_q);
|
|
|
|
_rtw_init_queue(&pstapriv->wakeup_q);
|
|
|
|
|
|
|
|
psta = (struct sta_info *)(pstapriv->pstainfo_buf);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-16 13:54:18 +00:00
|
|
|
for(i = 0; i < NUM_STA; i++) {
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_init_stainfo(psta);
|
|
|
|
|
|
|
|
_rtw_init_listhead(&(pstapriv->sta_hash[i]));
|
|
|
|
|
|
|
|
rtw_list_insert_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue));
|
|
|
|
|
|
|
|
psta++;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_AP_MODE
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pstapriv->sta_dz_bitmap = 0;
|
|
|
|
pstapriv->tim_bitmap = 0;
|
|
|
|
|
|
|
|
_rtw_init_listhead(&pstapriv->asoc_list);
|
|
|
|
_rtw_init_listhead(&pstapriv->auth_list);
|
2015-03-05 20:42:30 +00:00
|
|
|
spin_lock_init(&pstapriv->asoc_list_lock);
|
|
|
|
spin_lock_init(&pstapriv->auth_list_lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
pstapriv->asoc_list_cnt = 0;
|
|
|
|
pstapriv->auth_list_cnt = 0;
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
pstapriv->auth_to = 3; /* 3*2 = 6 sec */
|
2013-05-08 21:45:39 +00:00
|
|
|
pstapriv->assoc_to = 3;
|
2015-02-19 21:34:32 +00:00
|
|
|
pstapriv->expire_to = 3; /* 3*2 = 6 sec */
|
2013-05-08 21:45:39 +00:00
|
|
|
pstapriv->max_num_sta = NUM_STA;
|
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
|
|
|
|
{
|
|
|
|
int offset = (((u8 *)sta) - stapriv->pstainfo_buf)/sizeof(struct sta_info);
|
|
|
|
|
|
|
|
if (!stainfo_offset_valid(offset))
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X("%s invalid offset(%d), out of range!!!", __func__, offset);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset)
|
|
|
|
{
|
|
|
|
if (!stainfo_offset_valid(offset))
|
2014-12-11 21:15:04 +00:00
|
|
|
DBG_871X("%s invalid offset(%d), out of range!!!", __func__, offset);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info));
|
|
|
|
}
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* this function is used to free the memory of lock || sema for all stainfos */
|
2015-08-15 04:12:02 +00:00
|
|
|
static void rtw_mfree_all_stainfo(struct sta_priv *pstapriv )
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-03-16 13:54:18 +00:00
|
|
|
unsigned long irqL;
|
|
|
|
struct list_head *plist, *phead;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sta_info *psta = NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&pstapriv->sta_hash_lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
phead = get_list_head(&pstapriv->free_sta_queue);
|
|
|
|
plist = get_next(phead);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
while ((rtw_end_of_queue_search(phead, plist)) == false)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
psta = LIST_CONTAINOR(plist, struct sta_info ,list);
|
2013-05-08 21:45:39 +00:00
|
|
|
plist = get_next(plist);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv);
|
|
|
|
void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_AP_MODE
|
2013-05-08 21:45:39 +00:00
|
|
|
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
|
|
|
#endif
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
rtw_mfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
|
|
|
|
{
|
2015-03-16 13:54:18 +00:00
|
|
|
unsigned long irqL;
|
|
|
|
struct list_head *phead, *plist;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sta_info *psta = NULL;
|
|
|
|
struct recv_reorder_ctrl *preorder_ctrl;
|
2014-12-19 06:59:46 +00:00
|
|
|
int index;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pstapriv){
|
2014-12-19 06:59:46 +00:00
|
|
|
/* delete all reordering_ctrl_timer */
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&pstapriv->sta_hash_lock);
|
2014-12-11 21:15:04 +00:00
|
|
|
for(index = 0; index < NUM_STA; index++)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
phead = &(pstapriv->sta_hash[index]);
|
|
|
|
plist = get_next(phead);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
while ((rtw_end_of_queue_search(phead, plist)) == false)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
int i;
|
2014-12-11 21:15:04 +00:00
|
|
|
psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list);
|
2013-05-08 21:45:39 +00:00
|
|
|
plist = get_next(plist);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
for(i=0; i < 16 ; i++)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
preorder_ctrl = &psta->recvreorder_ctrl[i];
|
2014-12-19 06:59:46 +00:00
|
|
|
_cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
/*===============================*/
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_mfree_sta_priv_lock(pstapriv);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pstapriv->pallocated_stainfo_buf) {
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info)*NUM_STA+4);
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
|
|
|
|
{
|
2015-03-16 13:54:18 +00:00
|
|
|
unsigned long irqL, irqL2;
|
2014-12-11 21:15:04 +00:00
|
|
|
uint tmp_aid;
|
2013-05-08 21:45:39 +00:00
|
|
|
s32 index;
|
2015-03-16 13:54:18 +00:00
|
|
|
struct list_head *phash_list;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sta_info *psta;
|
2015-03-16 13:54:18 +00:00
|
|
|
struct __queue *pfree_sta_queue;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct recv_reorder_ctrl *preorder_ctrl;
|
|
|
|
int i = 0;
|
|
|
|
u16 wRxSeqInitialValue = 0xffff;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pfree_sta_queue = &pstapriv->free_sta_queue;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&(pstapriv->sta_hash_lock));
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-01-29 21:27:28 +00:00
|
|
|
if (_rtw_queue_empty(pfree_sta_queue) == true) {
|
2013-05-08 21:45:39 +00:00
|
|
|
psta = NULL;
|
2015-01-29 21:27:28 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_list_delete(&(psta->list));
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
tmp_aid = psta->aid;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_init_stainfo(psta);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
psta->padapter = pstapriv->padapter;
|
|
|
|
|
2015-02-19 20:50:04 +00:00
|
|
|
memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
index = wifi_mac_hash(hwaddr);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("rtw_alloc_stainfo: index = %x", index));
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (index >= NUM_STA){
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("ERROR=> rtw_alloc_stainfo: index >= NUM_STA"));
|
2014-12-19 06:59:46 +00:00
|
|
|
psta= NULL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
phash_list = &(pstapriv->sta_hash[index]);
|
|
|
|
|
|
|
|
rtw_list_insert_tail(&psta->hash_list, phash_list);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pstapriv->asoc_sta_count ++ ;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* Commented by Albert 2009/08/13 */
|
|
|
|
/* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
|
|
|
|
/* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
|
|
|
|
/* So, we initialize the tid_rxseq variable as the 0xffff. */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
for( i = 0; i < 16; i++ )
|
2015-02-19 20:50:04 +00:00
|
|
|
memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 );
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:00:19 +00:00
|
|
|
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc number_%d stainfo with hwaddr = %x %x %x %x %x %x \n",
|
2014-12-11 21:15:04 +00:00
|
|
|
pstapriv->asoc_sta_count , hwaddr[0], hwaddr[1], hwaddr[2],hwaddr[3],hwaddr[4],hwaddr[5]));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
init_addba_retry_timer(pstapriv->padapter, psta);
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* for A-MPDU Rx reordering buffer control */
|
2015-01-29 21:27:28 +00:00
|
|
|
for(i=0; i < 16 ; i++) {
|
2013-05-08 21:45:39 +00:00
|
|
|
preorder_ctrl = &psta->recvreorder_ctrl[i];
|
|
|
|
|
|
|
|
preorder_ctrl->padapter = pstapriv->padapter;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
preorder_ctrl->enable = false;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
preorder_ctrl->indicate_seq = 0xffff;
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef DBG_RX_SEQ
|
|
|
|
DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d\n", __FUNCTION__, __LINE__,
|
|
|
|
preorder_ctrl->indicate_seq);
|
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
preorder_ctrl->wend_b= 0xffff;
|
2015-02-19 21:34:32 +00:00
|
|
|
/* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
|
|
|
|
preorder_ctrl->wsize_b = 64;/* 64; */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);
|
|
|
|
|
|
|
|
rtw_init_recv_timer(preorder_ctrl);
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* init for DM */
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
|
|
|
|
psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
|
|
|
|
/* init for the sequence number of received management frame */
|
|
|
|
psta->RxMgmtFrameSeqNum = 0xffff;
|
|
|
|
}
|
|
|
|
exit:
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&(pstapriv->sta_hash_lock));
|
2013-05-08 21:45:39 +00:00
|
|
|
return psta;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* using pstapriv->sta_hash_lock to protect */
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
int i;
|
2015-03-16 13:54:18 +00:00
|
|
|
unsigned long irqL0;
|
|
|
|
struct __queue *pfree_sta_queue;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct recv_reorder_ctrl *preorder_ctrl;
|
|
|
|
struct sta_xmit_priv *pstaxmitpriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct xmit_priv *pxmitpriv= &padapter->xmitpriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct hw_xmit *phwxmit;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
if (psta == NULL)
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&psta->lock);
|
2014-12-11 21:15:04 +00:00
|
|
|
psta->state &= ~_FW_LINKED;
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&psta->lock);
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
pfree_sta_queue = &pstapriv->free_sta_queue;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pstaxmitpriv = &psta->sta_xmitpriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&pxmitpriv->lock);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
|
|
|
|
psta->sleepq_len = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* vo */
|
2015-03-06 17:54:48 +00:00
|
|
|
/* spin_lock_bh(&(pxmitpriv->vo_pending.lock)0); */
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending));
|
2014-12-11 21:15:04 +00:00
|
|
|
phwxmit = pxmitpriv->hwxmits;
|
|
|
|
phwxmit->accnt -= pstaxmitpriv->vo_q.qcnt;
|
|
|
|
pstaxmitpriv->vo_q.qcnt = 0;
|
2015-03-06 17:54:48 +00:00
|
|
|
/* spin_unlock_bh(&(pxmitpriv->vo_pending.lock)0); */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* vi */
|
2015-03-06 17:54:48 +00:00
|
|
|
/* spin_lock_bh(&(pxmitpriv->vi_pending.lock)0); */
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_list_delete(&(pstaxmitpriv->vi_q.tx_pending));
|
2014-12-11 21:15:04 +00:00
|
|
|
phwxmit = pxmitpriv->hwxmits+1;
|
|
|
|
phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt;
|
|
|
|
pstaxmitpriv->vi_q.qcnt = 0;
|
2015-03-06 17:54:48 +00:00
|
|
|
/* spin_unlock_bh(&(pxmitpriv->vi_pending.lock)0); */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* be */
|
2015-03-06 17:54:48 +00:00
|
|
|
/* spin_lock_bh(&(pxmitpriv->be_pending.lock)0); */
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending));
|
2014-12-11 21:15:04 +00:00
|
|
|
phwxmit = pxmitpriv->hwxmits+2;
|
|
|
|
phwxmit->accnt -= pstaxmitpriv->be_q.qcnt;
|
|
|
|
pstaxmitpriv->be_q.qcnt = 0;
|
2015-03-06 17:54:48 +00:00
|
|
|
/* spin_unlock_bh(&(pxmitpriv->be_pending.lock)0); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* bk */
|
2015-03-06 17:54:48 +00:00
|
|
|
/* spin_lock_bh(&(pxmitpriv->bk_pending.lock)0); */
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
|
|
|
|
rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending));
|
|
|
|
phwxmit = pxmitpriv->hwxmits+3;
|
|
|
|
phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt;
|
|
|
|
pstaxmitpriv->bk_q.qcnt = 0;
|
2015-03-06 17:54:48 +00:00
|
|
|
/* spin_unlock_bh(&(pxmitpriv->bk_pending.lock)0); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&pxmitpriv->lock);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_list_delete(&psta->hash_list);
|
2015-08-15 18:00:19 +00:00
|
|
|
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("\n free number_%d stainfo with hwaddr = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5]));
|
2014-12-11 21:15:04 +00:00
|
|
|
pstapriv->asoc_sta_count --;
|
2013-05-08 21:45:39 +00:00
|
|
|
_cancel_timer_ex(&psta->addba_retry_timer);
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */
|
2014-12-11 21:15:04 +00:00
|
|
|
for(i=0; i < 16 ; i++)
|
|
|
|
{
|
2015-03-16 13:54:18 +00:00
|
|
|
unsigned long irqL;
|
|
|
|
struct list_head *phead, *plist;
|
2013-05-08 21:45:39 +00:00
|
|
|
union recv_frame *prframe;
|
2015-03-16 13:54:18 +00:00
|
|
|
struct __queue *ppending_recvframe_queue;
|
|
|
|
struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
preorder_ctrl = &psta->recvreorder_ctrl[i];
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);
|
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&ppending_recvframe_queue->lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
phead = get_list_head(ppending_recvframe_queue);
|
2013-05-08 21:45:39 +00:00
|
|
|
plist = get_next(phead);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:04:12 +00:00
|
|
|
while (!rtw_is_list_empty(phead))
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
plist = get_next(plist);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_list_delete(&(prframe->u.hdr.list));
|
|
|
|
|
|
|
|
rtw_free_recvframe(prframe, pfree_recv_queue);
|
|
|
|
}
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&ppending_recvframe_queue->lock);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(psta->state & WIFI_AP_STATE))
|
2014-12-29 02:13:24 +00:00
|
|
|
rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, false);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_AP_MODE
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&pstapriv->auth_list_lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
if (!rtw_is_list_empty(&psta->auth_list)) {
|
|
|
|
rtw_list_delete(&psta->auth_list);
|
|
|
|
pstapriv->auth_list_cnt--;
|
|
|
|
}
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&pstapriv->auth_list_lock);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->expire_to = 0;
|
|
|
|
psta->sleepq_ac_len = 0;
|
|
|
|
psta->qos_info = 0;
|
|
|
|
|
|
|
|
psta->max_sp_len = 0;
|
|
|
|
psta->uapsd_bk = 0;
|
|
|
|
psta->uapsd_be = 0;
|
|
|
|
psta->uapsd_vi = 0;
|
|
|
|
psta->uapsd_vo = 0;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->has_legacy_ac = 0;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
pstapriv->sta_dz_bitmap &=~BIT(psta->aid);
|
2014-12-19 06:59:46 +00:00
|
|
|
pstapriv->tim_bitmap &=~BIT(psta->aid);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* rtw_indicate_sta_disassoc_event(padapter, psta); */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
if ((psta->aid >0)&&(pstapriv->sta_aid[psta->aid - 1] == psta))
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pstapriv->sta_aid[psta->aid - 1] = NULL;
|
|
|
|
psta->aid = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->under_exist_checking = 0;
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
#endif /* CONFIG_AP_MODE */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue));
|
|
|
|
exit:
|
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* free all stainfo which in sta_hash[all] */
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_free_all_stainfo(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-03-16 13:54:18 +00:00
|
|
|
unsigned long irqL;
|
|
|
|
struct list_head *plist, *phead;
|
2013-05-08 21:45:39 +00:00
|
|
|
s32 index;
|
|
|
|
struct sta_info *psta = NULL;
|
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct sta_info* pbcmc_stainfo =rtw_get_bcmc_stainfo( padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pstapriv->asoc_sta_count==1)
|
2014-12-11 21:15:04 +00:00
|
|
|
goto exit;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&pstapriv->sta_hash_lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
for(index=0; index< NUM_STA; index++)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
phead = &(pstapriv->sta_hash[index]);
|
|
|
|
plist = get_next(phead);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
while ((rtw_end_of_queue_search(phead, plist)) == false)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
plist = get_next(plist);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pbcmc_stainfo!=psta)
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_stainfo(padapter , psta);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
exit:
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* any station allocated can be searched by hash list */
|
|
|
|
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
|
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-03-16 13:54:18 +00:00
|
|
|
unsigned long irqL;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-03-16 13:54:18 +00:00
|
|
|
struct list_head *plist, *phead;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sta_info *psta = NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
u32 index;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 *addr;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (hwaddr==NULL)
|
2014-12-11 21:15:04 +00:00
|
|
|
return NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (IS_MCAST(hwaddr))
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
addr = bc_addr;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
addr = hwaddr;
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
index = wifi_mac_hash(addr);
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&pstapriv->sta_hash_lock);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
phead = &(pstapriv->sta_hash[index]);
|
|
|
|
plist = get_next(phead);
|
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
while ((rtw_end_of_queue_search(phead, plist)) == false)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN))== true)
|
2015-02-19 21:34:32 +00:00
|
|
|
{ /* if found the matched address */
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
psta=NULL;
|
2013-05-08 21:45:39 +00:00
|
|
|
plist = get_next(plist);
|
|
|
|
}
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&pstapriv->sta_hash_lock);
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
return psta;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtw_init_bcmc_stainfo(struct adapter* padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
struct sta_info *psta;
|
2014-12-11 21:15:04 +00:00
|
|
|
struct tx_servq *ptxservq;
|
|
|
|
u32 res=_SUCCESS;
|
2015-03-14 23:14:05 +00:00
|
|
|
u8 bcast_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (psta==NULL){
|
2014-12-11 21:15:04 +00:00
|
|
|
res=_FAIL;
|
|
|
|
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("rtw_alloc_stainfo fail"));
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* default broadcast & multicast use macid 1 */
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->mac_id = 1;
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
ptxservq= &(psta->sta_xmitpriv.be_q);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-11 21:15:04 +00:00
|
|
|
return _SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
struct sta_info* rtw_get_bcmc_stainfo(struct adapter* padapter)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
|
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
return rtw_get_stainfo(pstapriv, bc_addr);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 res = true;
|
2014-12-11 21:15:04 +00:00
|
|
|
#ifdef CONFIG_AP_MODE
|
2015-03-16 13:54:18 +00:00
|
|
|
unsigned long irqL;
|
|
|
|
struct list_head *plist, *phead;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct rtw_wlan_acl_node *paclnode;
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 match = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
|
|
|
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
|
2015-03-16 13:54:18 +00:00
|
|
|
struct __queue *pacl_node_q =&pacl_list->acl_node_q;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_lock_bh(&(pacl_node_q->lock));
|
2013-05-08 21:45:39 +00:00
|
|
|
phead = get_list_head(pacl_node_q);
|
2014-12-19 06:59:46 +00:00
|
|
|
plist = get_next(phead);
|
2014-12-29 02:13:24 +00:00
|
|
|
while ((rtw_end_of_queue_search(phead, plist)) == false)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
|
|
|
|
plist = get_next(plist);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (_rtw_memcmp(paclnode->addr, mac_addr, ETH_ALEN))
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (paclnode->valid == true)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
match = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
}
|
2015-03-06 17:54:48 +00:00
|
|
|
spin_unlock_bh(&(pacl_node_q->lock));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pacl_list->mode == 1)/* accept unless in deny list */
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
res = (match == true) ? false:true;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (pacl_list->mode == 2)/* deny unless in accept list */
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
res = (match == true) ? true:false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
res = true;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return res;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|