linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] mac80211: add functions to stop and wake all queues assigned to a vif
@ 2014-06-05 16:26 Emmanuel Grumbach
  2014-06-06  7:01 ` Coelho, Luciano
  0 siblings, 1 reply; 2+ messages in thread
From: Emmanuel Grumbach @ 2014-06-05 16:26 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Luciano Coelho, Emmanuel Grumbach

From: Luciano Coelho <luciano.coelho@intel.com>

In some cases we may want to stop the queues of a single vif (for
instance during a channel-switch).  Add a function that stops all the
queues that are assigned to a vif.  If a queue is assigned to more
than one vif, the corresponding netdev subqueue of the other vif(s)
will also be stopped.  If the HW doesn't set the
IEEE80211_HW_QUEUE_CONTROL flag, then all queues are stopped.

Also add a corresponding function to wake the queues of a vif back.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 net/mac80211/ieee80211_i.h |  6 ++++++
 net/mac80211/util.c        | 38 +++++++++++++++++++++++++++++++++-----
 2 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index c9309db..2f995b1 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1736,6 +1736,12 @@ void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
 void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
 				     unsigned long queues,
 				     enum queue_stop_reason reason);
+void ieee80211_stop_vif_queues(struct ieee80211_local *local,
+			       struct ieee80211_sub_if_data *sdata,
+			       enum queue_stop_reason reason);
+void ieee80211_wake_vif_queues(struct ieee80211_local *local,
+			       struct ieee80211_sub_if_data *sdata,
+			       enum queue_stop_reason reason);
 void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
 				     unsigned long queues,
 				     enum queue_stop_reason reason);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 6d29e40..f1e751d 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -529,14 +529,11 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw)
 }
 EXPORT_SYMBOL(ieee80211_wake_queues);
 
-void ieee80211_flush_queues(struct ieee80211_local *local,
-			    struct ieee80211_sub_if_data *sdata)
+static int ieee80211_get_vif_queues(struct ieee80211_local *local,
+				    struct ieee80211_sub_if_data *sdata)
 {
 	u32 queues;
 
-	if (!local->ops->flush)
-		return;
-
 	if (sdata && local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) {
 		int ac;
 
@@ -551,6 +548,19 @@ void ieee80211_flush_queues(struct ieee80211_local *local,
 		queues = BIT(local->hw.queues) - 1;
 	}
 
+	return queues;
+}
+
+void ieee80211_flush_queues(struct ieee80211_local *local,
+			    struct ieee80211_sub_if_data *sdata)
+{
+	u32 queues;
+
+	if (!local->ops->flush)
+		return;
+
+	queues = ieee80211_get_vif_queues(local, sdata);
+
 	ieee80211_stop_queues_by_reason(&local->hw, queues,
 					IEEE80211_QUEUE_STOP_REASON_FLUSH);
 
@@ -560,6 +570,24 @@ void ieee80211_flush_queues(struct ieee80211_local *local,
 					IEEE80211_QUEUE_STOP_REASON_FLUSH);
 }
 
+void ieee80211_stop_vif_queues(struct ieee80211_local *local,
+			       struct ieee80211_sub_if_data *sdata,
+			       enum queue_stop_reason reason)
+{
+	ieee80211_stop_queues_by_reason(&local->hw,
+					ieee80211_get_vif_queues(local, sdata),
+					reason);
+}
+
+void ieee80211_wake_vif_queues(struct ieee80211_local *local,
+			       struct ieee80211_sub_if_data *sdata,
+			       enum queue_stop_reason reason)
+{
+	ieee80211_wake_queues_by_reason(&local->hw,
+					ieee80211_get_vif_queues(local, sdata),
+					IEEE80211_QUEUE_STOP_REASON_DRIVER);
+}
+
 static void __iterate_active_interfaces(struct ieee80211_local *local,
 					u32 iter_flags,
 					void (*iterator)(void *data, u8 *mac,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] mac80211: add functions to stop and wake all queues assigned to a vif
  2014-06-05 16:26 [PATCH 2/3] mac80211: add functions to stop and wake all queues assigned to a vif Emmanuel Grumbach
@ 2014-06-06  7:01 ` Coelho, Luciano
  0 siblings, 0 replies; 2+ messages in thread
