diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-01-17 04:33:29 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-24 14:21:55 -0500 |
commit | 889cbb911a195b832745f77240f547cb2a2885bc (patch) | |
tree | 973a6325e082b0840a56a284a95b609134058c39 /net/mac80211 | |
parent | 151a02f693b866dd43e147725c818fc1ddb96aa3 (diff) |
mac80211: clean up rate control code
It seems exceedingly unlikely that we'll ever
support swapping rate control algorithms at
runtime, so remove the unused refcounting code.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/rate.c | 27 | ||||
-rw-r--r-- | net/mac80211/rate.h | 4 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 10 |
3 files changed, 7 insertions, 34 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 5a5a7767d541..a21110aecd1a 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -159,7 +159,6 @@ static struct rate_control_ref *rate_control_alloc(const char *name, | |||
159 | ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); | 159 | ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); |
160 | if (!ref) | 160 | if (!ref) |
161 | goto fail_ref; | 161 | goto fail_ref; |
162 | kref_init(&ref->kref); | ||
163 | ref->local = local; | 162 | ref->local = local; |
164 | ref->ops = ieee80211_rate_control_ops_get(name); | 163 | ref->ops = ieee80211_rate_control_ops_get(name); |
165 | if (!ref->ops) | 164 | if (!ref->ops) |
@@ -184,11 +183,8 @@ fail_ref: | |||
184 | return NULL; | 183 | return NULL; |
185 | } | 184 | } |
186 | 185 | ||
187 | static void rate_control_release(struct kref *kref) | 186 | static void rate_control_free(struct rate_control_ref *ctrl_ref) |
188 | { | 187 | { |
189 | struct rate_control_ref *ctrl_ref; | ||
190 | |||
191 | ctrl_ref = container_of(kref, struct rate_control_ref, kref); | ||
192 | ctrl_ref->ops->free(ctrl_ref->priv); | 188 | ctrl_ref->ops->free(ctrl_ref->priv); |
193 | 189 | ||
194 | #ifdef CONFIG_MAC80211_DEBUGFS | 190 | #ifdef CONFIG_MAC80211_DEBUGFS |
@@ -383,21 +379,10 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, | |||
383 | BUG_ON(info->control.rates[0].idx < 0); | 379 | BUG_ON(info->control.rates[0].idx < 0); |
384 | } | 380 | } |
385 | 381 | ||
386 | struct rate_control_ref *rate_control_get(struct rate_control_ref *ref) | ||
387 | { | ||
388 | kref_get(&ref->kref); | ||
389 | return ref; | ||
390 | } | ||
391 | |||
392 | void rate_control_put(struct rate_control_ref *ref) | ||
393 | { | ||
394 | kref_put(&ref->kref, rate_control_release); | ||
395 | } | ||
396 | |||
397 | int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | 382 | int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, |
398 | const char *name) | 383 | const char *name) |
399 | { | 384 | { |
400 | struct rate_control_ref *ref, *old; | 385 | struct rate_control_ref *ref; |
401 | 386 | ||
402 | ASSERT_RTNL(); | 387 | ASSERT_RTNL(); |
403 | 388 | ||
@@ -417,12 +402,8 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | |||
417 | return -ENOENT; | 402 | return -ENOENT; |
418 | } | 403 | } |
419 | 404 | ||
420 | old = local->rate_ctrl; | 405 | WARN_ON(local->rate_ctrl); |
421 | local->rate_ctrl = ref; | 406 | local->rate_ctrl = ref; |
422 | if (old) { | ||
423 | rate_control_put(old); | ||
424 | sta_info_flush(local, NULL); | ||
425 | } | ||
426 | 407 | ||
427 | wiphy_debug(local->hw.wiphy, "Selected rate control algorithm '%s'\n", | 408 | wiphy_debug(local->hw.wiphy, "Selected rate control algorithm '%s'\n", |
428 | ref->ops->name); | 409 | ref->ops->name); |
@@ -440,6 +421,6 @@ void rate_control_deinitialize(struct ieee80211_local *local) | |||
440 | return; | 421 | return; |
441 | 422 | ||
442 | local->rate_ctrl = NULL; | 423 | local->rate_ctrl = NULL; |
443 | rate_control_put(ref); | 424 | rate_control_free(ref); |
444 | } | 425 | } |
445 | 426 | ||
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h index 168427b0ffdc..8268457bd143 100644 --- a/net/mac80211/rate.h +++ b/net/mac80211/rate.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/skbuff.h> | 15 | #include <linux/skbuff.h> |
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/kref.h> | ||
18 | #include <net/mac80211.h> | 17 | #include <net/mac80211.h> |
19 | #include "ieee80211_i.h" | 18 | #include "ieee80211_i.h" |
20 | #include "sta_info.h" | 19 | #include "sta_info.h" |
@@ -23,14 +22,11 @@ struct rate_control_ref { | |||
23 | struct ieee80211_local *local; | 22 | struct ieee80211_local *local; |
24 | struct rate_control_ops *ops; | 23 | struct rate_control_ops *ops; |
25 | void *priv; | 24 | void *priv; |
26 | struct kref kref; | ||
27 | }; | 25 | }; |
28 | 26 | ||
29 | void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, | 27 | void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, |
30 | struct sta_info *sta, | 28 | struct sta_info *sta, |
31 | struct ieee80211_tx_rate_control *txrc); | 29 | struct ieee80211_tx_rate_control *txrc); |
32 | struct rate_control_ref *rate_control_get(struct rate_control_ref *ref); | ||
33 | void rate_control_put(struct rate_control_ref *ref); | ||
34 | 30 | ||
35 | static inline void rate_control_tx_status(struct ieee80211_local *local, | 31 | static inline void rate_control_tx_status(struct ieee80211_local *local, |
36 | struct ieee80211_supported_band *sband, | 32 | struct ieee80211_supported_band *sband, |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index a09000432664..f28fa02b6e54 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -208,10 +208,8 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, | |||
208 | */ | 208 | */ |
209 | void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) | 209 | void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) |
210 | { | 210 | { |
211 | if (sta->rate_ctrl) { | 211 | if (sta->rate_ctrl) |
212 | rate_control_free_sta(sta); | 212 | rate_control_free_sta(sta); |
213 | rate_control_put(sta->rate_ctrl); | ||
214 | } | ||
215 | 213 | ||
216 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 214 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
217 | wiphy_debug(local->hw.wiphy, "Destroyed STA %pM\n", sta->sta.addr); | 215 | wiphy_debug(local->hw.wiphy, "Destroyed STA %pM\n", sta->sta.addr); |
@@ -264,13 +262,11 @@ static int sta_prepare_rate_control(struct ieee80211_local *local, | |||
264 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) | 262 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) |
265 | return 0; | 263 | return 0; |
266 | 264 | ||
267 | sta->rate_ctrl = rate_control_get(local->rate_ctrl); | 265 | sta->rate_ctrl = local->rate_ctrl; |
268 | sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl, | 266 | sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl, |
269 | &sta->sta, gfp); | 267 | &sta->sta, gfp); |
270 | if (!sta->rate_ctrl_priv) { | 268 | if (!sta->rate_ctrl_priv) |
271 | rate_control_put(sta->rate_ctrl); | ||
272 | return -ENOMEM; | 269 | return -ENOMEM; |
273 | } | ||
274 | 270 | ||
275 | return 0; | 271 | return 0; |
276 | } | 272 | } |