diff options
Diffstat (limited to 'drivers/staging/rtl8188eu/core/rtw_sta_mgt.c')
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 87 |
1 files changed, 32 insertions, 55 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 02e1e1f8b3ea..2d0b60686a01 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -25,10 +25,10 @@ #include <xmit_osdep.h> #include <mlme_osdep.h> #include <sta_info.h> +#include <linux/vmalloc.h> static void _rtw_init_stainfo(struct sta_info *psta) { -_func_enter_; _rtw_memset((u8 *)psta, 0, sizeof (struct sta_info)); spin_lock_init(&psta->lock); @@ -69,7 +69,6 @@ _func_enter_; #endif /* CONFIG_88EU_AP_MODE */ -_func_exit_; } u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) @@ -77,9 +76,8 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) struct sta_info *psta; s32 i; -_func_enter_; - pstapriv->pallocated_stainfo_buf = rtw_zvmalloc(sizeof(struct sta_info) * NUM_STA + 4); + pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA + 4); if (!pstapriv->pallocated_stainfo_buf) return _FAIL; @@ -125,7 +123,6 @@ _func_enter_; pstapriv->max_num_sta = NUM_STA; #endif -_func_exit_; return _SUCCESS; } @@ -154,21 +151,19 @@ static void rtw_mfree_all_stainfo(struct sta_priv *pstapriv) struct list_head *plist, *phead; struct sta_info *psta = NULL; -_func_enter_; spin_lock_bh(&pstapriv->sta_hash_lock); phead = get_list_head(&pstapriv->free_sta_queue); - plist = get_next(phead); + plist = phead->next; while ((rtw_end_of_queue_search(phead, plist)) == false) { - psta = LIST_CONTAINOR(plist, struct sta_info , list); - plist = get_next(plist); + psta = container_of(plist, struct sta_info , list); + plist = plist->next; } spin_unlock_bh(&pstapriv->sta_hash_lock); -_func_exit_; } static void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv) @@ -183,22 +178,21 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) struct recv_reorder_ctrl *preorder_ctrl; int index; -_func_enter_; if (pstapriv) { /* delete all reordering_ctrl_timer */ spin_lock_bh(&pstapriv->sta_hash_lock); for (index = 0; index < NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); - plist = get_next(phead); + plist = phead->next; while ((rtw_end_of_queue_search(phead, plist)) == false) { int i; - psta = LIST_CONTAINOR(plist, struct sta_info , hash_list); - plist = get_next(plist); + psta = container_of(plist, struct sta_info , hash_list); + plist = plist->next; for (i = 0; i < 16; i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; - _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); + del_timer_sync(&preorder_ctrl->reordering_ctrl_timer); } } } @@ -208,10 +202,9 @@ _func_enter_; rtw_mfree_sta_priv_lock(pstapriv); if (pstapriv->pallocated_stainfo_buf) - rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info)*NUM_STA+4); + vfree(pstapriv->pallocated_stainfo_buf); } -_func_exit_; return _SUCCESS; } @@ -225,7 +218,6 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) int i = 0; u16 wRxSeqInitialValue = 0xffff; -_func_enter_; pfree_sta_queue = &pstapriv->free_sta_queue; @@ -235,7 +227,7 @@ _func_enter_; spin_unlock_bh(&pfree_sta_queue->lock); psta = NULL; } else { - psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); + psta = container_of((&pfree_sta_queue->queue)->next, struct sta_info, list); rtw_list_delete(&(psta->list)); spin_unlock_bh(&pfree_sta_queue->lock); _rtw_init_stainfo(psta); @@ -297,9 +289,6 @@ _func_enter_; } exit: - -_func_exit_; - return psta; } @@ -313,7 +302,6 @@ u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct sta_priv *pstapriv = &padapter->stapriv; -_func_enter_; if (psta == NULL) goto exit; @@ -353,32 +341,34 @@ _func_enter_; _rtw_init_sta_xmit_priv(&psta->sta_xmitpriv); _rtw_init_sta_recv_priv(&psta->sta_recvpriv); - _cancel_timer_ex(&psta->addba_retry_timer); + del_timer_sync(&psta->addba_retry_timer); /* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */ for (i = 0; i < 16; i++) { struct list_head *phead, *plist; - union recv_frame *prframe; + struct recv_frame *prhdr; + struct recv_frame *prframe; struct __queue *ppending_recvframe_queue; struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; preorder_ctrl = &psta->recvreorder_ctrl[i]; - _cancel_timer_ex(&preorder_ctrl->reordering_ctrl_timer); + del_timer_sync(&preorder_ctrl->reordering_ctrl_timer); ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; spin_lock_bh(&ppending_recvframe_queue->lock); phead = get_list_head(ppending_recvframe_queue); - plist = get_next(phead); + plist = phead->next; while (!rtw_is_list_empty(phead)) { - prframe = LIST_CONTAINOR(plist, union recv_frame, u); + prhdr = container_of(plist, struct recv_frame, list); + prframe = (struct recv_frame *)prhdr; - plist = get_next(plist); + plist = plist->next; - rtw_list_delete(&(prframe->u.hdr.list)); + rtw_list_delete(&(prframe->list)); rtw_free_recvframe(prframe, pfree_recv_queue); } @@ -428,7 +418,6 @@ _func_enter_; exit: -_func_exit_; return _SUCCESS; } @@ -442,32 +431,26 @@ void rtw_free_all_stainfo(struct adapter *padapter) struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo(padapter); -_func_enter_; if (pstapriv->asoc_sta_count == 1) - goto exit; + return; spin_lock_bh(&pstapriv->sta_hash_lock); for (index = 0; index < NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); - plist = get_next(phead); + plist = phead->next; while ((!rtw_end_of_queue_search(phead, plist))) { - psta = LIST_CONTAINOR(plist, struct sta_info , hash_list); + psta = container_of(plist, struct sta_info , hash_list); - plist = get_next(plist); + plist = plist->next; if (pbcmc_stainfo != psta) rtw_free_stainfo(padapter , psta); } } - spin_unlock_bh(&pstapriv->sta_hash_lock); - -exit: - -_func_exit_; } /* any station allocated can be searched by hash list */ @@ -479,7 +462,6 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) u8 *addr; u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -_func_enter_; if (hwaddr == NULL) return NULL; @@ -494,21 +476,20 @@ _func_enter_; spin_lock_bh(&pstapriv->sta_hash_lock); phead = &(pstapriv->sta_hash[index]); - plist = get_next(phead); + plist = phead->next; while ((!rtw_end_of_queue_search(phead, plist))) { - psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); + psta = container_of(plist, struct sta_info, hash_list); - if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) { + if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) { /* if found the matched address */ break; } psta = NULL; - plist = get_next(plist); + plist = plist->next; } spin_unlock_bh(&pstapriv->sta_hash_lock); -_func_exit_; return psta; } @@ -519,7 +500,6 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter) unsigned char bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; struct sta_priv *pstapriv = &padapter->stapriv; -_func_enter_; psta = rtw_alloc_stainfo(pstapriv, bcast_addr); @@ -533,7 +513,6 @@ _func_enter_; psta->mac_id = 1; exit: -_func_exit_; return res; } @@ -542,9 +521,7 @@ struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter) struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -_func_enter_; psta = rtw_get_stainfo(pstapriv, bc_addr); -_func_exit_; return psta; } @@ -561,12 +538,12 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) spin_lock_bh(&(pacl_node_q->lock)); phead = get_list_head(pacl_node_q); - plist = get_next(phead); + plist = phead->next; while ((!rtw_end_of_queue_search(phead, plist))) { - paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); - plist = get_next(plist); + paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + plist = plist->next; - if (_rtw_memcmp(paclnode->addr, mac_addr, ETH_ALEN)) { + if (!memcmp(paclnode->addr, mac_addr, ETH_ALEN)) { if (paclnode->valid) { match = true; break; |