0049-wifi-ath11k-Optimize-6-GHz-scan-time.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. From 8b4d2f080afbd4280ecca0f4b3ceea943a7a86d0 Mon Sep 17 00:00:00 2001
  2. From: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
  3. Date: Thu, 23 Mar 2023 11:39:13 +0530
  4. Subject: [PATCH] wifi: ath11k: Optimize 6 GHz scan time
  5. Currently, time taken to scan all supported channels on WCN6750
  6. is ~8 seconds and connection time is almost 10 seconds. WCN6750
  7. supports three Wi-Fi bands (i.e., 2.4/5/6 GHz) and the numbers of
  8. channels for scan come around ~100 channels (default case).
  9. Since the chip doesn't have support for DBS (Dual Band Simultaneous),
  10. scans cannot be parallelized resulting in longer scan times.
  11. Among the 100 odd channels, ~60 channels are in 6 GHz band. Therefore,
  12. optimizing the scan for 6 GHz channels will bring down the overall
  13. scan time.
  14. WCN6750 firmware has support to scan a 6 GHz channel based on co-located
  15. AP information i.e., RNR IE which is found in the legacy 2.4/5 GHz scan
  16. results. When a scan request with all supported channel list is enqueued
  17. to the firmware, then based on WMI_SCAN_CHAN_FLAG_SCAN_ONLY_IF_RNR_FOUND
  18. scan channel flag, firmware will scan only those 6 GHz channels for which
  19. RNR IEs are found in the legacy scan results.
  20. In the proposed design, based on NL80211_SCAN_FLAG_COLOCATED_6GHZ scan
  21. flag, driver will set the WMI_SCAN_CHAN_FLAG_SCAN_ONLY_IF_RNR_FOUND flag
  22. for non-PSC channels. Since there is high probability to find 6 GHz APs
  23. on PSC channels, these channels are always scanned. Only non-PSC channels
  24. are selectively scanned based on cached RNR information from the legacy
  25. scan results.
  26. If NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set in the scan flags,
  27. then scan will happen on all supported channels (default behavior).
  28. With these optimizations, scan time is improved by 1.5-1.8 seconds on
  29. WCN6750. Similar savings have been observed on WCN6855.
  30. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
  31. Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.16
  32. Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
  33. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  34. Link: https://lore.kernel.org/r/20230323060913.10097-1-quic_mpubbise@quicinc.com
  35. ---
  36. drivers/net/wireless/ath/ath11k/mac.c | 25 +++++++++++++++++++++++--
  37. drivers/net/wireless/ath/ath11k/wmi.h | 4 ++++
  38. 2 files changed, 27 insertions(+), 2 deletions(-)
  39. --- a/drivers/net/wireless/ath/ath11k/mac.c
  40. +++ b/drivers/net/wireless/ath/ath11k/mac.c
  41. @@ -3819,8 +3819,29 @@ static int ath11k_mac_op_hw_scan(struct
  42. goto exit;
  43. }
  44. - for (i = 0; i < arg->num_chan; i++)
  45. - arg->chan_list[i] = req->channels[i]->center_freq;
  46. + for (i = 0; i < arg->num_chan; i++) {
  47. + if (test_bit(WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL,
  48. + ar->ab->wmi_ab.svc_map)) {
  49. + arg->chan_list[i] =
  50. + u32_encode_bits(req->channels[i]->center_freq,
  51. + WMI_SCAN_CONFIG_PER_CHANNEL_MASK);
  52. +
  53. + /* If NL80211_SCAN_FLAG_COLOCATED_6GHZ is set in scan
  54. + * flags, then scan all PSC channels in 6 GHz band and
  55. + * those non-PSC channels where RNR IE is found during
  56. + * the legacy 2.4/5 GHz scan.
  57. + * If NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set,
  58. + * then all channels in 6 GHz will be scanned.
  59. + */
  60. + if (req->channels[i]->band == NL80211_BAND_6GHZ &&
  61. + req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ &&
  62. + !cfg80211_channel_is_psc(req->channels[i]))
  63. + arg->chan_list[i] |=
  64. + WMI_SCAN_CH_FLAG_SCAN_ONLY_IF_RNR_FOUND;
  65. + } else {
  66. + arg->chan_list[i] = req->channels[i]->center_freq;
  67. + }
  68. + }
  69. }
  70. if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
  71. --- a/drivers/net/wireless/ath/ath11k/wmi.h
  72. +++ b/drivers/net/wireless/ath/ath11k/wmi.h
  73. @@ -2100,6 +2100,7 @@ enum wmi_tlv_service {
  74. /* The second 128 bits */
  75. WMI_MAX_EXT_SERVICE = 256,
  76. + WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL = 265,
  77. WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281,
  78. WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326,
  79. @@ -3249,6 +3250,9 @@ struct wmi_start_scan_cmd {
  80. #define WMI_SCAN_DWELL_MODE_SHIFT 21
  81. #define WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE 0x00000800
  82. +#define WMI_SCAN_CONFIG_PER_CHANNEL_MASK GENMASK(19, 0)
  83. +#define WMI_SCAN_CH_FLAG_SCAN_ONLY_IF_RNR_FOUND BIT(20)
  84. +
  85. enum {
  86. WMI_SCAN_DWELL_MODE_DEFAULT = 0,
  87. WMI_SCAN_DWELL_MODE_CONSERVATIVE = 1,