nfsd4.1: common slot allocation size calculation
[safe/jmp/linux-2.6] / net / mac80211 / sta_info.c
index 7116220..594f231 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
+#include "driver-ops.h"
 #include "rate.h"
 #include "sta_info.h"
 #include "debugfs_sta.h"
  * When the insertion fails (sta_info_insert()) returns non-zero), the
  * structure will have been freed by sta_info_insert()!
  *
+ * sta entries are added by mac80211 when you establish a link with a
+ * peer. This means different things for the different type of interfaces
+ * we support. For a regular station this mean we add the AP sta when we
+ * receive an assocation response from the AP. For IBSS this occurs when
+ * we receive a probe response or a beacon from target IBSS network. For
+ * WDS we add the sta for the peer imediately upon device open. When using
+ * AP mode we add stations for each respective station upon request from
+ * userspace through nl80211.
+ *
  * Because there are debugfs entries for each station, and adding those
  * must be able to sleep, it is also possible to "pin" a station entry,
  * that means it can be removed from the hash table but not be freed.
@@ -292,6 +302,9 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
        skb_queue_head_init(&sta->ps_tx_buf);
        skb_queue_head_init(&sta->tx_filtered);
 
+       for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
+               sta->last_seq_ctrl[i] = cpu_to_le16(USHORT_MAX);
+
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
        printk(KERN_DEBUG "%s: Allocated STA %pM\n",
               wiphy_name(local->hw.wiphy), sta->sta.addr);
@@ -336,6 +349,7 @@ int sta_info_insert(struct sta_info *sta)
                goto out_free;
        }
        list_add(&sta->list, &local->sta_list);
+       local->sta_generation++;
        local->num_sta++;
        sta_info_hash_add(local, sta);
 
@@ -346,8 +360,8 @@ int sta_info_insert(struct sta_info *sta)
                                             struct ieee80211_sub_if_data,
                                             u.ap);
 
-               local->ops->sta_notify(local_to_hw(local), &sdata->vif,
-                                      STA_NOTIFY_ADD, &sta->sta);
+               drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta);
+               sdata = sta->sdata;
        }
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -405,8 +419,7 @@ static void __sta_info_set_tim_bit(struct ieee80211_if_ap *bss,
 
        if (sta->local->ops->set_tim) {
                sta->local->tim_in_locked_section = true;
-               sta->local->ops->set_tim(local_to_hw(sta->local),
-                                        &sta->sta, true);
+               drv_set_tim(sta->local, &sta->sta, true);
                sta->local->tim_in_locked_section = false;
        }
 }
@@ -431,8 +444,7 @@ static void __sta_info_clear_tim_bit(struct ieee80211_if_ap *bss,
 
        if (sta->local->ops->set_tim) {
                sta->local->tim_in_locked_section = true;
-               sta->local->ops->set_tim(local_to_hw(sta->local),
-                                        &sta->sta, false);
+               drv_set_tim(sta->local, &sta->sta, false);
                sta->local->tim_in_locked_section = false;
        }
 }
@@ -475,6 +487,7 @@ static void __sta_info_unlink(struct sta_info **sta)
        }
 
        local->num_sta--;
+       local->sta_generation++;
 
        if (local->ops->sta_notify) {
                if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
@@ -482,8 +495,9 @@ static void __sta_info_unlink(struct sta_info **sta)
                                             struct ieee80211_sub_if_data,
                                             u.ap);
 
-               local->ops->sta_notify(local_to_hw(local), &sdata->vif,
-                                      STA_NOTIFY_REMOVE, &(*sta)->sta);
+               drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE,
+                              &(*sta)->sta);
+               sdata = (*sta)->sdata;
        }
 
        if (ieee80211_vif_is_mesh(&sdata->vif)) {
@@ -610,6 +624,9 @@ static void sta_info_cleanup(unsigned long data)
                sta_info_cleanup_expire_buffered(local, sta);
        rcu_read_unlock();
 
+       if (local->quiescing)
+               return;
+
        local->sta_cleanup.expires =
                round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
        add_timer(&local->sta_cleanup);