From: Yibo Zhao <yiboz@codeaurora.org>
To: linux-wireless@vger.kernel.org
Cc: ath10k@lists.infradead.org, Yibo Zhao <yiboz@codeaurora.org>
Subject: [PATCH 2/4] mac80211: fix issue in loop scenario
Date: Fri, 13 Dec 2019 15:19:51 +0800 [thread overview]
Message-ID: <1576221593-1086-3-git-send-email-yiboz@codeaurora.org> (raw)
In-Reply-To: <1576221593-1086-1-git-send-email-yiboz@codeaurora.org>
In a loop txqs dequeue scenario, if the first txq in the rbtree gets
removed from rbtree immediately in the ieee80211_return_txq(), the
loop will break soon in the ieee80211_next_txq() due to schedule_pos
not leading to the second txq in the rbtree. Thus update schedule_pos
to previous node once the node of schedule_pos is either removed from
rbtree or move to other location in rbtree due to airtime update.
Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
---
net/mac80211/ieee80211_i.h | 2 ++
net/mac80211/tx.c | 14 +++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a4556f9..ed85400 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -847,6 +847,7 @@ struct txq_info {
struct codel_stats cstats;
struct sk_buff_head frags;
struct rb_node schedule_order;
+ u16 schedule_round;
unsigned long flags;
/* keep last! */
@@ -1144,6 +1145,7 @@ struct ieee80211_local {
struct rb_node *schedule_pos[IEEE80211_NUM_ACS];
u64 airtime_v_t[IEEE80211_NUM_ACS];
u64 airtime_weight_sum[IEEE80211_NUM_ACS];
+ u16 schedule_round[IEEE80211_NUM_ACS];
u16 airtime_flags;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d00baaa..c1444e7 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3644,6 +3644,7 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
lockdep_assert_held(&local->active_txq_lock[ac]);
+begin:
if (!node) {
node = rb_first_cached(&local->active_txqs[ac]);
first = true;
@@ -3668,7 +3669,10 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
}
}
+ if (txqi->schedule_round == local->schedule_round[ac])
+ goto begin;
+ txqi->schedule_round = local->schedule_round[ac];
local->schedule_pos[ac] = node;
return &txqi->txq;
}
@@ -3752,6 +3756,9 @@ void ieee80211_resort_txq(struct ieee80211_hw *hw,
u8 ac = txq->ac;
if (!RB_EMPTY_NODE(&txqi->schedule_order)) {
+ if (local->schedule_pos[ac] == &txqi->schedule_order)
+ local->schedule_pos[ac] = rb_prev(&txqi->schedule_order);
+
rb_erase_cached(&txqi->schedule_order,
&local->active_txqs[ac]);
RB_CLEAR_NODE(&txqi->schedule_order);
@@ -3771,6 +3778,9 @@ static void __ieee80211_unschedule_txq(struct ieee80211_hw *hw,
if (RB_EMPTY_NODE(&txqi->schedule_order))
return;
+ if (local->schedule_pos[ac] == &txqi->schedule_order)
+ local->schedule_pos[ac] = rb_prev(&txqi->schedule_order);
+
if (txq->sta) {
struct sta_info *sta = container_of(txq->sta,
struct sta_info, sta);
@@ -3803,7 +3813,7 @@ void ieee80211_return_txq(struct ieee80211_hw *hw,
lockdep_assert_held(&local->active_txq_lock[txq->ac]);
if (!RB_EMPTY_NODE(&txqi->schedule_order) &&
- (skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets))
+ !txq_has_queue(&txqi->txq))
__ieee80211_unschedule_txq(hw, txq);
}
EXPORT_SYMBOL(ieee80211_return_txq);
@@ -3832,6 +3842,8 @@ void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac)
struct ieee80211_local *local = hw_to_local(hw);
spin_lock_bh(&local->active_txq_lock[ac]);
+ local->schedule_round[ac]++;
+
}
EXPORT_SYMBOL(ieee80211_txq_schedule_start);
--
1.9.1
next prev parent reply other threads:[~2019-12-13 7:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 7:19 [PATCH V4 0/4] Enable virtual time-based airtime scheduler support on ath10k Yibo Zhao
2019-12-13 7:19 ` [PATCH 1/4] mac80211: Switch to a virtual time-based airtime scheduler Yibo Zhao
2019-12-13 7:19 ` Yibo Zhao [this message]
2019-12-13 9:56 ` [PATCH 2/4] mac80211: fix issue in loop scenario Johannes Berg
2019-12-18 10:12 ` yiboz
2019-12-18 10:18 ` Johannes Berg
2019-12-18 10:37 ` Toke Høiland-Jørgensen
2019-12-13 7:19 ` [PATCH 3/4] mac80211: fix low throughput in multi-clients situation Yibo Zhao
2020-01-08 10:46 ` Justin Capella
2020-01-08 11:31 ` Toke Høiland-Jørgensen
2019-12-13 7:19 ` [PATCH 4/4] mac80211: Sync airtime weight sum with per AC synced sta airtime weight together Yibo Zhao
2019-12-13 9:58 ` Johannes Berg
2019-12-17 15:20 ` Toke Høiland-Jørgensen
2019-12-13 9:03 ` [PATCH V4 0/4] Enable virtual time-based airtime scheduler support on ath10k Justin Capella
2019-12-13 10:06 ` Toke Høiland-Jørgensen
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=1576221593-1086-3-git-send-email-yiboz@codeaurora.org \
--to=yiboz@codeaurora.org \
--cc=ath10k@lists.infradead.org \
--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).