2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc.
4 * Copyright (c) 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/module.h>
12 #include <linux/init.h>
13 #include <linux/netdevice.h>
14 #include <linux/types.h>
15 #include <linux/slab.h>
16 #include <linux/skbuff.h>
17 #include <linux/compiler.h>
19 #include <net/mac80211.h>
20 #include "ieee80211_i.h"
21 #include "ieee80211_rate.h"
24 static void rate_control_lowest_tx_status(void *priv, struct net_device *dev,
26 struct ieee80211_tx_status *status)
30 static struct ieee80211_rate *
31 rate_control_lowest_get_rate(void *priv, struct net_device *dev,
33 struct rate_control_extra *extra)
35 struct ieee80211_hw_mode *mode = extra->mode;
38 for (i = 0; i < mode->num_rates; i++) {
39 struct ieee80211_rate *rate = &mode->rates[i];
41 if (rate->flags & IEEE80211_RATE_SUPPORTED)
44 return &mode->rates[0];
47 static void rate_control_lowest_rate_init(void *priv, void *priv_sta,
48 struct ieee80211_local *local,
54 static void *rate_control_lowest_alloc(struct ieee80211_local *local)
59 static void rate_control_lowest_free(void *priv)
63 static void rate_control_lowest_clear(void *priv)
67 static void *rate_control_lowest_alloc_sta(void *priv, gfp_t gfp)
72 static void rate_control_lowest_free_sta(void *priv, void *priv_sta)
76 static struct rate_control_ops rate_control_lowest = {
77 .module = THIS_MODULE,
79 .tx_status = rate_control_lowest_tx_status,
80 .get_rate = rate_control_lowest_get_rate,
81 .rate_init = rate_control_lowest_rate_init,
82 .clear = rate_control_lowest_clear,
83 .alloc = rate_control_lowest_alloc,
84 .free = rate_control_lowest_free,
85 .alloc_sta = rate_control_lowest_alloc_sta,
86 .free_sta = rate_control_lowest_free_sta,
89 static int __init rate_control_lowest_init(void)
91 return ieee80211_rate_control_register(&rate_control_lowest);
95 static void __exit rate_control_lowest_exit(void)
97 ieee80211_rate_control_unregister(&rate_control_lowest);
101 module_init(rate_control_lowest_init);
102 module_exit(rate_control_lowest_exit);
104 MODULE_DESCRIPTION("Forced 1 mbps rate control module for mac80211");
105 MODULE_LICENSE("GPL");