]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iwlegacy: add flush callback
authorStanislaw Gruszka <sgruszka@redhat.com>
Thu, 20 Dec 2012 13:31:51 +0000 (14:31 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 7 Jan 2013 20:16:53 +0000 (15:16 -0500)
Dump implementation of flush, which just wait until all TX queues
become empty.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlegacy/3945-mac.c
drivers/net/wireless/iwlegacy/4965-mac.c
drivers/net/wireless/iwlegacy/common.c
drivers/net/wireless/iwlegacy/common.h

index d604b4036a764358e52bd2c2ca9d02bd24f14ce9..962400a201610aafc55478fcaa8b7d07cf1e65ab 100644 (file)
@@ -3474,6 +3474,7 @@ struct ieee80211_ops il3945_mac_ops = {
        .sta_add = il3945_mac_sta_add,
        .sta_remove = il_mac_sta_remove,
        .tx_last_beacon = il_mac_tx_last_beacon,
+       .flush = il_mac_flush,
 };
 
 static int
index 6a86ed45835d034412e73b6a38ca182fc4d2f70f..c40020c8b273e3af9dd68715d878b8896d5f1985 100644 (file)
@@ -6308,6 +6308,7 @@ const struct ieee80211_ops il4965_mac_ops = {
        .sta_remove = il_mac_sta_remove,
        .channel_switch = il4965_mac_channel_switch,
        .tx_last_beacon = il_mac_tx_last_beacon,
+       .flush = il_mac_flush,
 };
 
 static int
index 7e16d10a7f140e4bc0a1414af1ec317f7284b9c6..56b80219d695910ebcecec3db8882e49be135175 100644 (file)
@@ -4707,6 +4707,42 @@ out:
 }
 EXPORT_SYMBOL(il_mac_change_interface);
 
+void
+il_mac_flush(struct ieee80211_hw *hw, bool drop)
+{
+       struct il_priv *il = hw->priv;
+       unsigned long timeout = jiffies + msecs_to_jiffies(500);
+       int i;
+
+       mutex_lock(&il->mutex);
+       D_MAC80211("enter\n");
+
+       if (il->txq == NULL)
+               goto out;
+
+       for (i = 0; i < il->hw_params.max_txq_num; i++) {
+               struct il_queue *q;
+
+               if (i == il->cmd_queue)
+                       continue;
+
+               q = &il->txq[i].q;
+               if (q->read_ptr == q->write_ptr)
+                       continue;
+
+               if (time_after(jiffies, timeout)) {
+                       IL_ERR("Failed to flush queue %d\n", q->id);
+                       break;
+               }
+
+               msleep(20);
+       }
+out:
+       D_MAC80211("leave\n");
+       mutex_unlock(&il->mutex);
+}
+EXPORT_SYMBOL(il_mac_flush);
+
 /*
  * On every watchdog tick we check (latest) time stamp. If it does not
  * change during timeout period and queue is not empty we reset firmware.
index a9a569f432fb3517d5421ea1c4d43cdd96a4d816..37fe553b25e0e86e8b0f772ba08da42d8808b920 100644 (file)
@@ -1723,6 +1723,7 @@ void il_mac_remove_interface(struct ieee80211_hw *hw,
                             struct ieee80211_vif *vif);
 int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                            enum nl80211_iftype newtype, bool newp2p);
+void il_mac_flush(struct ieee80211_hw *hw, bool drop);
 int il_alloc_txq_mem(struct il_priv *il);
 void il_free_txq_mem(struct il_priv *il);