diff options
Diffstat (limited to 'drivers/staging/rtl8188eu/core/rtw_sta_mgt.c')
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 122 |
1 files changed, 28 insertions, 94 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index cd3c9a7c3044..02e1e1f8b3ea 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -31,7 +31,7 @@ static void _rtw_init_stainfo(struct sta_info *psta) _func_enter_; _rtw_memset((u8 *)psta, 0, sizeof (struct sta_info)); - _rtw_spinlock_init(&psta->lock); + spin_lock_init(&psta->lock); _rtw_init_listhead(&psta->list); _rtw_init_listhead(&psta->hash_list); _rtw_init_queue(&psta->sleep_q); @@ -89,7 +89,7 @@ _func_enter_; _rtw_init_queue(&pstapriv->free_sta_queue); - _rtw_spinlock_init(&pstapriv->sta_hash_lock); + spin_lock_init(&pstapriv->sta_hash_lock); pstapriv->asoc_sta_count = 0; _rtw_init_queue(&pstapriv->sleep_q); @@ -114,8 +114,8 @@ _func_enter_; _rtw_init_listhead(&pstapriv->asoc_list); _rtw_init_listhead(&pstapriv->auth_list); - _rtw_spinlock_init(&pstapriv->asoc_list_lock); - _rtw_spinlock_init(&pstapriv->auth_list_lock); + spin_lock_init(&pstapriv->asoc_list_lock); + spin_lock_init(&pstapriv->auth_list_lock); pstapriv->asoc_list_cnt = 0; pstapriv->auth_list_cnt = 0; @@ -148,56 +148,15 @@ inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info)); } -void _rtw_free_sta_xmit_priv_lock(struct sta_xmit_priv *psta_xmitpriv); -void _rtw_free_sta_xmit_priv_lock(struct sta_xmit_priv *psta_xmitpriv) -{ -_func_enter_; - - _rtw_spinlock_free(&psta_xmitpriv->lock); - - _rtw_spinlock_free(&(psta_xmitpriv->be_q.sta_pending.lock)); - _rtw_spinlock_free(&(psta_xmitpriv->bk_q.sta_pending.lock)); - _rtw_spinlock_free(&(psta_xmitpriv->vi_q.sta_pending.lock)); - _rtw_spinlock_free(&(psta_xmitpriv->vo_q.sta_pending.lock)); -_func_exit_; -} - -static void _rtw_free_sta_recv_priv_lock(struct sta_recv_priv *psta_recvpriv) -{ -_func_enter_; - - _rtw_spinlock_free(&psta_recvpriv->lock); - - _rtw_spinlock_free(&(psta_recvpriv->defrag_q.lock)); - -_func_exit_; -} - -void rtw_mfree_stainfo(struct sta_info *psta); -void rtw_mfree_stainfo(struct sta_info *psta) -{ -_func_enter_; - - if (&psta->lock != NULL) - _rtw_spinlock_free(&psta->lock); - - _rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv); - _rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv); - -_func_exit_; -} - /* 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) +static void rtw_mfree_all_stainfo(struct sta_priv *pstapriv) { - unsigned long irql; struct list_head *plist, *phead; struct sta_info *psta = NULL; _func_enter_; - _enter_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_lock_bh(&pstapriv->sta_hash_lock); phead = get_list_head(&pstapriv->free_sta_queue); plist = get_next(phead); @@ -205,39 +164,20 @@ _func_enter_; while ((rtw_end_of_queue_search(phead, plist)) == false) { psta = LIST_CONTAINOR(plist, struct sta_info , list); plist = get_next(plist); - - rtw_mfree_stainfo(psta); } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_unlock_bh(&pstapriv->sta_hash_lock); _func_exit_; } static void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv) { -#ifdef CONFIG_88EU_AP_MODE - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; -#endif - rtw_mfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */ - - _rtw_spinlock_free(&pstapriv->free_sta_queue.lock); - - _rtw_spinlock_free(&pstapriv->sta_hash_lock); - _rtw_spinlock_free(&pstapriv->wakeup_q.lock); - _rtw_spinlock_free(&pstapriv->sleep_q.lock); - -#ifdef CONFIG_88EU_AP_MODE - _rtw_spinlock_free(&pstapriv->asoc_list_lock); - _rtw_spinlock_free(&pstapriv->auth_list_lock); - _rtw_spinlock_free(&pacl_list->acl_node_q.lock); -#endif } u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) { - unsigned long irql; struct list_head *phead, *plist; struct sta_info *psta = NULL; struct recv_reorder_ctrl *preorder_ctrl; @@ -246,7 +186,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) _func_enter_; if (pstapriv) { /* delete all reordering_ctrl_timer */ - _enter_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_lock_bh(&pstapriv->sta_hash_lock); for (index = 0; index < NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); @@ -262,7 +202,7 @@ _func_enter_; } } } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_unlock_bh(&pstapriv->sta_hash_lock); /*===============================*/ rtw_mfree_sta_priv_lock(pstapriv); @@ -277,7 +217,6 @@ _func_exit_; struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) { - unsigned long irql, irql2; s32 index; struct list_head *phash_list; struct sta_info *psta; @@ -290,15 +229,15 @@ _func_enter_; pfree_sta_queue = &pstapriv->free_sta_queue; - _enter_critical_bh(&(pfree_sta_queue->lock), &irql); + spin_lock_bh(&(pfree_sta_queue->lock)); if (_rtw_queue_empty(pfree_sta_queue) == true) { - _exit_critical_bh(&(pfree_sta_queue->lock), &irql); + spin_unlock_bh(&pfree_sta_queue->lock); psta = NULL; } else { psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); rtw_list_delete(&(psta->list)); - _exit_critical_bh(&(pfree_sta_queue->lock), &irql); + spin_unlock_bh(&pfree_sta_queue->lock); _rtw_init_stainfo(psta); memcpy(psta->hwaddr, hwaddr, ETH_ALEN); index = wifi_mac_hash(hwaddr); @@ -310,13 +249,13 @@ _func_enter_; } phash_list = &(pstapriv->sta_hash[index]); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irql2); + spin_lock_bh(&(pstapriv->sta_hash_lock)); rtw_list_insert_tail(&psta->hash_list, phash_list); pstapriv->asoc_sta_count++; - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irql2); + spin_unlock_bh(&pstapriv->sta_hash_lock); /* Commented by Albert 2009/08/13 */ /* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */ @@ -368,7 +307,6 @@ _func_exit_; u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta) { int i; - unsigned long irql0; struct __queue *pfree_sta_queue; struct recv_reorder_ctrl *preorder_ctrl; struct sta_xmit_priv *pstaxmitpriv; @@ -384,7 +322,7 @@ _func_enter_; pstaxmitpriv = &psta->sta_xmitpriv; - _enter_critical_bh(&pxmitpriv->lock, &irql0); + spin_lock_bh(&pxmitpriv->lock); rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q); psta->sleepq_len = 0; @@ -405,7 +343,7 @@ _func_enter_; rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); - _exit_critical_bh(&pxmitpriv->lock, &irql0); + spin_unlock_bh(&pxmitpriv->lock); 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])); @@ -419,7 +357,6 @@ _func_enter_; /* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */ for (i = 0; i < 16; i++) { - unsigned long irql; struct list_head *phead, *plist; union recv_frame *prframe; struct __queue *ppending_recvframe_queue; @@ -431,7 +368,7 @@ _func_enter_; ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; - _enter_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_lock_bh(&ppending_recvframe_queue->lock); phead = get_list_head(ppending_recvframe_queue); plist = get_next(phead); @@ -446,7 +383,7 @@ _func_enter_; rtw_free_recvframe(prframe, pfree_recv_queue); } - _exit_critical_bh(&ppending_recvframe_queue->lock, &irql); + spin_unlock_bh(&ppending_recvframe_queue->lock); } if (!(psta->state & WIFI_AP_STATE)) @@ -454,12 +391,12 @@ _func_enter_; #ifdef CONFIG_88EU_AP_MODE - _enter_critical_bh(&pstapriv->auth_list_lock, &irql0); + spin_lock_bh(&pstapriv->auth_list_lock); if (!rtw_is_list_empty(&psta->auth_list)) { rtw_list_delete(&psta->auth_list); pstapriv->auth_list_cnt--; } - _exit_critical_bh(&pstapriv->auth_list_lock, &irql0); + spin_unlock_bh(&pstapriv->auth_list_lock); psta->expire_to = 0; @@ -485,9 +422,9 @@ _func_enter_; #endif /* CONFIG_88EU_AP_MODE */ - _enter_critical_bh(&(pfree_sta_queue->lock), &irql0); + spin_lock_bh(&(pfree_sta_queue->lock)); rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue)); - _exit_critical_bh(&(pfree_sta_queue->lock), &irql0); + spin_unlock_bh(&pfree_sta_queue->lock); exit: @@ -499,7 +436,6 @@ _func_exit_; /* free all stainfo which in sta_hash[all] */ void rtw_free_all_stainfo(struct adapter *padapter) { - unsigned long irql; struct list_head *plist, *phead; s32 index; struct sta_info *psta = NULL; @@ -511,7 +447,7 @@ _func_enter_; if (pstapriv->asoc_sta_count == 1) goto exit; - _enter_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_lock_bh(&pstapriv->sta_hash_lock); for (index = 0; index < NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); @@ -527,7 +463,7 @@ _func_enter_; } } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_unlock_bh(&pstapriv->sta_hash_lock); exit: @@ -537,7 +473,6 @@ _func_exit_; /* any station allocated can be searched by hash list */ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) { - unsigned long irql; struct list_head *plist, *phead; struct sta_info *psta = NULL; u32 index; @@ -556,7 +491,7 @@ _func_enter_; index = wifi_mac_hash(addr); - _enter_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_lock_bh(&pstapriv->sta_hash_lock); phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); @@ -572,7 +507,7 @@ _func_enter_; plist = get_next(plist); } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irql); + spin_unlock_bh(&pstapriv->sta_hash_lock); _func_exit_; return psta; } @@ -617,7 +552,6 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) { u8 res = true; #ifdef CONFIG_88EU_AP_MODE - unsigned long irql; struct list_head *plist, *phead; struct rtw_wlan_acl_node *paclnode; u8 match = false; @@ -625,7 +559,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct __queue *pacl_node_q = &pacl_list->acl_node_q; - _enter_critical_bh(&(pacl_node_q->lock), &irql); + spin_lock_bh(&(pacl_node_q->lock)); phead = get_list_head(pacl_node_q); plist = get_next(phead); while ((!rtw_end_of_queue_search(phead, plist))) { @@ -639,7 +573,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) } } } - _exit_critical_bh(&(pacl_node_q->lock), &irql); + spin_unlock_bh(&pacl_node_q->lock); if (pacl_list->mode == 1)/* accept unless in deny list */ res = (match) ? false : true; |