]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath12k: Add num_stations counter for each interface
authorAditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Mon, 30 Jun 2025 04:45:31 +0000 (10:15 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Mon, 7 Jul 2025 22:34:49 +0000 (15:34 -0700)
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@oss.qualcomm.com>
Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250630044531.3490058-1-quic_rdevanat@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/mac.c

index 295609d849b81d5a8c058be6278777821e4b3d08..afc8329980c8cc9a684787c2121c74d5e1146d39 100644 (file)
@@ -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 {
index 50a474f8bc2265ce9d2538c5f45b6f9c8f41416d..42eb9e8e14d1361c7bf0148467b78d65128496a6 100644 (file)
@@ -3858,6 +3858,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;
                arvif->bitrate_mask.control[i].gi = NL80211_TXRATE_DEFAULT_GI;
@@ -6168,6 +6170,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;
 }
@@ -6184,6 +6191,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,