summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2013-07-08 16:55:55 +0200
committerJohannes Berg <johannes.berg@intel.com>2013-07-16 09:58:08 +0300
commit0430c883470d0c9a23661ea9f02c56b1d91cf93c (patch)
tree719ac23c82a3ed725ad3e0155cf223720be02e75 /include/net
parent74608aca4d82e2855b1a6a2cd60331d1a98f2d6a (diff)
downloadlinux-stable-0430c883470d0c9a23661ea9f02c56b1d91cf93c.tar.gz
linux-stable-0430c883470d0c9a23661ea9f02c56b1d91cf93c.tar.bz2
linux-stable-0430c883470d0c9a23661ea9f02c56b1d91cf93c.zip
cfg80211/mac80211: use reduced txpower for 5 and 10 MHz
Some regulations (like germany, but also FCC) express their transmission power limit in dBm/MHz or mW/MHz. To cope with that and be on the safe side, reduce the maximum power to half (10 MHz) or quarter (5 MHz) when operating on these reduced bandwidth channels. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/cfg80211.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 88f15631701a..aeaf6dff6e05 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -461,6 +461,33 @@ ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
}
/**
+ * ieee80211_chandef_max_power - maximum transmission power for the chandef
+ *
+ * In some regulations, the transmit power may depend on the configured channel
+ * bandwidth which may be defined as dBm/MHz. This function returns the actual
+ * max_power for non-standard (20 MHz) channels.
+ *
+ * @chandef: channel definition for the channel
+ *
+ * Returns: maximum allowed transmission power in dBm for the chandef
+ */
+static inline int
+ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
+{
+ switch (chandef->width) {
+ case NL80211_CHAN_WIDTH_5:
+ return min(chandef->chan->max_reg_power - 6,
+ chandef->chan->max_power);
+ case NL80211_CHAN_WIDTH_10:
+ return min(chandef->chan->max_reg_power - 3,
+ chandef->chan->max_power);
+ default:
+ break;
+ }
+ return chandef->chan->max_power;
+}
+
+/**
* enum survey_info_flags - survey information flags
*
* @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in