diff options
Diffstat (limited to 'drivers/staging/rtl8188eu/core/rtw_sta_mgt.c')
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 167 |
1 files changed, 86 insertions, 81 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 91a30142c567..73f2cb5ebaa6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -83,7 +83,8 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) INIT_LIST_HEAD(&pstapriv->sta_hash[i]); - list_add_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue)); + list_add_tail(&psta->list, + get_list_head(&pstapriv->free_sta_queue)); psta++; } @@ -134,31 +135,30 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) struct recv_reorder_ctrl *preorder_ctrl; int index; - 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 = phead->next; + if (!pstapriv) + return _SUCCESS; - while (phead != plist) { - int i; + /* 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 = phead->next; - psta = container_of(plist, struct sta_info, - hash_list); - plist = plist->next; + while (phead != plist) { + int i; - for (i = 0; i < 16; i++) { - preorder_ctrl = &psta->recvreorder_ctrl[i]; - del_timer_sync(&preorder_ctrl->reordering_ctrl_timer); - } + psta = container_of(plist, struct sta_info, hash_list); + plist = plist->next; + + for (i = 0; i < 16; i++) { + preorder_ctrl = &psta->recvreorder_ctrl[i]; + del_timer_sync(&preorder_ctrl->reordering_ctrl_timer); } } - spin_unlock_bh(&pstapriv->sta_hash_lock); - /*===============================*/ - - vfree(pstapriv->pallocated_stainfo_buf); } + spin_unlock_bh(&pstapriv->sta_hash_lock); + + vfree(pstapriv->pallocated_stainfo_buf); return _SUCCESS; } @@ -167,7 +167,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) { s32 index; struct list_head *phash_list; - struct sta_info *psta; + struct sta_info *psta; struct __queue *pfree_sta_queue; struct recv_reorder_ctrl *preorder_ctrl; int i = 0; @@ -180,65 +180,70 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) struct sta_info, list); if (!psta) { spin_unlock_bh(&pfree_sta_queue->lock); - } else { - list_del_init(&psta->list); - spin_unlock_bh(&pfree_sta_queue->lock); - _rtw_init_stainfo(psta); - memcpy(psta->hwaddr, hwaddr, ETH_ALEN); - index = wifi_mac_hash(hwaddr); - RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, ("%s: index=%x", __func__, index)); - if (index >= NUM_STA) { - RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("ERROR => %s: index >= NUM_STA", __func__)); - psta = NULL; - goto exit; - } - phash_list = &pstapriv->sta_hash[index]; - - spin_lock_bh(&pstapriv->sta_hash_lock); - list_add_tail(&psta->hash_list, phash_list); - pstapriv->asoc_sta_count++; - spin_unlock_bh(&pstapriv->sta_hash_lock); + return NULL; + } -/* 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. */ + list_del_init(&psta->list); + spin_unlock_bh(&pfree_sta_queue->lock); + _rtw_init_stainfo(psta); + memcpy(psta->hwaddr, hwaddr, ETH_ALEN); + index = wifi_mac_hash(hwaddr); + RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, + ("%s: index=%x", __func__, index)); + if (index >= NUM_STA) { + RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, + ("ERROR => %s: index >= NUM_STA", __func__)); + return NULL; + } + phash_list = &pstapriv->sta_hash[index]; - for (i = 0; i < 16; i++) - memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2); + spin_lock_bh(&pstapriv->sta_hash_lock); + list_add_tail(&psta->hash_list, phash_list); + pstapriv->asoc_sta_count++; + spin_unlock_bh(&pstapriv->sta_hash_lock); - RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, - ("alloc number_%d stainfo with hwaddr = %pM\n", - pstapriv->asoc_sta_count, hwaddr)); + /* 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. + */ - init_addba_retry_timer(pstapriv->padapter, psta); + for (i = 0; i < 16; i++) + memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], + &wRxSeqInitialValue, 2); - /* for A-MPDU Rx reordering buffer control */ - for (i = 0; i < 16; i++) { - preorder_ctrl = &psta->recvreorder_ctrl[i]; + RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, + ("alloc number_%d stainfo with hwaddr = %pM\n", + pstapriv->asoc_sta_count, hwaddr)); - preorder_ctrl->padapter = pstapriv->padapter; + init_addba_retry_timer(pstapriv->padapter, psta); - preorder_ctrl->enable = false; + /* for A-MPDU Rx reordering buffer control */ + for (i = 0; i < 16; i++) { + preorder_ctrl = &psta->recvreorder_ctrl[i]; - preorder_ctrl->indicate_seq = 0xffff; - preorder_ctrl->wend_b = 0xffff; - preorder_ctrl->wsize_b = 64;/* 64; */ + preorder_ctrl->padapter = pstapriv->padapter; - _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue); + preorder_ctrl->enable = false; - rtw_init_recv_timer(preorder_ctrl); - } + preorder_ctrl->indicate_seq = 0xffff; + preorder_ctrl->wend_b = 0xffff; + preorder_ctrl->wsize_b = 64;/* 64; */ - /* init for DM */ - psta->rssi_stat.UndecoratedSmoothedPWDB = -1; - psta->rssi_stat.UndecoratedSmoothedCCK = -1; + _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue); - /* init for the sequence number of received management frame */ - psta->RxMgmtFrameSeqNum = 0xffff; + rtw_init_recv_timer(preorder_ctrl); } -exit: + /* init for DM */ + psta->rssi_stat.UndecoratedSmoothedPWDB = -1; + psta->rssi_stat.UndecoratedSmoothedCCK = -1; + + /* init for the sequence number of received management frame */ + psta->RxMgmtFrameSeqNum = 0xffff; + return psta; } @@ -296,7 +301,9 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) del_timer_sync(&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++) { struct list_head *phead, *plist; struct recv_frame *prframe; @@ -311,7 +318,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) spin_lock_bh(&ppending_recvframe_queue->lock); - phead = get_list_head(ppending_recvframe_queue); + phead = get_list_head(ppending_recvframe_queue); plist = phead->next; while (!list_empty(phead)) { @@ -444,23 +451,21 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) u32 rtw_init_bcmc_stainfo(struct adapter *padapter) { struct sta_info *psta; - u32 res = _SUCCESS; - unsigned char bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; struct sta_priv *pstapriv = &padapter->stapriv; - psta = rtw_alloc_stainfo(pstapriv, bcast_addr); + psta = rtw_alloc_stainfo(pstapriv, bc_addr); if (!psta) { - res = _FAIL; - RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("rtw_alloc_stainfo fail")); - goto exit; + RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, + ("rtw_alloc_stainfo fail")); + return _FAIL; } /* default broadcast & multicast use macid 1 */ psta->mac_id = 1; -exit: - return res; + return _SUCCESS; } struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter) @@ -471,13 +476,13 @@ struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter) return rtw_get_stainfo(pstapriv, bc_addr); } -u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) +bool rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) { - u8 res = true; + bool res = true; #ifdef CONFIG_88EU_AP_MODE struct list_head *plist, *phead; struct rtw_wlan_acl_node *paclnode; - u8 match = false; + bool match = false; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct __queue *pacl_node_q = &pacl_list->acl_node_q; @@ -499,9 +504,9 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) spin_unlock_bh(&pacl_node_q->lock); if (pacl_list->mode == 1)/* accept unless in deny list */ - res = (match) ? false : true; + res = !match; else if (pacl_list->mode == 2)/* deny unless in accept list */ - res = (match) ? true : false; + res = match; else res = true; |