From: Coelho, Luciano @ 2014-06-06  7:01 UTC (permalink / raw)
  To: Grumbach, Emmanuel
  Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net

T24gVGh1LCAyMDE0LTA2LTA1IGF0IDE5OjI2ICswMzAwLCBFbW1hbnVlbCBHcnVtYmFjaCB3cm90
ZToNCj4gRnJvbTogTHVjaWFubyBDb2VsaG8gPGx1Y2lhbm8uY29lbGhvQGludGVsLmNvbT4NCj4g
DQo+IEluIHNvbWUgY2FzZXMgd2UgbWF5IHdhbnQgdG8gc3RvcCB0aGUgcXVldWVzIG9mIGEgc2lu
Z2xlIHZpZiAoZm9yDQo+IGluc3RhbmNlIGR1cmluZyBhIGNoYW5uZWwtc3dpdGNoKS4gIEFkZCBh
IGZ1bmN0aW9uIHRoYXQgc3RvcHMgYWxsIHRoZQ0KPiBxdWV1ZXMgdGhhdCBhcmUgYXNzaWduZWQg
dG8gYSB2aWYuICBJZiBhIHF1ZXVlIGlzIGFzc2lnbmVkIHRvIG1vcmUNCj4gdGhhbiBvbmUgdmlm
LCB0aGUgY29ycmVzcG9uZGluZyBuZXRkZXYgc3VicXVldWUgb2YgdGhlIG90aGVyIHZpZihzKQ0K
PiB3aWxsIGFsc28gYmUgc3RvcHBlZC4gIElmIHRoZSBIVyBkb2Vzbid0IHNldCB0aGUNCj4gSUVF
RTgwMjExX0hXX1FVRVVFX0NPTlRST0wgZmxhZywgdGhlbiBhbGwgcXVldWVzIGFyZSBzdG9wcGVk
Lg0KPiANCj4gQWxzbyBhZGQgYSBjb3JyZXNwb25kaW5nIGZ1bmN0aW9uIHRvIHdha2UgdGhlIHF1
ZXVlcyBvZiBhIHZpZiBiYWNrLg0KPiANCj4gU2lnbmVkLW9mZi1ieTogTHVjaWFubyBDb2VsaG8g
PGx1Y2lhbm8uY29lbGhvQGludGVsLmNvbT4NCj4gU2lnbmVkLW9mZi1ieTogRW1tYW51ZWwgR3J1
bWJhY2ggPGVtbWFudWVsLmdydW1iYWNoQGludGVsLmNvbT4NCj4gLS0tDQoNClsuLi5dDQoNCj4g
K3ZvaWQgaWVlZTgwMjExX3dha2VfdmlmX3F1ZXVlcyhzdHJ1Y3QgaWVlZTgwMjExX2xvY2FsICps
b2NhbCwNCj4gKwkJCSAgICAgICBzdHJ1Y3QgaWVlZTgwMjExX3N1Yl9pZl9kYXRhICpzZGF0YSwN
Cj4gKwkJCSAgICAgICBlbnVtIHF1ZXVlX3N0b3BfcmVhc29uIHJlYXNvbikNCj4gK3sNCj4gKwlp
ZWVlODAyMTFfd2FrZV9xdWV1ZXNfYnlfcmVhc29uKCZsb2NhbC0+aHcsDQo+ICsJCQkJCWllZWU4
MDIxMV9nZXRfdmlmX3F1ZXVlcyhsb2NhbCwgc2RhdGEpLA0KPiArCQkJCQlJRUVFODAyMTFfUVVF
VUVfU1RPUF9SRUFTT05fRFJJVkVSKTsNCg0KT29vcHMsIHRoaXMgaXMgd3JvbmcsIGl0IHNob3Vs
ZCBiZSByZWFzb24gaW5zdGVhZC4NCg0KLS0NCkx1Y2EuDQo=

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-06  7:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-05 16:26 [PATCH 2/3] mac80211: add functions to stop and wake all queues assigned to a vif Emmanuel Grumbach
2014-06-06  7:01 ` Coelho, Luciano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).