[PATCH v5 2/3] wifi: ath12k: properly handling the state variables of monitor mode
Kang Yang
quic_kangyang at quicinc.com
Thu Jan 2 22:20:40 PST 2025
Now monitor mode has some status variables, such as monitor_started,
monitor_vdev_created. They are not always handled correctly.
For monitor_started, it should be true when driver works in monitor
mode, and should be false at other times.
For monitor_vdev_id, it should be -1 when driver doesn't work in monitor
mode.
For monitor_vdev_created, it should be true after monitor vdev is
created successfully and should be false at other times.
For monitor_conf_enabled, it should be true when mac80211 sets
IEEE80211_CONF_MONITOR, and should be false at other times.
Handle those state variables according to above descriptions.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Signed-off-by: Kang Yang <quic_kangyang at quicinc.com>
---
drivers/net/wireless/ath/ath12k/core.c | 5 +++++
drivers/net/wireless/ath/ath12k/mac.c | 11 +++++++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index 0c6b35aac96e..cf471acb75e1 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -1261,6 +1261,11 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab)
ath12k_mac_tx_mgmt_pending_free, ar);
idr_destroy(&ar->txmgmt_idr);
wake_up(&ar->txmgmt_empty_waitq);
+
+ ar->monitor_vdev_id = -1;
+ ar->monitor_started = false;
+ ar->monitor_vdev_created = false;
+ ar->monitor_conf_enabled = false;
}
}
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 6f10813d9378..8b99d01b32e6 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -7947,6 +7947,9 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
goto err_peer_del;
}
break;
+ case WMI_VDEV_TYPE_MONITOR:
+ ar->monitor_vdev_created = true;
+ break;
default:
break;
}
@@ -7993,6 +7996,10 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
err_vdev_del:
ath12k_wmi_vdev_delete(ar, arvif->vdev_id);
+ if (ahvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
+ ar->monitor_vdev_created = false;
+ ar->monitor_vdev_id = -1;
+ }
ar->num_created_vdevs--;
arvif->is_created = false;
arvif->ar = NULL;
@@ -11057,6 +11064,10 @@ static void ath12k_mac_setup(struct ath12k *ar)
ar->num_tx_chains = hweight32(pdev->cap.tx_chain_mask);
ar->num_rx_chains = hweight32(pdev->cap.rx_chain_mask);
ar->scan.arvif = NULL;
+ ar->monitor_vdev_id = -1;
+ ar->monitor_started = false;
+ ar->monitor_vdev_created = false;
+ ar->monitor_conf_enabled = false;
spin_lock_init(&ar->data_lock);
INIT_LIST_HEAD(&ar->arvifs);
--
2.34.1
More information about the ath12k
mailing list