diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-06-10 05:30:17 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-06-10 05:30:17 -0300 |
commit | d635711daa98be86d4c7fd01499c34f566b54ccb (patch) | |
tree | aa5cc3760a27c3d57146498cb82fa549547de06c /drivers/staging/rtl8723au/core/rtw_ap.c | |
parent | c91265cd0efb83778f015b4d4b1129bd2cfd075e (diff) |
Linux-libre 4.6.2-gnu
Diffstat (limited to 'drivers/staging/rtl8723au/core/rtw_ap.c')
-rw-r--r-- | drivers/staging/rtl8723au/core/rtw_ap.c | 193 |
1 files changed, 17 insertions, 176 deletions
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 1aa9b267c..f68e27702 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -171,24 +171,20 @@ static u8 chk_sta_is_alive(struct sta_info *psta) return ret; } -void expire_timeout_chk23a(struct rtw_adapter *padapter) +void expire_timeout_chk23a(struct rtw_adapter *padapter) { - struct list_head *phead, *plist, *ptmp; + struct list_head *phead; u8 updated = 0; - struct sta_info *psta; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; struct sta_info *chk_alive_list[NUM_STA]; int i; spin_lock_bh(&pstapriv->auth_list_lock); - phead = &pstapriv->auth_list; - /* check auth_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, auth_list); - + list_for_each_entry_safe(psta, ptmp, phead, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -206,19 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) spin_lock_bh(&pstapriv->auth_list_lock); } } - } - spin_unlock_bh(&pstapriv->auth_list_lock); spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - /* check asoc_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; @@ -283,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) } } } - spin_unlock_bh(&pstapriv->asoc_list_lock); if (chk_alive_num) { @@ -1057,103 +1046,6 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode) pacl_list->mode = mode; } -int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) -{ - struct list_head *plist, *phead; - u8 added = false; - int i, ret = 0; - struct rtw_wlan_acl_node *paclnode; - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q; - - DBG_8723A("%s(acl_num =%d) =%pM\n", __func__, pacl_list->num, addr); - - if ((NUM_ACL-1) < pacl_list->num) - return -1; - - spin_lock_bh(&pacl_node_q->lock); - - phead = get_list_head(pacl_node_q); - - list_for_each(plist, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { - if (paclnode->valid == true) { - added = true; - DBG_8723A("%s, sta has been added\n", __func__); - break; - } - } - } - - spin_unlock_bh(&pacl_node_q->lock); - - if (added) - return ret; - - spin_lock_bh(&pacl_node_q->lock); - - for (i = 0; i < NUM_ACL; i++) { - paclnode = &pacl_list->aclnode[i]; - - if (!paclnode->valid) { - INIT_LIST_HEAD(&paclnode->list); - - memcpy(paclnode->addr, addr, ETH_ALEN); - - paclnode->valid = true; - - list_add_tail(&paclnode->list, get_list_head(pacl_node_q)); - - pacl_list->num++; - - break; - } - } - - DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num); - - spin_unlock_bh(&pacl_node_q->lock); - return ret; -} - -int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) -{ - struct list_head *plist, *phead, *ptmp; - struct rtw_wlan_acl_node *paclnode; - struct sta_priv *pstapriv = &padapter->stapriv; - struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; - struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q; - - DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr); - - spin_lock_bh(&pacl_node_q->lock); - - phead = get_list_head(pacl_node_q); - - list_for_each_safe(plist, ptmp, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { - if (paclnode->valid) { - paclnode->valid = false; - - list_del_init(&paclnode->list); - - pacl_list->num--; - } - } - } - - spin_unlock_bh(&pacl_node_q->lock); - - DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num); - - return 0; -} - static void update_bcn_erpinfo_ie(struct rtw_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1354,20 +1246,14 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) { /* update associated stations cap. */ if (updated == true) { - struct list_head *phead, *plist, *ptmp; - struct sta_info *psta; + struct list_head *phead; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) VCS_update23a(padapter, psta); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); } } @@ -1625,41 +1511,10 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti return beacon_updated; } -int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset) -{ - struct list_head *phead, *plist; - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - if ((pmlmeinfo->state&0x03) != MSR_AP) - return 0; - - DBG_8723A("%s(%s): with ch:%u, offset:%u\n", __func__, - padapter->pnetdev->name, new_ch, ch_offset); - - spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - - list_for_each(plist, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - - issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset); - psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); - - issue_action_spct_ch_switch23a(padapter, bc_addr, new_ch, ch_offset); - - return 0; -} - int rtw_sta_flush23a(struct rtw_adapter *padapter) { - struct list_head *phead, *plist, *ptmp; - struct sta_info *psta; + struct list_head *phead; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; @@ -1675,10 +1530,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter) spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; - - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { /* Remove sta from asoc_list */ list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -1744,9 +1596,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter) struct mlme_priv *mlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta; + struct sta_info *psta, *ptmp; struct security_priv *psecuritypriv = &padapter->securitypriv; - struct list_head *phead, *plist, *ptmp; + struct list_head *phead; u8 chk_alive_num = 0; struct sta_info *chk_alive_list[NUM_STA]; int i; @@ -1775,15 +1627,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter) } spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) chk_alive_list[chk_alive_num++] = psta; - } - spin_unlock_bh(&pstapriv->asoc_list_lock); for (i = 0; i < chk_alive_num; i++) { @@ -1841,8 +1687,8 @@ void start_ap_mode23a(struct rtw_adapter *padapter) void stop_ap_mode23a(struct rtw_adapter *padapter) { - struct list_head *phead, *plist, *ptmp; - struct rtw_wlan_acl_node *paclnode; + struct list_head *phead; + struct rtw_wlan_acl_node *paclnode, *ptmp; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1864,15 +1710,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter) /* for ACL */ spin_lock_bh(&pacl_node_q->lock); phead = get_list_head(pacl_node_q); - - list_for_each_safe(plist, ptmp, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - + list_for_each_entry_safe(paclnode, ptmp, phead, list) { if (paclnode->valid == true) { paclnode->valid = false; - list_del_init(&paclnode->list); - pacl_list->num--; } } |