wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/773-001-ath12k-add-num_stations-counter-for-each-interface.patch
John Crispin 144c5d00f4 ipq95xx/mac80211: update to ATH12.3-CS
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

85 lines
2.5 KiB
Diff

From b19575e3cbc749aab98192a45be084f8cce52888 Mon Sep 17 00:00:00 2001
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
Date: Thu, 11 May 2023 10:18:23 +0530
Subject: [PATCH] ath12k: add num_stations counter for each interface
Currently ath12k maintains number of stations connected to each radio.
However, at certain times it is useful to know number of stations
connected to any one of the interface under that radio.
Add support to maintain a counter for number of stations connected to
each interface.
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
drivers/net/wireless/ath/ath12k/core.h | 1 +
drivers/net/wireless/ath/ath12k/mac.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -408,6 +408,7 @@ struct ath12k_link_vif {
bool mvr_processing;
bool pending_csa_up;
+ int num_stations;
};
struct ath12k_vif {
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -4877,6 +4877,7 @@ ath12k_mac_assign_link_vif( struct ath12
ath12k_update_obss_color_notify_work);
INIT_WORK(&arvif->update_bcn_template_work,
ath12k_update_bcn_template_work);
+ arvif->num_stations = 0;
}
}
@@ -6157,6 +6158,15 @@ static int ath12k_station_assoc(struct a
}
}
+ spin_lock_bh(&ar->data_lock);
+
+ 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);
+
+ spin_unlock_bh(&ar->data_lock);
+
return 0;
}
@@ -6175,6 +6185,21 @@ static int ath12k_station_disassoc(struc
sta = container_of((void *)ahsta, struct ieee80211_sta, drv_priv);
+ spin_lock_bh(&arvif->ar->data_lock);
+
+ if (!arvif->num_stations) {
+ ath12k_warn(ar->ab,
+ "mac station disassoc for vdev %u which does not have any station connected\n",
+ arvif->vdev_id);
+ } else {
+ 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);
+ }
+
+ spin_unlock_bh(&arvif->ar->data_lock);
+
if (!sta->wme) {
arvif->num_legacy_stations--;
ret = ath12k_recalc_rtscts_prot(arvif);
@@ -10002,6 +10027,7 @@ static int ath12k_mac_op_add_interface(s
ath12k_update_obss_color_notify_work);
INIT_WORK(&ahvif->deflink.update_bcn_template_work,
ath12k_update_bcn_template_work);
+ ahvif->deflink.num_stations = 0;
ahvif->key_cipher = INVALID_CIPHER;