rt2x00: Implement tx_frames_pending mac80211 callback function.
authorGertjan van Wingerde <gwingerde@gmail.com>
Wed, 6 Jul 2011 21:00:21 +0000 (23:00 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 7 Jul 2011 17:21:00 +0000 (13:21 -0400)
Implementing this callback function will cause mac80211 refrain from
going to powersave state when there are still untransmitted TX frames
in the queues.
This would exactly mimic the behaviour of the legacy vendor driver which
also doesn't go in powersave mode if there are still TX frames that are not
transmitted.
This should make powersaving and rt2x00 a better couple.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 937f9e8bf05f51ba38fda4d7e5517f292251960f..76bcc3547976703842747ae4369d47bf734da3f1 100644 (file)
@@ -1723,6 +1723,7 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = {
        .set_antenna            = rt2x00mac_set_antenna,
        .get_antenna            = rt2x00mac_get_antenna,
        .get_ringparam          = rt2x00mac_get_ringparam,
+       .tx_frames_pending      = rt2x00mac_tx_frames_pending,
 };
 
 static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
index d27d7b8ba3b648f88331ff6e4be7b0c8eeadf2dd..c288d951c03433f15196d7dd708f78d8c973d351 100644 (file)
@@ -2016,6 +2016,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
        .set_antenna            = rt2x00mac_set_antenna,
        .get_antenna            = rt2x00mac_get_antenna,
        .get_ringparam          = rt2x00mac_get_ringparam,
+       .tx_frames_pending      = rt2x00mac_tx_frames_pending,
 };
 
 static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
index 15237c275486467b7971a8495480c01863dbcf9e..53c5f878f61d56b134956d489ad43d49911d48aa 100644 (file)
@@ -1827,6 +1827,7 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = {
        .set_antenna            = rt2x00mac_set_antenna,
        .get_antenna            = rt2x00mac_get_antenna,
        .get_ringparam          = rt2x00mac_get_ringparam,
+       .tx_frames_pending      = rt2x00mac_tx_frames_pending,
 };
 
 static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
index fd994490f58e77422b5b516f1c65ed0314bb98a0..5319ed921a88c1a77f446a60776f412b85976756 100644 (file)
@@ -1031,6 +1031,7 @@ static const struct ieee80211_ops rt2800pci_mac80211_ops = {
        .flush                  = rt2x00mac_flush,
        .get_survey             = rt2800_get_survey,
        .get_ringparam          = rt2x00mac_get_ringparam,
+       .tx_frames_pending      = rt2x00mac_tx_frames_pending,
 };
 
 static const struct rt2800_ops rt2800pci_rt2800_ops = {
index af230583d0a6988ba130aad6a03310e725335894..59e77797c0fa3eaf825aeda1eaf911adf19e4491 100644 (file)
@@ -757,6 +757,7 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = {
        .flush                  = rt2x00mac_flush,
        .get_survey             = rt2800_get_survey,
        .get_ringparam          = rt2x00mac_get_ringparam,
+       .tx_frames_pending      = rt2x00mac_tx_frames_pending,
 };
 
 static const struct rt2800_ops rt2800usb_rt2800_ops = {
index c446db69bd3c12418ae09b35cf14e1261e2b00cb..db435abbd57a980c56b549fc39ab5089e247a662 100644 (file)
@@ -1276,6 +1276,7 @@ int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
 int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
 void rt2x00mac_get_ringparam(struct ieee80211_hw *hw,
                             u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
+bool rt2x00mac_tx_frames_pending(struct ieee80211_hw *hw);
 
 /*
  * Driver allocation handlers.
index 93bec140e598612145c50b44adc86be70b42bca2..8efab3983528a0e54d0f70bdeb96e2729c414c08 100644 (file)
@@ -818,3 +818,17 @@ void rt2x00mac_get_ringparam(struct ieee80211_hw *hw,
        *rx_max = rt2x00dev->rx->limit;
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_get_ringparam);
+
+bool rt2x00mac_tx_frames_pending(struct ieee80211_hw *hw)
+{
+       struct rt2x00_dev *rt2x00dev = hw->priv;
+       struct data_queue *queue;
+
+       tx_queue_for_each(rt2x00dev, queue) {
+               if (!rt2x00queue_empty(queue))
+                       return true;
+       }
+
+       return false;
+}
+EXPORT_SYMBOL_GPL(rt2x00mac_tx_frames_pending);
index 9d35ec16a3a5ff9c8c226837ce69da8c29fc35df..53110b83bf6e47a2ff172b03c90db0cab81f5c4c 100644 (file)
@@ -2982,6 +2982,7 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = {
        .set_antenna            = rt2x00mac_set_antenna,
        .get_antenna            = rt2x00mac_get_antenna,
        .get_ringparam          = rt2x00mac_get_ringparam,
+       .tx_frames_pending      = rt2x00mac_tx_frames_pending,
 };
 
 static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
index ad20953cbf05860c9d26f97604b1bae91cc9fafd..6a93939f44e887984d3f9877a8753485b3d82980 100644 (file)
@@ -2314,6 +2314,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
        .set_antenna            = rt2x00mac_set_antenna,
        .get_antenna            = rt2x00mac_get_antenna,
        .get_ringparam          = rt2x00mac_get_ringparam,
+       .tx_frames_pending      = rt2x00mac_tx_frames_pending,
 };
 
 static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {