Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 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 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 10 | #include <linux/init.h> |
| 11 | #include <linux/netdevice.h> |
| 12 | #include <linux/types.h> |
| 13 | #include <linux/slab.h> |
| 14 | #include <linux/skbuff.h> |
| 15 | #include <linux/compiler.h> |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 16 | #include <linux/module.h> |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 17 | |
| 18 | #include <net/mac80211.h> |
| 19 | #include "ieee80211_i.h" |
| 20 | #include "ieee80211_rate.h" |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 21 | #include "debugfs.h" |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 22 | |
| 23 | |
| 24 | /* This is a minimal implementation of TX rate controlling that can be used |
| 25 | * as the default when no improved mechanisms are available. */ |
| 26 | |
Mattias Nissler | 1abbe49 | 2007-12-20 13:50:07 +0100 | [diff] [blame] | 27 | #define RATE_CONTROL_NUM_DOWN 20 |
| 28 | #define RATE_CONTROL_NUM_UP 15 |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 29 | |
| 30 | #define RATE_CONTROL_EMERG_DEC 2 |
| 31 | #define RATE_CONTROL_INTERVAL (HZ / 20) |
| 32 | #define RATE_CONTROL_MIN_TX 10 |
| 33 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 34 | static void rate_control_rate_inc(struct ieee80211_local *local, |
| 35 | struct sta_info *sta) |
| 36 | { |
| 37 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 38 | struct ieee80211_supported_band *sband; |
| 39 | int i = sta->txrate_idx; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 40 | int maxrate; |
| 41 | |
| 42 | sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); |
| 43 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) { |
| 44 | /* forced unicast rate - do not change STA rate */ |
| 45 | return; |
| 46 | } |
| 47 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 48 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 49 | maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1; |
| 50 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 51 | if (i > sband->n_bitrates) |
| 52 | i = sband->n_bitrates - 2; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 53 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 54 | while (i + 1 < sband->n_bitrates) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 55 | i++; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 56 | if (rate_supported(sta, sband->band, i) && |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 57 | (maxrate < 0 || i <= maxrate)) { |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 58 | sta->txrate_idx = i; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 59 | break; |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | |
| 65 | static void rate_control_rate_dec(struct ieee80211_local *local, |
| 66 | struct sta_info *sta) |
| 67 | { |
| 68 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 69 | struct ieee80211_supported_band *sband; |
| 70 | int i = sta->txrate_idx; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 71 | |
| 72 | sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); |
| 73 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) { |
| 74 | /* forced unicast rate - do not change STA rate */ |
| 75 | return; |
| 76 | } |
| 77 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 78 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 79 | if (i > sband->n_bitrates) |
| 80 | i = sband->n_bitrates; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 81 | |
| 82 | while (i > 0) { |
| 83 | i--; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 84 | if (rate_supported(sta, sband->band, i)) { |
| 85 | sta->txrate_idx = i; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 86 | break; |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 91 | struct global_rate_control { |
| 92 | int dummy; |
| 93 | }; |
| 94 | |
| 95 | struct sta_rate_control { |
| 96 | unsigned long last_rate_change; |
| 97 | u32 tx_num_failures; |
| 98 | u32 tx_num_xmit; |
| 99 | |
| 100 | unsigned long avg_rate_update; |
| 101 | u32 tx_avg_rate_sum; |
| 102 | u32 tx_avg_rate_num; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 103 | |
| 104 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 105 | struct dentry *tx_avg_rate_sum_dentry; |
| 106 | struct dentry *tx_avg_rate_num_dentry; |
| 107 | #endif |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | |
| 111 | static void rate_control_simple_tx_status(void *priv, struct net_device *dev, |
| 112 | struct sk_buff *skb, |
| 113 | struct ieee80211_tx_status *status) |
| 114 | { |
| 115 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 116 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
| 117 | struct sta_info *sta; |
| 118 | struct sta_rate_control *srctrl; |
| 119 | |
| 120 | sta = sta_info_get(local, hdr->addr1); |
| 121 | |
| 122 | if (!sta) |
| 123 | return; |
| 124 | |
| 125 | srctrl = sta->rate_ctrl_priv; |
| 126 | srctrl->tx_num_xmit++; |
| 127 | if (status->excessive_retries) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 128 | srctrl->tx_num_failures++; |
| 129 | sta->tx_retry_failed++; |
| 130 | sta->tx_num_consecutive_failures++; |
| 131 | sta->tx_num_mpdu_fail++; |
| 132 | } else { |
| 133 | sta->last_ack_rssi[0] = sta->last_ack_rssi[1]; |
| 134 | sta->last_ack_rssi[1] = sta->last_ack_rssi[2]; |
| 135 | sta->last_ack_rssi[2] = status->ack_signal; |
| 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 | |
Johannes Berg | 3ef8bed | 2007-07-10 19:32:09 +0200 | [diff] [blame] | 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) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 165 | rate_control_rate_dec(local, sta); |
Johannes Berg | 3ef8bed | 2007-07-10 19:32:09 +0200 | [diff] [blame] | 166 | } else if (per_failed < RATE_CONTROL_NUM_UP) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 167 | rate_control_rate_inc(local, sta); |
| 168 | } |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 169 | srctrl->tx_avg_rate_sum += status->control.tx_rate->bitrate; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 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 (srctrl->avg_rate_update + 60 * HZ < jiffies) { |
| 179 | srctrl->avg_rate_update = jiffies; |
| 180 | if (srctrl->tx_avg_rate_num > 0) { |
| 181 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
Joe Perches | 0795af5 | 2007-10-03 17:59:30 -0700 | [diff] [blame] | 182 | DECLARE_MAC_BUF(mac); |
| 183 | printk(KERN_DEBUG "%s: STA %s Average rate: " |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 184 | "%d (%d/%d)\n", |
Joe Perches | 0795af5 | 2007-10-03 17:59:30 -0700 | [diff] [blame] | 185 | dev->name, print_mac(mac, sta->addr), |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 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 | sta_info_put(sta); |
| 197 | } |
| 198 | |
| 199 | |
Mattias Nissler | 1abbe49 | 2007-12-20 13:50:07 +0100 | [diff] [blame] | 200 | static void |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 201 | rate_control_simple_get_rate(void *priv, struct net_device *dev, |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 202 | struct ieee80211_supported_band *sband, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 203 | struct sk_buff *skb, |
Mattias Nissler | 1abbe49 | 2007-12-20 13:50:07 +0100 | [diff] [blame] | 204 | struct rate_selection *sel) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 205 | { |
| 206 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 207 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
Michael Wu | 2bc454b | 2007-12-25 19:33:16 -0500 | [diff] [blame] | 208 | struct ieee80211_sub_if_data *sdata; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 209 | struct sta_info *sta; |
Mattias Nissler | 1abbe49 | 2007-12-20 13:50:07 +0100 | [diff] [blame] | 210 | int rateidx; |
Michael Wu | 2bc454b | 2007-12-25 19:33:16 -0500 | [diff] [blame] | 211 | u16 fc; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 212 | |
| 213 | sta = sta_info_get(local, hdr->addr1); |
| 214 | |
Michael Wu | 2bc454b | 2007-12-25 19:33:16 -0500 | [diff] [blame] | 215 | /* Send management frames and broadcast/multicast data using lowest |
| 216 | * rate. */ |
| 217 | fc = le16_to_cpu(hdr->frame_control); |
| 218 | if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || |
| 219 | is_multicast_ether_addr(hdr->addr1) || !sta) { |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 220 | sel->rate = rate_lowest(local, sband, sta); |
Michael Wu | 2bc454b | 2007-12-25 19:33:16 -0500 | [diff] [blame] | 221 | if (sta) |
| 222 | sta_info_put(sta); |
Mattias Nissler | 1abbe49 | 2007-12-20 13:50:07 +0100 | [diff] [blame] | 223 | return; |
| 224 | } |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 225 | |
Michael Wu | 2bc454b | 2007-12-25 19:33:16 -0500 | [diff] [blame] | 226 | /* If a forced rate is in effect, select it. */ |
| 227 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 228 | if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 229 | sta->txrate_idx = sdata->bss->force_unicast_rateidx; |
Michael Wu | 2bc454b | 2007-12-25 19:33:16 -0500 | [diff] [blame] | 230 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 231 | rateidx = sta->txrate_idx; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 232 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 233 | if (rateidx >= sband->n_bitrates) |
| 234 | rateidx = sband->n_bitrates - 1; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 235 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 236 | sta->last_txrate_idx = rateidx; |
Michael Wu | 2bc454b | 2007-12-25 19:33:16 -0500 | [diff] [blame] | 237 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 238 | sta_info_put(sta); |
| 239 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 240 | sel->rate = &sband->bitrates[rateidx]; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | |
| 244 | static void rate_control_simple_rate_init(void *priv, void *priv_sta, |
| 245 | struct ieee80211_local *local, |
| 246 | struct sta_info *sta) |
| 247 | { |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 248 | struct ieee80211_supported_band *sband; |
| 249 | |
| 250 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 251 | |
Larry Finger | eef6caf | 2007-07-02 22:36:38 -0700 | [diff] [blame] | 252 | /* TODO: This routine should consider using RSSI from previous packets |
| 253 | * as we need to have IEEE 802.1X auth succeed immediately after assoc.. |
| 254 | * Until that method is implemented, we will use the lowest supported rate |
| 255 | * as a workaround, */ |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame^] | 256 | sta->txrate_idx = rate_lowest_index(local, sband, sta); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | |
| 260 | static void * rate_control_simple_alloc(struct ieee80211_local *local) |
| 261 | { |
| 262 | struct global_rate_control *rctrl; |
| 263 | |
| 264 | rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC); |
| 265 | |
| 266 | return rctrl; |
| 267 | } |
| 268 | |
| 269 | |
| 270 | static void rate_control_simple_free(void *priv) |
| 271 | { |
| 272 | struct global_rate_control *rctrl = priv; |
| 273 | kfree(rctrl); |
| 274 | } |
| 275 | |
| 276 | |
| 277 | static void rate_control_simple_clear(void *priv) |
| 278 | { |
| 279 | } |
| 280 | |
| 281 | |
| 282 | static void * rate_control_simple_alloc_sta(void *priv, gfp_t gfp) |
| 283 | { |
| 284 | struct sta_rate_control *rctrl; |
| 285 | |
| 286 | rctrl = kzalloc(sizeof(*rctrl), gfp); |
| 287 | |
| 288 | return rctrl; |
| 289 | } |
| 290 | |
| 291 | |
| 292 | static void rate_control_simple_free_sta(void *priv, void *priv_sta) |
| 293 | { |
| 294 | struct sta_rate_control *rctrl = priv_sta; |
| 295 | kfree(rctrl); |
| 296 | } |
| 297 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 298 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 299 | |
| 300 | static int open_file_generic(struct inode *inode, struct file *file) |
| 301 | { |
| 302 | file->private_data = inode->i_private; |
| 303 | return 0; |
| 304 | } |
| 305 | |
| 306 | static ssize_t sta_tx_avg_rate_sum_read(struct file *file, |
| 307 | char __user *userbuf, |
| 308 | size_t count, loff_t *ppos) |
| 309 | { |
| 310 | struct sta_rate_control *srctrl = file->private_data; |
| 311 | char buf[20]; |
| 312 | |
| 313 | sprintf(buf, "%d\n", srctrl->tx_avg_rate_sum); |
| 314 | return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); |
| 315 | } |
| 316 | |
| 317 | static const struct file_operations sta_tx_avg_rate_sum_ops = { |
| 318 | .read = sta_tx_avg_rate_sum_read, |
| 319 | .open = open_file_generic, |
| 320 | }; |
| 321 | |
| 322 | static ssize_t sta_tx_avg_rate_num_read(struct file *file, |
| 323 | char __user *userbuf, |
| 324 | size_t count, loff_t *ppos) |
| 325 | { |
| 326 | struct sta_rate_control *srctrl = file->private_data; |
| 327 | char buf[20]; |
| 328 | |
| 329 | sprintf(buf, "%d\n", srctrl->tx_avg_rate_num); |
| 330 | return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); |
| 331 | } |
| 332 | |
| 333 | static const struct file_operations sta_tx_avg_rate_num_ops = { |
| 334 | .read = sta_tx_avg_rate_num_read, |
| 335 | .open = open_file_generic, |
| 336 | }; |
| 337 | |
| 338 | static void rate_control_simple_add_sta_debugfs(void *priv, void *priv_sta, |
| 339 | struct dentry *dir) |
| 340 | { |
| 341 | struct sta_rate_control *srctrl = priv_sta; |
| 342 | |
| 343 | srctrl->tx_avg_rate_num_dentry = |
| 344 | debugfs_create_file("rc_simple_sta_tx_avg_rate_num", 0400, |
| 345 | dir, srctrl, &sta_tx_avg_rate_num_ops); |
| 346 | srctrl->tx_avg_rate_sum_dentry = |
| 347 | debugfs_create_file("rc_simple_sta_tx_avg_rate_sum", 0400, |
| 348 | dir, srctrl, &sta_tx_avg_rate_sum_ops); |
| 349 | } |
| 350 | |
| 351 | static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta) |
| 352 | { |
| 353 | struct sta_rate_control *srctrl = priv_sta; |
| 354 | |
| 355 | debugfs_remove(srctrl->tx_avg_rate_sum_dentry); |
| 356 | debugfs_remove(srctrl->tx_avg_rate_num_dentry); |
| 357 | } |
| 358 | #endif |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 359 | |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 360 | static struct rate_control_ops mac80211_rcsimple = { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 361 | .name = "simple", |
| 362 | .tx_status = rate_control_simple_tx_status, |
| 363 | .get_rate = rate_control_simple_get_rate, |
| 364 | .rate_init = rate_control_simple_rate_init, |
| 365 | .clear = rate_control_simple_clear, |
| 366 | .alloc = rate_control_simple_alloc, |
| 367 | .free = rate_control_simple_free, |
| 368 | .alloc_sta = rate_control_simple_alloc_sta, |
| 369 | .free_sta = rate_control_simple_free_sta, |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 370 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 371 | .add_sta_debugfs = rate_control_simple_add_sta_debugfs, |
| 372 | .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, |
| 373 | #endif |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 374 | }; |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 375 | |
| 376 | MODULE_LICENSE("GPL"); |
| 377 | MODULE_DESCRIPTION("Simple rate control algorithm"); |
| 378 | |
| 379 | int __init rc80211_simple_init(void) |
| 380 | { |
| 381 | return ieee80211_rate_control_register(&mac80211_rcsimple); |
| 382 | } |
| 383 | |
Johannes Berg | f0b9205 | 2008-01-31 19:31:57 +0100 | [diff] [blame] | 384 | void rc80211_simple_exit(void) |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 385 | { |
| 386 | ieee80211_rate_control_unregister(&mac80211_rcsimple); |
| 387 | } |
| 388 | |
| 389 | #ifdef CONFIG_MAC80211_RC_SIMPLE_MODULE |
| 390 | module_init(rc80211_simple_init); |
| 391 | module_exit(rc80211_simple_exit); |
| 392 | #endif |