From: Rajkumar Manoharan <rmanohar@codeaurora.org>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
Rajkumar Manoharan <rmanohar@codeaurora.org>
Subject: [RFC 2/3] mac80211: pause txq transmission on negative airtime deficit
Date: Mon, 13 Aug 2018 16:13:30 -0700 [thread overview]
Message-ID: <1534202011-13101-3-git-send-email-rmanohar@codeaurora.org> (raw)
In-Reply-To: <1534202011-13101-1-git-send-email-rmanohar@codeaurora.org>
Airtime fairness prioritizes txqs and picks high priority txq. Once
a txq is selected for transmission by next_txq(), dequeue routine is
not preventing over downloading packets. i.e the driver is still
allowed to dequeue frames from txq even when its fairness deficit
goes negative. This is also causing inefficient fq-codel of mac80211
when the driver/firmware is maintaining another set of data queues.
To address this problem, pause txq transmission when given txq's
was already served for the assigned quantum and resume the transmission
upon prioritization.
Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
---
net/mac80211/debugfs_sta.c | 7 ++++---
net/mac80211/ieee80211_i.h | 1 +
net/mac80211/sta_info.c | 9 +++++++++
net/mac80211/tx.c | 9 ++++++++-
4 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index bae0fa7ff95a..5c38994cd95c 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -178,9 +178,10 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf,
txqi->tin.tx_bytes,
txqi->tin.tx_packets,
txqi->flags,
- txqi->flags & (1<<IEEE80211_TXQ_STOP) ? "STOP" : "RUN",
- txqi->flags & (1<<IEEE80211_TXQ_AMPDU) ? " AMPDU" : "",
- txqi->flags & (1<<IEEE80211_TXQ_NO_AMSDU) ? " NO-AMSDU" : "");
+ txqi->flags & (1 << IEEE80211_TXQ_STOP) ? "STOP" :
+ txqi->flags & (1 << IEEE80211_TXQ_PAUSE) ? "PAUSE": "RUN",
+ txqi->flags & (1 << IEEE80211_TXQ_AMPDU) ? " AMPDU" : "",
+ txqi->flags & (1 << IEEE80211_TXQ_NO_AMSDU) ? " NO-AMSDU" : "");
}
rcu_read_unlock();
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 5825824cfe5b..3ef287075cb1 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -818,6 +818,7 @@ enum txq_info_flags {
IEEE80211_TXQ_STOP,
IEEE80211_TXQ_AMPDU,
IEEE80211_TXQ_NO_AMSDU,
+ IEEE80211_TXQ_PAUSE,
};
/**
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 8af9e5c05ce4..215ae3a690aa 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1830,6 +1830,8 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
{
struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
struct ieee80211_local *local = sta->sdata->local;
+ struct fq *fq = &local->fq;
+ struct txq_info *txqi;
u8 ac = ieee80211_ac_from_tid(tid);
u32 airtime = 0;
@@ -1844,6 +1846,13 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
sta->airtime.deficit[ac] -= airtime;
if (airtime)
sta->local->airtime_flags |= AIRTIME_ACTIVE;
+
+ if (sta->airtime.deficit[ac] < 0) {
+ txqi = to_txq_info(pubsta->txq[tid]);
+ spin_lock_bh(&fq->lock);
+ set_bit(IEEE80211_TXQ_PAUSE, &txqi->flags);
+ spin_unlock_bh(&fq->lock);
+ }
spin_unlock_bh(&local->active_txq_lock);
}
EXPORT_SYMBOL(ieee80211_sta_register_airtime);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 6a76852ba1f3..0af35c08e0d9 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3475,7 +3475,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
spin_lock_bh(&fq->lock);
- if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
+ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ||
+ test_bit(IEEE80211_TXQ_PAUSE, &txqi->flags))
goto out;
/* Make sure fragments stay together. */
@@ -3636,6 +3637,7 @@ static inline struct txq_info *find_txqi(struct ieee80211_local *local, s8 ac)
struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac)
{
struct ieee80211_local *local = hw_to_local(hw);
+ struct fq *fq = &local->fq;
struct txq_info *txqi = NULL;
spin_lock_bh(&local->active_txq_lock);
@@ -3653,6 +3655,11 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac)
sta->airtime.deficit[txqi->txq.ac] += IEEE80211_AIRTIME_QUANTUM * sta->airtime.weight;
list_move_tail(&txqi->schedule_order,
&local->active_txqs[txqi->txq.ac]);
+ if (sta->airtime.deficit[txqi->txq.ac] > 0) {
+ spin_lock_bh(&fq->lock);
+ clear_bit(IEEE80211_TXQ_PAUSE, &txqi->flags);
+ spin_unlock_bh(&fq->lock);
+ }
goto begin;
}
}
--
1.9.1
next prev parent reply other threads:[~2018-08-14 1:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-13 23:13 [RFC 0/3] mac80211: handle push-pull path in ATF Rajkumar Manoharan
2018-08-13 23:13 ` [RFC 1/3] mac80211: make airtime txq list per ac Rajkumar Manoharan
2018-08-13 23:13 ` Rajkumar Manoharan [this message]
2018-08-13 23:13 ` [RFC 3/3] mac80211: add ieee80211_reorder_txq Rajkumar Manoharan
2018-08-21 12:24 ` Toke Høiland-Jørgensen
2018-08-21 21:25 ` Rajkumar Manoharan
2018-08-22 11:10 ` Toke Høiland-Jørgensen
2018-08-27 18:34 ` Rajkumar Manoharan
2018-08-28 10:20 ` Toke Høiland-Jørgensen
2018-08-28 23:54 ` Rajkumar Manoharan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1534202011-13101-3-git-send-email-rmanohar@codeaurora.org \
--to=rmanohar@codeaurora.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).