tcp: reserve tcp_skb_mss() to tcp stack
[linux-2.6-block.git] / net / mac80211 / scan.c
index 7bb6a9383f58ec01b3f9c68964aac3f44f3e5beb..11d0901ebb7b6e1015abae8534ee3aa6cc5c8b26 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright 2005, Devicescape Software, Inc.
  * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
- * Copyright 2013-2014  Intel Mobile Communications GmbH
+ * Copyright 2013-2015  Intel Mobile Communications GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -69,10 +69,11 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
        int clen, srlen;
        enum nl80211_bss_scan_width scan_width;
        s32 signal = 0;
+       bool signal_valid;
 
-       if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
+       if (ieee80211_hw_check(&local->hw, SIGNAL_DBM))
                signal = rx_status->signal * 100;
-       else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
+       else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC))
                signal = (rx_status->signal * 100) / local->hw.max_signal;
 
        scan_width = NL80211_BSS_CHAN_WIDTH_20;
@@ -86,6 +87,11 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
                                               GFP_ATOMIC);
        if (!cbss)
                return NULL;
+       /* In case the signal is invalid update the status */
+       signal_valid = abs(channel->center_freq - cbss->channel->center_freq)
+               <= local->hw.wiphy->max_adj_channel_rssi_comp;
+       if (!signal_valid)
+               rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
 
        bss = (void *)cbss->priv;
 
@@ -257,7 +263,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
        if (test_bit(SCAN_HW_CANCELLED, &local->scanning))
                return false;
 
-       if (local->hw.flags & IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS) {
+       if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
                for (i = 0; i < req->n_channels; i++) {
                        local->hw_scan_req->req.channels[i] = req->channels[i];
                        bands_used |= BIT(req->channels[i]->band);
@@ -326,7 +332,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
                return;
 
        if (hw_scan && !aborted &&
-           !(local->hw.flags & IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS) &&
+           !ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS) &&
            ieee80211_prep_hw_scan(local)) {
                int rc;
 
@@ -520,7 +526,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 
                local->hw_scan_ies_bufsize = local->scan_ies_len + req->ie_len;
 
-               if (local->hw.flags & IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS) {
+               if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
                        int i, n_bands = 0;
                        u8 bands_counted = 0;