diff options
-rw-r--r-- | net/mac80211/ieee80211.c | 41 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/ieee80211_rate.c | 42 | ||||
-rw-r--r-- | net/mac80211/ieee80211_rate.h | 6 |
4 files changed, 48 insertions, 43 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index f20e647552ec..2b15505a6e48 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -1542,47 +1542,6 @@ void ieee80211_if_mgmt_setup(struct net_device *dev) | |||
1542 | dev->destructor = ieee80211_if_free; | 1542 | dev->destructor = ieee80211_if_free; |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | ||
1546 | const char *name) | ||
1547 | { | ||
1548 | struct rate_control_ref *ref, *old; | ||
1549 | |||
1550 | ASSERT_RTNL(); | ||
1551 | if (local->open_count || netif_running(local->mdev) || | ||
1552 | (local->apdev && netif_running(local->apdev))) | ||
1553 | return -EBUSY; | ||
1554 | |||
1555 | ref = rate_control_alloc(name, local); | ||
1556 | if (!ref) { | ||
1557 | printk(KERN_WARNING "%s: Failed to select rate control " | ||
1558 | "algorithm\n", local->mdev->name); | ||
1559 | return -ENOENT; | ||
1560 | } | ||
1561 | |||
1562 | old = local->rate_ctrl; | ||
1563 | local->rate_ctrl = ref; | ||
1564 | if (old) { | ||
1565 | rate_control_put(old); | ||
1566 | sta_info_flush(local, NULL); | ||
1567 | } | ||
1568 | |||
1569 | printk(KERN_DEBUG "%s: Selected rate control " | ||
1570 | "algorithm '%s'\n", local->mdev->name, | ||
1571 | ref->ops->name); | ||
1572 | |||
1573 | |||
1574 | return 0; | ||
1575 | } | ||
1576 | |||
1577 | static void rate_control_deinitialize(struct ieee80211_local *local) | ||
1578 | { | ||
1579 | struct rate_control_ref *ref; | ||
1580 | |||
1581 | ref = local->rate_ctrl; | ||
1582 | local->rate_ctrl = NULL; | ||
1583 | rate_control_put(ref); | ||
1584 | } | ||
1585 | |||
1586 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | 1545 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, |
1587 | const struct ieee80211_ops *ops) | 1546 | const struct ieee80211_ops *ops) |
1588 | { | 1547 | { |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index af8b9848e021..28414b3e0c34 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -727,8 +727,6 @@ void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx); | |||
727 | int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr); | 727 | int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr); |
728 | void ieee80211_if_setup(struct net_device *dev); | 728 | void ieee80211_if_setup(struct net_device *dev); |
729 | void ieee80211_if_mgmt_setup(struct net_device *dev); | 729 | void ieee80211_if_mgmt_setup(struct net_device *dev); |
730 | int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | ||
731 | const char *name); | ||
732 | struct net_device_stats *ieee80211_dev_stats(struct net_device *dev); | 730 | struct net_device_stats *ieee80211_dev_stats(struct net_device *dev); |
733 | struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local, | 731 | struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local, |
734 | int phymode, int hwrate); | 732 | int phymode, int hwrate); |
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c index 2118de04fc35..a1ded7449784 100644 --- a/net/mac80211/ieee80211_rate.c +++ b/net/mac80211/ieee80211_rate.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/rtnetlink.h> | ||
12 | #include "ieee80211_rate.h" | 13 | #include "ieee80211_rate.h" |
13 | #include "ieee80211_i.h" | 14 | #include "ieee80211_i.h" |
14 | 15 | ||
@@ -137,3 +138,44 @@ void rate_control_put(struct rate_control_ref *ref) | |||
137 | { | 138 | { |
138 | kref_put(&ref->kref, rate_control_release); | 139 | kref_put(&ref->kref, rate_control_release); |
139 | } | 140 | } |
141 | |||
142 | int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | ||
143 | const char *name) | ||
144 | { | ||
145 | struct rate_control_ref *ref, *old; | ||
146 | |||
147 | ASSERT_RTNL(); | ||
148 | if (local->open_count || netif_running(local->mdev) || | ||
149 | (local->apdev && netif_running(local->apdev))) | ||
150 | return -EBUSY; | ||
151 | |||
152 | ref = rate_control_alloc(name, local); | ||
153 | if (!ref) { | ||
154 | printk(KERN_WARNING "%s: Failed to select rate control " | ||
155 | "algorithm\n", local->mdev->name); | ||
156 | return -ENOENT; | ||
157 | } | ||
158 | |||
159 | old = local->rate_ctrl; | ||
160 | local->rate_ctrl = ref; | ||
161 | if (old) { | ||
162 | rate_control_put(old); | ||
163 | sta_info_flush(local, NULL); | ||
164 | } | ||
165 | |||
166 | printk(KERN_DEBUG "%s: Selected rate control " | ||
167 | "algorithm '%s'\n", local->mdev->name, | ||
168 | ref->ops->name); | ||
169 | |||
170 | |||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | void rate_control_deinitialize(struct ieee80211_local *local) | ||
175 | { | ||
176 | struct rate_control_ref *ref; | ||
177 | |||
178 | ref = local->rate_ctrl; | ||
179 | local->rate_ctrl = NULL; | ||
180 | rate_control_put(ref); | ||
181 | } | ||
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h index f021a028d9d0..cac91a960ff4 100644 --- a/net/mac80211/ieee80211_rate.h +++ b/net/mac80211/ieee80211_rate.h | |||
@@ -141,4 +141,10 @@ static inline void rate_control_remove_sta_debugfs(struct sta_info *sta) | |||
141 | #endif | 141 | #endif |
142 | } | 142 | } |
143 | 143 | ||
144 | |||
145 | /* functions for rate control related to a device */ | ||
146 | int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | ||
147 | const char *name); | ||
148 | void rate_control_deinitialize(struct ieee80211_local *local); | ||
149 | |||
144 | #endif /* IEEE80211_RATE_H */ | 150 | #endif /* IEEE80211_RATE_H */ |