aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/sta_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/sta_info.c')
-rw-r--r--net/mac80211/sta_info.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 71f370dd24bc..d1a77e79d7a9 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -103,13 +103,16 @@ static int sta_info_hash_del(struct ieee80211_local *local,
103} 103}
104 104
105/* protected by RCU */ 105/* protected by RCU */
106struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr) 106struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
107 const u8 *addr)
107{ 108{
109 struct ieee80211_local *local = sdata->local;
108 struct sta_info *sta; 110 struct sta_info *sta;
109 111
110 sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); 112 sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);
111 while (sta) { 113 while (sta) {
112 if (memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) 114 if (sta->sdata == sdata &&
115 memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
113 break; 116 break;
114 sta = rcu_dereference(sta->hnext); 117 sta = rcu_dereference(sta->hnext);
115 } 118 }
@@ -369,7 +372,7 @@ int sta_info_insert(struct sta_info *sta)
369 goto out_free; 372 goto out_free;
370 } 373 }
371 374
372 if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 || 375 if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->vif.addr) == 0 ||
373 is_multicast_ether_addr(sta->sta.addr))) { 376 is_multicast_ether_addr(sta->sta.addr))) {
374 err = -EINVAL; 377 err = -EINVAL;
375 goto out_free; 378 goto out_free;
@@ -377,7 +380,7 @@ int sta_info_insert(struct sta_info *sta)
377 380
378 spin_lock_irqsave(&local->sta_lock, flags); 381 spin_lock_irqsave(&local->sta_lock, flags);
379 /* check if STA exists already */ 382 /* check if STA exists already */
380 if (sta_info_get(local, sta->sta.addr)) { 383 if (sta_info_get(sdata, sta->sta.addr)) {
381 spin_unlock_irqrestore(&local->sta_lock, flags); 384 spin_unlock_irqrestore(&local->sta_lock, flags);
382 err = -EEXIST; 385 err = -EEXIST;
383 goto out_free; 386 goto out_free;
@@ -394,7 +397,7 @@ int sta_info_insert(struct sta_info *sta)
394 struct ieee80211_sub_if_data, 397 struct ieee80211_sub_if_data,
395 u.ap); 398 u.ap);
396 399
397 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta); 400 drv_sta_notify(local, sdata, STA_NOTIFY_ADD, &sta->sta);
398 sdata = sta->sdata; 401 sdata = sta->sdata;
399 } 402 }
400 403
@@ -534,7 +537,7 @@ static void __sta_info_unlink(struct sta_info **sta)
534 struct ieee80211_sub_if_data, 537 struct ieee80211_sub_if_data,
535 u.ap); 538 u.ap);
536 539
537 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE, 540 drv_sta_notify(local, sdata, STA_NOTIFY_REMOVE,
538 &(*sta)->sta); 541 &(*sta)->sta);
539 sdata = (*sta)->sdata; 542 sdata = (*sta)->sdata;
540 } 543 }
@@ -828,7 +831,7 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
828 if (time_after(jiffies, sta->last_rx + exp_time)) { 831 if (time_after(jiffies, sta->last_rx + exp_time)) {
829#ifdef CONFIG_MAC80211_IBSS_DEBUG 832#ifdef CONFIG_MAC80211_IBSS_DEBUG
830 printk(KERN_DEBUG "%s: expiring inactive STA %pM\n", 833 printk(KERN_DEBUG "%s: expiring inactive STA %pM\n",
831 sdata->dev->name, sta->sta.addr); 834 sdata->name, sta->sta.addr);
832#endif 835#endif
833 __sta_info_unlink(&sta); 836 __sta_info_unlink(&sta);
834 if (sta) 837 if (sta)
@@ -843,11 +846,12 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
843struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw, 846struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw,
844 const u8 *addr) 847 const u8 *addr)
845{ 848{
846 struct sta_info *sta = sta_info_get(hw_to_local(hw), addr); 849 struct sta_info *sta, *nxt;
847 850
848 if (!sta) 851 /* Just return a random station ... first in list ... */
849 return NULL; 852 for_each_sta_info(hw_to_local(hw), addr, sta, nxt)
850 return &sta->sta; 853 return &sta->sta;
854 return NULL;
851} 855}
852EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw); 856EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw);
853 857
@@ -872,7 +876,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
872 struct ieee80211_local *local = sdata->local; 876 struct ieee80211_local *local = sdata->local;
873 int sent, buffered; 877 int sent, buffered;
874 878
875 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_AWAKE, &sta->sta); 879 drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
876 880
877 if (!skb_queue_empty(&sta->ps_tx_buf)) 881 if (!skb_queue_empty(&sta->ps_tx_buf))
878 sta_info_clear_tim_bit(sta); 882 sta_info_clear_tim_bit(sta);
@@ -885,7 +889,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
885 889
886#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 890#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
887 printk(KERN_DEBUG "%s: STA %pM aid %d sending %d filtered/%d PS frames " 891 printk(KERN_DEBUG "%s: STA %pM aid %d sending %d filtered/%d PS frames "
888 "since STA not sleeping anymore\n", sdata->dev->name, 892 "since STA not sleeping anymore\n", sdata->name,
889 sta->sta.addr, sta->sta.aid, sent - buffered, buffered); 893 sta->sta.addr, sta->sta.aid, sent - buffered, buffered);
890#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 894#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
891} 895}
@@ -944,7 +948,7 @@ void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta)
944 */ 948 */
945 printk(KERN_DEBUG "%s: STA %pM sent PS Poll even " 949 printk(KERN_DEBUG "%s: STA %pM sent PS Poll even "
946 "though there are no buffered frames for it\n", 950 "though there are no buffered frames for it\n",
947 sdata->dev->name, sta->sta.addr); 951 sdata->name, sta->sta.addr);
948#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 952#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
949 } 953 }
950} 954}