ath9k: Disable SWBA interrupt on remove_interface
[pandora-kernel.git] / net / mac80211 / ibss.c
index c691780..239c483 100644 (file)
@@ -173,6 +173,19 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
                memcpy(skb_put(skb, ifibss->ie_len),
                       ifibss->ie, ifibss->ie_len);
 
+       if (local->hw.queues >= 4) {
+               pos = skb_put(skb, 9);
+               *pos++ = WLAN_EID_VENDOR_SPECIFIC;
+               *pos++ = 7; /* len */
+               *pos++ = 0x00; /* Microsoft OUI 00:50:F2 */
+               *pos++ = 0x50;
+               *pos++ = 0xf2;
+               *pos++ = 2; /* WME */
+               *pos++ = 0; /* WME info */
+               *pos++ = 1; /* WME ver */
+               *pos++ = 0; /* U-APSD no in use */
+       }
+
        rcu_assign_pointer(ifibss->presp, skb);
 
        sdata->vif.bss_conf.beacon_int = beacon_int;
@@ -266,37 +279,45 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
        if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
                return;
 
-       if (sdata->vif.type == NL80211_IFTYPE_ADHOC && elems->supp_rates &&
+       if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
            memcmp(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) {
-               supp_rates = ieee80211_sta_get_rates(local, elems, band);
 
                rcu_read_lock();
-
                sta = sta_info_get(sdata, mgmt->sa);
-               if (sta) {
-                       u32 prev_rates;
 
-                       prev_rates = sta->sta.supp_rates[band];
-                       /* make sure mandatory rates are always added */
-                       sta->sta.supp_rates[band] = supp_rates |
-                               ieee80211_mandatory_rates(local, band);
+               if (elems->supp_rates) {
+                       supp_rates = ieee80211_sta_get_rates(local, elems,
+                                                            band);
+                       if (sta) {
+                               u32 prev_rates;
+
+                               prev_rates = sta->sta.supp_rates[band];
+                               /* make sure mandatory rates are always added */
+                               sta->sta.supp_rates[band] = supp_rates |
+                                       ieee80211_mandatory_rates(local, band);
 
-                       if (sta->sta.supp_rates[band] != prev_rates) {
+                               if (sta->sta.supp_rates[band] != prev_rates) {
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
-                               printk(KERN_DEBUG "%s: updated supp_rates set "
-                                   "for %pM based on beacon/probe_response "
-                                   "(0x%x -> 0x%x)\n",
-                                   sdata->name, sta->sta.addr,
-                                   prev_rates, sta->sta.supp_rates[band]);
+                                       printk(KERN_DEBUG
+                                               "%s: updated supp_rates set "
+                                               "for %pM based on beacon"
+                                               "/probe_resp (0x%x -> 0x%x)\n",
+                                               sdata->name, sta->sta.addr,
+                                               prev_rates,
+                                               sta->sta.supp_rates[band]);
 #endif
-                               rate_control_rate_init(sta);
-                       }
-                       rcu_read_unlock();
-               } else {
-                       rcu_read_unlock();
-                       ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
-                                              supp_rates, GFP_KERNEL);
+                                       rate_control_rate_init(sta);
+                               }
+                       } else
+                               sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
+                                               mgmt->sa, supp_rates,
+                                               GFP_ATOMIC);
                }
+
+               if (sta && elems->wmm_info)
+                       set_sta_flags(sta, WLAN_STA_WME);
+
+               rcu_read_unlock();
        }
 
        bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
@@ -427,14 +448,15 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
                return NULL;
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-       printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n",
-              wiphy_name(local->hw.wiphy), addr, sdata->name);
+       wiphy_debug(local->hw.wiphy, "Adding new IBSS station %pM (dev=%s)\n",
+                   addr, sdata->name);
 #endif
 
        sta = sta_info_alloc(sdata, addr, gfp);
        if (!sta)
                return NULL;
 
+       sta->last_rx = jiffies;
        set_sta_flags(sta, WLAN_STA_AUTHORIZED);
 
        /* make sure mandatory rates are always added */
@@ -920,12 +942,14 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
        memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN);
        sdata->u.ibss.ssid_len = params->ssid_len;
 
+       mutex_unlock(&sdata->u.ibss.mtx);
+
+       mutex_lock(&sdata->local->mtx);
        ieee80211_recalc_idle(sdata->local);
+       mutex_unlock(&sdata->local->mtx);
 
        ieee80211_queue_work(&sdata->local->hw, &sdata->work);
 
-       mutex_unlock(&sdata->u.ibss.mtx);
-
        return 0;
 }
 
@@ -980,7 +1004,9 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
 
        mutex_unlock(&sdata->u.ibss.mtx);
 
+       mutex_lock(&local->mtx);
        ieee80211_recalc_idle(sdata->local);
+       mutex_unlock(&local->mtx);
 
        return 0;
 }