aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/util.c
diff options
context:
space:
mode:
authorAshok Nagarajan <ashok@cozybit.com>2013-05-10 20:50:51 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-05-24 17:54:43 -0400
commitb422c6cd7e93bb613030f14d7d8a0cc73f115629 (patch)
treed27418a219e0c4809bee0e73c5117da8095ad01a /net/wireless/util.c
parentd4a5a48976d12ab340ed34605b5f5049b123d868 (diff)
{cfg,mac}80211: move mandatory rates calculation to cfg80211
Move mandatory rates calculation to cfg80211, shared with non mac80211 drivers. Signed-off-by: Ashok Nagarajan <ashok@cozybit.com> [extend documentation] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r--net/wireless/util.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index b11052be09be..0962f107f57f 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -33,6 +33,29 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
33} 33}
34EXPORT_SYMBOL(ieee80211_get_response_rate); 34EXPORT_SYMBOL(ieee80211_get_response_rate);
35 35
36u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband)
37{
38 struct ieee80211_rate *bitrates;
39 u32 mandatory_rates = 0;
40 enum ieee80211_rate_flags mandatory_flag;
41 int i;
42
43 if (WARN_ON(!sband))
44 return 1;
45
46 if (sband->band == IEEE80211_BAND_2GHZ)
47 mandatory_flag = IEEE80211_RATE_MANDATORY_B;
48 else
49 mandatory_flag = IEEE80211_RATE_MANDATORY_A;
50
51 bitrates = sband->bitrates;
52 for (i = 0; i < sband->n_bitrates; i++)
53 if (bitrates[i].flags & mandatory_flag)
54 mandatory_rates |= BIT(i);
55 return mandatory_rates;
56}
57EXPORT_SYMBOL(ieee80211_mandatory_rates);
58
36int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band) 59int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band)
37{ 60{
38 /* see 802.11 17.3.8.3.2 and Annex J 61 /* see 802.11 17.3.8.3.2 and Annex J