diff --git a/package/kernel/mac80211/patches/ath11k/0227-wifi-ath11k-add-support-to-configure-channel-dwell-time.patch b/package/kernel/mac80211/patches/ath11k/0227-wifi-ath11k-add-support-to-configure-channel-dwell-time.patch new file mode 100644 index 000000000..12c87b7ea --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0227-wifi-ath11k-add-support-to-configure-channel-dwell-time.patch @@ -0,0 +1,102 @@ +From c362daa213cdeb0a9e7c2ed84849544c24505720 Mon Sep 17 00:00:00 2001 +From: Manikanta Pubbisetty +Date: Fri, 7 Oct 2022 10:41:30 +0530 +Subject: [PATCH] wifi: ath11k: add support to configure channel dwell time + +Add support to configure channel dwell time during scan. +Dwell time help to stay on the channel for a specified duration +during scan and aid userspace in finding WiFi networks. Very +useful in passive scans where longer dwell times are needed +to find the WiFi networks. + +Configure channel dwell time from duration of the scan request +received from mac80211 when the duration is non-zero. When the +scan request does not have duration value, use the default ones, +the current implementation. + +Advertise corresponding feature flag NL80211_EXT_FEATURE_SET_SCAN_DWELL +to enable the feature. + +Change is applicable for all ath11k hardware. + +Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 + +Signed-off-by: Manikanta Pubbisetty +Reviewed-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20221007051130.6067-1-quic_mpubbise@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 33 +++++++++++++++++++++++---- + 1 file changed, 29 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -241,7 +241,10 @@ const struct htt_rx_ring_tlv_filter ath1 + #define ath11k_a_rates (ath11k_legacy_rates + 4) + #define ath11k_a_rates_size (ARRAY_SIZE(ath11k_legacy_rates) - 4) + +-#define ATH11K_MAC_SCAN_TIMEOUT_MSECS 200 /* in msecs */ ++#define ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD 200 /* in msecs */ ++ ++/* Overhead due to the processing of channel switch events from FW */ ++#define ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD 10 /* in msecs */ + + static const u32 ath11k_smps_map[] = { + [WLAN_HT_CAP_SM_PS_STATIC] = WMI_PEER_SMPS_STATIC, +@@ -3597,6 +3600,7 @@ static int ath11k_mac_op_hw_scan(struct + struct scan_req_params arg; + int ret = 0; + int i; ++ u32 scan_timeout; + + mutex_lock(&ar->conf_mutex); + +@@ -3666,6 +3670,26 @@ static int ath11k_mac_op_hw_scan(struct + ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); + } + ++ /* if duration is set, default dwell times will be overwritten */ ++ if (req->duration) { ++ arg.dwell_time_active = req->duration; ++ arg.dwell_time_active_2g = req->duration; ++ arg.dwell_time_active_6g = req->duration; ++ arg.dwell_time_passive = req->duration; ++ arg.dwell_time_passive_6g = req->duration; ++ arg.burst_duration = req->duration; ++ ++ scan_timeout = min_t(u32, arg.max_rest_time * ++ (arg.num_chan - 1) + (req->duration + ++ ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * ++ arg.num_chan, arg.max_scan_time); ++ } else { ++ scan_timeout = arg.max_scan_time; ++ } ++ ++ /* Add a margin to account for event/command processing */ ++ scan_timeout += ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD; ++ + ret = ath11k_start_scan(ar, &arg); + if (ret) { + ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); +@@ -3674,10 +3698,8 @@ static int ath11k_mac_op_hw_scan(struct + spin_unlock_bh(&ar->data_lock); + } + +- /* Add a 200ms margin to account for event/command processing */ + ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, +- msecs_to_jiffies(arg.max_scan_time + +- ATH11K_MAC_SCAN_TIMEOUT_MSECS)); ++ msecs_to_jiffies(scan_timeout)); + + exit: + kfree(arg.chan_list); +@@ -8738,6 +8760,9 @@ static int __ath11k_mac_register(struct + NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP); + } + ++ wiphy_ext_feature_set(ar->hw->wiphy, ++ NL80211_EXT_FEATURE_SET_SCAN_DWELL); ++ + ath11k_reg_init(ar); + + if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { diff --git a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch b/package/kernel/mac80211/patches/ath11k/0228-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch rename to package/kernel/mac80211/patches/ath11k/0228-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch index 50c14e7b9..2b34171b6 100644 --- a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch +++ b/package/kernel/mac80211/patches/ath11k/0228-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch @@ -23,7 +23,7 @@ Link: https://lore.kernel.org/r/20221205192125.13533-1-quic_kathirve@quicinc.com --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3612,7 +3612,7 @@ static int ath11k_mac_op_hw_scan(struct +@@ -3597,7 +3597,7 @@ static int ath11k_mac_op_hw_scan(struct struct ath11k *ar = hw->priv; struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); struct cfg80211_scan_request *req = &hw_req->req; @@ -32,7 +32,7 @@ Link: https://lore.kernel.org/r/20221205192125.13533-1-quic_kathirve@quicinc.com int ret = 0; int i; u32 scan_timeout; -@@ -3640,72 +3640,78 @@ static int ath11k_mac_op_hw_scan(struct +@@ -3625,72 +3625,78 @@ static int ath11k_mac_op_hw_scan(struct if (ret) goto exit; @@ -143,7 +143,7 @@ Link: https://lore.kernel.org/r/20221205192125.13533-1-quic_kathirve@quicinc.com if (ret) { ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); spin_lock_bh(&ar->data_lock); -@@ -3717,10 +3723,11 @@ static int ath11k_mac_op_hw_scan(struct +@@ -3702,10 +3708,11 @@ static int ath11k_mac_op_hw_scan(struct msecs_to_jiffies(scan_timeout)); exit: diff --git a/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-fix-monitor-mode-bringup-crash.patch b/package/kernel/mac80211/patches/ath11k/0229-wifi-ath11k-fix-monitor-mode-bringup-crash.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-fix-monitor-mode-bringup-crash.patch rename to package/kernel/mac80211/patches/ath11k/0229-wifi-ath11k-fix-monitor-mode-bringup-crash.patch index 62397de72..ec1090473 100644 --- a/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-fix-monitor-mode-bringup-crash.patch +++ b/package/kernel/mac80211/patches/ath11k/0229-wifi-ath11k-fix-monitor-mode-bringup-crash.patch @@ -69,7 +69,7 @@ Link: https://lore.kernel.org/r/20221129142532.23421-1-quic_nmaran@quicinc.com --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -5022,6 +5022,7 @@ static int ath11k_dp_rx_mon_deliver(stru +@@ -5018,6 +5018,7 @@ static int ath11k_dp_rx_mon_deliver(stru } else { rxs->flag |= RX_FLAG_ALLOW_SAME_PN; }