mac80211: delay IBSS station insertion

In order to notify drivers and simplify the station
management code, defer IBSS station insertion to a
work item and don't do it directly while receiving
a frame.

This increases the complexity in IBSS a little bit,
but it's pretty straight forward and it allows us
to reduce the station management complexity (next
patch) considerably.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Johannes Berg
2011-12-15 11:17:37 +01:00
committed by John W. Linville
parent 56544160d4
commit 8bf11d8d08
4 changed files with 139 additions and 56 deletions

View File

@@ -354,35 +354,26 @@ static int sta_info_finish_insert(struct sta_info *sta,
/* notify driver */
err = drv_sta_add(local, sdata, &sta->sta);
if (err) {
if (!async)
if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
return err;
printk(KERN_DEBUG "%s: failed to add IBSS STA %pM to "
"driver (%d) - keeping it anyway.\n",
sdata->name, sta->sta.addr, err);
} else {
} else
sta->uploaded = true;
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
if (async)
wiphy_debug(local->hw.wiphy,
"Finished adding IBSS STA %pM\n",
sta->sta.addr);
#endif
}
sdata = sta->sdata;
}
if (!dummy_reinsert) {
if (!async) {
local->num_sta++;
local->sta_generation++;
smp_mb();
local->num_sta++;
local->sta_generation++;
smp_mb();
/* make the station visible */
spin_lock_irqsave(&local->sta_lock, flags);
sta_info_hash_add(local, sta);
spin_unlock_irqrestore(&local->sta_lock, flags);
}
/* make the station visible */
spin_lock_irqsave(&local->sta_lock, flags);
sta_info_hash_add(local, sta);
spin_unlock_irqrestore(&local->sta_lock, flags);
list_add(&sta->list, &local->sta_list);
} else {
@@ -1546,7 +1537,7 @@ EXPORT_SYMBOL(ieee80211_sta_set_buffered);
int sta_info_move_state_checked(struct sta_info *sta,
enum ieee80211_sta_state new_state)
{
/* might_sleep(); -- for driver notify later, fix IBSS first */
might_sleep();
if (sta->sta_state == new_state)
return 0;