aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_rate.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-07-27 09:43:23 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:47:35 -0400
commitff6880892990aece71a3271425dfde35344d51bb (patch)
tree6a6c5f61c0e060a9080345324df5a16e33a94f7e /net/mac80211/ieee80211_rate.c
parent1f5a7e47ae58cc23c623c09f1c9d97b7a8cf6344 (diff)
[MAC80211]: move some rate control functions out of ieee80211.c
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>
Diffstat (limited to 'net/mac80211/ieee80211_rate.c')
-rw-r--r--net/mac80211/ieee80211_rate.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index 2118de04fc3..a1ded744978 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/rtnetlink.h>
12#include "ieee80211_rate.h" 13#include "ieee80211_rate.h"
13#include "ieee80211_i.h" 14#include "ieee80211_i.h"
14 15
@@ -137,3 +138,44 @@ void rate_control_put(struct rate_control_ref *ref)
137{ 138{
138 kref_put(&ref->kref, rate_control_release); 139 kref_put(&ref->kref, rate_control_release);
139} 140}
141
142int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
143 const char *name)
144{
145 struct rate_control_ref *ref, *old;
146
147 ASSERT_RTNL();
148 if (local->open_count || netif_running(local->mdev) ||
149 (local->apdev && netif_running(local->apdev)))
150 return -EBUSY;
151
152 ref = rate_control_alloc(name, local);
153 if (!ref) {
154 printk(KERN_WARNING "%s: Failed to select rate control "
155 "algorithm\n", local->mdev->name);
156 return -ENOENT;
157 }
158
159 old = local->rate_ctrl;
160 local->rate_ctrl = ref;
161 if (old) {
162 rate_control_put(old);
163 sta_info_flush(local, NULL);
164 }
165
166 printk(KERN_DEBUG "%s: Selected rate control "
167 "algorithm '%s'\n", local->mdev->name,
168 ref->ops->name);
169
170
171 return 0;
172}
173
174void rate_control_deinitialize(struct ieee80211_local *local)
175{
176 struct rate_control_ref *ref;
177
178 ref = local->rate_ctrl;
179 local->rate_ctrl = NULL;
180 rate_control_put(ref);
181}