summaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-29 20:00:45 +0100
committerJohn W. Linville <linville@tuxdriver.com>2008-11-10 15:17:35 -0500
commitbd815252720e4b667d9946d050d003ec89bda099 (patch)
treed7bb98f512c8b48031f9df01745820b7d6dfb3ac /net/wireless
parent743b97caf98036ec8ee4bfc6fc6f85ad94e04783 (diff)
downloadop-kernel-dev-bd815252720e4b667d9946d050d003ec89bda099.zip
op-kernel-dev-bd815252720e4b667d9946d050d003ec89bda099.tar.gz
wireless: implement basic rate helper function
This adds a helper function that, given a bitmap of basic rates and a bitrate returns the response rate for this rate. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index f544246..e76cc28 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -7,6 +7,25 @@
#include <asm/bitops.h>
#include "core.h"
+struct ieee80211_rate *
+ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
+ u64 basic_rates, int bitrate)
+{
+ struct ieee80211_rate *result = &sband->bitrates[0];
+ int i;
+
+ for (i = 0; i < sband->n_bitrates; i++) {
+ if (!(basic_rates & BIT(i)))
+ continue;
+ if (sband->bitrates[i].bitrate > bitrate)
+ continue;
+ result = &sband->bitrates[i];
+ }
+
+ return result;
+}
+EXPORT_SYMBOL(ieee80211_get_response_rate);
+
int ieee80211_channel_to_frequency(int chan)
{
if (chan < 14)
OpenPOWER on IntegriCloud