diff options
author | Daniel Drake <dsd@gentoo.org> | 2006-07-18 16:34:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-07-27 16:17:28 -0400 |
commit | d7712ac254a4ae2e9c927e29e37b8c7ac334e6ad (patch) | |
tree | 99b5aef9dcb65cf96c6ac97063bb25d17d3e0649 | |
parent | 5acd0c4153be25269d7cb9a4b09fd6db571c5cc1 (diff) |
[PATCH] softmac: export highest_supported_rate function
zd1211 needs this functionality, no point duplicating it.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/net/ieee80211softmac.h | 8 | ||||
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_module.c | 16 |
2 files changed, 13 insertions, 11 deletions
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index c27d03433c21..425b3a57ac74 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
@@ -279,6 +279,14 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev, | |||
279 | * Note that the rates need to be sorted. */ | 279 | * Note that the rates need to be sorted. */ |
280 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); | 280 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); |
281 | 281 | ||
282 | /* Finds the highest rate which is: | ||
283 | * 1. Present in ri (optionally a basic rate) | ||
284 | * 2. Supported by the device | ||
285 | * 3. Less than or equal to the user-defined rate | ||
286 | */ | ||
287 | extern u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac, | ||
288 | struct ieee80211softmac_ratesinfo *ri, int basic_only); | ||
289 | |||
282 | /* Helper function which advises you the rate at which a frame should be | 290 | /* Helper function which advises you the rate at which a frame should be |
283 | * transmitted at. */ | 291 | * transmitted at. */ |
284 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, | 292 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, |
diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c index c275646b2269..addea1cf73ae 100644 --- a/net/ieee80211/softmac/ieee80211softmac_module.c +++ b/net/ieee80211/softmac/ieee80211softmac_module.c | |||
@@ -179,21 +179,14 @@ int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo | |||
179 | return 0; | 179 | return 0; |
180 | } | 180 | } |
181 | 181 | ||
182 | /* Finds the highest rate which is: | 182 | u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac, |
183 | * 1. Present in ri (optionally a basic rate) | ||
184 | * 2. Supported by the device | ||
185 | * 3. Less than or equal to the user-defined rate | ||
186 | */ | ||
187 | static u8 highest_supported_rate(struct ieee80211softmac_device *mac, | ||
188 | struct ieee80211softmac_ratesinfo *ri, int basic_only) | 183 | struct ieee80211softmac_ratesinfo *ri, int basic_only) |
189 | { | 184 | { |
190 | u8 user_rate = mac->txrates.user_rate; | 185 | u8 user_rate = mac->txrates.user_rate; |
191 | int i; | 186 | int i; |
192 | 187 | ||
193 | if (ri->count == 0) { | 188 | if (ri->count == 0) |
194 | dprintk(KERN_ERR PFX "empty ratesinfo?\n"); | ||
195 | return IEEE80211_CCK_RATE_1MB; | 189 | return IEEE80211_CCK_RATE_1MB; |
196 | } | ||
197 | 190 | ||
198 | for (i = ri->count - 1; i >= 0; i--) { | 191 | for (i = ri->count - 1; i >= 0; i--) { |
199 | u8 rate = ri->rates[i]; | 192 | u8 rate = ri->rates[i]; |
@@ -209,6 +202,7 @@ static u8 highest_supported_rate(struct ieee80211softmac_device *mac, | |||
209 | /* If we haven't found a suitable rate by now, just trust the user */ | 202 | /* If we haven't found a suitable rate by now, just trust the user */ |
210 | return user_rate; | 203 | return user_rate; |
211 | } | 204 | } |
205 | EXPORT_SYMBOL_GPL(ieee80211softmac_highest_supported_rate); | ||
212 | 206 | ||
213 | void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac, | 207 | void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac, |
214 | u8 erp_value) | 208 | u8 erp_value) |
@@ -244,13 +238,13 @@ void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac) | |||
244 | u32 change = 0; | 238 | u32 change = 0; |
245 | 239 | ||
246 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; | 240 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; |
247 | txrates->default_rate = highest_supported_rate(mac, &mac->bssinfo.supported_rates, 0); | 241 | txrates->default_rate = ieee80211softmac_highest_supported_rate(mac, &mac->bssinfo.supported_rates, 0); |
248 | 242 | ||
249 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK; | 243 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK; |
250 | txrates->default_fallback = lower_rate(mac, txrates->default_rate); | 244 | txrates->default_fallback = lower_rate(mac, txrates->default_rate); |
251 | 245 | ||
252 | change |= IEEE80211SOFTMAC_TXRATECHG_MCAST; | 246 | change |= IEEE80211SOFTMAC_TXRATECHG_MCAST; |
253 | txrates->mcast_rate = highest_supported_rate(mac, &mac->bssinfo.supported_rates, 1); | 247 | txrates->mcast_rate = ieee80211softmac_highest_supported_rate(mac, &mac->bssinfo.supported_rates, 1); |
254 | 248 | ||
255 | if (mac->txrates_change) | 249 | if (mac->txrates_change) |
256 | mac->txrates_change(mac->dev, change); | 250 | mac->txrates_change(mac->dev, change); |