Skip to content

Commit ad01837

Browse files
saittamdavem330
authored andcommitted
mac80211: add PID controller based rate control algorithm
Add a new rate control algorithm based on a PID controller. It samples the percentage of failed frames over time, feeds the result into the controller and uses its output to control the TX rate. Signed-off-by: Mattias Nissler <[email protected]> Signed-off-by: John W. Linville <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1abbe49 commit ad01837

File tree

5 files changed

+403
-5
lines changed

5 files changed

+403
-5
lines changed

net/mac80211/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ config MAC80211_RCSIMPLE
2525
Say Y unless you know you will have another algorithm
2626
available.
2727

28+
config MAC80211_RCPID
29+
bool "'PID' rate control algorithm" if EMBEDDED
30+
default y
31+
depends on MAC80211
32+
help
33+
This option enables a TX rate control algorithm for
34+
mac80211 that uses a PID controller to select the TX
35+
rate.
36+
37+
Say Y unless you're sure you want to use a different
38+
rate control algorithm.
39+
2840
config MAC80211_LEDS
2941
bool "Enable LED triggers"
3042
depends on MAC80211 && LEDS_TRIGGERS

net/mac80211/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
44
mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
55
mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
66
mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o
7+
mac80211-objs-$(CONFIG_MAC80211_RCPID) += rc80211_pid.o
78

89
mac80211-objs := \
910
ieee80211.o \

net/mac80211/ieee80211.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,30 +1315,47 @@ static int __init ieee80211_init(void)
13151315
#ifdef CONFIG_MAC80211_RCSIMPLE
13161316
ret = ieee80211_rate_control_register(&mac80211_rcsimple);
13171317
if (ret)
1318-
return ret;
1318+
goto fail;
1319+
#endif
1320+
1321+
#ifdef CONFIG_MAC80211_RCPID
1322+
ret = ieee80211_rate_control_register(&mac80211_rcpid);
1323+
if (ret)
1324+
goto fail;
13191325
#endif
13201326

13211327
ret = ieee80211_wme_register();
13221328
if (ret) {
1323-
#ifdef CONFIG_MAC80211_RCSIMPLE
1324-
ieee80211_rate_control_unregister(&mac80211_rcsimple);
1325-
#endif
13261329
printk(KERN_DEBUG "ieee80211_init: failed to "
13271330
"initialize WME (err=%d)\n", ret);
1328-
return ret;
1331+
goto fail;
13291332
}
13301333

13311334
ieee80211_debugfs_netdev_init();
13321335
ieee80211_regdomain_init();
13331336

13341337
return 0;
1338+
1339+
fail:
1340+
1341+
#ifdef CONFIG_MAC80211_RCSIMPLE
1342+
ieee80211_rate_control_unregister(&mac80211_rcsimple);
1343+
#endif
1344+
#ifdef CONFIG_MAC80211_RCPID
1345+
ieee80211_rate_control_unregister(&mac80211_rcpid);
1346+
#endif
1347+
1348+
return ret;
13351349
}
13361350

13371351
static void __exit ieee80211_exit(void)
13381352
{
13391353
#ifdef CONFIG_MAC80211_RCSIMPLE
13401354
ieee80211_rate_control_unregister(&mac80211_rcsimple);
13411355
#endif
1356+
#ifdef CONFIG_MAC80211_RCPID
1357+
ieee80211_rate_control_unregister(&mac80211_rcpid);
1358+
#endif
13421359

13431360
ieee80211_wme_unregister();
13441361
ieee80211_debugfs_netdev_exit();

net/mac80211/ieee80211_rate.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ struct rate_control_ref {
6161
/* default 'simple' algorithm */
6262
extern struct rate_control_ops mac80211_rcsimple;
6363

64+
/* 'PID' algorithm */
65+
extern struct rate_control_ops mac80211_rcpid;
66+
6467
int ieee80211_rate_control_register(struct rate_control_ops *ops);
6568
void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
6669

0 commit comments

Comments
 (0)