mbox series

[v2,0/4] wcn36xx: Add spectrum survey reporting

Message ID 20220108171057.1823315-1-bryan.odonoghue@linaro.org
Headers show
Series wcn36xx: Add spectrum survey reporting | expand

Message

Bryan O'Donoghue Jan. 8, 2022, 5:10 p.m. UTC
V2:
- Fixes typo "ret -= ENOMEM" => "ret = -ENOMEM" - kernel test bot
- Makes get_survey() static - kernel test bot
- Ignores riscv warnings since none apply to code in this patch - bod

V1:
This series enables get_survey() on wcn36xx. Tested with wcn3620 and
wcn3680b.

wcn36xx reports RSSI and SNR in the buffer descriptor of each delivered
frame wcn36xx -> host. Thus far we have only extracted RSSI but, extracting
the SNR lets us also report the noise-floor.

Adding in some background tracking of the current tuned channel lets us
flag which channel is currently in use when running "iw wlan0 survey dump"

For both wcn3620 and wcn3680b I have verified both the STA and AP's view of
RSSI and noise.

Example wcn3620:
  AP Asus RT-AX88U
    SSID: "linaro-test"
    noise: -78 dBm	Channel: 8
    BSSID: 04:D4:C4:AA:BB:CC

    MAC               RSSI
    02:00:16:qq:xx:yy -35dBm

  STA
    root@linaro-developer:~# iw wlan0 link
    Connected to 04:d4:c4:aa:bb:cc (on wlan0)
          SSID: linaro-test
          freq: 2447
          RX: 768377 bytes (4250 packets)
          TX: 8136 bytes (97 packets)
          signal: -37 dBm

    root@linaro-developer:~# iw wlan0 survey dump
    Survey data from wlan0
            frequency:                      2412 MHz
    Survey data from wlan0
            frequency:                      2417 MHz
            noise:                          -12 dBm
    Survey data from wlan0
            frequency:                      2422 MHz
            noise:                          -82 dBm
    Survey data from wlan0
            frequency:                      2427 MHz
            noise:                          -76 dBm
    Survey data from wlan0
            frequency:                      2432 MHz
            noise:                          -78 dBm
    Survey data from wlan0
            frequency:                      2437 MHz
            noise:                          -100 dBm
    Survey data from wlan0
            frequency:                      2442 MHz
            noise:                          -41 dBm
    Survey data from wlan0
            frequency:                      2447 MHz [in use]
            noise:                          -75 dBm

Example wcn3680b:
  AP Asus RT-AX88U:
    SSID: "linaro-test"
    noise: -80 dBm	Channel: 60/160
    BSSID: 04:D4:C4:DD:EE:FF	

    MAC               RSSI
    E2:C0:10:YY:XX:QQ -31dBm

  STA:
    root@linaro-developer:~# iw wlan0 link
    Connected to 04:d4:c4:dd:ee:ff (on wlan0)
            SSID: linaro-test
            freq: 5300
            RX: 5999294 bytes (32764 packets)
            TX: 35443 bytes (493 packets)
            signal: -27 dBm
            rx bitrate: 433.3 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 1
            tx bitrate: 6.0 MBit/s

            bss flags:      short-slot-time
            dtim period:    3
            beacon int:     100

    root@linaro-developer:~# iw wlan0 survey dump
    Survey data from wlan0
            frequency:                      2412 MHz
            noise:                          -63 dBm
    Survey data from wlan0
            frequency:                      2417 MHz
            noise:                          -57 dBm
    Survey data from wlan0
            frequency:                      2422 MHz
            noise:                          -74 dBm
    Survey data from wlan0
            frequency:                      2427 MHz
            noise:                          -90 dBm
    Survey data from wlan0
            frequency:                      2432 MHz
            noise:                          -72 dBm
    Survey data from wlan0
            frequency:                      2437 MHz
            noise:                          -33 dBm
    Survey data from wlan0
            frequency:                      2442 MHz
            noise:                          -72 dBm
    Survey data from wlan0
            frequency:                      2447 MHz
            noise:                          -68 dBm
    Survey data from wlan0
            frequency:                      2452 MHz
            noise:                          -33 dBm
    Survey data from wlan0
            frequency:                      2457 MHz
            noise:                          -33 dBm
    Survey data from wlan0
            frequency:                      2462 MHz
            noise:                          -36 dBm
    Survey data from wlan0
            frequency:                      2467 MHz
            noise:                          -68 dBm
    Survey data from wlan0
            frequency:                      2472 MHz
            noise:                          -34 dBm
    Survey data from wlan0
            frequency:                      5180 MHz
            noise:                          -63 dBm
    Survey data from wlan0
            frequency:                      5200 MHz
            noise:                          -57 dBm
    Survey data from wlan0
            frequency:                      5220 MHz
            noise:                          -74 dBm
    Survey data from wlan0
            frequency:                      5240 MHz
            noise:                          -90 dBm
    Survey data from wlan0
            frequency:                      5260 MHz
            noise:                          -72 dBm
    Survey data from wlan0
            frequency:                      5280 MHz
            noise:                          -33 dBm
    Survey data from wlan0
            frequency:                      5300 MHz [in use]
            noise:                          -72 dBm

Bryan O'Donoghue (4):
  wcn36xx: Implement get_snr()
  wcn36xx: Track the band and channel we are tuned to
  wcn36xx: Track SNR and RSSI for each RX frame
  wcn36xx: Add SNR reporting via get_survey()

 drivers/net/wireless/ath/wcn36xx/main.c    | 81 ++++++++++++++++++++++
 drivers/net/wireless/ath/wcn36xx/txrx.c    | 36 ++++++++++
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 13 ++++
 3 files changed, 130 insertions(+)