aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/mlme.c26
-rw-r--r--net/mac80211/sta_info.c28
-rw-r--r--net/mac80211/sta_info.h3
3 files changed, 29 insertions, 28 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2c06f6965b7d..ffc47c81a161 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1913,32 +1913,6 @@ static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata)
1913} 1913}
1914 1914
1915 1915
1916static void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, unsigned long exp_time)
1917{
1918 struct ieee80211_local *local = sdata->local;
1919 struct sta_info *sta, *tmp;
1920 LIST_HEAD(tmp_list);
1921 DECLARE_MAC_BUF(mac);
1922 unsigned long flags;
1923
1924 spin_lock_irqsave(&local->sta_lock, flags);
1925 list_for_each_entry_safe(sta, tmp, &local->sta_list, list)
1926 if (time_after(jiffies, sta->last_rx + exp_time)) {
1927#ifdef CONFIG_MAC80211_IBSS_DEBUG
1928 printk(KERN_DEBUG "%s: expiring inactive STA %s\n",
1929 sdata->dev->name, print_mac(mac, sta->addr));
1930#endif
1931 __sta_info_unlink(&sta);
1932 if (sta)
1933 list_add(&sta->list, &tmp_list);
1934 }
1935 spin_unlock_irqrestore(&local->sta_lock, flags);
1936
1937 list_for_each_entry_safe(sta, tmp, &tmp_list, list)
1938 sta_info_destroy(sta);
1939}
1940
1941
1942static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata, 1916static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata,
1943 struct ieee80211_if_sta *ifsta) 1917 struct ieee80211_if_sta *ifsta)
1944{ 1918{
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index f2ba653b9d69..3370b2625633 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -424,7 +424,7 @@ void sta_info_clear_tim_bit(struct sta_info *sta)
424 spin_unlock_irqrestore(&sta->local->sta_lock, flags); 424 spin_unlock_irqrestore(&sta->local->sta_lock, flags);
425} 425}
426 426
427void __sta_info_unlink(struct sta_info **sta) 427static void __sta_info_unlink(struct sta_info **sta)
428{ 428{
429 struct ieee80211_local *local = (*sta)->local; 429 struct ieee80211_local *local = (*sta)->local;
430 struct ieee80211_sub_if_data *sdata = (*sta)->sdata; 430 struct ieee80211_sub_if_data *sdata = (*sta)->sdata;
@@ -802,3 +802,29 @@ void sta_info_flush_delayed(struct ieee80211_sub_if_data *sdata)
802 schedule_work(&local->sta_flush_work); 802 schedule_work(&local->sta_flush_work);
803 spin_unlock_irqrestore(&local->sta_lock, flags); 803 spin_unlock_irqrestore(&local->sta_lock, flags);
804} 804}
805
806void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
807 unsigned long exp_time)
808{
809 struct ieee80211_local *local = sdata->local;
810 struct sta_info *sta, *tmp;
811 LIST_HEAD(tmp_list);
812 DECLARE_MAC_BUF(mac);
813 unsigned long flags;
814
815 spin_lock_irqsave(&local->sta_lock, flags);
816 list_for_each_entry_safe(sta, tmp, &local->sta_list, list)
817 if (time_after(jiffies, sta->last_rx + exp_time)) {
818#ifdef CONFIG_MAC80211_IBSS_DEBUG
819 printk(KERN_DEBUG "%s: expiring inactive STA %s\n",
820 sdata->dev->name, print_mac(mac, sta->addr));
821#endif
822 __sta_info_unlink(&sta);
823 if (sta)
824 list_add(&sta->list, &tmp_list);
825 }
826 spin_unlock_irqrestore(&local->sta_lock, flags);
827
828 list_for_each_entry_safe(sta, tmp, &tmp_list, list)
829 sta_info_destroy(sta);
830}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 4a581a5b5766..220079900991 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -452,7 +452,6 @@ int sta_info_insert(struct sta_info *sta);
452 * has already unlinked it. 452 * has already unlinked it.
453 */ 453 */
454void sta_info_unlink(struct sta_info **sta); 454void sta_info_unlink(struct sta_info **sta);
455void __sta_info_unlink(struct sta_info **sta);
456 455
457void sta_info_destroy(struct sta_info *sta); 456void sta_info_destroy(struct sta_info *sta);
458void sta_info_set_tim_bit(struct sta_info *sta); 457void sta_info_set_tim_bit(struct sta_info *sta);
@@ -464,5 +463,7 @@ void sta_info_stop(struct ieee80211_local *local);
464int sta_info_flush(struct ieee80211_local *local, 463int sta_info_flush(struct ieee80211_local *local,
465 struct ieee80211_sub_if_data *sdata); 464 struct ieee80211_sub_if_data *sdata);
466void sta_info_flush_delayed(struct ieee80211_sub_if_data *sdata); 465void sta_info_flush_delayed(struct ieee80211_sub_if_data *sdata);
466void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
467 unsigned long exp_time);
467 468
468#endif /* STA_INFO_H */ 469#endif /* STA_INFO_H */