tx: stop sta queues when going to sleep

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2015-06-13 09:26:41 +02:00
parent 5a343275e9
commit 93550af391
3 changed files with 31 additions and 0 deletions
+12
View File
@@ -269,6 +269,18 @@ static void
mt76_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
enum sta_notify_cmd cmd, struct ieee80211_sta *sta)
{
struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
struct mt76_dev *dev = hw->priv;
switch (cmd) {
case STA_NOTIFY_SLEEP:
msta->sleeping = true;
mt76_stop_tx_queues(dev, sta);
break;
case STA_NOTIFY_AWAKE:
msta->sleeping = false;
break;
}
}
static int
+3
View File
@@ -214,6 +214,7 @@ struct mt76_sta {
u32 status;
int n_frames;
bool sleeping;
};
struct mt76_txq {
@@ -345,4 +346,6 @@ void mt76_release_buffered_frames(struct ieee80211_hw *hw,
enum ieee80211_frame_release_type reason,
bool more_data);
void mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta);
#endif
+16
View File
@@ -399,6 +399,22 @@ void mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq)
mtxq->hwq = &dev->q_tx[mt76_txq_get_qid(txq)];
}
void
mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta)
{
int i;
for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
struct ieee80211_txq *txq = sta->txq[i];
struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
spin_lock_bh(&mtxq->hwq->lock);
if (!list_empty(&mtxq->list))
list_del_init(&mtxq->list);
spin_unlock_bh(&mtxq->hwq->lock);
}
}
void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
{
struct mt76_dev *dev = hw->priv;