[PATCH ath-next] wifi: ath12k: Add num_stations counter for each interface
Roopni Devanathan
quic_rdevanat at quicinc.com
Sun Jun 29 21:45:31 PDT 2025
From: Aditya Kumar Singh <aditya.kumar.singh at oss.qualcomm.com>
Currently, ath12k driver maintains a counter to store the number of
stations connected to each radio. However, at certain times like
debugging, it is useful to know number of stations connected to any
one of the interface in that radio.
Add support to maintain a counter for number of stations connected to
each interface.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh at oss.qualcomm.com>
Signed-off-by: Roopni Devanathan <quic_rdevanat at quicinc.com>
---
drivers/net/wireless/ath/ath12k/core.h | 1 +
drivers/net/wireless/ath/ath12k/mac.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 3c10d7eb9669..20fe10eea507 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -349,6 +349,7 @@ struct ath12k_link_vif {
bool group_key_valid;
struct wmi_vdev_install_key_arg group_key;
bool pairwise_key_done;
+ u16 num_stations;
};
struct ath12k_vif {
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 71e07c546a2d..0f3ccefbee00 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -3455,6 +3455,8 @@ static void ath12k_mac_init_arvif(struct ath12k_vif *ahvif,
INIT_DELAYED_WORK(&arvif->connection_loss_work,
ath12k_mac_vif_sta_connection_loss_work);
+ arvif->num_stations = 0;
+
for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) {
arvif->bitrate_mask.control[i].legacy = 0xffffffff;
memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff,
@@ -5660,6 +5662,11 @@ static int ath12k_mac_inc_num_stations(struct ath12k_link_vif *arvif,
return -ENOBUFS;
ar->num_stations++;
+ arvif->num_stations++;
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "mac station %pM connected to vdev %u num_stations %u\n",
+ arsta->addr, arvif->vdev_id, arvif->num_stations);
return 0;
}
@@ -5676,6 +5683,17 @@ static void ath12k_mac_dec_num_stations(struct ath12k_link_vif *arvif,
return;
ar->num_stations--;
+
+ if (arvif->num_stations) {
+ arvif->num_stations--;
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "mac station %pM disconnected from vdev %u num_stations %u\n",
+ arsta->addr, arvif->vdev_id, arvif->num_stations);
+ } else {
+ ath12k_warn(ar->ab,
+ "mac station %pM disconnect for vdev %u without any connected station\n",
+ arsta->addr, arvif->vdev_id);
+ }
}
static void ath12k_mac_station_post_remove(struct ath12k *ar,
base-commit: 391a83d0c8ebb1e476cba73bf4c010af73993111
--
2.25.1
More information about the ath12k
mailing list