sta_info.c (4a80f2788952055a627f2093a0174537d70aec1b) | sta_info.c (ee3858551ae6d044578f598f8001db5f1a9fd52e) |
---|---|
1/* 2 * Copyright 2002-2005, Instant802 Networks, Inc. 3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation. 8 */ --- 7 unchanged lines hidden (view full) --- 16#include <linux/if_arp.h> 17#include <linux/timer.h> 18 19#include <net/mac80211.h> 20#include "ieee80211_i.h" 21#include "ieee80211_rate.h" 22#include "sta_info.h" 23#include "debugfs_sta.h" | 1/* 2 * Copyright 2002-2005, Instant802 Networks, Inc. 3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation. 8 */ --- 7 unchanged lines hidden (view full) --- 16#include <linux/if_arp.h> 17#include <linux/timer.h> 18 19#include <net/mac80211.h> 20#include "ieee80211_i.h" 21#include "ieee80211_rate.h" 22#include "sta_info.h" 23#include "debugfs_sta.h" |
24#ifdef CONFIG_MAC80211_MESH 25#include "mesh.h" 26#endif |
|
24 25/* Caller must hold local->sta_lock */ 26static void sta_info_hash_add(struct ieee80211_local *local, 27 struct sta_info *sta) 28{ 29 sta->hnext = local->sta_hash[STA_HASH(sta->addr)]; 30 local->sta_hash[STA_HASH(sta->addr)] = sta; 31} --- 47 unchanged lines hidden (view full) --- 79 if (sta) 80 __sta_info_get(sta); 81 read_unlock_bh(&local->sta_lock); 82 83 return sta; 84} 85EXPORT_SYMBOL(sta_info_get); 86 | 27 28/* Caller must hold local->sta_lock */ 29static void sta_info_hash_add(struct ieee80211_local *local, 30 struct sta_info *sta) 31{ 32 sta->hnext = local->sta_hash[STA_HASH(sta->addr)]; 33 local->sta_hash[STA_HASH(sta->addr)] = sta; 34} --- 47 unchanged lines hidden (view full) --- 82 if (sta) 83 __sta_info_get(sta); 84 read_unlock_bh(&local->sta_lock); 85 86 return sta; 87} 88EXPORT_SYMBOL(sta_info_get); 89 |
90struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx, 91 struct net_device *dev) 92{ 93 struct sta_info *sta; 94 int i = 0; |
|
87 | 95 |
96 read_lock_bh(&local->sta_lock); 97 list_for_each_entry(sta, &local->sta_list, list) { 98 if (i < idx) { 99 ++i; 100 continue; 101 } else if (!dev || dev == sta->dev) { 102 __sta_info_get(sta); 103 read_unlock_bh(&local->sta_lock); 104 return sta; 105 } 106 } 107 read_unlock_bh(&local->sta_lock); 108 109 return NULL; 110} 111 |
|
88static void sta_info_release(struct kref *kref) 89{ 90 struct sta_info *sta = container_of(kref, struct sta_info, kref); 91 struct ieee80211_local *local = sta->local; 92 struct sk_buff *skb; 93 int i; 94 95 /* free sta structure; it has already been removed from --- 183 unchanged lines hidden (view full) --- 279 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 280 if (sta->flags & WLAN_STA_PS) { 281 sta->flags &= ~WLAN_STA_PS; 282 if (sdata->bss) 283 atomic_dec(&sdata->bss->num_sta_ps); 284 __sta_info_clear_tim_bit(sdata->bss, sta); 285 } 286 local->num_sta--; | 112static void sta_info_release(struct kref *kref) 113{ 114 struct sta_info *sta = container_of(kref, struct sta_info, kref); 115 struct ieee80211_local *local = sta->local; 116 struct sk_buff *skb; 117 int i; 118 119 /* free sta structure; it has already been removed from --- 183 unchanged lines hidden (view full) --- 303 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 304 if (sta->flags & WLAN_STA_PS) { 305 sta->flags &= ~WLAN_STA_PS; 306 if (sdata->bss) 307 atomic_dec(&sdata->bss->num_sta_ps); 308 __sta_info_clear_tim_bit(sdata->bss, sta); 309 } 310 local->num_sta--; |
311 312#ifdef CONFIG_MAC80211_MESH 313 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) 314 mesh_accept_plinks_update(sdata->dev); 315#endif |
|
287} 288 289void sta_info_free(struct sta_info *sta) 290{ 291 struct sk_buff *skb; 292 struct ieee80211_local *local = sta->local; | 316} 317 318void sta_info_free(struct sta_info *sta) 319{ 320 struct sk_buff *skb; 321 struct ieee80211_local *local = sta->local; |
322 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 323 |
|
293 DECLARE_MAC_BUF(mac); 294 295 might_sleep(); 296 297 write_lock_bh(&local->sta_lock); 298 sta_info_remove(sta); 299 write_unlock_bh(&local->sta_lock); 300 | 324 DECLARE_MAC_BUF(mac); 325 326 might_sleep(); 327 328 write_lock_bh(&local->sta_lock); 329 sta_info_remove(sta); 330 write_unlock_bh(&local->sta_lock); 331 |
332#ifdef CONFIG_MAC80211_MESH 333 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) { 334 spin_lock_bh(&sta->plink_lock); 335 mesh_plink_deactivate(sta); 336 spin_unlock_bh(&sta->plink_lock); 337 } 338#endif 339 |
|
301 while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { 302 local->total_ps_buffered--; 303 dev_kfree_skb(skb); 304 } 305 while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { 306 dev_kfree_skb(skb); 307 } 308 309#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 310 printk(KERN_DEBUG "%s: Removed STA %s\n", 311 wiphy_name(local->hw.wiphy), print_mac(mac, sta->addr)); 312#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 313 314 ieee80211_key_free(sta->key); 315 WARN_ON(sta->key); 316 317 if (local->ops->sta_notify) { | 340 while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { 341 local->total_ps_buffered--; 342 dev_kfree_skb(skb); 343 } 344 while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { 345 dev_kfree_skb(skb); 346 } 347 348#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 349 printk(KERN_DEBUG "%s: Removed STA %s\n", 350 wiphy_name(local->hw.wiphy), print_mac(mac, sta->addr)); 351#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 352 353 ieee80211_key_free(sta->key); 354 WARN_ON(sta->key); 355 356 if (local->ops->sta_notify) { |
318 struct ieee80211_sub_if_data *sdata; | |
319 | 357 |
320 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 321 | |
322 if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) 323 sdata = sdata->u.vlan.ap; 324 325 local->ops->sta_notify(local_to_hw(local), &sdata->vif, 326 STA_NOTIFY_REMOVE, sta->addr); 327 } 328 329 rate_control_remove_sta_debugfs(sta); --- 160 unchanged lines hidden --- | 358 if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) 359 sdata = sdata->u.vlan.ap; 360 361 local->ops->sta_notify(local_to_hw(local), &sdata->vif, 362 STA_NOTIFY_REMOVE, sta->addr); 363 } 364 365 rate_control_remove_sta_debugfs(sta); --- 160 unchanged lines hidden --- |