From: Rajkumar Manoharan <rmanohar@codeaurora.org>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
Rajkumar Manoharan <rmanohar@codeaurora.org>
Subject: [RFC 3/3] mac80211: add ieee80211_reorder_txq
Date: Mon, 13 Aug 2018 16:13:31 -0700 [thread overview]
Message-ID: <1534202011-13101-4-git-send-email-rmanohar@codeaurora.org> (raw)
In-Reply-To: <1534202011-13101-1-git-send-email-rmanohar@codeaurora.org>
This allows the driver to refill airtime fairness deficit
where the driver will not access txqs by ieee80211_next_txq.
In tx push mode data path, high priority txqs will be scheduled
for data transmission by ieee80211_next_txq and driver will not
prioritize txqs whereas in push-pull mode, the drivers can
prioritize txqs and access them directly. In such mode, airtime
deficit can not filled by ieee80211_next_txq.
Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
---
include/net/mac80211.h | 15 +++++++++++++
net/mac80211/tx.c | 59 +++++++++++++++++++++++++++++++++++---------------
2 files changed, 57 insertions(+), 17 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index cc16847bd52d..a2f0b6800100 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -6033,6 +6033,21 @@ bool ieee80211_schedule_txq(struct ieee80211_hw *hw,
struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac);
/**
+ * ieee80211_reorder_txq - change txq position in scheduling loop
+ *
+ * This function is used to reorder txq's position in scheduling loop.
+ * The txq fairness deficit will be refilled. The drivers calling this
+ * function should ensure the txq won't be accessed by ieee80211_next_txq
+ * in the same path.
+ *
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
+ * @txq: pointer obtained from station or virtual interface
+ *
+ */
+void ieee80211_reorder_txq(struct ieee80211_hw *hw,
+ struct ieee80211_txq *txq);
+
+/**
* ieee80211_txq_get_depth - get pending frame/byte count of given txq
*
* The values are not guaranteed to be coherent with regard to each other, i.e.
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0af35c08e0d9..b7b2f93152f8 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3634,10 +3634,38 @@ static inline struct txq_info *find_txqi(struct ieee80211_local *local, s8 ac)
return txqi;
}
+static bool ieee80211_txq_refill_deficit(struct ieee80211_local *local,
+ struct txq_info *txqi)
+{
+ struct fq *fq = &local->fq;
+ struct sta_info *sta;
+
+ lockdep_assert_held(&local->active_txq_lock);
+
+ if (!txqi->txq.sta)
+ return false;
+
+ sta = container_of(txqi->txq.sta, struct sta_info, sta);
+
+ if (sta->airtime.deficit[txqi->txq.ac] > 0)
+ return false;
+
+ 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);
+ }
+ return true;
+}
+
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);
@@ -3647,22 +3675,8 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac)
if (!txqi)
goto out;
- if (txqi->txq.sta) {
- struct sta_info *sta = container_of(txqi->txq.sta,
- struct sta_info, sta);
-
- if (sta->airtime.deficit[txqi->txq.ac] < 0) {
- 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;
- }
- }
+ if (ieee80211_txq_refill_deficit(local, txqi))
+ goto begin;
list_del_init(&txqi->schedule_order);
@@ -3676,6 +3690,17 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac)
}
EXPORT_SYMBOL(ieee80211_next_txq);
+void ieee80211_reorder_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
+{
+ struct ieee80211_local *local = hw_to_local(hw);
+ struct txq_info *txqi = to_txq_info(txq);
+
+ spin_lock_bh(&local->active_txq_lock);
+ ieee80211_txq_refill_deficit(local, txqi);
+ spin_unlock_bh(&local->active_txq_lock);
+}
+EXPORT_SYMBOL(ieee80211_reorder_txq);
+
void __ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev,
u32 info_flags)
--
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 ` [RFC 2/3] mac80211: pause txq transmission on negative airtime deficit Rajkumar Manoharan
2018-08-13 23:13 ` Rajkumar Manoharan [this message]
2018-08-21 12:24 ` [RFC 3/3] mac80211: add ieee80211_reorder_txq 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-4-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).