Commit ac71c691 authored by Johannes Berg's avatar Johannes Berg Committed by David S. Miller

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: default avatarJohannes Berg <johannes@sipsolutions.net>
Acked-by: default avatarMichael Buesch <mb@bu3sch.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8a8f1c04
...@@ -13,6 +13,18 @@ config MAC80211 ...@@ -13,6 +13,18 @@ config MAC80211
This option enables the hardware independent IEEE 802.11 This option enables the hardware independent IEEE 802.11
networking stack. networking stack.
config MAC80211_RCSIMPLE
bool "'simple' rate control algorithm"
default y
depends on MAC80211 && EMBEDDED
help
This option allows you to turn off the 'simple' rate
control algorithm in mac80211. If you do turn it off,
you absolutely need another rate control algorithm.
Say Y unless you know you will have another algorithm
available.
config MAC80211_LEDS config MAC80211_LEDS
bool "Enable LED triggers" bool "Enable LED triggers"
depends on MAC80211 && LEDS_TRIGGERS depends on MAC80211 && LEDS_TRIGGERS
......
obj-$(CONFIG_MAC80211) += mac80211.o rc80211_simple.o obj-$(CONFIG_MAC80211) += mac80211.o
mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
mac80211-objs-$(CONFIG_NET_SCHED) += wme.o mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o
mac80211-objs := \ mac80211-objs := \
ieee80211.o \ ieee80211.o \
......
...@@ -1233,8 +1233,17 @@ static int __init ieee80211_init(void) ...@@ -1233,8 +1233,17 @@ static int __init ieee80211_init(void)
BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb));
#ifdef CONFIG_MAC80211_RCSIMPLE
ret = ieee80211_rate_control_register(&mac80211_rcsimple);
if (ret)
return ret;
#endif
ret = ieee80211_wme_register(); ret = ieee80211_wme_register();
if (ret) { if (ret) {
#ifdef CONFIG_MAC80211_RCSIMPLE
ieee80211_rate_control_unregister(&mac80211_rcsimple);
#endif
printk(KERN_DEBUG "ieee80211_init: failed to " printk(KERN_DEBUG "ieee80211_init: failed to "
"initialize WME (err=%d)\n", ret); "initialize WME (err=%d)\n", ret);
return ret; return ret;
...@@ -1248,6 +1257,10 @@ static int __init ieee80211_init(void) ...@@ -1248,6 +1257,10 @@ static int __init ieee80211_init(void)
static void __exit ieee80211_exit(void) static void __exit ieee80211_exit(void)
{ {
#ifdef CONFIG_MAC80211_RCSIMPLE
ieee80211_rate_control_unregister(&mac80211_rcsimple);
#endif
ieee80211_wme_unregister(); ieee80211_wme_unregister();
ieee80211_debugfs_netdev_exit(); ieee80211_debugfs_netdev_exit();
} }
......
...@@ -25,6 +25,9 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops) ...@@ -25,6 +25,9 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
{ {
struct rate_control_alg *alg; struct rate_control_alg *alg;
if (!ops->name)
return -EINVAL;
alg = kzalloc(sizeof(*alg), GFP_KERNEL); alg = kzalloc(sizeof(*alg), GFP_KERNEL);
if (alg == NULL) { if (alg == NULL) {
return -ENOMEM; return -ENOMEM;
...@@ -61,9 +64,12 @@ ieee80211_try_rate_control_ops_get(const char *name) ...@@ -61,9 +64,12 @@ ieee80211_try_rate_control_ops_get(const char *name)
struct rate_control_alg *alg; struct rate_control_alg *alg;
struct rate_control_ops *ops = NULL; struct rate_control_ops *ops = NULL;
if (!name)
return NULL;
mutex_lock(&rate_ctrl_mutex); mutex_lock(&rate_ctrl_mutex);
list_for_each_entry(alg, &rate_ctrl_algs, list) { list_for_each_entry(alg, &rate_ctrl_algs, list) {
if (!name || !strcmp(alg->ops->name, name)) if (!strcmp(alg->ops->name, name))
if (try_module_get(alg->ops->module)) { if (try_module_get(alg->ops->module)) {
ops = alg->ops; ops = alg->ops;
break; break;
...@@ -80,9 +86,12 @@ ieee80211_rate_control_ops_get(const char *name) ...@@ -80,9 +86,12 @@ ieee80211_rate_control_ops_get(const char *name)
{ {
struct rate_control_ops *ops; struct rate_control_ops *ops;
if (!name)
name = "simple";
ops = ieee80211_try_rate_control_ops_get(name); ops = ieee80211_try_rate_control_ops_get(name);
if (!ops) { if (!ops) {
request_module("rc80211_%s", name ? name : "default"); request_module("rc80211_%s", name);
ops = ieee80211_try_rate_control_ops_get(name); ops = ieee80211_try_rate_control_ops_get(name);
} }
return ops; return ops;
......
...@@ -65,6 +65,9 @@ struct rate_control_ref { ...@@ -65,6 +65,9 @@ struct rate_control_ref {
struct kref kref; struct kref kref;
}; };
/* default 'simple' algorithm */
extern struct rate_control_ops mac80211_rcsimple;
int ieee80211_rate_control_register(struct rate_control_ops *ops); int ieee80211_rate_control_register(struct rate_control_ops *ops);
void ieee80211_rate_control_unregister(struct rate_control_ops *ops); void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -29,8 +28,6 @@ ...@@ -29,8 +28,6 @@
#define RATE_CONTROL_INTERVAL (HZ / 20) #define RATE_CONTROL_INTERVAL (HZ / 20)
#define RATE_CONTROL_MIN_TX 10 #define RATE_CONTROL_MIN_TX 10
MODULE_ALIAS("rc80211_default");
static void rate_control_rate_inc(struct ieee80211_local *local, static void rate_control_rate_inc(struct ieee80211_local *local,
struct sta_info *sta) struct sta_info *sta)
{ {
...@@ -394,8 +391,7 @@ static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta) ...@@ -394,8 +391,7 @@ static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta)
} }
#endif #endif
static struct rate_control_ops rate_control_simple = { struct rate_control_ops mac80211_rcsimple = {
.module = THIS_MODULE,
.name = "simple", .name = "simple",
.tx_status = rate_control_simple_tx_status, .tx_status = rate_control_simple_tx_status,
.get_rate = rate_control_simple_get_rate, .get_rate = rate_control_simple_get_rate,
...@@ -410,22 +406,3 @@ static struct rate_control_ops rate_control_simple = { ...@@ -410,22 +406,3 @@ static struct rate_control_ops rate_control_simple = {
.remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs,
#endif #endif
}; };
static int __init rate_control_simple_init(void)
{
return ieee80211_rate_control_register(&rate_control_simple);
}
static void __exit rate_control_simple_exit(void)
{
ieee80211_rate_control_unregister(&rate_control_simple);
}
subsys_initcall(rate_control_simple_init);
module_exit(rate_control_simple_exit);
MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211");
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment