Skip to content

Commit c9c5608

Browse files
bendotliKalle Valo
authored andcommitted
wcn36xx: populate band before determining rate on RX
status.band is used in determination of status.rate -- for 5GHz on legacy rates there is a linear shift between the BD descriptor's rate field and the wcn36xx driver's rate table (wcn_5ghz_rates). We have a special clause to populate status.band for hardware scan offload frames. However, this block occurs after status.rate is already populated. Correctly handle this dependency by moving the band block before the rate block. This patch addresses kernel warnings & missing scan results for 5GHz APs that send their beacons/probe responses at the higher four legacy rates (24-54 Mbps), when using hardware scan offload: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at net/mac80211/rx.c:4532 ieee80211_rx_napi+0x744/0x8d8 Modules linked in: wcn36xx [...] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.19.107-g73909fa #1 Hardware name: Square, Inc. T2 (all variants) (DT) Call trace: dump_backtrace+0x0/0x148 show_stack+0x14/0x1c dump_stack+0xb8/0xf0 __warn+0x2ac/0x2d8 warn_slowpath_null+0x44/0x54 ieee80211_rx_napi+0x744/0x8d8 ieee80211_tasklet_handler+0xa4/0xe0 tasklet_action_common+0xe0/0x118 tasklet_action+0x20/0x28 __do_softirq+0x108/0x1ec irq_exit+0xd4/0xd8 __handle_domain_irq+0x84/0xbc gic_handle_irq+0x4c/0xb8 el1_irq+0xe8/0x190 lpm_cpuidle_enter+0x220/0x260 cpuidle_enter_state+0x114/0x1c0 cpuidle_enter+0x34/0x48 do_idle+0x150/0x268 cpu_startup_entry+0x20/0x24 rest_init+0xd4/0xe0 start_kernel+0x398/0x430 ---[ end trace ae28cb759352b403 ]--- Fixes: 8a27ca3 ("wcn36xx: Correct band/freq reporting on RX") Signed-off-by: Benjamin Li <[email protected]> Tested-by: Loic Poulain <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ed04ea7 commit c9c5608

File tree

1 file changed

+19
-18
lines changed
  • drivers/net/wireless/ath/wcn36xx

1 file changed

+19
-18
lines changed

drivers/net/wireless/ath/wcn36xx/txrx.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
314314
fc = __le16_to_cpu(hdr->frame_control);
315315
sn = IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl));
316316

317-
status.freq = WCN36XX_CENTER_FREQ(wcn);
318-
status.band = WCN36XX_BAND(wcn);
319317
status.mactime = 10;
320318
status.signal = -get_rssi0(bd);
321319
status.antenna = 1;
@@ -327,6 +325,25 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
327325

328326
wcn36xx_dbg(WCN36XX_DBG_RX, "status.flags=%x\n", status.flag);
329327

328+
if (bd->scan_learn) {
329+
/* If packet originate from hardware scanning, extract the
330+
* band/channel from bd descriptor.
331+
*/
332+
u8 hwch = (bd->reserved0 << 4) + bd->rx_ch;
333+
334+
if (bd->rf_band != 1 && hwch <= sizeof(ab_rx_ch_map) && hwch >= 1) {
335+
status.band = NL80211_BAND_5GHZ;
336+
status.freq = ieee80211_channel_to_frequency(ab_rx_ch_map[hwch - 1],
337+
status.band);
338+
} else {
339+
status.band = NL80211_BAND_2GHZ;
340+
status.freq = ieee80211_channel_to_frequency(hwch, status.band);
341+
}
342+
} else {
343+
status.band = WCN36XX_BAND(wcn);
344+
status.freq = WCN36XX_CENTER_FREQ(wcn);
345+
}
346+
330347
if (bd->rate_id < ARRAY_SIZE(wcn36xx_rate_table)) {
331348
rate = &wcn36xx_rate_table[bd->rate_id];
332349
status.encoding = rate->encoding;
@@ -353,22 +370,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
353370
ieee80211_is_probe_resp(hdr->frame_control))
354371
status.boottime_ns = ktime_get_boottime_ns();
355372

356-
if (bd->scan_learn) {
357-
/* If packet originates from hardware scanning, extract the
358-
* band/channel from bd descriptor.
359-
*/
360-
u8 hwch = (bd->reserved0 << 4) + bd->rx_ch;
361-
362-
if (bd->rf_band != 1 && hwch <= sizeof(ab_rx_ch_map) && hwch >= 1) {
363-
status.band = NL80211_BAND_5GHZ;
364-
status.freq = ieee80211_channel_to_frequency(ab_rx_ch_map[hwch - 1],
365-
status.band);
366-
} else {
367-
status.band = NL80211_BAND_2GHZ;
368-
status.freq = ieee80211_channel_to_frequency(hwch, status.band);
369-
}
370-
}
371-
372373
memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
373374

374375
if (ieee80211_is_beacon(hdr->frame_control)) {

0 commit comments

Comments
 (0)