mac80211: adding 802.11n IEs handling
[powerpc.git] / net / mac80211 / sta_info.c
index fba2d79..ffe8a49 100644 (file)
 #include <linux/slab.h>
 #include <linux/skbuff.h>
 #include <linux/if_arp.h>
+#include <linux/timer.h>
 
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
 #include "ieee80211_rate.h"
 #include "sta_info.h"
-#include "debugfs_key.h"
 #include "debugfs_sta.h"
 
 /* Caller must hold local->sta_lock */
@@ -118,8 +118,6 @@ static void sta_info_release(struct kref *kref)
        }
        rate_control_free_sta(sta->rate_ctrl, sta->rate_ctrl_priv);
        rate_control_put(sta->rate_ctrl);
-       if (sta->key)
-               ieee80211_debugfs_key_sta_del(sta->key, sta);
        kfree(sta);
 }
 
@@ -135,6 +133,7 @@ struct sta_info * sta_info_add(struct ieee80211_local *local,
                               struct net_device *dev, u8 *addr, gfp_t gfp)
 {
        struct sta_info *sta;
+       DECLARE_MAC_BUF(mac);
 
        sta = kzalloc(sizeof(*sta), gfp);
        if (!sta)
@@ -161,14 +160,14 @@ struct sta_info * sta_info_add(struct ieee80211_local *local,
        list_add(&sta->list, &local->sta_list);
        local->num_sta++;
        sta_info_hash_add(local, sta);
-       if (local->ops->sta_table_notification)
-               local->ops->sta_table_notification(local_to_hw(local),
-                                                 local->num_sta);
+       if (local->ops->sta_notify)
+               local->ops->sta_notify(local_to_hw(local), dev->ifindex,
+                                       STA_NOTIFY_ADD, addr);
        write_unlock_bh(&local->sta_lock);
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-       printk(KERN_DEBUG "%s: Added STA " MAC_FMT "\n",
-              local->mdev->name, MAC_ARG(addr));
+       printk(KERN_DEBUG "%s: Added STA %s\n",
+              wiphy_name(local->hw.wiphy), print_mac(mac, addr));
 #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
 
 #ifdef CONFIG_MAC80211_DEBUGFS
@@ -201,15 +200,13 @@ void sta_info_remove(struct sta_info *sta)
        local->num_sta--;
        sta_info_remove_aid_ptr(sta);
 
-       if (local->ops->sta_table_notification)
-               local->ops->sta_table_notification(local_to_hw(local),
-                                                  local->num_sta);
 }
 
 void sta_info_free(struct sta_info *sta)
 {
        struct sk_buff *skb;
        struct ieee80211_local *local = sta->local;
+       DECLARE_MAC_BUF(mac);
 
        might_sleep();
 
@@ -226,15 +223,16 @@ void sta_info_free(struct sta_info *sta)
        }
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-       printk(KERN_DEBUG "%s: Removed STA " MAC_FMT "\n",
-              local->mdev->name, MAC_ARG(sta->addr));
+       printk(KERN_DEBUG "%s: Removed STA %s\n",
+              wiphy_name(local->hw.wiphy), print_mac(mac, sta->addr));
 #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
 
-       if (sta->key) {
-               ieee80211_debugfs_key_remove(sta->key);
-               ieee80211_key_free(sta->key);
-               sta->key = NULL;
-       }
+       ieee80211_key_free(sta->key);
+       sta->key = NULL;
+
+       if (local->ops->sta_notify)
+               local->ops->sta_notify(local_to_hw(local), sta->dev->ifindex,
+                                       STA_NOTIFY_REMOVE, sta->addr);
 
        rate_control_remove_sta_debugfs(sta);
        ieee80211_sta_debugfs_remove(sta);
@@ -269,6 +267,7 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
 {
        unsigned long flags;
        struct sk_buff *skb;
+       DECLARE_MAC_BUF(mac);
 
        if (skb_queue_empty(&sta->ps_tx_buf))
                return;
@@ -287,7 +286,7 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
                if (skb) {
                        local->total_ps_buffered--;
                        printk(KERN_DEBUG "Buffered frame expired (STA "
-                              MAC_FMT ")\n", MAC_ARG(sta->addr));
+                              "%s)\n", print_mac(mac, sta->addr));
                        dev_kfree_skb(skb);
                } else
                        break;
@@ -308,7 +307,8 @@ static void sta_info_cleanup(unsigned long data)
        }
        read_unlock_bh(&local->sta_lock);
 
-       local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL;
+       local->sta_cleanup.expires =
+               round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
        add_timer(&local->sta_cleanup);
 }
 
@@ -346,10 +346,10 @@ void sta_info_init(struct ieee80211_local *local)
        rwlock_init(&local->sta_lock);
        INIT_LIST_HEAD(&local->sta_list);
 
-       init_timer(&local->sta_cleanup);
-       local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL;
-       local->sta_cleanup.data = (unsigned long) local;
-       local->sta_cleanup.function = sta_info_cleanup;
+       setup_timer(&local->sta_cleanup, sta_info_cleanup,
+                   (unsigned long)local);
+       local->sta_cleanup.expires =
+               round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
 
 #ifdef CONFIG_MAC80211_DEBUGFS
        INIT_WORK(&local->sta_debugfs_add, sta_info_debugfs_add_task);