[MAC80211]: move some rate control functions out of ieee80211.c
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 27 Jul 2007 13:43:23 +0000 (15:43 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:47:35 +0000 (16:47 -0700)
I think these can go with rate control just as well and it makes
ieee80211.c more readable.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/ieee80211.c
net/mac80211/ieee80211_i.h
net/mac80211/ieee80211_rate.c
net/mac80211/ieee80211_rate.h

index f20e647552ec65fc6758adedf1c5b97e9df34574..2b15505a6e487a8cb6d16368c33b67d105a6d9af 100644 (file)
@@ -1542,47 +1542,6 @@ void ieee80211_if_mgmt_setup(struct net_device *dev)
        dev->destructor = ieee80211_if_free;
 }
 
-int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
-                                const char *name)
-{
-       struct rate_control_ref *ref, *old;
-
-       ASSERT_RTNL();
-       if (local->open_count || netif_running(local->mdev) ||
-           (local->apdev && netif_running(local->apdev)))
-               return -EBUSY;
-
-       ref = rate_control_alloc(name, local);
-       if (!ref) {
-               printk(KERN_WARNING "%s: Failed to select rate control "
-                      "algorithm\n", local->mdev->name);
-               return -ENOENT;
-       }
-
-       old = local->rate_ctrl;
-       local->rate_ctrl = ref;
-       if (old) {
-               rate_control_put(old);
-               sta_info_flush(local, NULL);
-       }
-
-       printk(KERN_DEBUG "%s: Selected rate control "
-              "algorithm '%s'\n", local->mdev->name,
-              ref->ops->name);
-
-
-       return 0;
-}
-
-static void rate_control_deinitialize(struct ieee80211_local *local)
-{
-       struct rate_control_ref *ref;
-
-       ref = local->rate_ctrl;
-       local->rate_ctrl = NULL;
-       rate_control_put(ref);
-}
-
 struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
                                        const struct ieee80211_ops *ops)
 {
index af8b9848e0210080821fb0fc7ded51de522ef4c7..28414b3e0c3484fe6be26e624ff6e409872811ad 100644 (file)
@@ -727,8 +727,6 @@ void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
 int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
 void ieee80211_if_setup(struct net_device *dev);
 void ieee80211_if_mgmt_setup(struct net_device *dev);
-int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
-                                const char *name);
 struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
 struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local,
                                          int phymode, int hwrate);
index 2118de04fc3542b1ee2323f90ff040013dfa121f..a1ded7449784d8c25361d4d49056e04f9d6ba000 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/rtnetlink.h>
 #include "ieee80211_rate.h"
 #include "ieee80211_i.h"
 
@@ -137,3 +138,44 @@ void rate_control_put(struct rate_control_ref *ref)
 {
        kref_put(&ref->kref, rate_control_release);
 }
+
+int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
+                                const char *name)
+{
+       struct rate_control_ref *ref, *old;
+
+       ASSERT_RTNL();
+       if (local->open_count || netif_running(local->mdev) ||
+           (local->apdev && netif_running(local->apdev)))
+               return -EBUSY;
+
+       ref = rate_control_alloc(name, local);
+       if (!ref) {
+               printk(KERN_WARNING "%s: Failed to select rate control "
+                      "algorithm\n", local->mdev->name);
+               return -ENOENT;
+       }
+
+       old = local->rate_ctrl;
+       local->rate_ctrl = ref;
+       if (old) {
+               rate_control_put(old);
+               sta_info_flush(local, NULL);
+       }
+
+       printk(KERN_DEBUG "%s: Selected rate control "
+              "algorithm '%s'\n", local->mdev->name,
+              ref->ops->name);
+
+
+       return 0;
+}
+
+void rate_control_deinitialize(struct ieee80211_local *local)
+{
+       struct rate_control_ref *ref;
+
+       ref = local->rate_ctrl;
+       local->rate_ctrl = NULL;
+       rate_control_put(ref);
+}
index f021a028d9d0fa551b55d1b999dccdf0bcdb2be4..cac91a960ff4e1db5bda61e8a4de4706177bb9ec 100644 (file)
@@ -141,4 +141,10 @@ static inline void rate_control_remove_sta_debugfs(struct sta_info *sta)
 #endif
 }
 
+
+/* functions for rate control related to a device */
+int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
+                                const char *name);
+void rate_control_deinitialize(struct ieee80211_local *local);
+
 #endif /* IEEE80211_RATE_H */