mac80211: separate encoding/bandwidth from flags
[linux-2.6-microblaze.git] / net / mac80211 / mlme.c
index 6e90301..24d69bc 100644 (file)
@@ -1908,6 +1908,8 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
        sdata->u.mgd.associated = cbss;
        memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN);
 
+       ieee80211_check_rate_mask(sdata);
+
        sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE;
 
        if (sdata->vif.p2p ||
@@ -2797,8 +2799,9 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
 
        reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
 
-       sdata_info(sdata, "disassociated from %pM (Reason: %u)\n",
-                  mgmt->sa, reason_code);
+       sdata_info(sdata, "disassociated from %pM (Reason: %u=%s)\n",
+                  mgmt->sa, reason_code,
+                  ieee80211_get_reason_code_string(reason_code));
 
        ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
 
@@ -2822,15 +2825,15 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
                        *have_higher_than_11mbit = true;
 
                /*
-                * BSS_MEMBERSHIP_SELECTOR_HT_PHY is defined in 802.11n-2009
-                * 7.3.2.2 as a magic value instead of a rate. Hence, skip it.
+                * Skip HT and VHT BSS membership selectors since they're not
+                * rates.
                 *
-                * Note: Even through the membership selector and the basic
+                * Note: Even though the membership selector and the basic
                 *       rate flag share the same bit, they are not exactly
                 *       the same.
                 */
-               if (!!(supp_rates[i] & 0x80) &&
-                   (supp_rates[i] & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY)
+               if (supp_rates[i] == (0x80 | BSS_MEMBERSHIP_SELECTOR_HT_PHY) ||
+                   supp_rates[i] == (0x80 | BSS_MEMBERSHIP_SELECTOR_VHT_PHY))
                        continue;
 
                for (j = 0; j < sband->n_bitrates; j++) {
@@ -3430,6 +3433,30 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
                }
        }
 
+       if (bss_conf->cqm_rssi_low &&
+           ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) {
+               int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal);
+               int last_event = ifmgd->last_cqm_event_signal;
+               int low = bss_conf->cqm_rssi_low;
+               int high = bss_conf->cqm_rssi_high;
+
+               if (sig < low &&
+                   (last_event == 0 || last_event >= low)) {
+                       ifmgd->last_cqm_event_signal = sig;
+                       ieee80211_cqm_rssi_notify(
+                               &sdata->vif,
+                               NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
+                               sig, GFP_KERNEL);
+               } else if (sig > high &&
+                          (last_event == 0 || last_event <= high)) {
+                       ifmgd->last_cqm_event_signal = sig;
+                       ieee80211_cqm_rssi_notify(
+                               &sdata->vif,
+                               NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
+                               sig, GFP_KERNEL);
+               }
+       }
+
        if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) {
                mlme_dbg_ratelimited(sdata,
                                     "cancelling AP probe due to a received beacon\n");