mac80211: add functions to stop and wake all queues assigned to a vif
authorLuciano Coelho <luciano.coelho@intel.com>
Fri, 13 Jun 2014 13:30:06 +0000 (16:30 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 23 Jun 2014 12:22:27 +0000 (14:22 +0200)
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: Johannes Berg <johannes.berg@intel.com>
net/mac80211/ieee80211_i.h
net/mac80211/util.c

index a0c7da809744754cd5740b78337bb875de985f88..b202df2aebe8ae8ff1d0c47e6d71e94654911911 100644 (file)
@@ -1720,6 +1720,12 @@ void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
                                     unsigned long queues,
                                     enum queue_stop_reason reason,
                                     bool refcounted);
+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,
index 4e8513cfdae50274730f9a7c66208f543586a35d..42d448d765b48915d0a3c9766843737696ef751e 100644 (file)
@@ -552,13 +552,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 unsigned int
+ieee80211_get_vif_queues(struct ieee80211_local *local,
+                        struct ieee80211_sub_if_data *sdata)
 {
-       u32 queues;
-
-       if (!local->ops->flush)
-               return;
+       unsigned int queues;
 
        if (sdata && local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) {
                int ac;
@@ -574,6 +572,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)
+{
+       unsigned int 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,
                                        false);
@@ -585,6 +596,24 @@ void ieee80211_flush_queues(struct ieee80211_local *local,
                                        false);
 }
 
+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, true);
+}
+
+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),
+                                       reason, true);
+}
+
 static void __iterate_active_interfaces(struct ieee80211_local *local,
                                        u32 iter_flags,
                                        void (*iterator)(void *data, u8 *mac,