mac80211: move dynamic PS timeout to hardware config
[linux-2.6.git] / net / mac80211 / mlme.c
index 563ceb4..7709e76 100644 (file)
@@ -777,9 +777,10 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
 
        if (local->powersave &&
                        !(local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS)) {
-               if (local->dynamic_ps_timeout > 0)
+               if (local->hw.conf.dynamic_ps_timeout > 0)
                        mod_timer(&local->dynamic_ps_timer, jiffies +
-                                 msecs_to_jiffies(local->dynamic_ps_timeout));
+                                 msecs_to_jiffies(
+                                       local->hw.conf.dynamic_ps_timeout));
                else {
                        ieee80211_send_nullfunc(local, sdata, 1);
                        conf->flags |= IEEE80211_CONF_PS;
@@ -901,8 +902,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
 
        rcu_read_unlock();
 
+       /* channel(_type) changes are handled by ieee80211_hw_config */
        local->oper_channel_type = NL80211_CHAN_NO_HT;
-       config_changed |= IEEE80211_CONF_CHANGE_HT;
 
        del_timer_sync(&local->dynamic_ps_timer);
        cancel_work_sync(&local->dynamic_ps_enable_work);
@@ -1629,6 +1630,13 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
        if (!bss)
                return;
 
+       if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3) &&
+           (memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0)) {
+               struct ieee80211_channel_sw_ie *sw_elem =
+                       (struct ieee80211_channel_sw_ie *)elems->ch_switch_elem;
+               ieee80211_process_chanswitch(sdata, sw_elem, bss);
+       }
+
        /* was just updated in ieee80211_bss_info_update */
        beacon_timestamp = bss->timestamp;
 
@@ -1644,6 +1652,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 
        /* check if we need to merge IBSS */
        if (sdata->vif.type == NL80211_IFTYPE_ADHOC && beacon &&
+           (!(sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)) &&
            bss->capability & WLAN_CAPABILITY_IBSS &&
            bss->freq == local->oper_channel->center_freq &&
            elems->ssid_len == sdata->u.sta.ssid_len &&
@@ -1764,6 +1773,9 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
            memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
                return;
 
+       if (rx_status->freq != local->hw.conf.channel->center_freq)
+               return;
+
        ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param,
                                 elems.wmm_param_len);
 
@@ -1831,8 +1843,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
                                        struct ieee80211_if_sta *ifsta,
                                        struct ieee80211_mgmt *mgmt,
-                                       size_t len,
-                                       struct ieee80211_rx_status *rx_status)
+                                       size_t len)
 {
        struct ieee80211_local *local = sdata->local;
        int tx_last_beacon;
@@ -1947,8 +1958,7 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
 
        switch (fc & IEEE80211_FCTL_STYPE) {
        case IEEE80211_STYPE_PROBE_REQ:
-               ieee80211_rx_mgmt_probe_req(sdata, ifsta, mgmt, skb->len,
-                                           rx_status);
+               ieee80211_rx_mgmt_probe_req(sdata, ifsta, mgmt, skb->len);
                break;
        case IEEE80211_STYPE_PROBE_RESP:
                ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len, rx_status);
@@ -2424,8 +2434,11 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
 
        ifsta = &sdata->u.sta;
        INIT_WORK(&ifsta->work, ieee80211_sta_work);
+       INIT_WORK(&ifsta->chswitch_work, ieee80211_chswitch_work);
        setup_timer(&ifsta->timer, ieee80211_sta_timer,
                    (unsigned long) sdata);
+       setup_timer(&ifsta->chswitch_timer, ieee80211_chswitch_timer,
+                   (unsigned long) sdata);
        skb_queue_head_init(&ifsta->skb_queue);
 
        ifsta->capab = WLAN_CAPABILITY_ESS;