aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/Kconfig37
-rw-r--r--net/mac80211/Makefile41
-rw-r--r--net/mac80211/ieee80211.c34
-rw-r--r--net/mac80211/ieee80211_rate.c4
-rw-r--r--net/mac80211/ieee80211_rate.h38
-rw-r--r--net/mac80211/rc80211_pid_algo.c24
-rw-r--r--net/mac80211/rc80211_simple.c21
7 files changed, 134 insertions, 65 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index cac6cf2e9ac8..09c255002e56 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -13,25 +13,17 @@ 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
16config MAC80211_RC_DEFAULT_CHOICE 16menu "Rate control algorithm selection"
17 bool "Choose default rate control algorithm" if EMBEDDED 17 depends on MAC80211 != n
18 default y
19 depends on MAC80211
20 ---help---
21 This options enables selection of a default rate control
22 algorithm to be built into the mac80211 module. Alternate
23 rate control algorithms might be built into the mac80211
24 module as well.
25 18
26choice 19choice
27 prompt "Default rate control algorithm" 20 prompt "Default rate control algorithm"
28 default MAC80211_RC_DEFAULT_PID 21 default MAC80211_RC_DEFAULT_PID
29 depends on MAC80211 && MAC80211_RC_DEFAULT_CHOICE
30 ---help--- 22 ---help---
31 This option selects the default rate control algorithm 23 This option selects the default rate control algorithm
32 mac80211 will use. Note that this default can still be 24 mac80211 will use. Note that this default can still be
33 overriden through the ieee80211_default_rc_algo module 25 overriden through the ieee80211_default_rc_algo module
34 parameter. 26 parameter if different algorithms are available.
35 27
36config MAC80211_RC_DEFAULT_PID 28config MAC80211_RC_DEFAULT_PID
37 bool "PID controller based rate control algorithm" 29 bool "PID controller based rate control algorithm"
@@ -50,19 +42,27 @@ config MAC80211_RC_DEFAULT_SIMPLE
50 dumb algorithm. You should choose the PID rate control 42 dumb algorithm. You should choose the PID rate control
51 instead. 43 instead.
52 44
45config MAC80211_RC_DEFAULT_NONE
46 bool "No default algorithm"
47 depends on EMBEDDED
48 help
49 Selecting this option will select no default algorithm
50 and allow you to not build any. Do not choose this
51 option unless you know your driver comes with another
52 suitable algorithm.
53endchoice 53endchoice
54 54
55comment "Selecting 'y' for an algorithm will"
56comment "build the algorithm into mac80211."
57
55config MAC80211_RC_DEFAULT 58config MAC80211_RC_DEFAULT
56 string 59 string
57 depends on MAC80211
58 default "pid" if MAC80211_RC_DEFAULT_PID 60 default "pid" if MAC80211_RC_DEFAULT_PID
59 default "simple" if MAC80211_RC_DEFAULT_SIMPLE 61 default "simple" if MAC80211_RC_DEFAULT_SIMPLE
60 default "" 62 default ""
61 63
62config MAC80211_RC_PID 64config MAC80211_RC_PID
63 bool "PID controller based rate control algorithm" 65 tristate "PID controller based rate control algorithm"
64 default y
65 depends on MAC80211
66 ---help--- 66 ---help---
67 This option enables a TX rate control algorithm for 67 This option enables a TX rate control algorithm for
68 mac80211 that uses a PID controller to select the TX 68 mac80211 that uses a PID controller to select the TX
@@ -72,16 +72,15 @@ config MAC80211_RC_PID
72 different rate control algorithm. 72 different rate control algorithm.
73 73
74config MAC80211_RC_SIMPLE 74config MAC80211_RC_SIMPLE
75 bool "Simple rate control algorithm (DEPRECATED)" 75 tristate "Simple rate control algorithm (DEPRECATED)"
76 default n
77 depends on MAC80211
78 ---help--- 76 ---help---
79 This option enables a very simple, non-responsive TX 77 This option enables a very simple, non-responsive TX
80 rate control algorithm. This algorithm is deprecated 78 rate control algorithm. This algorithm is deprecated
81 and will be removed from the kernel in near future. 79 and will be removed from the kernel in the near future.
82 It has been replaced by the PID algorithm. 80 It has been replaced by the PID algorithm.
83 81
84 Say N unless you know what you are doing. 82 Say N unless you know what you are doing.
83endmenu
85 84
86config MAC80211_LEDS 85config MAC80211_LEDS
87 bool "Enable LED triggers" 86 bool "Enable LED triggers"
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 06aea8009cd4..54f46bc80cfe 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -1,19 +1,15 @@
1obj-$(CONFIG_MAC80211) += mac80211.o 1obj-$(CONFIG_MAC80211) += mac80211.o
2 2
3mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o 3# objects for PID algorithm
4mac80211-objs-$(CONFIG_NET_SCHED) += wme.o 4rc80211_pid-y := rc80211_pid_algo.o
5mac80211-objs-$(CONFIG_MAC80211_RC_SIMPLE) += rc80211_simple.o 5rc80211_pid-$(CONFIG_MAC80211_DEBUGFS) += rc80211_pid_debugfs.o
6mac80211-objs-$(CONFIG_MAC80211_RC_PID) += rc80211_pid_algo.o
7 6
8mac80211-debugfs-objs-$(CONFIG_MAC80211_RC_PID) += rc80211_pid_debugfs.o 7# build helper for PID algorithm
9mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += \ 8rc-pid-y := $(rc80211_pid-y)
10 debugfs.o \ 9rc-pid-m := rc80211_pid.o
11 debugfs_sta.o \
12 debugfs_netdev.o \
13 debugfs_key.o \
14 $(mac80211-debugfs-objs-y)
15 10
16mac80211-objs := \ 11# mac80211 objects
12mac80211-y := \
17 ieee80211.o \ 13 ieee80211.o \
18 ieee80211_ioctl.o \ 14 ieee80211_ioctl.o \
19 sta_info.o \ 15 sta_info.o \
@@ -31,5 +27,22 @@ mac80211-objs := \
31 tx.o \ 27 tx.o \
32 key.o \ 28 key.o \
33 util.o \ 29 util.o \
34 event.o \ 30 event.o
35 $(mac80211-objs-y) 31
32mac80211-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
33mac80211-$(CONFIG_NET_SCHED) += wme.o
34mac80211-$(CONFIG_MAC80211_DEBUGFS) += \
35 debugfs.o \
36 debugfs_sta.o \
37 debugfs_netdev.o \
38 debugfs_key.o
39
40
41# Build rate control algorithm(s)
42CFLAGS_rc80211_simple.o += -DRC80211_SIMPLE_COMPILE
43CFLAGS_rc80211_pid_algo.o += -DRC80211_PID_COMPILE
44mac80211-$(CONFIG_MAC80211_RC_SIMPLE) += rc80211_simple.o
45mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc-pid-$(CONFIG_MAC80211_RC_PID))
46
47# Modular rate algorithms are assigned to mac80211-m - make separate modules
48obj-m += $(mac80211-m)
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 2011c726f2b1..8ba69ae676ca 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -1323,23 +1323,19 @@ static int __init ieee80211_init(void)
1323 1323
1324 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); 1324 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb));
1325 1325
1326#ifdef CONFIG_MAC80211_RC_SIMPLE 1326 ret = rc80211_simple_init();
1327 ret = ieee80211_rate_control_register(&mac80211_rcsimple);
1328 if (ret) 1327 if (ret)
1329 goto fail; 1328 goto fail;
1330#endif
1331 1329
1332#ifdef CONFIG_MAC80211_RC_PID 1330 ret = rc80211_pid_init();
1333 ret = ieee80211_rate_control_register(&mac80211_rcpid);
1334 if (ret) 1331 if (ret)
1335 goto fail; 1332 goto fail_simple;
1336#endif
1337 1333
1338 ret = ieee80211_wme_register(); 1334 ret = ieee80211_wme_register();
1339 if (ret) { 1335 if (ret) {
1340 printk(KERN_DEBUG "ieee80211_init: failed to " 1336 printk(KERN_DEBUG "ieee80211_init: failed to "
1341 "initialize WME (err=%d)\n", ret); 1337 "initialize WME (err=%d)\n", ret);
1342 goto fail; 1338 goto fail_pid;
1343 } 1339 }
1344 1340
1345 ieee80211_debugfs_netdev_init(); 1341 ieee80211_debugfs_netdev_init();
@@ -1347,26 +1343,18 @@ static int __init ieee80211_init(void)
1347 1343
1348 return 0; 1344 return 0;
1349 1345
1350fail: 1346 fail_pid:
1351 1347 rc80211_simple_exit();
1352#ifdef CONFIG_MAC80211_RC_SIMPLE 1348 fail_simple:
1353 ieee80211_rate_control_unregister(&mac80211_rcsimple); 1349 rc80211_pid_exit();
1354#endif 1350 fail:
1355#ifdef CONFIG_MAC80211_RC_PID
1356 ieee80211_rate_control_unregister(&mac80211_rcpid);
1357#endif
1358
1359 return ret; 1351 return ret;
1360} 1352}
1361 1353
1362static void __exit ieee80211_exit(void) 1354static void __exit ieee80211_exit(void)
1363{ 1355{
1364#ifdef CONFIG_MAC80211_RC_SIMPLE 1356 rc80211_simple_exit();
1365 ieee80211_rate_control_unregister(&mac80211_rcsimple); 1357 rc80211_pid_exit();
1366#endif
1367#ifdef CONFIG_MAC80211_RC_PID
1368 ieee80211_rate_control_unregister(&mac80211_rcpid);
1369#endif
1370 1358
1371 ieee80211_wme_unregister(); 1359 ieee80211_wme_unregister();
1372 ieee80211_debugfs_netdev_exit(); 1360 ieee80211_debugfs_netdev_exit();
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index 65fc9ad615e9..5676a26a7c75 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -115,6 +115,10 @@ ieee80211_rate_control_ops_get(const char *name)
115 /* try default if specific alg requested but not found */ 115 /* try default if specific alg requested but not found */
116 ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo); 116 ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo);
117 117
118 /* try built-in one if specific alg requested but not found */
119 if (!ops && strlen(CONFIG_MAC80211_RC_DEFAULT))
120 ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT);
121
118 return ops; 122 return ops;
119} 123}
120 124
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h
index 3eb0696f3757..73f19e8aa51c 100644
--- a/net/mac80211/ieee80211_rate.h
+++ b/net/mac80211/ieee80211_rate.h
@@ -58,12 +58,6 @@ struct rate_control_ref {
58 struct kref kref; 58 struct kref kref;
59}; 59};
60 60
61/* default 'simple' algorithm */
62extern struct rate_control_ops mac80211_rcsimple;
63
64/* 'PID' algorithm */
65extern struct rate_control_ops mac80211_rcpid;
66
67int ieee80211_rate_control_register(struct rate_control_ops *ops); 61int ieee80211_rate_control_register(struct rate_control_ops *ops);
68void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 62void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
69 63
@@ -170,4 +164,36 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
170 const char *name); 164 const char *name);
171void rate_control_deinitialize(struct ieee80211_local *local); 165void rate_control_deinitialize(struct ieee80211_local *local);
172 166
167
168/* Rate control algorithms */
169#if defined(RC80211_SIMPLE_COMPILE) || \
170 (defined(CONFIG_MAC80211_RC_SIMPLE) && \
171 !defined(CONFIG_MAC80211_RC_SIMPLE_MODULE))
172extern int rc80211_simple_init(void);
173extern void rc80211_simple_exit(void);
174#else
175static inline int rc80211_simple_init(void)
176{
177 return 0;
178}
179static inline void rc80211_simple_exit(void)
180{
181}
182#endif
183
184#if defined(RC80211_PID_COMPILE) || \
185 (defined(CONFIG_MAC80211_RC_PID) && \
186 !defined(CONFIG_MAC80211_RC_PID_MODULE))
187extern int rc80211_pid_init(void);
188extern void rc80211_pid_exit(void);
189#else
190static inline int rc80211_pid_init(void)
191{
192 return 0;
193}
194static inline void rc80211_pid_exit(void)
195{
196}
197#endif
198
173#endif /* IEEE80211_RATE_H */ 199#endif /* IEEE80211_RATE_H */
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index da3529017da1..0995bb9cec21 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -12,7 +12,7 @@
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/skbuff.h> 14#include <linux/skbuff.h>
15 15#include <linux/debugfs.h>
16#include <net/mac80211.h> 16#include <net/mac80211.h>
17#include "ieee80211_rate.h" 17#include "ieee80211_rate.h"
18 18
@@ -492,7 +492,7 @@ static void rate_control_pid_free_sta(void *priv, void *priv_sta)
492 kfree(spinfo); 492 kfree(spinfo);
493} 493}
494 494
495struct rate_control_ops mac80211_rcpid = { 495static struct rate_control_ops mac80211_rcpid = {
496 .name = "pid", 496 .name = "pid",
497 .tx_status = rate_control_pid_tx_status, 497 .tx_status = rate_control_pid_tx_status,
498 .get_rate = rate_control_pid_get_rate, 498 .get_rate = rate_control_pid_get_rate,
@@ -507,3 +507,23 @@ struct rate_control_ops mac80211_rcpid = {
507 .remove_sta_debugfs = rate_control_pid_remove_sta_debugfs, 507 .remove_sta_debugfs = rate_control_pid_remove_sta_debugfs,
508#endif 508#endif
509}; 509};
510
511MODULE_DESCRIPTION("PID controller based rate control algorithm");
512MODULE_AUTHOR("Stefano Brivio");
513MODULE_AUTHOR("Mattias Nissler");
514MODULE_LICENSE("GPL");
515
516int __init rc80211_pid_init(void)
517{
518 return ieee80211_rate_control_register(&mac80211_rcpid);
519}
520
521void __exit rc80211_pid_exit(void)
522{
523 ieee80211_rate_control_unregister(&mac80211_rcpid);
524}
525
526#ifdef CONFIG_MAC80211_RC_PID_MODULE
527module_init(rc80211_pid_init);
528module_exit(rc80211_pid_exit);
529#endif
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c
index c1c8b76a56af..33de6f967e55 100644
--- a/net/mac80211/rc80211_simple.c
+++ b/net/mac80211/rc80211_simple.c
@@ -13,6 +13,7 @@
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/skbuff.h> 14#include <linux/skbuff.h>
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <linux/module.h>
16 17
17#include <net/mac80211.h> 18#include <net/mac80211.h>
18#include "ieee80211_i.h" 19#include "ieee80211_i.h"
@@ -349,7 +350,7 @@ static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta)
349} 350}
350#endif 351#endif
351 352
352struct rate_control_ops mac80211_rcsimple = { 353static struct rate_control_ops mac80211_rcsimple = {
353 .name = "simple", 354 .name = "simple",
354 .tx_status = rate_control_simple_tx_status, 355 .tx_status = rate_control_simple_tx_status,
355 .get_rate = rate_control_simple_get_rate, 356 .get_rate = rate_control_simple_get_rate,
@@ -364,3 +365,21 @@ struct rate_control_ops mac80211_rcsimple = {
364 .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, 365 .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs,
365#endif 366#endif
366}; 367};
368
369MODULE_LICENSE("GPL");
370MODULE_DESCRIPTION("Simple rate control algorithm");
371
372int __init rc80211_simple_init(void)
373{
374 return ieee80211_rate_control_register(&mac80211_rcsimple);
375}
376
377void __exit rc80211_simple_exit(void)
378{
379 ieee80211_rate_control_unregister(&mac80211_rcsimple);
380}
381
382#ifdef CONFIG_MAC80211_RC_SIMPLE_MODULE
383module_init(rc80211_simple_init);
384module_exit(rc80211_simple_exit);
385#endif