summaryrefslogtreecommitdiff
path: root/net/wireless/util.c
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2017-01-04 18:58:30 +0100
committerJohannes Berg <johannes.berg@intel.com>2017-01-06 13:54:04 +0100
commit4787cfa08476d4193c35d958f564f643bb6ae234 (patch)
treec36343fde17cbf304e7c1a178d4ae4eb4f167107 /net/wireless/util.c
parentb330b25eaabda00d74e47566d9200907da381896 (diff)
cfg80211: move function checking range fit to util.c
It is needed for another cfg80211 helper that will be out of reg.c so move it to common util.c file and make it non-static. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r--net/wireless/util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index c91bc25c4dd5..cd8a7ae55e7d 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1847,6 +1847,21 @@ void cfg80211_free_nan_func(struct cfg80211_nan_func *f)
}
EXPORT_SYMBOL(cfg80211_free_nan_func);
+bool cfg80211_does_bw_fit_range(const struct ieee80211_freq_range *freq_range,
+ u32 center_freq_khz, u32 bw_khz)
+{
+ u32 start_freq_khz, end_freq_khz;
+
+ start_freq_khz = center_freq_khz - (bw_khz / 2);
+ end_freq_khz = center_freq_khz + (bw_khz / 2);
+
+ if (start_freq_khz >= freq_range->start_freq_khz &&
+ end_freq_khz <= freq_range->end_freq_khz)
+ return true;
+
+ return false;
+}
+
/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
const unsigned char rfc1042_header[] __aligned(2) =