diff options
author | Arik Nemtsov <arik@wizery.com> | 2011-04-27 00:35:39 +0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-05-02 11:27:21 +0400 |
commit | 33437893025aa3c0195b933ac99ef7de924019f4 (patch) | |
tree | e811e118dc4b7cb6792c2c3ab8cab905636f5dce | |
parent | 4cf557fcf01e352fb418e110dd013e4128493c5f (diff) | |
download | linux-33437893025aa3c0195b933ac99ef7de924019f4.tar.xz |
wl12xx: implement the tx_frames_pending mac80211 callback
Frames are considered pending when they reside in the driver TX queue or
already queued in the FW.
This notion of "pending" is appropriate for power save considerations in
STA mode, but not necessarily in other modes (for instance P2P-GO).
[Fixed a sparse warning about missing "static" in a function
declaration -- Luca]
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 6dd72365b63a..e177764e7140 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c @@ -3147,6 +3147,28 @@ out: return ret; } +static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw) +{ + struct wl1271 *wl = hw->priv; + bool ret = false; + + mutex_lock(&wl->mutex); + + if (unlikely(wl->state == WL1271_STATE_OFF)) + goto out; + + /* packets are considered pending if in the TX queue or the FW */ + ret = (wl->tx_queue_count > 0) || (wl->tx_frames_cnt > 0); + + /* the above is appropriate for STA mode for PS purposes */ + WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS); + +out: + mutex_unlock(&wl->mutex); + + return ret; +} + /* can't be const, mac80211 writes to this */ static struct ieee80211_rate wl1271_rates[] = { { .bitrate = 10, @@ -3398,6 +3420,7 @@ static const struct ieee80211_ops wl1271_ops = { .sta_add = wl1271_op_sta_add, .sta_remove = wl1271_op_sta_remove, .ampdu_action = wl1271_op_ampdu_action, + .tx_frames_pending = wl1271_tx_frames_pending, CFG80211_TESTMODE_CMD(wl1271_tm_cmd) }; |