]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: Refactor the monitor channel context procedure
authorKarthikeyan Periyasamy <quic_periyasa@quicinc.com>
Mon, 24 Mar 2025 06:25:16 +0000 (11:55 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Thu, 27 Mar 2025 22:55:42 +0000 (15:55 -0700)
Currently, the monitor start procedure use the iteration callback to pick
the last available channel definition in the mac80211 hardware. This
approach is incorrect for the single wiphy model, as it holds multiple
radio/link channel contexts within the same mac80211 hardware. To fix this,
change the iteration callback to pick the specific channel context for the
given radio/link. This approach makes the monitor start procedure
compatible with both multi wiphy and single wiphy models.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Link: https://patch.msgid.link/20250324062518.2752822-9-quic_periyasa@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/mac.c

index d4fb776767a941854e6f8d1b8cd5a058018c0dd0..a5ed74428f230d77873b33d60dd1b8d84e10f830 100644 (file)
@@ -1336,19 +1336,9 @@ static int ath12k_mac_monitor_vdev_delete(struct ath12k *ar)
        return ret;
 }
 
-static void
-ath12k_mac_get_any_chandef_iter(struct ieee80211_hw *hw,
-                               struct ieee80211_chanctx_conf *conf,
-                               void *data)
-{
-       struct cfg80211_chan_def **def = data;
-
-       *def = &conf->def;
-}
-
 static int ath12k_mac_monitor_start(struct ath12k *ar)
 {
-       struct cfg80211_chan_def *chandef = NULL;
+       struct ath12k_mac_get_any_chanctx_conf_arg arg;
        int ret;
 
        lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
@@ -1356,13 +1346,16 @@ static int ath12k_mac_monitor_start(struct ath12k *ar)
        if (ar->monitor_started)
                return 0;
 
+       arg.ar = ar;
+       arg.chanctx_conf = NULL;
        ieee80211_iter_chan_contexts_atomic(ath12k_ar_to_hw(ar),
-                                           ath12k_mac_get_any_chandef_iter,
-                                           &chandef);
-       if (!chandef)
+                                           ath12k_mac_get_any_chanctx_conf_iter,
+                                           &arg);
+       if (!arg.chanctx_conf)
                return 0;
 
-       ret = ath12k_mac_monitor_vdev_start(ar, ar->monitor_vdev_id, chandef);
+       ret = ath12k_mac_monitor_vdev_start(ar, ar->monitor_vdev_id,
+                                           &arg.chanctx_conf->def);
        if (ret) {
                ath12k_warn(ar->ab, "failed to start monitor vdev: %d\n", ret);
                ath12k_mac_monitor_vdev_delete(ar);