diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-10-28 09:17:44 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-11-11 00:59:23 -0500 |
commit | ac71c691e6a5ce991fe221d3bdb0c972f617aa37 (patch) | |
tree | a3641b416579fbb8368e04e1a88f68e0da8dfe39 /net | |
parent | 8a8f1c0437a77cce29c1cb6089f01f22a6d9ca6e (diff) |
mac80211: make simple rate control algorithm built-in
Too frequently people do not have module autoloading enabled
or fail to install the rate control module correctly, hence
their hardware probing fails due to no rate control algorithm
being available. This makes the 'simple' algorithm built into
the mac80211 module unless EMBEDDED is enabled in which case
it can be disabled (eg. if the wanted driver requires another
rate control algorithm.)
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/Kconfig | 12 | ||||
-rw-r--r-- | net/mac80211/Makefile | 3 | ||||
-rw-r--r-- | net/mac80211/ieee80211.c | 13 | ||||
-rw-r--r-- | net/mac80211/ieee80211_rate.c | 13 | ||||
-rw-r--r-- | net/mac80211/ieee80211_rate.h | 3 | ||||
-rw-r--r-- | net/mac80211/rc80211_simple.c | 25 |
6 files changed, 42 insertions, 27 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 6fffb3845ab6..32c8c08c4683 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -13,6 +13,18 @@ config MAC80211 | |||
13 | This option enables the hardware independent IEEE 802.11 | 13 | This option enables the hardware independent IEEE 802.11 |
14 | networking stack. | 14 | networking stack. |
15 | 15 | ||
16 | config MAC80211_RCSIMPLE | ||
17 | bool "'simple' rate control algorithm" | ||
18 | default y | ||
19 | depends on MAC80211 && EMBEDDED | ||
20 | help | ||
21 | This option allows you to turn off the 'simple' rate | ||
22 | control algorithm in mac80211. If you do turn it off, | ||
23 | you absolutely need another rate control algorithm. | ||
24 | |||
25 | Say Y unless you know you will have another algorithm | ||
26 | available. | ||
27 | |||
16 | config MAC80211_LEDS | 28 | config MAC80211_LEDS |
17 | bool "Enable LED triggers" | 29 | bool "Enable LED triggers" |
18 | depends on MAC80211 && LEDS_TRIGGERS | 30 | depends on MAC80211 && LEDS_TRIGGERS |
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index 219cd9f9341f..1e6237b34846 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile | |||
@@ -1,8 +1,9 @@ | |||
1 | obj-$(CONFIG_MAC80211) += mac80211.o rc80211_simple.o | 1 | obj-$(CONFIG_MAC80211) += mac80211.o |
2 | 2 | ||
3 | mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o | 3 | mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o |
4 | mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o | 4 | mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o |
5 | mac80211-objs-$(CONFIG_NET_SCHED) += wme.o | 5 | mac80211-objs-$(CONFIG_NET_SCHED) += wme.o |
6 | mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o | ||
6 | 7 | ||
7 | mac80211-objs := \ | 8 | mac80211-objs := \ |
8 | ieee80211.o \ | 9 | ieee80211.o \ |
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index f484ca7ade9c..52ba6ef90685 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -1233,8 +1233,17 @@ static int __init ieee80211_init(void) | |||
1233 | 1233 | ||
1234 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); | 1234 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); |
1235 | 1235 | ||
1236 | #ifdef CONFIG_MAC80211_RCSIMPLE | ||
1237 | ret = ieee80211_rate_control_register(&mac80211_rcsimple); | ||
1238 | if (ret) | ||
1239 | return ret; | ||
1240 | #endif | ||
1241 | |||
1236 | ret = ieee80211_wme_register(); | 1242 | ret = ieee80211_wme_register(); |
1237 | if (ret) { | 1243 | if (ret) { |
1244 | #ifdef CONFIG_MAC80211_RCSIMPLE | ||
1245 | ieee80211_rate_control_unregister(&mac80211_rcsimple); | ||
1246 | #endif | ||
1238 | printk(KERN_DEBUG "ieee80211_init: failed to " | 1247 | printk(KERN_DEBUG "ieee80211_init: failed to " |
1239 | "initialize WME (err=%d)\n", ret); | 1248 | "initialize WME (err=%d)\n", ret); |
1240 | return ret; | 1249 | return ret; |
@@ -1248,6 +1257,10 @@ static int __init ieee80211_init(void) | |||
1248 | 1257 | ||
1249 | static void __exit ieee80211_exit(void) | 1258 | static void __exit ieee80211_exit(void) |
1250 | { | 1259 | { |
1260 | #ifdef CONFIG_MAC80211_RCSIMPLE | ||
1261 | ieee80211_rate_control_unregister(&mac80211_rcsimple); | ||
1262 | #endif | ||
1263 | |||
1251 | ieee80211_wme_unregister(); | 1264 | ieee80211_wme_unregister(); |
1252 | ieee80211_debugfs_netdev_exit(); | 1265 | ieee80211_debugfs_netdev_exit(); |
1253 | } | 1266 | } |
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c index 93abb8fff141..e4bd8481554d 100644 --- a/net/mac80211/ieee80211_rate.c +++ b/net/mac80211/ieee80211_rate.c | |||
@@ -25,6 +25,9 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops) | |||
25 | { | 25 | { |
26 | struct rate_control_alg *alg; | 26 | struct rate_control_alg *alg; |
27 | 27 | ||
28 | if (!ops->name) | ||
29 | return -EINVAL; | ||
30 | |||
28 | alg = kzalloc(sizeof(*alg), GFP_KERNEL); | 31 | alg = kzalloc(sizeof(*alg), GFP_KERNEL); |
29 | if (alg == NULL) { | 32 | if (alg == NULL) { |
30 | return -ENOMEM; | 33 | return -ENOMEM; |
@@ -61,9 +64,12 @@ ieee80211_try_rate_control_ops_get(const char *name) | |||
61 | struct rate_control_alg *alg; | 64 | struct rate_control_alg *alg; |
62 | struct rate_control_ops *ops = NULL; | 65 | struct rate_control_ops *ops = NULL; |
63 | 66 | ||
67 | if (!name) | ||
68 | return NULL; | ||
69 | |||
64 | mutex_lock(&rate_ctrl_mutex); | 70 | mutex_lock(&rate_ctrl_mutex); |
65 | list_for_each_entry(alg, &rate_ctrl_algs, list) { | 71 | list_for_each_entry(alg, &rate_ctrl_algs, list) { |
66 | if (!name || !strcmp(alg->ops->name, name)) | 72 | if (!strcmp(alg->ops->name, name)) |
67 | if (try_module_get(alg->ops->module)) { | 73 | if (try_module_get(alg->ops->module)) { |
68 | ops = alg->ops; | 74 | ops = alg->ops; |
69 | break; | 75 | break; |
@@ -80,9 +86,12 @@ ieee80211_rate_control_ops_get(const char *name) | |||
80 | { | 86 | { |
81 | struct rate_control_ops *ops; | 87 | struct rate_control_ops *ops; |
82 | 88 | ||
89 | if (!name) | ||
90 | name = "simple"; | ||
91 | |||
83 | ops = ieee80211_try_rate_control_ops_get(name); | 92 | ops = ieee80211_try_rate_control_ops_get(name); |
84 | if (!ops) { | 93 | if (!ops) { |
85 | request_module("rc80211_%s", name ? name : "default"); | 94 | request_module("rc80211_%s", name); |
86 | ops = ieee80211_try_rate_control_ops_get(name); | 95 | ops = ieee80211_try_rate_control_ops_get(name); |
87 | } | 96 | } |
88 | return ops; | 97 | return ops; |
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h index 7cd1ebab4f83..23688139ffb3 100644 --- a/net/mac80211/ieee80211_rate.h +++ b/net/mac80211/ieee80211_rate.h | |||
@@ -65,6 +65,9 @@ struct rate_control_ref { | |||
65 | struct kref kref; | 65 | struct kref kref; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /* default 'simple' algorithm */ | ||
69 | extern struct rate_control_ops mac80211_rcsimple; | ||
70 | |||
68 | int ieee80211_rate_control_register(struct rate_control_ops *ops); | 71 | int ieee80211_rate_control_register(struct rate_control_ops *ops); |
69 | void ieee80211_rate_control_unregister(struct rate_control_ops *ops); | 72 | void ieee80211_rate_control_unregister(struct rate_control_ops *ops); |
70 | 73 | ||
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c index 314b8de88862..da72737364e4 100644 --- a/net/mac80211/rc80211_simple.c +++ b/net/mac80211/rc80211_simple.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/init.h> | 10 | #include <linux/init.h> |
12 | #include <linux/netdevice.h> | 11 | #include <linux/netdevice.h> |
13 | #include <linux/types.h> | 12 | #include <linux/types.h> |
@@ -29,8 +28,6 @@ | |||
29 | #define RATE_CONTROL_INTERVAL (HZ / 20) | 28 | #define RATE_CONTROL_INTERVAL (HZ / 20) |
30 | #define RATE_CONTROL_MIN_TX 10 | 29 | #define RATE_CONTROL_MIN_TX 10 |
31 | 30 | ||
32 | MODULE_ALIAS("rc80211_default"); | ||
33 | |||
34 | static void rate_control_rate_inc(struct ieee80211_local *local, | 31 | static void rate_control_rate_inc(struct ieee80211_local *local, |
35 | struct sta_info *sta) | 32 | struct sta_info *sta) |
36 | { | 33 | { |
@@ -394,8 +391,7 @@ static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta) | |||
394 | } | 391 | } |
395 | #endif | 392 | #endif |
396 | 393 | ||
397 | static struct rate_control_ops rate_control_simple = { | 394 | struct rate_control_ops mac80211_rcsimple = { |
398 | .module = THIS_MODULE, | ||
399 | .name = "simple", | 395 | .name = "simple", |
400 | .tx_status = rate_control_simple_tx_status, | 396 | .tx_status = rate_control_simple_tx_status, |
401 | .get_rate = rate_control_simple_get_rate, | 397 | .get_rate = rate_control_simple_get_rate, |
@@ -410,22 +406,3 @@ static struct rate_control_ops rate_control_simple = { | |||
410 | .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, | 406 | .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, |
411 | #endif | 407 | #endif |
412 | }; | 408 | }; |
413 | |||
414 | |||
415 | static int __init rate_control_simple_init(void) | ||
416 | { | ||
417 | return ieee80211_rate_control_register(&rate_control_simple); | ||
418 | } | ||
419 | |||
420 | |||
421 | static void __exit rate_control_simple_exit(void) | ||
422 | { | ||
423 | ieee80211_rate_control_unregister(&rate_control_simple); | ||
424 | } | ||
425 | |||
426 | |||
427 | subsys_initcall(rate_control_simple_init); | ||
428 | module_exit(rate_control_simple_exit); | ||
429 | |||
430 | MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211"); | ||
431 | MODULE_LICENSE("GPL"); | ||