Skip to contentSkip to conversation

mac80211: serialize rx path workers

RFC New Christian Lamparter 1 participant 1 message Dec 29, 2010 mac80211

lore
Share & tools
lore
#0 lore raw

RFC 1/1 mac80211: serialize rx path workers

This patch addresses the issue of serialization between the main rx path and various reorder release timers.

<http://www.spinics.net/lists/linux-wireless/msg57214.html>

As discussed before, we can choose between:
1. get a new rx-path lock

2. convert all drivers to use ieee80211_rx_irqsafe and let the tasklet handle the timeout procedure.

3. call the release reorder code from within ieee80211_rx() (e.g.: before returning back to the driver)

4. like 1. but without the global "lock". (this patch)

5. ... maybe more?

Seems like we are spoilt for choice? However, each way does have its own unique drawback.

1. Locking is easy to implement but hard to maintain. Furthermore, Johannes worked very hard to get rid of as many as possible.

2. converting the drivers to ieee80211_rx_irqsafe has the drawback that frames have to go through several queues and tasklets/workers (driver and mac80211) before they can be passed on to net-core (backlog). I tried this approach before and on a UP-system ath9k struggled to reach even 11g speeds.

3. Not so bad, but in order to work properly the driver needs to "deliver" a constant stream of frames. Which isn't a problem, as long as beacons are not filtered and the beacon interval is reasonably short.

So, what should we do?

The attached solution is so far the easiest to implement. It converts the previously local "frames" queue into a global rx queue (reorder_release). This way, everyone (be it the main rx-path or some reorder release timeout) can add frames to it.

Now, only one active rx handler worker (ieee80211_rx_handlers) is needed. All other threads which have lost the race of "runnning_rx_handlers" can now simply "return", knowing that the thread who had the "edge" will also take care of their workload.

(not the most intelligent bits, but it's getting late...)
---
Don't forget that the reorder release timers have been disabled. If you want to test this patch, you must also revert "mac80211: temporarily disable reorder release timer" (15943a72c7d2031c9150917ca9161a9f891d455a in wt.git)

Regards,
Chr

 ieee80211_i.h |    3 ++
 main.c        |    4 ++
 rx.c          |   82 +++++++++++++++++++++++++---------------------------------
 3 files changed, 43 insertions(+), 46 deletions(-)

---

net/mac80211/ieee80211_i.h +3 -0
index a0cf5ab..57b223a 100644
@@ -704,6 +704,9 @@ struct ieee80211_local {
 	struct work_struct work_work;
 	struct sk_buff_head work_skb_queue;
 
+	struct sk_buff_head reorder_release;
+	atomic_t running_rx_handlers;
+
 	/*
 	 * private workqueue to mac80211. mac80211 makes this accessible
 	 * via ieee80211_queue_work()
net/mac80211/main.c +4 -0
index 32e58ee..18f7e9a 100644
@@ -569,6 +569,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
 	spin_lock_init(&local->filter_lock);
 	spin_lock_init(&local->queue_stop_reason_lock);
 
+	skb_queue_head_init(&local->reorder_release);
+	atomic_set(&local->running_rx_handlers, 0);
+
 	INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
 
 	ieee80211_work_init(local);
@@ -917,6 +920,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
 		wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
 	skb_queue_purge(&local->skb_queue);
 	skb_queue_purge(&local->skb_queue_unreliable);
+	skb_queue_purge(&local->reorder_release);
 
 	destroy_workqueue(local->workqueue);
 	wiphy_unregister(local->hw.wiphy);
net/mac80211/rx.c +33 -42

215 lines not on this page · raw message