From: Michal Kazior <michal.kazior@tieto.com>
To: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, Michal Kazior <michal.kazior@tieto.com>
Subject: [PATCH 1/3] ath10k: fix ar->rx_channel updating logic
Date: Wed, 3 Jun 2015 12:16:54 +0200 [thread overview]
Message-ID: <1433326616-23279-1-git-send-email-michal.kazior@tieto.com> (raw)
Channel contexts aren't iterable until after
they've been added to the driver. The code assumed
otherwise.
This problem could result in:
* rx_channel being NULL and forcing Rx path to go
the slow way to get channel on QCA988X,
* report incorrect channel when running
multi-channel on QCA61X4 hw2.1,
* report incorrect channel after AP channel
switch.
Fixes: 500ff9f9389d ("ath10k: implement chanctx API")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
drivers/net/wireless/ath/ath10k/mac.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index f4de71721f7d..fe53b1f5e6c9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6144,7 +6144,10 @@ static int ath10k_ampdu_action(struct ieee80211_hw *hw,
}
static void
-ath10k_mac_update_rx_channel(struct ath10k *ar)
+ath10k_mac_update_rx_channel(struct ath10k *ar,
+ struct ieee80211_chanctx_conf *ctx,
+ struct ieee80211_vif_chanctx_switch *vifs,
+ int n_vifs)
{
struct cfg80211_chan_def *def = NULL;
@@ -6154,6 +6157,9 @@ ath10k_mac_update_rx_channel(struct ath10k *ar)
lockdep_assert_held(&ar->conf_mutex);
lockdep_assert_held(&ar->data_lock);
+ WARN_ON(ctx && vifs);
+ WARN_ON(vifs && n_vifs != 1);
+
/* FIXME: Sort of an optimization and a workaround. Peers and vifs are
* on a linked list now. Doing a lookup peer -> vif -> chanctx for each
* ppdu on Rx may reduce performance on low-end systems. It should be
@@ -6165,11 +6171,17 @@ ath10k_mac_update_rx_channel(struct ath10k *ar)
* affected much.
*/
rcu_read_lock();
- if (ath10k_mac_num_chanctxs(ar) == 1) {
+ if (!ctx && ath10k_mac_num_chanctxs(ar) == 1) {
ieee80211_iter_chan_contexts_atomic(ar->hw,
ath10k_mac_get_any_chandef_iter,
&def);
+
+ if (vifs)
+ def = &vifs[0].new_ctx->def;
+
ar->rx_channel = def->chan;
+ } else if (ctx && ath10k_mac_num_chanctxs(ar) == 0) {
+ ar->rx_channel = ctx->def.chan;
} else {
ar->rx_channel = NULL;
}
@@ -6204,7 +6216,7 @@ ath10k_mac_op_add_chanctx(struct ieee80211_hw *hw,
spin_lock_bh(&ar->data_lock);
ath10k_mac_chan_ctx_init(ar, arctx, ctx);
- ath10k_mac_update_rx_channel(ar);
+ ath10k_mac_update_rx_channel(ar, ctx, NULL, 0);
spin_unlock_bh(&ar->data_lock);
ath10k_recalc_radar_detection(ar);
@@ -6228,7 +6240,7 @@ ath10k_mac_op_remove_chanctx(struct ieee80211_hw *hw,
mutex_lock(&ar->conf_mutex);
spin_lock_bh(&ar->data_lock);
- ath10k_mac_update_rx_channel(ar);
+ ath10k_mac_update_rx_channel(ar, NULL, NULL, 0);
spin_unlock_bh(&ar->data_lock);
ath10k_recalc_radar_detection(ar);
@@ -6413,7 +6425,7 @@ ath10k_mac_op_switch_vif_chanctx(struct ieee80211_hw *hw,
*/
arctx_old->conf = *vifs[i].new_ctx;
}
- ath10k_mac_update_rx_channel(ar);
+ ath10k_mac_update_rx_channel(ar, NULL, vifs, n_vifs);
spin_unlock_bh(&ar->data_lock);
/* FIXME: Reconfigure only affected vifs */
--
2.1.4
next reply other threads:[~2015-06-03 10:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 10:16 Michal Kazior [this message]
2015-06-03 10:16 ` [PATCH 2/3] ath10k: remove ath10k_chanctx struct Michal Kazior
2015-06-03 10:16 ` [PATCH 3/3] ath10k: fix channel switching Michal Kazior
2015-06-09 10:50 ` [PATCH 1/3] ath10k: fix ar->rx_channel updating logic Kalle Valo
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=1433326616-23279-1-git-send-email-michal.kazior@tieto.com \
--to=michal.kazior@tieto.com \
--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).