wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/695-ath12k-monitor-vdev-create-validation.patch
John Crispin b9b03a6e38 ipq95xx: add Qualcomm wifi-7 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00

65 lines
2.1 KiB
Diff

From 2578f59ab616a5a8aad89af0e3338e816c32d60d Mon Sep 17 00:00:00 2001
From: Ramya Gnanasekar <quic_rgnanase@quicinc.com>
Date: Tue, 22 Nov 2022 16:08:16 +0530
Subject: [PATCH] ath12k: monitor vdev create validation
When monitor vif is created through add interface,
monitor flags has to be updated.
Without this validation, monitor vdev is created again
in ath12k_mac_op_assign_vif_chanctx() in race condition.
Signed-off-by: Ramya Gnanasekar <quic_rgnanase@quicinc.com>
Index: b/drivers/net/wireless/ath/ath12k/mac.c
===================================================================
--- a/drivers/net/wireless/ath/ath12k/mac.c 2022-11-23 12:06:58.538536996 +0530
+++ b/drivers/net/wireless/ath/ath12k/mac.c 2022-11-23 12:41:00.759804423 +0530
@@ -7685,6 +7685,7 @@ static int ath12k_mac_op_add_interface(s
struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
struct ath12k_hw *ah = hw->priv;
int i;
+ struct ath12k *ar;
/* The ar in which this vif will be assigned can be determined since
* it depends on the channel in which the vif is brought up.
@@ -7700,6 +7701,17 @@ static int ath12k_mac_op_add_interface(s
arvif->vdev_type = vif->type;
arvif->vif = vif;
+ ar = ah->radio;
+
+ /* WAR :
+ * Monitor flag is set for first radio from hw_group.
+ */
+ if (ar && vif->type == NL80211_IFTYPE_MONITOR) {
+ mutex_lock(&ar->conf_mutex);
+ set_bit(MONITOR_VDEV_CREATED, &ar->monitor_flags);
+ mutex_unlock(&ar->conf_mutex);
+ }
+
INIT_LIST_HEAD(&arvif->list);
arvif->key_cipher = INVALID_CIPHER;
@@ -7728,6 +7740,9 @@ static int ath12k_mac_op_add_interface(s
vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
mutex_unlock(&ah->conf_mutex);
+
+ ath12k_dbg(NULL, ATH12K_DBG_MAC, "mac add interface (vdev %d), type: %d",
+ arvif->vdev_id, arvif->vdev_type);
return 0;
}
@@ -7783,6 +7798,10 @@ static void ath12k_mac_op_remove_interfa
mutex_lock(&ar->conf_mutex);
+ if ((vif->type == NL80211_IFTYPE_MONITOR) &&
+ (test_bit(MONITOR_VDEV_CREATED, &ar->monitor_flags)))
+ clear_bit(MONITOR_VDEV_CREATED, &ar->monitor_flags);
+
ath12k_dbg(ab, ATH12K_DBG_MAC, "mac remove interface (vdev %d)\n",
arvif->vdev_id);