Skip to contentSkip to conversation

compat-wireless: simplify mac80211 queue backport

PATCH In review Johannes Berg 2 participants 2 messages Apr 6, 2012 – Apr 7, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat-wireless: simplify mac80211 queue backport

From: Johannes Berg <[email protected]>

With compat now having a define for netif_wake_subqueue for kernels 2.6.23 and higher we can remove most of the backport patch for multiqueue. This does give up on kernels 2.6.22 and older though.

---
 patches/22-multiqueue.patch |   95 +++---------------------------------------
 1 files changed, 7 insertions(+), 88 deletions(-)
patches/22-multiqueue.patch +7 -88
index 54926d9..0c7940c 100644
@@ -1,4 +1,4 @@
-Backport multiqueue support for kernels < 2.6.27
+Backport multiqueue support for kernels 2.6.23-27
 
 The 2.6.23 kernel added some initial multiqueue support.
 That release relied on the on the notion of struct
@@ -18,82 +18,16 @@ here is just that all these queues share a common lock
 so stateful operations on one queue would imply a delay
 on other queues.
 
-For older kernels than 2.6.23 we can only stop all the
-queues then and wake them up only if no other queue had
-been stopped previously. This means for kernels older
-than 2.6.23 there is a performance penalty and congestion
-on one queue would imply propagating the same congestion
-impact on all the other queues.
-
 The select_queue callback was only added as of 2.6.27 via
-commit eae792b7 so for kernels older than 2.6.23 and up
-to 2.6.27 we must ensure we do the selection of the queue
-once the core networking calls mac80211's dev_hard_start_xmit()
+commit eae792b7 so for kernels 2.6.23 up to 2.6.27 we must
+ensure we do the selection of the queue once the core
+networking calls mac80211's dev_hard_start_xmit()
 (ndo_start_xmit() callback on newer kernels).
 
-This patch then consists of three parts:
-
-  1) Addresses the lack of select_queue on older kernels than 2.6.27
-  2) Extends the backport of net_device_ops for select_queue for kernels >= 2.6.27
-  3) Backporting wake/stop queue for older kernels:
-	- Handle with net_device_subqueue for >= 2.6.23
-	- Treat each queue operation as an aggregate for all queues
+This patch thus only addresses the lack of select_queue on
+kernels older than 2.6.27, naming differences are handled
+in compat.
 
-Monitor interfaces have their own select_queue -- monitor interfaces
-are used for injecting frames so they have their own respective queue
-handling, but mac80211 just always sends management frames on VO
-queue by using skb_set_queue_mapping(skb, 0) through ieee80211_tx_skb()
-
---- a/net/mac80211/util.c
-+++ b/net/mac80211/util.c
-@@ -265,6 +265,18 @@ __le16 ieee80211_ctstoself_duration(stru
- }
- EXPORT_SYMBOL(ieee80211_ctstoself_duration);
- 
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
-+static bool ieee80211_all_queues_started(struct ieee80211_hw *hw)
-+{
-+	unsigned int queue;
-+
-+	for (queue = 0; queue < hw->queues; queue++)
-+		if (ieee80211_queue_stopped(hw, queue))
-+			return false;
-+	return true;
-+}
-+#endif
-+
- static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
- 				   enum queue_stop_reason reason)
- {
-@@ -287,7 +299,14 @@ static void __ieee80211_wake_queue(struc
- 		list_for_each_entry_rcu(sdata, &local->interfaces, list) {
- 			if (test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state))
- 				continue;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
- 			netif_wake_subqueue(sdata->dev, queue);
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
-+			netif_start_subqueue(sdata->dev, queue);
-+#else
-+			if (ieee80211_all_queues_started(hw))
-+				netif_wake_queue(sdata->dev);
-+#endif
- 		}
- 		rcu_read_unlock();
- 	} else
-@@ -327,7 +346,13 @@ static void __ieee80211_stop_queue(struc
- 
- 	rcu_read_lock();
- 	list_for_each_entry_rcu(sdata, &local->interfaces, list)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
-+		netif_stop_subqueue(sdata->dev, queue);
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
- 		netif_stop_subqueue(sdata->dev, queue);
-+#else
-+		netif_stop_queue(sdata->dev);
-+#endif
- 	rcu_read_unlock();
- }
- 
 --- a/net/mac80211/tx.c
 +++ b/net/mac80211/tx.c
 @@ -1475,6 +1475,10 @@ void ieee80211_xmit(struct ieee80211_sub
@@ -107,18 +41,3 @@ queue by using skb_set_queue_mapping(skb, 0) through ieee80211_tx_skb()
  	ieee80211_set_qos_hdr(sdata, skb);
  	ieee80211_tx(sdata, skb, false);
  	rcu_read_unlock();
-@@ -2210,7 +2214,14 @@ void ieee80211_tx_pending(unsigned long
- 
- 		if (skb_queue_empty(&local->pending[i]))
- 			list_for_each_entry_rcu(sdata, &local->interfaces, list)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
- 				netif_wake_subqueue(sdata->dev, i);
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
-+				netif_start_subqueue(sdata->dev, i);
-+#else
-+				if (ieee80211_all_queues_started(hw))
-+					netif_wake_queue(sdata->dev);
-+#endif
- 	}
- 	spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
- 
Signature · 1 line
1.7.9.1
#1 lore raw
Quoted 8 lines · Johannes Berg

From: Johannes Berg <[email protected]>

With compat now having a define for netif_wake_subqueue for kernels 2.6.23 and higher we can remove most of the backport patch for multiqueue. This does give up on kernels 2.6.22 and older though.

Tested with ckmake, applied and pushed, thanks!

    mcgrof@flash ~/devel/compat-wireless (git::master)$ time ckmake
    Trying kernel                     3.2.2-030202-generic  [OK]
    Trying kernel                    3.1.10-030110-generic  [OK]
    Trying kernel                    3.0.18-030018-generic  [OK]
    Trying kernel                  2.6.39-02063904-generic  [OK]
    Trying kernel                  2.6.38-02063808-generic  [OK]
    Trying kernel                  2.6.37-02063706-generic  [OK]
    Trying kernel                  2.6.36-02063604-generic  [OK]
    Trying kernel                  2.6.35-02063512-generic  [OK]
    Trying kernel                  2.6.34-02063410-generic  [OK]
    Trying kernel                  2.6.33-02063305-generic  [OK]
    Trying kernel                  2.6.32-02063255-generic  [OK]
    Trying kernel                  2.6.31-02063113-generic  [OK]
    Trying kernel                  2.6.30-02063010-generic  [OK]
    Trying kernel                  2.6.29-02062906-generic  [OK]
    Trying kernel                  2.6.28-02062810-generic  [OK]
    Trying kernel                    2.6.27-020627-generic  [OK]
    Trying kernel                    2.6.26-020626-generic  [OK]
    Trying kernel                    2.6.25-020625-generic  [OK]
    Trying kernel                    2.6.24-020624-generic  [OK]

    real    27m43.716s
    user    69m9.115s
    sys     13m8.241s

Luis