diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2010-11-04 15:40:11 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-15 13:26:04 -0500 |
commit | f44df18c58d4debe3ec0bb76a490aa2f3929fd8b (patch) | |
tree | 9085f6c5eefc694bb5c5d05e0bc3bb356021afeb | |
parent | aaf886bd215396f295bc0489e8ae09d1c03d9aa0 (diff) |
rt2x00: Implement flush callback
Implement a basic flush callback function, which simply loops
over all TX queues and waits until all frames have been transmitted
and the status reports have been gathered.
At this moment we don't support dropping any frames during the
flush, but mac80211 will only send 'false' for this argument anyway,
so this is not important at this time.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 1 |
9 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index c94aa1e5d089..bc1ae1ebfdb0 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1612,6 +1612,7 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = { | |||
1612 | .get_tsf = rt2400pci_get_tsf, | 1612 | .get_tsf = rt2400pci_get_tsf, |
1613 | .tx_last_beacon = rt2400pci_tx_last_beacon, | 1613 | .tx_last_beacon = rt2400pci_tx_last_beacon, |
1614 | .rfkill_poll = rt2x00mac_rfkill_poll, | 1614 | .rfkill_poll = rt2x00mac_rfkill_poll, |
1615 | .flush = rt2x00mac_flush, | ||
1615 | }; | 1616 | }; |
1616 | 1617 | ||
1617 | static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { | 1618 | static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index b69e55fedda9..54754150250b 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1909,6 +1909,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = { | |||
1909 | .get_tsf = rt2500pci_get_tsf, | 1909 | .get_tsf = rt2500pci_get_tsf, |
1910 | .tx_last_beacon = rt2500pci_tx_last_beacon, | 1910 | .tx_last_beacon = rt2500pci_tx_last_beacon, |
1911 | .rfkill_poll = rt2x00mac_rfkill_poll, | 1911 | .rfkill_poll = rt2x00mac_rfkill_poll, |
1912 | .flush = rt2x00mac_flush, | ||
1912 | }; | 1913 | }; |
1913 | 1914 | ||
1914 | static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { | 1915 | static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index f20ab79b2817..478c4f127ce6 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1801,6 +1801,7 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = { | |||
1801 | .bss_info_changed = rt2x00mac_bss_info_changed, | 1801 | .bss_info_changed = rt2x00mac_bss_info_changed, |
1802 | .conf_tx = rt2x00mac_conf_tx, | 1802 | .conf_tx = rt2x00mac_conf_tx, |
1803 | .rfkill_poll = rt2x00mac_rfkill_poll, | 1803 | .rfkill_poll = rt2x00mac_rfkill_poll, |
1804 | .flush = rt2x00mac_flush, | ||
1804 | }; | 1805 | }; |
1805 | 1806 | ||
1806 | static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | 1807 | static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 2c12b598be50..6dc61b7710b9 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -943,6 +943,7 @@ static const struct ieee80211_ops rt2800pci_mac80211_ops = { | |||
943 | .get_tsf = rt2800_get_tsf, | 943 | .get_tsf = rt2800_get_tsf, |
944 | .rfkill_poll = rt2x00mac_rfkill_poll, | 944 | .rfkill_poll = rt2x00mac_rfkill_poll, |
945 | .ampdu_action = rt2800_ampdu_action, | 945 | .ampdu_action = rt2800_ampdu_action, |
946 | .flush = rt2x00mac_flush, | ||
946 | }; | 947 | }; |
947 | 948 | ||
948 | static const struct rt2800_ops rt2800pci_rt2800_ops = { | 949 | static const struct rt2800_ops rt2800pci_rt2800_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 3f44131baeee..04dfedc70f85 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -508,6 +508,7 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = { | |||
508 | .get_tsf = rt2800_get_tsf, | 508 | .get_tsf = rt2800_get_tsf, |
509 | .rfkill_poll = rt2x00mac_rfkill_poll, | 509 | .rfkill_poll = rt2x00mac_rfkill_poll, |
510 | .ampdu_action = rt2800_ampdu_action, | 510 | .ampdu_action = rt2800_ampdu_action, |
511 | .flush = rt2x00mac_flush, | ||
511 | }; | 512 | }; |
512 | 513 | ||
513 | static const struct rt2800_ops rt2800usb_rt2800_ops = { | 514 | static const struct rt2800_ops rt2800usb_rt2800_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 94fe589acfaa..42bd3a96f23b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -1133,6 +1133,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, | |||
1133 | int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | 1133 | int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue, |
1134 | const struct ieee80211_tx_queue_params *params); | 1134 | const struct ieee80211_tx_queue_params *params); |
1135 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); | 1135 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); |
1136 | void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop); | ||
1136 | 1137 | ||
1137 | /* | 1138 | /* |
1138 | * Driver allocation handlers. | 1139 | * Driver allocation handlers. |
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 | } |
721 | EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); | 721 | EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); |
722 | |||
723 | void 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 | } | ||
759 | EXPORT_SYMBOL_GPL(rt2x00mac_flush); | ||
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index fba9ee11873b..f01bff7656bc 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2824,6 +2824,7 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = { | |||
2824 | .conf_tx = rt61pci_conf_tx, | 2824 | .conf_tx = rt61pci_conf_tx, |
2825 | .get_tsf = rt61pci_get_tsf, | 2825 | .get_tsf = rt61pci_get_tsf, |
2826 | .rfkill_poll = rt2x00mac_rfkill_poll, | 2826 | .rfkill_poll = rt2x00mac_rfkill_poll, |
2827 | .flush = rt2x00mac_flush, | ||
2827 | }; | 2828 | }; |
2828 | 2829 | ||
2829 | static const struct rt2x00lib_ops rt61pci_rt2x00_ops = { | 2830 | static const struct rt2x00lib_ops rt61pci_rt2x00_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 3c86f0075aed..dcb9211c4771 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2264,6 +2264,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = { | |||
2264 | .conf_tx = rt73usb_conf_tx, | 2264 | .conf_tx = rt73usb_conf_tx, |
2265 | .get_tsf = rt73usb_get_tsf, | 2265 | .get_tsf = rt73usb_get_tsf, |
2266 | .rfkill_poll = rt2x00mac_rfkill_poll, | 2266 | .rfkill_poll = rt2x00mac_rfkill_poll, |
2267 | .flush = rt2x00mac_flush, | ||
2267 | }; | 2268 | }; |
2268 | 2269 | ||
2269 | static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | 2270 | static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { |