]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/wireless/util.c
Merge tag 'mac80211-next-for-davem-2017-01-13' of git://git.kernel.org/pub/scm/linux...
[linux.git] / net / wireless / util.c
index e9d040d29846f87517c0b6b40f0ff9dbeca63a05..1b9296882dcd6a0b585dfd604a30807e7f26290c 100644 (file)
@@ -114,8 +114,7 @@ int ieee80211_frequency_to_channel(int freq)
 }
 EXPORT_SYMBOL(ieee80211_frequency_to_channel);
 
-struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
-                                                 int freq)
+struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq)
 {
        enum nl80211_band band;
        struct ieee80211_supported_band *sband;
@@ -135,14 +134,13 @@ struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
 
        return NULL;
 }
-EXPORT_SYMBOL(__ieee80211_get_channel);
+EXPORT_SYMBOL(ieee80211_get_channel);
 
-static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
-                                    enum nl80211_band band)
+static void set_mandatory_flags_band(struct ieee80211_supported_band *sband)
 {
        int i, want;
 
-       switch (band) {
+       switch (sband->band) {
        case NL80211_BAND_5GHZ:
                want = 3;
                for (i = 0; i < sband->n_bitrates; i++) {
@@ -192,6 +190,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
                WARN_ON((sband->ht_cap.mcs.rx_mask[0] & 0x1e) != 0x1e);
                break;
        case NUM_NL80211_BANDS:
+       default:
                WARN_ON(1);
                break;
        }
@@ -203,7 +202,7 @@ void ieee80211_set_bitrate_flags(struct wiphy *wiphy)
 
        for (band = 0; band < NUM_NL80211_BANDS; band++)
                if (wiphy->bands[band])
-                       set_mandatory_flags_band(wiphy->bands[band], band);
+                       set_mandatory_flags_band(wiphy->bands[band]);
 }
 
 bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher)
@@ -952,7 +951,7 @@ void cfg80211_process_wdev_events(struct wireless_dev *wdev)
                                ev->cr.resp_ie, ev->cr.resp_ie_len,
                                ev->cr.status,
                                ev->cr.status == WLAN_STATUS_SUCCESS,
-                               ev->cr.bss);
+                               ev->cr.bss, ev->cr.timeout_reason);
                        break;
                case EVENT_ROAMED:
                        __cfg80211_roamed(wdev, ev->rm.bss, ev->rm.req_ie,
@@ -1848,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) =