1. 17 Nov, 2021 1 commit
    • Sven Eckelmann's avatar
      ath11k: Fix ETSI regd with weather radar overlap · 086c921a
      Sven Eckelmann authored
      Some ETSI countries have a small overlap in the wireless-regdb with an ETSI
      channel (5590-5650). A good example is Australia:
      
        country AU: DFS-ETSI
        	(2400 - 2483.5 @ 40), (36)
        	(5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW
        	(5250 - 5350 @ 80), (20), NO-OUTDOOR, AUTO-BW, DFS
        	(5470 - 5600 @ 80), (27), DFS
        	(5650 - 5730 @ 80), (27), DFS
        	(5730 - 5850 @ 80), (36)
        	(57000 - 66000 @ 2160), (43), NO-OUTDOOR
      
      If the firmware (or the BDF) is shipped with these rules then there is only
      a 10 MHz overlap with the weather radar:
      
      * below: 5470 - 5590
      * weather radar: 5590 - 5600
      * above: (none for the rule "5470 - 5600 @ 80")
      
      There are several wrong assumption in the ath11k code:
      
      * there is always a valid range below the weather radar
        (actually: there could be no range below the weather radar range OR range
         could be smaller than 20 MHz)
      * intersected range in the weather radar range is valid
        (actually: the range could be smaller than 20 MHz)
      * range above weather radar is either empty or valid
        (actually: the range could be smaller than 20 MHz)
      
      These wrong assumption will lead in this example to a rule
      
        (5590 - 5600 @ 20), (N/A, 27), (600000 ms), DFS, AUTO-BW
      
      which is invalid according to is_valid_reg_rule() because the freq_diff is
      only 10 MHz but the max_bandwidth is set to 20 MHz. Which results in a
      rejection like:
      
        WARNING: at backports-20210222_001-4.4.60-b157d2276/net/wireless/reg.c:3984
        [...]
        Call trace:
        [<ffffffbffc3d2e50>] reg_get_max_bandwidth+0x300/0x3a8 [cfg80211]
        [<ffffffbffc3d3d0c>] regulatory_set_wiphy_regd_sync+0x3c/0x98 [cfg80211]
        [<ffffffbffc651598>] ath11k_regd_update+0x1a8/0x210 [ath11k]
        [<ffffffbffc652108>] ath11k_regd_update_work+0x18/0x20 [ath11k]
        [<ffffffc0000a93e0>] process_one_work+0x1f8/0x340
        [<ffffffc0000a9784>] worker_thread+0x25c/0x448
        [<ffffffc0000aedc8>] kthread+0xd0/0xd8
        [<ffffffc000085550>] ret_from_fork+0x10/0x40
        ath11k c000000.wifi: failed to perform regd update : -22
        Invalid regulatory domain detected
      
      To avoid this, the algorithm has to be changed slightly. Instead of
      splitting a rule which overlaps with the weather radar range into 3 pieces
      and accepting the first two parts blindly, it must actually be checked for
      each piece whether it is a valid range. And only if it is valid, add it to
      the output array.
      
      When these checks are in place, the processed rules for AU would end up as
      
        country AU: DFS-ETSI
                (2400 - 2483 @ 40), (N/A, 36), (N/A)
                (5150 - 5250 @ 80), (6, 23), (N/A), NO-OUTDOOR, AUTO-BW
                (5250 - 5350 @ 80), (6, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
                (5470 - 5590 @ 80), (6, 27), (0 ms), DFS, AUTO-BW
                (5650 - 5730 @ 80), (6, 27), (0 ms), DFS, AUTO-BW
                (5730 - 5850 @ 80), (6, 36), (N/A), AUTO-BW
      
      and will be accepted by the wireless regulatory code.
      
      Fixes: d5c65159 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20211112153116.1214421-1-sven@narfation.org
      086c921a
  2. 15 Nov, 2021 25 commits
  3. 12 Nov, 2021 3 commits
  4. 10 Nov, 2021 2 commits
  5. 08 Nov, 2021 5 commits
  6. 01 Nov, 2021 4 commits
    • Yang Guang's avatar
      22f9ba7f
    • Bryan O'Donoghue's avatar
      wcn36xx: Indicate beacon not connection loss on MISSED_BEACON_IND · 588b45c8
      Bryan O'Donoghue authored
      Firmware can trigger a missed beacon indication, this is not the same as a
      lost signal.
      
      Flag to Linux the missed beacon and let the WiFi stack decide for itself if
      the link is up or down by sending its own probe to determine this.
      
      We should only be signalling the link is lost when the firmware indicates
      
      Fixes: 8e84c258 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20211027232529.657764-1-bryan.odonoghue@linaro.org
      588b45c8
    • Benjamin Li's avatar
      wcn36xx: ensure pairing of init_scan/finish_scan and start_scan/end_scan · 8f1ba8b0
      Benjamin Li authored
      An SMD capture from the downstream prima driver on WCN3680B shows the
      following command sequence for connected scans:
      
      - init_scan_req
          - start_scan_req, channel 1
          - end_scan_req, channel 1
          - start_scan_req, channel 2
          - ...
          - end_scan_req, channel 3
      - finish_scan_req
      - init_scan_req
          - start_scan_req, channel 4
          - ...
          - end_scan_req, channel 6
      - finish_scan_req
      - ...
          - end_scan_req, channel 165
      - finish_scan_req
      
      Upstream currently never calls wcn36xx_smd_end_scan, and in some cases[1]
      still sends finish_scan_req twice in a row or before init_scan_req. A
      typical connected scan looks like this:
      
      - init_scan_req
          - start_scan_req, channel 1
      - finish_scan_req
      - init_scan_req
          - start_scan_req, channel 2
      - ...
          - start_scan_req, channel 165
      - finish_scan_req
      - finish_scan_req
      
      This patch cleans up scanning so that init/finish and start/end are always
      paired together and correctly nested.
      
      - init_scan_req
          - start_scan_req, channel 1
          - end_scan_req, channel 1
      - finish_scan_req
      - init_scan_req
          - start_scan_req, channel 2
          - end_scan_req, channel 2
      - ...
          - start_scan_req, channel 165
          - end_scan_req, channel 165
      - finish_scan_req
      
      Note that upstream will not do batching of 3 active-probe scans before
      returning to the operating channel, and this patch does not change that.
      To match downstream in this aspect, adjust IEEE80211_PROBE_DELAY and/or
      the 125ms max off-channel time in ieee80211_scan_state_decision.
      
      [1]: commit d195d7aa ("wcn36xx: Ensure finish scan is not requested
      before start scan") addressed one case of finish_scan_req being sent
      without a preceding init_scan_req (the case of the operating channel
      coinciding with the first scan channel); two other cases are:
      1) if SW scan is started and aborted immediately, without scanning any
         channels, we send a finish_scan_req without ever sending init_scan_req,
         and
      2) as SW scan logic always returns us to the operating channel before
         calling wcn36xx_sw_scan_complete, finish_scan_req is always sent twice
         at the end of a SW scan
      
      Fixes: 8e84c258 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
      Signed-off-by: default avatarBenjamin Li <benl@squareup.com>
      Tested-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20211027170306.555535-4-benl@squareup.com
      8f1ba8b0
    • Benjamin Li's avatar
      wcn36xx: implement flush op to speed up connected scan · f02e1cc2
      Benjamin Li authored
      Without ieee80211_ops->flush implemented to empty HW queues, mac80211 will
      do a 100ms dead wait after stopping SW queues, before leaving the operating
      channel to resume a software connected scan[1].
      (see ieee80211_scan_state_resume)
      
      This wait is correctly included in the calculation for whether or not
      we've exceeded max off-channel time, as it occurs after sending the null
      frame with PS bit set. Thus, with 125 ms max off-channel time we only
      have 25 ms of scan time, which technically isn't even enough to scan one
      channel (although mac80211 always scans at least one channel per off-
      channel window).
      
      Moreover, for passive probes we end up spending at least 100 ms + 111 ms
      (IEEE80211_PASSIVE_CHANNEL_TIME) "off-channel"[2], which exceeds the listen
      interval of 200 ms that we provide in our association request frame. That's
      technically out-of-spec.
      
      [1]: Until recently, wcn36xx performed software (rather than FW-offloaded)
      scanning when 5GHz channels are requested. This apparent limitation is now
      resolved -- see commit 1395f8a6a4d5 ("wcn36xx: Enable hardware scan offload
      for 5Ghz band").
      [2]: in quotes because about 100 ms of it is still on-channel but with PS
      set
      Signed-off-by: default avatarBenjamin Li <benl@squareup.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20211027170306.555535-3-benl@squareup.com
      f02e1cc2