aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00mac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00mac.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index c3c206a97d54..283a8d9874ee 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -719,3 +719,41 @@ void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw)
719 wiphy_rfkill_set_hw_state(hw->wiphy, !active); 719 wiphy_rfkill_set_hw_state(hw->wiphy, !active);
720} 720}
721EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); 721EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll);
722
723void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop)
724{
725 struct rt2x00_dev *rt2x00dev = hw->priv;
726 struct data_queue *queue;
727 unsigned int i = 0;
728
729 ieee80211_stop_queues(hw);
730
731 /*
732 * Run over all queues to kick them, this will force
733 * any pending frames to be transmitted.
734 */
735 tx_queue_for_each(rt2x00dev, queue) {
736 rt2x00dev->ops->lib->kick_tx_queue(queue);
737 }
738
739 /**
740 * All queues have been kicked, now wait for each queue
741 * to become empty. With a bit of luck, we only have to wait
742 * for the first queue to become empty, because while waiting
743 * for the that queue, the other queues will have transmitted
744 * all their frames as well (since they were already kicked).
745 */
746 tx_queue_for_each(rt2x00dev, queue) {
747 for (i = 0; i < 10; i++) {
748 if (rt2x00queue_empty(queue))
749 break;
750 msleep(100);
751 }
752
753 if (!rt2x00queue_empty(queue))
754 WARNING(rt2x00dev, "Failed to flush queue %d", queue->qid);
755 }
756
757 ieee80211_wake_queues(hw);
758}
759EXPORT_SYMBOL_GPL(rt2x00mac_flush);