mac80211: convert aggregation to operate on vifs/stas
[safe/jmp/linux-2.6] / net / mac80211 / ibss.c
index 6e3cca6..fbffce9 100644 (file)
@@ -73,6 +73,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_mgmt *mgmt;
        u8 *pos;
        struct ieee80211_supported_band *sband;
+       struct cfg80211_bss *bss;
        u32 bss_change;
        u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
 
@@ -177,8 +178,9 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
        mod_timer(&ifibss->timer,
                  round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL));
 
-       cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel,
-                                 mgmt, skb->len, 0, GFP_KERNEL);
+       bss = cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel,
+                                       mgmt, skb->len, 0, GFP_KERNEL);
+       cfg80211_put_bss(bss);
        cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL);
 }
 
@@ -453,6 +455,10 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
 
        ieee80211_sta_expire(sdata, IEEE80211_IBSS_INACTIVITY_LIMIT);
 
+       if (time_before(jiffies, ifibss->last_scan_completed +
+                      IEEE80211_IBSS_MERGE_INTERVAL))
+               return;
+
        if (ieee80211_sta_active_ibss(sdata))
                return;
 
@@ -538,13 +544,12 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
                                       WLAN_CAPABILITY_PRIVACY,
                                       capability);
 
+       if (bss) {
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
-       if (bss)
                printk(KERN_DEBUG "   sta_find_ibss: selected %pM current "
                       "%pM\n", bss->cbss.bssid, ifibss->bssid);
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
 
-       if (bss && memcmp(ifibss->bssid, bss->cbss.bssid, ETH_ALEN)) {
                printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
                       " based on configured SSID\n",
                       sdata->dev->name, bss->cbss.bssid);
@@ -552,8 +557,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
                ieee80211_sta_join_ibss(sdata, bss);
                ieee80211_rx_bss_put(local, bss);
                return;
-       } else if (bss)
-               ieee80211_rx_bss_put(local, bss);
+       }
 
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
        printk(KERN_DEBUG "   did not try to join ibss\n");
@@ -781,7 +785,7 @@ static void ieee80211_ibss_timer(unsigned long data)
        }
 
        set_bit(IEEE80211_IBSS_REQ_RUN, &ifibss->request);
-       queue_work(local->hw.workqueue, &ifibss->work);
+       ieee80211_queue_work(&local->hw, &ifibss->work);
 }
 
 #ifdef CONFIG_PM
@@ -829,7 +833,7 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local)
                if (!sdata->u.ibss.ssid_len)
                        continue;
                sdata->u.ibss.last_scan_completed = jiffies;
-               ieee80211_sta_find_ibss(sdata);
+               mod_timer(&sdata->u.ibss.timer, 0);
        }
        mutex_unlock(&local->iflist_mtx);
 }
@@ -853,7 +857,7 @@ ieee80211_ibss_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
        case IEEE80211_STYPE_PROBE_REQ:
        case IEEE80211_STYPE_AUTH:
                skb_queue_tail(&sdata->u.ibss.skb_queue, skb);
-               queue_work(local->hw.workqueue, &sdata->u.ibss.work);
+               ieee80211_queue_work(&local->hw, &sdata->u.ibss.work);
                return RX_QUEUED;
        }
 
@@ -912,7 +916,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
        ieee80211_recalc_idle(sdata->local);
 
        set_bit(IEEE80211_IBSS_REQ_RUN, &sdata->u.ibss.request);
-       queue_work(sdata->local->hw.workqueue, &sdata->u.ibss.work);
+       ieee80211_queue_work(&sdata->local->hw, &sdata->u.ibss.work);
 
        return 0;
 }