public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath10k: fix band reporting for mgmt CCK frames on 5GHz
@ 2013-12-13  9:44 Michal Kazior
  2013-12-16  7:29 ` Alex Hacker
  2013-12-16 13:19 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Kazior @ 2013-12-13  9:44 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

Although CCK modulation isn't expected for 11a if
it happened it made ath10k report wrong band
(2GHz) for a mgmt frame that were actually
received on 5Ghz band. Frequency would also
decoded incorrectly too.

In case of 5GHz-only devices this triggered
mac80211 WARN_ON because there was no according
sband pointer to be found.

The patch should fix delivery of such frames by
using different means to acquire band parameter.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---

One could argue whether such frames should be even
delievered to mac80211. I decided it's better to
deliver to increase interoperability with silly
devices.

If anyone disagrees I can change the patch to
simply drop such frames in ath10k.

 drivers/net/wireless/ath/ath10k/wmi.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 9ea333a..3ec6c9a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -875,6 +875,7 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
 	struct wmi_mgmt_rx_event_v2 *ev_v2;
 	struct wmi_mgmt_rx_hdr_v1 *ev_hdr;
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
+	struct ieee80211_channel *ch;
 	struct ieee80211_hdr *hdr;
 	u32 rx_status;
 	u32 channel;
@@ -927,7 +928,25 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
 	if (rx_status & WMI_RX_STATUS_ERR_MIC)
 		status->flag |= RX_FLAG_MMIC_ERROR;
 
-	status->band = phy_mode_to_band(phy_mode);
+	/* HW can Rx CCK rates on 5GHz. In that case phy_mode is set to
+	 * MODE_11B. This means phy_mode is not a reliable source for the band
+	 * of mgmt rx. */
+
+	ch = ar->scan_channel;
+	if (!ch)
+		ch = ar->rx_channel;
+
+	if (ch) {
+		status->band = ch->band;
+
+		if (phy_mode == MODE_11B &&
+		    status->band == IEEE80211_BAND_5GHZ)
+			ath10k_dbg(ATH10K_DBG_MGMT, "wmi mgmt rx 11b (CCK) on 5GHz\n");
+	} else {
+		ath10k_warn("using (unreliable) phy_mode to extract band for mgmt rx\n");
+		status->band = phy_mode_to_band(phy_mode);
+	}
+
 	status->freq = ieee80211_channel_to_frequency(channel, status->band);
 	status->signal = snr + ATH10K_DEFAULT_NOISE_FLOOR;
 	status->rate_idx = get_rate_idx(rate, status->band);
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ath10k: fix band reporting for mgmt CCK frames on 5GHz
  2013-12-13  9:44 [PATCH] ath10k: fix band reporting for mgmt CCK frames on 5GHz Michal Kazior
@ 2013-12-16  7:29 ` Alex Hacker
  2013-12-16 13:19 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Hacker @ 2013-12-16  7:29 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, linux-wireless

Hello,
If QCA98xx can receive CCK on 5GHz band (like all ath9k supported chips), I
want to ask: Is it should do that? I think no... It looks like FW bug.

Regards,
Alex.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ath10k: fix band reporting for mgmt CCK frames on 5GHz
  2013-12-13  9:44 [PATCH] ath10k: fix band reporting for mgmt CCK frames on 5GHz Michal Kazior
  2013-12-16  7:29 ` Alex Hacker
@ 2013-12-16 13:19 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2013-12-16 13:19 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> Although CCK modulation isn't expected for 11a if
> it happened it made ath10k report wrong band
> (2GHz) for a mgmt frame that were actually
> received on 5Ghz band. Frequency would also
> decoded incorrectly too.
>
> In case of 5GHz-only devices this triggered
> mac80211 WARN_ON because there was no according
> sband pointer to be found.
>
> The patch should fix delivery of such frames by
> using different means to acquire band parameter.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

Thanks, applied.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-16 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13  9:44 [PATCH] ath10k: fix band reporting for mgmt CCK frames on 5GHz Michal Kazior
2013-12-16  7:29 ` Alex Hacker
2013-12-16 13:19 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox