rtl8188eu: Fix checkpatch errors in core/rtw_sta_mgt.c

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-08-01 13:33:20 -05:00
parent 79b808ad13
commit 9e855cb914

View file

@ -28,7 +28,6 @@
void _rtw_init_stainfo(struct sta_info *psta) void _rtw_init_stainfo(struct sta_info *psta)
{ {
_func_enter_; _func_enter_;
_rtw_memset((u8 *)psta, 0, sizeof (struct sta_info)); _rtw_memset((u8 *)psta, 0, sizeof (struct sta_info));
@ -56,7 +55,6 @@ _func_enter_;
psta->bpairwise_key_installed = false; psta->bpairwise_key_installed = false;
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
psta->nonerp_set = 0; psta->nonerp_set = 0;
psta->no_short_slot_time_set = 0; psta->no_short_slot_time_set = 0;
@ -73,7 +71,6 @@ _func_enter_;
#endif /* CONFIG_AP_MODE */ #endif /* CONFIG_AP_MODE */
_func_exit_; _func_exit_;
} }
u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
@ -83,13 +80,13 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
_func_enter_; _func_enter_;
pstapriv->pallocated_stainfo_buf = rtw_zvmalloc (sizeof(struct sta_info) * NUM_STA+ 4); pstapriv->pallocated_stainfo_buf = rtw_zvmalloc(sizeof(struct sta_info) * NUM_STA + 4);
if (!pstapriv->pallocated_stainfo_buf) if (!pstapriv->pallocated_stainfo_buf)
return _FAIL; return _FAIL;
pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
((size_t)(pstapriv->pallocated_stainfo_buf ) & 3); ((size_t)(pstapriv->pallocated_stainfo_buf) & 3);
_rtw_init_queue(&pstapriv->free_sta_queue); _rtw_init_queue(&pstapriv->free_sta_queue);
@ -101,7 +98,6 @@ _func_enter_;
psta = (struct sta_info *)(pstapriv->pstainfo_buf); psta = (struct sta_info *)(pstapriv->pstainfo_buf);
for (i = 0; i < NUM_STA; i++) { for (i = 0; i < NUM_STA; i++) {
_rtw_init_stainfo(psta); _rtw_init_stainfo(psta);
@ -112,8 +108,6 @@ _func_enter_;
psta++; psta++;
} }
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
pstapriv->sta_dz_bitmap = 0; pstapriv->sta_dz_bitmap = 0;
@ -135,7 +129,6 @@ _func_enter_;
_func_exit_; _func_exit_;
return _SUCCESS; return _SUCCESS;
} }
inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
@ -179,7 +172,6 @@ _func_enter_;
_rtw_spinlock_free(&(psta_recvpriv->defrag_q.lock)); _rtw_spinlock_free(&(psta_recvpriv->defrag_q.lock));
_func_exit_; _func_exit_;
} }
void rtw_mfree_stainfo(struct sta_info *psta); void rtw_mfree_stainfo(struct sta_info *psta);
@ -196,38 +188,34 @@ _func_enter_;
_func_exit_; _func_exit_;
} }
/* this function is used to free the memory of lock || sema for all stainfos */ /* this function is used to free the memory of lock || sema for all stainfos */
void rtw_mfree_all_stainfo(struct sta_priv *pstapriv ); void rtw_mfree_all_stainfo(struct sta_priv *pstapriv);
void rtw_mfree_all_stainfo(struct sta_priv *pstapriv ) void rtw_mfree_all_stainfo(struct sta_priv *pstapriv)
{ {
unsigned long irqL; unsigned long irql;
struct list_head *plist, *phead; struct list_head *plist, *phead;
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
_func_enter_; _func_enter_;
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); _enter_critical_bh(&pstapriv->sta_hash_lock, &irql);
phead = get_list_head(&pstapriv->free_sta_queue); phead = get_list_head(&pstapriv->free_sta_queue);
plist = get_next(phead); plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == false) while ((rtw_end_of_queue_search(phead, plist)) == false) {
{ psta = LIST_CONTAINOR(plist, struct sta_info , list);
psta = LIST_CONTAINOR(plist, struct sta_info ,list);
plist = get_next(plist); plist = get_next(plist);
rtw_mfree_stainfo(psta); rtw_mfree_stainfo(psta);
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irql);
_func_exit_; _func_exit_;
} }
void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv); void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
{ {
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
@ -246,39 +234,36 @@ void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
_rtw_spinlock_free(&pstapriv->auth_list_lock); _rtw_spinlock_free(&pstapriv->auth_list_lock);
_rtw_spinlock_free(&pacl_list->acl_node_q.lock); _rtw_spinlock_free(&pacl_list->acl_node_q.lock);
#endif #endif
} }
u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
{ {
unsigned long irqL; unsigned long irql;
struct list_head *phead, *plist; struct list_head *phead, *plist;
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
struct recv_reorder_ctrl *preorder_ctrl; struct recv_reorder_ctrl *preorder_ctrl;
int index; int index;
_func_enter_; _func_enter_;
if (pstapriv){ if (pstapriv) {
/* delete all reordering_ctrl_timer */ /* delete all reordering_ctrl_timer */
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); _enter_critical_bh(&pstapriv->sta_hash_lock, &irql);
for (index = 0; index < NUM_STA; index++) for (index = 0; index < NUM_STA; index++) {
{
phead = &(pstapriv->sta_hash[index]); phead = &(pstapriv->sta_hash[index]);
plist = get_next(phead); plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == false) { while ((rtw_end_of_queue_search(phead, plist)) == false) {
int i; int i;
psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list); psta = LIST_CONTAINOR(plist, struct sta_info , hash_list);
plist = get_next(plist); plist = get_next(plist);
for (i=0; i < 16; i++) { for (i = 0; i < 16; i++) {
preorder_ctrl = &psta->recvreorder_ctrl[i]; preorder_ctrl = &psta->recvreorder_ctrl[i];
_cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);
} }
} }
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irql);
/*===============================*/ /*===============================*/
rtw_mfree_sta_priv_lock(pstapriv); rtw_mfree_sta_priv_lock(pstapriv);
@ -294,7 +279,7 @@ _func_exit_;
struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{ {
unsigned long irqL, irqL2; unsigned long irql, irql2;
s32 index; s32 index;
struct list_head *phash_list; struct list_head *phash_list;
struct sta_info *psta; struct sta_info *psta;
@ -307,52 +292,50 @@ _func_enter_;
pfree_sta_queue = &pstapriv->free_sta_queue; pfree_sta_queue = &pstapriv->free_sta_queue;
_enter_critical_bh(&(pfree_sta_queue->lock), &irqL); _enter_critical_bh(&(pfree_sta_queue->lock), &irql);
if (_rtw_queue_empty(pfree_sta_queue) == true) { if (_rtw_queue_empty(pfree_sta_queue) == true) {
_exit_critical_bh(&(pfree_sta_queue->lock), &irqL); _exit_critical_bh(&(pfree_sta_queue->lock), &irql);
psta = NULL; psta = NULL;
} else { } else {
psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
rtw_list_delete(&(psta->list)); rtw_list_delete(&(psta->list));
_exit_critical_bh(&(pfree_sta_queue->lock), &irqL); _exit_critical_bh(&(pfree_sta_queue->lock), &irql);
_rtw_init_stainfo(psta); _rtw_init_stainfo(psta);
_rtw_memcpy(psta->hwaddr, hwaddr, ETH_ALEN); _rtw_memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
index = wifi_mac_hash(hwaddr); index = wifi_mac_hash(hwaddr);
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("rtw_alloc_stainfo: index = %x", index)); RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, ("rtw_alloc_stainfo: index=%x", index));
if (index >= NUM_STA) { if (index >= NUM_STA) {
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("ERROR=> rtw_alloc_stainfo: index >= NUM_STA")); RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("ERROR => rtw_alloc_stainfo: index >= NUM_STA"));
psta= NULL; psta = NULL;
goto exit; goto exit;
} }
phash_list = &(pstapriv->sta_hash[index]); phash_list = &(pstapriv->sta_hash[index]);
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); _enter_critical_bh(&(pstapriv->sta_hash_lock), &irql2);
rtw_list_insert_tail(&psta->hash_list, phash_list); rtw_list_insert_tail(&psta->hash_list, phash_list);
pstapriv->asoc_sta_count ++ ; pstapriv->asoc_sta_count++ ;
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); _exit_critical_bh(&(pstapriv->sta_hash_lock), &irql2);
/* Commented by Albert 2009/08/13 */ /* Commented by Albert 2009/08/13 */
/* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */ /* 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. */ /* 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. */ /* So, we initialize the tid_rxseq variable as the 0xffff. */
for ( i = 0; i < 16; i++ ) for (i = 0; i < 16; i++)
{ _rtw_memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);
_rtw_memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 );
}
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc number_%d stainfo with hwaddr = %x %x %x %x %x %x\n", RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
pstapriv->asoc_sta_count , hwaddr[0], hwaddr[1], hwaddr[2],hwaddr[3],hwaddr[4],hwaddr[5])); ("alloc number_%d stainfo with hwaddr = %pM\n",
pstapriv->asoc_sta_count , hwaddr));
init_addba_retry_timer(pstapriv->padapter, psta); init_addba_retry_timer(pstapriv->padapter, psta);
/* for A-MPDU Rx reordering buffer control */ /* for A-MPDU Rx reordering buffer control */
for (i=0; i < 16 ; i++) for (i = 0; i < 16; i++) {
{
preorder_ctrl = &psta->recvreorder_ctrl[i]; preorder_ctrl = &psta->recvreorder_ctrl[i];
preorder_ctrl->padapter = pstapriv->padapter; preorder_ctrl->padapter = pstapriv->padapter;
@ -360,7 +343,7 @@ _func_enter_;
preorder_ctrl->enable = false; preorder_ctrl->enable = false;
preorder_ctrl->indicate_seq = 0xffff; preorder_ctrl->indicate_seq = 0xffff;
preorder_ctrl->wend_b= 0xffff; preorder_ctrl->wend_b = 0xffff;
preorder_ctrl->wsize_b = 64;/* 64; */ preorder_ctrl->wsize_b = 64;/* 64; */
_rtw_init_queue(&preorder_ctrl->pending_recvframe_queue); _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);
@ -368,7 +351,6 @@ _func_enter_;
rtw_init_recv_timer(preorder_ctrl); rtw_init_recv_timer(preorder_ctrl);
} }
/* init for DM */ /* init for DM */
psta->rssi_stat.UndecoratedSmoothedPWDB = (-1); psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
psta->rssi_stat.UndecoratedSmoothedCCK = (-1); psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
@ -382,23 +364,19 @@ exit:
_func_exit_; _func_exit_;
return psta; return psta;
} }
/* using pstapriv->sta_hash_lock to protect */ /* using pstapriv->sta_hash_lock to protect */
u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta) u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
{ {
int i; int i;
unsigned long irqL0; unsigned long irql0;
struct __queue *pfree_sta_queue; struct __queue *pfree_sta_queue;
struct recv_reorder_ctrl *preorder_ctrl; struct recv_reorder_ctrl *preorder_ctrl;
struct sta_xmit_priv *pstaxmitpriv; struct sta_xmit_priv *pstaxmitpriv;
struct xmit_priv *pxmitpriv= &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
_func_enter_; _func_enter_;
if (psta == NULL) if (psta == NULL)
@ -406,35 +384,34 @@ _func_enter_;
pfree_sta_queue = &pstapriv->free_sta_queue; pfree_sta_queue = &pstapriv->free_sta_queue;
pstaxmitpriv = &psta->sta_xmitpriv; pstaxmitpriv = &psta->sta_xmitpriv;
_enter_critical_bh(&pxmitpriv->lock, &irqL0); _enter_critical_bh(&pxmitpriv->lock, &irql0);
rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q); rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
psta->sleepq_len = 0; psta->sleepq_len = 0;
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vo_q.sta_pending); rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending)); rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending));
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vi_q.sta_pending); rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
rtw_list_delete(&(pstaxmitpriv->vi_q.tx_pending)); rtw_list_delete(&(pstaxmitpriv->vi_q.tx_pending));
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->bk_q.sta_pending); rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending)); rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending));
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->be_q.sta_pending); rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending));
_exit_critical_bh(&pxmitpriv->lock, &irqL0); _exit_critical_bh(&pxmitpriv->lock, &irql0);
rtw_list_delete(&psta->hash_list); rtw_list_delete(&psta->hash_list);
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])); 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]));
pstapriv->asoc_sta_count --; pstapriv->asoc_sta_count--;
/* re-init sta_info; 20061114 */ /* re-init sta_info; 20061114 */
_rtw_init_sta_xmit_priv(&psta->sta_xmitpriv); _rtw_init_sta_xmit_priv(&psta->sta_xmitpriv);
@ -443,9 +420,8 @@ _func_enter_;
_cancel_timer_ex(&psta->addba_retry_timer); _cancel_timer_ex(&psta->addba_retry_timer);
/* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */ /* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */
for (i=0; i < 16 ; i++) for (i = 0; i < 16 ; i++) {
{ unsigned long irql;
unsigned long irqL;
struct list_head *phead, *plist; struct list_head *phead, *plist;
union recv_frame *prframe; union recv_frame *prframe;
struct __queue *ppending_recvframe_queue; struct __queue *ppending_recvframe_queue;
@ -455,16 +431,14 @@ _func_enter_;
_cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer);
ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
_enter_critical_bh(&ppending_recvframe_queue->lock, &irqL); _enter_critical_bh(&ppending_recvframe_queue->lock, &irql);
phead = get_list_head(ppending_recvframe_queue); phead = get_list_head(ppending_recvframe_queue);
plist = get_next(phead); plist = get_next(phead);
while (!rtw_is_list_empty(phead)) while (!rtw_is_list_empty(phead)) {
{
prframe = LIST_CONTAINOR(plist, union recv_frame, u); prframe = LIST_CONTAINOR(plist, union recv_frame, u);
plist = get_next(plist); plist = get_next(plist);
@ -474,8 +448,7 @@ _func_enter_;
rtw_free_recvframe(prframe, pfree_recv_queue); rtw_free_recvframe(prframe, pfree_recv_queue);
} }
_exit_critical_bh(&ppending_recvframe_queue->lock, &irqL); _exit_critical_bh(&ppending_recvframe_queue->lock, &irql);
} }
if (!(psta->state & WIFI_AP_STATE)) if (!(psta->state & WIFI_AP_STATE))
@ -483,12 +456,12 @@ _func_enter_;
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
_enter_critical_bh(&pstapriv->auth_list_lock, &irqL0); _enter_critical_bh(&pstapriv->auth_list_lock, &irql0);
if (!rtw_is_list_empty(&psta->auth_list)) { if (!rtw_is_list_empty(&psta->auth_list)) {
rtw_list_delete(&psta->auth_list); rtw_list_delete(&psta->auth_list);
pstapriv->auth_list_cnt--; pstapriv->auth_list_cnt--;
} }
_exit_critical_bh(&pstapriv->auth_list_lock, &irqL0); _exit_critical_bh(&pstapriv->auth_list_lock, &irql0);
psta->expire_to = 0; psta->expire_to = 0;
@ -500,15 +473,12 @@ _func_enter_;
psta->uapsd_be = 0; psta->uapsd_be = 0;
psta->uapsd_vi = 0; psta->uapsd_vi = 0;
psta->uapsd_vo = 0; psta->uapsd_vo = 0;
psta->has_legacy_ac = 0; psta->has_legacy_ac = 0;
pstapriv->sta_dz_bitmap &= ~BIT(psta->aid);
pstapriv->tim_bitmap &= ~BIT(psta->aid);
pstapriv->sta_dz_bitmap &=~BIT(psta->aid); if ((psta->aid > 0) && (pstapriv->sta_aid[psta->aid - 1] == psta)) {
pstapriv->tim_bitmap &=~BIT(psta->aid);
if ((psta->aid >0)&&(pstapriv->sta_aid[psta->aid - 1] == psta))
{
pstapriv->sta_aid[psta->aid - 1] = NULL; pstapriv->sta_aid[psta->aid - 1] = NULL;
psta->aid = 0; psta->aid = 0;
} }
@ -517,73 +487,68 @@ _func_enter_;
#endif /* CONFIG_AP_MODE */ #endif /* CONFIG_AP_MODE */
_enter_critical_bh(&(pfree_sta_queue->lock), &irqL0); _enter_critical_bh(&(pfree_sta_queue->lock), &irql0);
rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue)); rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue));
_exit_critical_bh(&(pfree_sta_queue->lock), &irqL0); _exit_critical_bh(&(pfree_sta_queue->lock), &irql0);
exit: exit:
_func_exit_; _func_exit_;
return _SUCCESS; return _SUCCESS;
} }
/* free all stainfo which in sta_hash[all] */ /* free all stainfo which in sta_hash[all] */
void rtw_free_all_stainfo(struct adapter *padapter) void rtw_free_all_stainfo(struct adapter *padapter)
{ {
unsigned long irqL; unsigned long irql;
struct list_head *plist, *phead; struct list_head *plist, *phead;
s32 index; s32 index;
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info* pbcmc_stainfo =rtw_get_bcmc_stainfo( padapter); struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo(padapter);
_func_enter_; _func_enter_;
if (pstapriv->asoc_sta_count==1) if (pstapriv->asoc_sta_count == 1)
goto exit; goto exit;
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); _enter_critical_bh(&pstapriv->sta_hash_lock, &irql);
for (index=0; index< NUM_STA; index++) for (index = 0; index < NUM_STA; index++) {
{
phead = &(pstapriv->sta_hash[index]); phead = &(pstapriv->sta_hash[index]);
plist = get_next(phead); plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == false) while ((!rtw_end_of_queue_search(phead, plist))) {
{ psta = LIST_CONTAINOR(plist, struct sta_info , hash_list);
psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list);
plist = get_next(plist); plist = get_next(plist);
if (pbcmc_stainfo!=psta) if (pbcmc_stainfo != psta)
rtw_free_stainfo(padapter , psta); rtw_free_stainfo(padapter , psta);
} }
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irql);
exit: exit:
_func_exit_; _func_exit_;
} }
/* any station allocated can be searched by hash list */ /* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{ {
unsigned long irqL; unsigned long irql;
struct list_head *plist, *phead; struct list_head *plist, *phead;
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
u32 index; u32 index;
u8 *addr; u8 *addr;
u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
_func_enter_; _func_enter_;
if (hwaddr==NULL) if (hwaddr == NULL)
return NULL; return NULL;
if (IS_MCAST(hwaddr)) if (IS_MCAST(hwaddr))
@ -593,45 +558,41 @@ _func_enter_;
index = wifi_mac_hash(addr); index = wifi_mac_hash(addr);
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); _enter_critical_bh(&pstapriv->sta_hash_lock, &irql);
phead = &(pstapriv->sta_hash[index]); phead = &(pstapriv->sta_hash[index]);
plist = get_next(phead); plist = get_next(phead);
while ((!rtw_end_of_queue_search(phead, plist))) {
while ((rtw_end_of_queue_search(phead, plist)) == false)
{
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN))== true) if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) {
{ /* if found the matched address */ /* if found the matched address */
break; break;
} }
psta=NULL; psta = NULL;
plist = get_next(plist); plist = get_next(plist);
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irql);
_func_exit_; _func_exit_;
return psta; return psta;
} }
u32 rtw_init_bcmc_stainfo(struct adapter* padapter) u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
{ {
struct sta_info *psta; struct sta_info *psta;
u32 res=_SUCCESS; u32 res = _SUCCESS;
unsigned char bcast_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; unsigned char bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
_func_enter_; _func_enter_;
psta = rtw_alloc_stainfo(pstapriv, bcast_addr); psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
if (psta==NULL){ if (psta == NULL) {
res=_FAIL; res = _FAIL;
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("rtw_alloc_stainfo fail")); RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("rtw_alloc_stainfo fail"));
goto exit; goto exit;
} }
@ -643,65 +604,53 @@ _func_exit_;
return res; return res;
} }
struct sta_info* rtw_get_bcmc_stainfo(struct adapter* padapter) struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
{ {
struct sta_info *psta; struct sta_info *psta;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
_func_enter_; _func_enter_;
psta = rtw_get_stainfo(pstapriv, bc_addr); psta = rtw_get_stainfo(pstapriv, bc_addr);
_func_exit_; _func_exit_;
return psta; return psta;
} }
u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
{ {
u8 res = true; u8 res = true;
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
unsigned long irqL; unsigned long irql;
struct list_head *plist, *phead; struct list_head *plist, *phead;
struct rtw_wlan_acl_node *paclnode; struct rtw_wlan_acl_node *paclnode;
u8 match = false; u8 match = false;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct __queue *pacl_node_q =&pacl_list->acl_node_q; struct __queue *pacl_node_q = &pacl_list->acl_node_q;
_enter_critical_bh(&(pacl_node_q->lock), &irqL); _enter_critical_bh(&(pacl_node_q->lock), &irql);
phead = get_list_head(pacl_node_q); phead = get_list_head(pacl_node_q);
plist = get_next(phead); plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == false) while ((!rtw_end_of_queue_search(phead, plist))) {
{
paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list);
plist = get_next(plist); plist = get_next(plist);
if (_rtw_memcmp(paclnode->addr, mac_addr, ETH_ALEN)) if (_rtw_memcmp(paclnode->addr, mac_addr, ETH_ALEN)) {
{ if (paclnode->valid) {
if (paclnode->valid == true)
{
match = true; match = true;
break; break;
} }
} }
} }
_exit_critical_bh(&(pacl_node_q->lock), &irqL); _exit_critical_bh(&(pacl_node_q->lock), &irql);
if (pacl_list->mode == 1)/* accept unless in deny list */ if (pacl_list->mode == 1)/* accept unless in deny list */
{ res = (match) ? false : true;
res = (match == true) ? false:true;
}
else if (pacl_list->mode == 2)/* deny unless in accept list */ else if (pacl_list->mode == 2)/* deny unless in accept list */
{ res = (match) ? true : false;
res = (match == true) ? true:false;
}
else else
{
res = true; res = true;
}
#endif #endif
return res; return res;
} }