diff options
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 10 | ||||
-rw-r--r-- | net/mac80211/Kconfig | 19 | ||||
-rw-r--r-- | net/mac80211/Makefile | 2 | ||||
-rw-r--r-- | net/mac80211/ieee80211.c | 9 | ||||
-rw-r--r-- | net/mac80211/ieee80211_rate.h | 15 | ||||
-rw-r--r-- | net/mac80211/rc80211_simple.c | 394 |
6 files changed, 1 insertions, 448 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 2cf4d7ad7b0b..7279595b96c3 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -230,16 +230,6 @@ Who: Jean Delvare <khali@linux-fr.org> | |||
230 | 230 | ||
231 | --------------------------- | 231 | --------------------------- |
232 | 232 | ||
233 | What: rc80211-simple rate control algorithm for mac80211 | ||
234 | When: 2.6.26 | ||
235 | Files: net/mac80211/rc80211-simple.c | ||
236 | Why: This algorithm was provided for reference but always exhibited bad | ||
237 | responsiveness and performance and has some serious flaws. It has been | ||
238 | replaced by rc80211-pid. | ||
239 | Who: Stefano Brivio <stefano.brivio@polimi.it> | ||
240 | |||
241 | --------------------------- | ||
242 | |||
243 | What (Why): | 233 | What (Why): |
244 | - include/linux/netfilter_ipv4/ipt_TOS.h ipt_tos.h header files | 234 | - include/linux/netfilter_ipv4/ipt_TOS.h ipt_tos.h header files |
245 | (superseded by xt_TOS/xt_tos target & match) | 235 | (superseded by xt_TOS/xt_tos target & match) |
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 3c3f62faae1e..520a5180a4f6 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -32,15 +32,6 @@ config MAC80211_RC_DEFAULT_PID | |||
32 | default rate control algorithm. You should choose | 32 | default rate control algorithm. You should choose |
33 | this unless you know what you are doing. | 33 | this unless you know what you are doing. |
34 | 34 | ||
35 | config MAC80211_RC_DEFAULT_SIMPLE | ||
36 | bool "Simple rate control algorithm" | ||
37 | select MAC80211_RC_SIMPLE | ||
38 | ---help--- | ||
39 | Select the simple rate control as the default rate | ||
40 | control algorithm. Note that this is a non-responsive, | ||
41 | dumb algorithm. You should choose the PID rate control | ||
42 | instead. | ||
43 | |||
44 | config MAC80211_RC_DEFAULT_NONE | 35 | config MAC80211_RC_DEFAULT_NONE |
45 | bool "No default algorithm" | 36 | bool "No default algorithm" |
46 | depends on EMBEDDED | 37 | depends on EMBEDDED |
@@ -57,7 +48,6 @@ comment "build the algorithm into mac80211." | |||
57 | config MAC80211_RC_DEFAULT | 48 | config MAC80211_RC_DEFAULT |
58 | string | 49 | string |
59 | default "pid" if MAC80211_RC_DEFAULT_PID | 50 | default "pid" if MAC80211_RC_DEFAULT_PID |
60 | default "simple" if MAC80211_RC_DEFAULT_SIMPLE | ||
61 | default "" | 51 | default "" |
62 | 52 | ||
63 | config MAC80211_RC_PID | 53 | config MAC80211_RC_PID |
@@ -70,15 +60,6 @@ config MAC80211_RC_PID | |||
70 | Say Y or M unless you're sure you want to use a | 60 | Say Y or M unless you're sure you want to use a |
71 | different rate control algorithm. | 61 | different rate control algorithm. |
72 | 62 | ||
73 | config MAC80211_RC_SIMPLE | ||
74 | tristate "Simple rate control algorithm (DEPRECATED)" | ||
75 | ---help--- | ||
76 | This option enables a very simple, non-responsive TX | ||
77 | rate control algorithm. This algorithm is deprecated | ||
78 | and will be removed from the kernel in the near future. | ||
79 | It has been replaced by the PID algorithm. | ||
80 | |||
81 | Say N unless you know what you are doing. | ||
82 | endmenu | 63 | endmenu |
83 | 64 | ||
84 | config MAC80211_MESH | 65 | config MAC80211_MESH |
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index 829ce4256b76..70f4b26c2d87 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile | |||
@@ -44,9 +44,7 @@ mac80211-$(CONFIG_MAC80211_MESH) += \ | |||
44 | 44 | ||
45 | 45 | ||
46 | # Build rate control algorithm(s) | 46 | # Build rate control algorithm(s) |
47 | CFLAGS_rc80211_simple.o += -DRC80211_SIMPLE_COMPILE | ||
48 | CFLAGS_rc80211_pid_algo.o += -DRC80211_PID_COMPILE | 47 | CFLAGS_rc80211_pid_algo.o += -DRC80211_PID_COMPILE |
49 | mac80211-$(CONFIG_MAC80211_RC_SIMPLE) += rc80211_simple.o | ||
50 | mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc-pid-$(CONFIG_MAC80211_RC_PID)) | 48 | mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc-pid-$(CONFIG_MAC80211_RC_PID)) |
51 | 49 | ||
52 | # Modular rate algorithms are assigned to mac80211-m - make separate modules | 50 | # Modular rate algorithms are assigned to mac80211-m - make separate modules |
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 484b063a3538..55b63712e48c 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -1803,13 +1803,9 @@ static int __init ieee80211_init(void) | |||
1803 | 1803 | ||
1804 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); | 1804 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); |
1805 | 1805 | ||
1806 | ret = rc80211_simple_init(); | ||
1807 | if (ret) | ||
1808 | goto out; | ||
1809 | |||
1810 | ret = rc80211_pid_init(); | 1806 | ret = rc80211_pid_init(); |
1811 | if (ret) | 1807 | if (ret) |
1812 | goto out_cleanup_simple; | 1808 | goto out; |
1813 | 1809 | ||
1814 | ret = ieee80211_wme_register(); | 1810 | ret = ieee80211_wme_register(); |
1815 | if (ret) { | 1811 | if (ret) { |
@@ -1824,15 +1820,12 @@ static int __init ieee80211_init(void) | |||
1824 | 1820 | ||
1825 | out_cleanup_pid: | 1821 | out_cleanup_pid: |
1826 | rc80211_pid_exit(); | 1822 | rc80211_pid_exit(); |
1827 | out_cleanup_simple: | ||
1828 | rc80211_simple_exit(); | ||
1829 | out: | 1823 | out: |
1830 | return ret; | 1824 | return ret; |
1831 | } | 1825 | } |
1832 | 1826 | ||
1833 | static void __exit ieee80211_exit(void) | 1827 | static void __exit ieee80211_exit(void) |
1834 | { | 1828 | { |
1835 | rc80211_simple_exit(); | ||
1836 | rc80211_pid_exit(); | 1829 | rc80211_pid_exit(); |
1837 | 1830 | ||
1838 | if (mesh_allocated) | 1831 | if (mesh_allocated) |
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h index bfd0a1982e4a..5b45f33cb766 100644 --- a/net/mac80211/ieee80211_rate.h +++ b/net/mac80211/ieee80211_rate.h | |||
@@ -171,21 +171,6 @@ void rate_control_deinitialize(struct ieee80211_local *local); | |||
171 | 171 | ||
172 | 172 | ||
173 | /* Rate control algorithms */ | 173 | /* Rate control algorithms */ |
174 | #if defined(RC80211_SIMPLE_COMPILE) || \ | ||
175 | (defined(CONFIG_MAC80211_RC_SIMPLE) && \ | ||
176 | !defined(CONFIG_MAC80211_RC_SIMPLE_MODULE)) | ||
177 | extern int rc80211_simple_init(void); | ||
178 | extern void rc80211_simple_exit(void); | ||
179 | #else | ||
180 | static inline int rc80211_simple_init(void) | ||
181 | { | ||
182 | return 0; | ||
183 | } | ||
184 | static inline void rc80211_simple_exit(void) | ||
185 | { | ||
186 | } | ||
187 | #endif | ||
188 | |||
189 | #if defined(RC80211_PID_COMPILE) || \ | 174 | #if defined(RC80211_PID_COMPILE) || \ |
190 | (defined(CONFIG_MAC80211_RC_PID) && \ | 175 | (defined(CONFIG_MAC80211_RC_PID) && \ |
191 | !defined(CONFIG_MAC80211_RC_PID_MODULE)) | 176 | !defined(CONFIG_MAC80211_RC_PID_MODULE)) |
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c deleted file mode 100644 index 4f72fdca7f12..000000000000 --- a/net/mac80211/rc80211_simple.c +++ /dev/null | |||
@@ -1,394 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2002-2005, Instant802 Networks, Inc. | ||
3 | * Copyright 2005, Devicescape Software, Inc. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #include <linux/jiffies.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/netdevice.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <linux/skbuff.h> | ||
16 | #include <linux/compiler.h> | ||
17 | #include <linux/module.h> | ||
18 | |||
19 | #include <net/mac80211.h> | ||
20 | #include "ieee80211_i.h" | ||
21 | #include "ieee80211_rate.h" | ||
22 | #include "debugfs.h" | ||
23 | |||
24 | |||
25 | /* This is a minimal implementation of TX rate controlling that can be used | ||
26 | * as the default when no improved mechanisms are available. */ | ||
27 | |||
28 | #define RATE_CONTROL_NUM_DOWN 20 | ||
29 | #define RATE_CONTROL_NUM_UP 15 | ||
30 | |||
31 | #define RATE_CONTROL_EMERG_DEC 2 | ||
32 | #define RATE_CONTROL_INTERVAL (HZ / 20) | ||
33 | #define RATE_CONTROL_MIN_TX 10 | ||
34 | |||
35 | static void rate_control_rate_inc(struct ieee80211_local *local, | ||
36 | struct sta_info *sta) | ||
37 | { | ||
38 | struct ieee80211_sub_if_data *sdata; | ||
39 | struct ieee80211_supported_band *sband; | ||
40 | int i = sta->txrate_idx; | ||
41 | int maxrate; | ||
42 | |||
43 | sdata = sta->sdata; | ||
44 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) { | ||
45 | /* forced unicast rate - do not change STA rate */ | ||
46 | return; | ||
47 | } | ||
48 | |||
49 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
50 | maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1; | ||
51 | |||
52 | if (i > sband->n_bitrates) | ||
53 | i = sband->n_bitrates - 2; | ||
54 | |||
55 | while (i + 1 < sband->n_bitrates) { | ||
56 | i++; | ||
57 | if (rate_supported(sta, sband->band, i) && | ||
58 | (maxrate < 0 || i <= maxrate)) { | ||
59 | sta->txrate_idx = i; | ||
60 | break; | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | |||
65 | |||
66 | static void rate_control_rate_dec(struct ieee80211_local *local, | ||
67 | struct sta_info *sta) | ||
68 | { | ||
69 | struct ieee80211_sub_if_data *sdata; | ||
70 | struct ieee80211_supported_band *sband; | ||
71 | int i = sta->txrate_idx; | ||
72 | |||
73 | sdata = sta->sdata; | ||
74 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) { | ||
75 | /* forced unicast rate - do not change STA rate */ | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
80 | if (i > sband->n_bitrates) | ||
81 | i = sband->n_bitrates; | ||
82 | |||
83 | while (i > 0) { | ||
84 | i--; | ||
85 | if (rate_supported(sta, sband->band, i)) { | ||
86 | sta->txrate_idx = i; | ||
87 | break; | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | |||
92 | struct global_rate_control { | ||
93 | int dummy; | ||
94 | }; | ||
95 | |||
96 | struct sta_rate_control { | ||
97 | unsigned long last_rate_change; | ||
98 | u32 tx_num_failures; | ||
99 | u32 tx_num_xmit; | ||
100 | |||
101 | unsigned long avg_rate_update; | ||
102 | u32 tx_avg_rate_sum; | ||
103 | u32 tx_avg_rate_num; | ||
104 | |||
105 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
106 | struct dentry *tx_avg_rate_sum_dentry; | ||
107 | struct dentry *tx_avg_rate_num_dentry; | ||
108 | #endif | ||
109 | }; | ||
110 | |||
111 | |||
112 | static void rate_control_simple_tx_status(void *priv, struct net_device *dev, | ||
113 | struct sk_buff *skb, | ||
114 | struct ieee80211_tx_status *status) | ||
115 | { | ||
116 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
117 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
118 | struct sta_info *sta; | ||
119 | struct sta_rate_control *srctrl; | ||
120 | |||
121 | rcu_read_lock(); | ||
122 | |||
123 | sta = sta_info_get(local, hdr->addr1); | ||
124 | |||
125 | if (!sta) | ||
126 | goto unlock; | ||
127 | |||
128 | srctrl = sta->rate_ctrl_priv; | ||
129 | srctrl->tx_num_xmit++; | ||
130 | if (status->excessive_retries) { | ||
131 | srctrl->tx_num_failures++; | ||
132 | sta->tx_retry_failed++; | ||
133 | sta->tx_num_consecutive_failures++; | ||
134 | sta->tx_num_mpdu_fail++; | ||
135 | } else { | ||
136 | sta->tx_num_consecutive_failures = 0; | ||
137 | sta->tx_num_mpdu_ok++; | ||
138 | } | ||
139 | sta->tx_retry_count += status->retry_count; | ||
140 | sta->tx_num_mpdu_fail += status->retry_count; | ||
141 | |||
142 | if (time_after(jiffies, | ||
143 | srctrl->last_rate_change + RATE_CONTROL_INTERVAL) && | ||
144 | srctrl->tx_num_xmit > RATE_CONTROL_MIN_TX) { | ||
145 | u32 per_failed; | ||
146 | srctrl->last_rate_change = jiffies; | ||
147 | |||
148 | per_failed = (100 * sta->tx_num_mpdu_fail) / | ||
149 | (sta->tx_num_mpdu_fail + sta->tx_num_mpdu_ok); | ||
150 | /* TODO: calculate average per_failed to make adjusting | ||
151 | * parameters easier */ | ||
152 | #if 0 | ||
153 | if (net_ratelimit()) { | ||
154 | printk(KERN_DEBUG "MPDU fail=%d ok=%d per_failed=%d\n", | ||
155 | sta->tx_num_mpdu_fail, sta->tx_num_mpdu_ok, | ||
156 | per_failed); | ||
157 | } | ||
158 | #endif | ||
159 | |||
160 | /* | ||
161 | * XXX: Make these configurable once we have an | ||
162 | * interface to the rate control algorithms | ||
163 | */ | ||
164 | if (per_failed > RATE_CONTROL_NUM_DOWN) { | ||
165 | rate_control_rate_dec(local, sta); | ||
166 | } else if (per_failed < RATE_CONTROL_NUM_UP) { | ||
167 | rate_control_rate_inc(local, sta); | ||
168 | } | ||
169 | srctrl->tx_avg_rate_sum += status->control.tx_rate->bitrate; | ||
170 | srctrl->tx_avg_rate_num++; | ||
171 | srctrl->tx_num_failures = 0; | ||
172 | srctrl->tx_num_xmit = 0; | ||
173 | } else if (sta->tx_num_consecutive_failures >= | ||
174 | RATE_CONTROL_EMERG_DEC) { | ||
175 | rate_control_rate_dec(local, sta); | ||
176 | } | ||
177 | |||
178 | if (time_after(jiffies, srctrl->avg_rate_update + 60 * HZ)) { | ||
179 | srctrl->avg_rate_update = jiffies; | ||
180 | if (srctrl->tx_avg_rate_num > 0) { | ||
181 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
182 | DECLARE_MAC_BUF(mac); | ||
183 | printk(KERN_DEBUG "%s: STA %s Average rate: " | ||
184 | "%d (%d/%d)\n", | ||
185 | dev->name, print_mac(mac, sta->addr), | ||
186 | srctrl->tx_avg_rate_sum / | ||
187 | srctrl->tx_avg_rate_num, | ||
188 | srctrl->tx_avg_rate_sum, | ||
189 | srctrl->tx_avg_rate_num); | ||
190 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
191 | srctrl->tx_avg_rate_sum = 0; | ||
192 | srctrl->tx_avg_rate_num = 0; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | unlock: | ||
197 | rcu_read_unlock(); | ||
198 | } | ||
199 | |||
200 | |||
201 | static void | ||
202 | rate_control_simple_get_rate(void *priv, struct net_device *dev, | ||
203 | struct ieee80211_supported_band *sband, | ||
204 | struct sk_buff *skb, | ||
205 | struct rate_selection *sel) | ||
206 | { | ||
207 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
208 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
209 | struct ieee80211_sub_if_data *sdata; | ||
210 | struct sta_info *sta; | ||
211 | int rateidx; | ||
212 | u16 fc; | ||
213 | |||
214 | rcu_read_lock(); | ||
215 | |||
216 | sta = sta_info_get(local, hdr->addr1); | ||
217 | |||
218 | /* Send management frames and broadcast/multicast data using lowest | ||
219 | * rate. */ | ||
220 | fc = le16_to_cpu(hdr->frame_control); | ||
221 | if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || | ||
222 | is_multicast_ether_addr(hdr->addr1) || !sta) { | ||
223 | sel->rate = rate_lowest(local, sband, sta); | ||
224 | rcu_read_unlock(); | ||
225 | return; | ||
226 | } | ||
227 | |||
228 | /* If a forced rate is in effect, select it. */ | ||
229 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
230 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) | ||
231 | sta->txrate_idx = sdata->bss->force_unicast_rateidx; | ||
232 | |||
233 | rateidx = sta->txrate_idx; | ||
234 | |||
235 | if (rateidx >= sband->n_bitrates) | ||
236 | rateidx = sband->n_bitrates - 1; | ||
237 | |||
238 | sta->last_txrate_idx = rateidx; | ||
239 | |||
240 | rcu_read_unlock(); | ||
241 | |||
242 | sel->rate = &sband->bitrates[rateidx]; | ||
243 | } | ||
244 | |||
245 | |||
246 | static void rate_control_simple_rate_init(void *priv, void *priv_sta, | ||
247 | struct ieee80211_local *local, | ||
248 | struct sta_info *sta) | ||
249 | { | ||
250 | struct ieee80211_supported_band *sband; | ||
251 | |||
252 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
253 | |||
254 | /* TODO: This routine should consider using RSSI from previous packets | ||
255 | * as we need to have IEEE 802.1X auth succeed immediately after assoc.. | ||
256 | * Until that method is implemented, we will use the lowest supported rate | ||
257 | * as a workaround, */ | ||
258 | sta->txrate_idx = rate_lowest_index(local, sband, sta); | ||
259 | } | ||
260 | |||
261 | |||
262 | static void * rate_control_simple_alloc(struct ieee80211_local *local) | ||
263 | { | ||
264 | struct global_rate_control *rctrl; | ||
265 | |||
266 | rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC); | ||
267 | |||
268 | return rctrl; | ||
269 | } | ||
270 | |||
271 | |||
272 | static void rate_control_simple_free(void *priv) | ||
273 | { | ||
274 | struct global_rate_control *rctrl = priv; | ||
275 | kfree(rctrl); | ||
276 | } | ||
277 | |||
278 | |||
279 | static void rate_control_simple_clear(void *priv) | ||
280 | { | ||
281 | } | ||
282 | |||
283 | |||
284 | static void * rate_control_simple_alloc_sta(void *priv, gfp_t gfp) | ||
285 | { | ||
286 | struct sta_rate_control *rctrl; | ||
287 | |||
288 | rctrl = kzalloc(sizeof(*rctrl), gfp); | ||
289 | |||
290 | return rctrl; | ||
291 | } | ||
292 | |||
293 | |||
294 | static void rate_control_simple_free_sta(void *priv, void *priv_sta) | ||
295 | { | ||
296 | struct sta_rate_control *rctrl = priv_sta; | ||
297 | kfree(rctrl); | ||
298 | } | ||
299 | |||
300 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
301 | |||
302 | static int open_file_generic(struct inode *inode, struct file *file) | ||
303 | { | ||
304 | file->private_data = inode->i_private; | ||
305 | return 0; | ||
306 | } | ||
307 | |||
308 | static ssize_t sta_tx_avg_rate_sum_read(struct file *file, | ||
309 | char __user *userbuf, | ||
310 | size_t count, loff_t *ppos) | ||
311 | { | ||
312 | struct sta_rate_control *srctrl = file->private_data; | ||
313 | char buf[20]; | ||
314 | |||
315 | sprintf(buf, "%d\n", srctrl->tx_avg_rate_sum); | ||
316 | return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); | ||
317 | } | ||
318 | |||
319 | static const struct file_operations sta_tx_avg_rate_sum_ops = { | ||
320 | .read = sta_tx_avg_rate_sum_read, | ||
321 | .open = open_file_generic, | ||
322 | }; | ||
323 | |||
324 | static ssize_t sta_tx_avg_rate_num_read(struct file *file, | ||
325 | char __user *userbuf, | ||
326 | size_t count, loff_t *ppos) | ||
327 | { | ||
328 | struct sta_rate_control *srctrl = file->private_data; | ||
329 | char buf[20]; | ||
330 | |||
331 | sprintf(buf, "%d\n", srctrl->tx_avg_rate_num); | ||
332 | return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); | ||
333 | } | ||
334 | |||
335 | static const struct file_operations sta_tx_avg_rate_num_ops = { | ||
336 | .read = sta_tx_avg_rate_num_read, | ||
337 | .open = open_file_generic, | ||
338 | }; | ||
339 | |||
340 | static void rate_control_simple_add_sta_debugfs(void *priv, void *priv_sta, | ||
341 | struct dentry *dir) | ||
342 | { | ||
343 | struct sta_rate_control *srctrl = priv_sta; | ||
344 | |||
345 | srctrl->tx_avg_rate_num_dentry = | ||
346 | debugfs_create_file("rc_simple_sta_tx_avg_rate_num", 0400, | ||
347 | dir, srctrl, &sta_tx_avg_rate_num_ops); | ||
348 | srctrl->tx_avg_rate_sum_dentry = | ||
349 | debugfs_create_file("rc_simple_sta_tx_avg_rate_sum", 0400, | ||
350 | dir, srctrl, &sta_tx_avg_rate_sum_ops); | ||
351 | } | ||
352 | |||
353 | static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta) | ||
354 | { | ||
355 | struct sta_rate_control *srctrl = priv_sta; | ||
356 | |||
357 | debugfs_remove(srctrl->tx_avg_rate_sum_dentry); | ||
358 | debugfs_remove(srctrl->tx_avg_rate_num_dentry); | ||
359 | } | ||
360 | #endif | ||
361 | |||
362 | static struct rate_control_ops mac80211_rcsimple = { | ||
363 | .name = "simple", | ||
364 | .tx_status = rate_control_simple_tx_status, | ||
365 | .get_rate = rate_control_simple_get_rate, | ||
366 | .rate_init = rate_control_simple_rate_init, | ||
367 | .clear = rate_control_simple_clear, | ||
368 | .alloc = rate_control_simple_alloc, | ||
369 | .free = rate_control_simple_free, | ||
370 | .alloc_sta = rate_control_simple_alloc_sta, | ||
371 | .free_sta = rate_control_simple_free_sta, | ||
372 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
373 | .add_sta_debugfs = rate_control_simple_add_sta_debugfs, | ||
374 | .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, | ||
375 | #endif | ||
376 | }; | ||
377 | |||
378 | MODULE_LICENSE("GPL"); | ||
379 | MODULE_DESCRIPTION("Simple rate control algorithm"); | ||
380 | |||
381 | int __init rc80211_simple_init(void) | ||
382 | { | ||
383 | return ieee80211_rate_control_register(&mac80211_rcsimple); | ||
384 | } | ||
385 | |||
386 | void rc80211_simple_exit(void) | ||
387 | { | ||
388 | ieee80211_rate_control_unregister(&mac80211_rcsimple); | ||
389 | } | ||
390 | |||
391 | #ifdef CONFIG_MAC80211_RC_SIMPLE_MODULE | ||
392 | module_init(rc80211_simple_init); | ||
393 | module_exit(rc80211_simple_exit); | ||
394 | #endif | ||