Skip to contentSkip to conversation

ath10k: Fix 10.4 extended peer stats update

PATCH In review Mohammed Shafi Shajakhan 3 participants 7 messages Jun 2, 2016 – Jul 8, 2016 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ath10k: Fix 10.4 extended peer stats update

From: Mohammed Shafi Shajakhan <[email protected]>

10.4 'extended peer stats' will be not be appended with normal peer stats data and they shall be coming in separate chunks. Fix this by maintaining a separate linked list 'extender peer stats' for 10.4 and update rx_duration for per station statistics. Also parse through beacon filter (if enabled), to make sure we parse the extended peer stats properly. This issue was exposed when more than one client is connected and extended peer stats for 10.4 is enabled

The order for the stats is as below
S - standard peer stats, E- extended peer stats, B - beacon filter stats

{S1, S2, S3..} -> {B1, B2, B3..}(if available) -> {E1, E2, E3..}

Fixes f9575793d44c ("ath10k: enable parsing per station rx duration for 10.4")

---
[v1: addressed line wrap around comment from Kalle]
[v2: fixed ; in dummy inline function definition - thanks Sven Eckelmann]
[v3: removed wmi-op-version suggested by Kalle, introduced fw specifi hw param for extd_stats]

 drivers/net/wireless/ath/ath10k/core.c        |    3 ++
 drivers/net/wireless/ath/ath10k/core.h        |    9 +++++
 drivers/net/wireless/ath/ath10k/debug.c       |   18 ++++++++-
 drivers/net/wireless/ath/ath10k/debug.h       |    8 ++--
 drivers/net/wireless/ath/ath10k/debugfs_sta.c |   32 ++++++++++++++-
 drivers/net/wireless/ath/ath10k/wmi.c         |   53 ++++++++++++++++++-------
 drivers/net/wireless/ath/ath10k/wmi.h         |   14 ++++++-
 7 files changed, 117 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +3 -0
index 9ccb69c..bfa96ac 100644
@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
 			.board_size = QCA99X0_BOARD_DATA_SZ,
 			.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 	{
@@ -203,6 +204,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA9984_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA99X0_BOARD_DATA_SZ,
 			.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 	{
@@ -261,6 +263,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA4019_BOARD_DATA_SZ,
 			.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 };
drivers/net/wireless/ath/ath10k/core.h +9 -0
index bbc4e0f..da9b2a9 100644
@@ -165,6 +165,13 @@ struct ath10k_fw_stats_peer {
 	u32 rx_duration;
 };
 
+struct ath10k_fw_extd_stats_peer {
+	struct list_head list;
+
+	u8 peer_macaddr[ETH_ALEN];
+	u32 rx_duration;
+};
+
 struct ath10k_fw_stats_vdev {
 	struct list_head list;
 
@@ -259,6 +266,7 @@ struct ath10k_fw_stats {
 	struct list_head pdevs;
 	struct list_head vdevs;
 	struct list_head peers;
+	struct list_head peers_extd;
 };
 
 #define ATH10K_TPC_TABLE_TYPE_FLAG	1
@@ -752,6 +760,7 @@ struct ath10k {
 			const char *board;
 			size_t board_size;
 			size_t board_ext_size;
+			bool extd_peer_stats;
 		} fw;
 	} hw_params;
 
drivers/net/wireless/ath/ath10k/debug.c +17 -1
index 8fbb8f2..001c0a1 100644
@@ -313,6 +313,16 @@ static void ath10k_fw_stats_peers_free(struct list_head *head)
 	}
 }
 
+static void ath10k_fw_extd_stats_peers_free(struct list_head *head)
+{
+	struct ath10k_fw_extd_stats_peer *i, *tmp;
+
+	list_for_each_entry_safe(i, tmp, head, list) {
+		list_del(&i->list);
+		kfree(i);
+	}
+}
+
 static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 {
 	spin_lock_bh(&ar->data_lock);
@@ -320,6 +330,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 	ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs);
 	ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs);
 	ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers);
+	ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd);
 	spin_unlock_bh(&ar->data_lock);
 }
 
@@ -334,6 +345,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
 	INIT_LIST_HEAD(&stats.pdevs);
 	INIT_LIST_HEAD(&stats.vdevs);
 	INIT_LIST_HEAD(&stats.peers);
+	INIT_LIST_HEAD(&stats.peers_extd);
 
 	spin_lock_bh(&ar->data_lock);
 	ret = ath10k_wmi_pull_fw_stats(ar, skb, &stats);
@@ -354,7 +366,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
 	 *     delivered which is treated as end-of-data and is itself discarded
 	 */
 	if (ath10k_peer_stats_enabled(ar))
-		ath10k_sta_update_rx_duration(ar, &stats.peers);
+		ath10k_sta_update_rx_duration(ar, &stats);
 
 	if (ar->debug.fw_stats_done) {
 		if (!ath10k_peer_stats_enabled(ar))
@@ -396,6 +408,8 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
 
 		list_splice_tail_init(&stats.peers, &ar->debug.fw_stats.peers);
 		list_splice_tail_init(&stats.vdevs, &ar->debug.fw_stats.vdevs);
+		list_splice_tail_init(&stats.peers_extd,
+				      &ar->debug.fw_stats.peers_extd);
 	}
 
 	complete(&ar->debug.fw_stats_complete);
@@ -407,6 +421,7 @@ free:
 	ath10k_fw_stats_pdevs_free(&stats.pdevs);
 	ath10k_fw_stats_vdevs_free(&stats.vdevs);
 	ath10k_fw_stats_peers_free(&stats.peers);
+	ath10k_fw_extd_stats_peers_free(&stats.peers_extd);
 
 	spin_unlock_bh(&ar->data_lock);
 }
@@ -2330,6 +2345,7 @@ int ath10k_debug_create(struct ath10k *ar)
 	INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs);
 	INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs);
 	INIT_LIST_HEAD(&ar->debug.fw_stats.peers);
+	INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd);
 
 	return 0;
 }
drivers/net/wireless/ath/ath10k/debug.h +5 -3
index 75c89e3..dc549c4 100644
@@ -154,10 +154,12 @@ ath10k_debug_get_new_fw_crash_data(struct ath10k *ar)
 #ifdef CONFIG_MAC80211_DEBUGFS
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			    struct ieee80211_sta *sta, struct dentry *dir);
-void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *peer);
+void ath10k_sta_update_rx_duration(struct ath10k *ar,
+				   struct ath10k_fw_stats *stats);
 #else
-static inline void ath10k_sta_update_rx_duration(struct ath10k *ar,
-						 struct list_head *peer)
+static inline
+void ath10k_sta_update_rx_duration(struct ath10k *ar,
+				   struct ath10k_fw_stats *stats)
 {
 }
 #endif /* CONFIG_MAC80211_DEBUGFS */
drivers/net/wireless/ath/ath10k/debugfs_sta.c +31 -1
index 67ef75b..af3d49a 100644
@@ -18,7 +18,27 @@
 #include "wmi-ops.h"
 #include "debug.h"
 
-void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *head)
+static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar,
+						     struct list_head *head)
+{
+	struct ieee80211_sta *sta;
+	struct ath10k_fw_extd_stats_peer *peer;
+	struct ath10k_sta *arsta;
+
+	rcu_read_lock();
+	list_for_each_entry(peer, head, list) {
+		sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr,
+						   NULL);
+		if (!sta)
+			continue;
+		arsta = (struct ath10k_sta *)sta->drv_priv;
+		arsta->rx_duration += (u64)peer->rx_duration;
+	}
+	rcu_read_unlock();
+}
+
+static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar,
+						struct list_head *head)
 {	struct ieee80211_sta *sta;
 	struct ath10k_fw_stats_peer *peer;
 	struct ath10k_sta *arsta;
@@ -35,6 +55,16 @@ void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *head)
 	rcu_read_unlock();
 }
 
+void ath10k_sta_update_rx_duration(struct ath10k *ar,
+				   struct ath10k_fw_stats *stats)
+{
+	if (ar->hw_params.fw.extd_peer_stats)
+		ath10k_sta_update_stats_rx_duration(ar, &stats->peers);
+	else
+		ath10k_sta_update_extd_stats_rx_duration(ar,
+							 &stats->peers_extd);
+}
+
 static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file,
 					     char __user *user_buf,
 					     size_t count, loff_t *ppos)
drivers/net/wireless/ath/ath10k/wmi.c +39 -14

83 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/wmi.h +13 -1
index 90f594e..3ef4688 100644
@@ -4340,7 +4340,6 @@ struct wmi_10_4_peer_stats {
 } __packed;
 
 struct wmi_10_4_peer_extd_stats {
-	struct wmi_10_4_peer_stats common;
 	struct wmi_mac_addr peer_macaddr;
 	__le32 inactive_time;
 	__le32 peer_chain_rssi;
@@ -4348,6 +4347,19 @@ struct wmi_10_4_peer_extd_stats {
 	__le32 reserved[10];
 } __packed;
 
+struct wmi_10_4_bss_bcn_stats {
+	__le32 vdev_id;
+	__le32 bss_bcns_dropped;
+	__le32 bss_bcn_delivered;
+} __packed;
+
+struct wmi_10_4_bss_bcn_filter_stats {
+	__le32 bcns_dropped;
+	__le32 bcns_delivered;
+	__le32 active_filters;
+	struct wmi_10_4_bss_bcn_stats bss_stats;
+} __packed;
+
 struct wmi_10_2_pdev_ext_stats {
 	__le32 rx_rssi_comb;
 	__le32 rx_rssi[4];
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 13 lines · Mohammed Shafi Shajakhan

From: Mohammed Shafi Shajakhan <[email protected]>

10.4 'extended peer stats' will be not be appended with normal peer stats data and they shall be coming in separate chunks. Fix this by maintaining a separate linked list 'extender peer stats' for 10.4 and update rx_duration for per station statistics. Also parse through beacon filter (if enabled), to make sure we parse the extended peer stats properly. This issue was exposed when more than one client is connected and extended peer stats for 10.4 is enabled

The order for the stats is as below
S - standard peer stats, E- extended peer stats, B - beacon filter stats

Quoted 8 lines

{S1, S2, S3..} -> {B1, B2, B3..}(if available) -> {E1, E2, E3..}

Fixes f9575793d44c ("ath10k: enable parsing per station rx duration for 10.4")

---
[v1: addressed line wrap around comment from Kalle]
[v2: fixed ; in dummy inline function definition - thanks Sven Eckelmann]
[v3: removed wmi-op-version suggested by Kalle, introduced fw specifi hw param for extd_stats]

I was sure I replied to this, but I can't find my reply anywhere. So I guess I didn't, sorry about that.

Quoted 19 lines
drivers/net/wireless/ath/ath10k/core.c +2 -0
@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
 			.board_size = QCA99X0_BOARD_DATA_SZ,
 			.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 	{
@@ -203,6 +204,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA9984_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA99X0_BOARD_DATA_SZ,
 			.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 	{

drivers/net/wireless/ath/ath10k/core.c static const struct ath10k_hw_params ath10k_hw_params_list[] = { · line 269

Quoted 7 lines
drivers/net/wireless/ath/ath10k/core.c +1 -0
@@ -261,6 +263,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA4019_BOARD_DATA_SZ,
 			.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 };

This is not a hardware feature so hw_params is not really the right place to handle this. In the pending branch I tried to solve this a bit differently:

https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=ecf4daadc7677518ec7185dbddab959ac6e2db96

I added a bool "extended" to struct ath10k_fw_stats which is used to detect if extended stats are used. Would that work? Please note that I have only compile tested the patch.

Signature · 1 line
Kalle Valo
#2 lore raw
Quoted 13 lines · Kalle Valo

Review static const struct ath10k_hw_params ath10k_hw_params_list[] = { · line 269

Quoted 8 lines
(quoted diff) +1 -0
@@ -261,6 +263,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA4019_BOARD_DATA_SZ,
 			.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 };

This is not a hardware feature so hw_params is not really the right place to handle this. In the pending branch I tried to solve this a bit differently:

Quoted 5 lines

https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=ecf4daadc7677518ec7185dbddab959ac6e2db96

I added a bool "extended" to struct ath10k_fw_stats which is used to detect if extended stats are used. Would that work? Please note that I have only compile tested the patch.

Here's a diff of what I did:

drivers/net/wireless/ath/ath10k/core.c +0 -3
index 58932c09efc5..b734345ab598 100644
@@ -180,7 +180,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
 			.board_size = QCA99X0_BOARD_DATA_SZ,
 			.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
-			.extd_peer_stats = true,
 		},
 	},
 	{
@@ -203,7 +202,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA9984_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA99X0_BOARD_DATA_SZ,
 			.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
-			.extd_peer_stats = true,
 		},
 	},
 	{
@@ -261,7 +259,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA4019_BOARD_DATA_SZ,
 			.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
-			.extd_peer_stats = true,
 		},
 	},
 };
drivers/net/wireless/ath/ath10k/core.h +1 -1
index 73a0b1ae1559..3707d8a707a2 100644
@@ -263,6 +263,7 @@ struct ath10k_fw_stats_pdev {
 };
 
 struct ath10k_fw_stats {
+	bool extended;
 	struct list_head pdevs;
 	struct list_head vdevs;
 	struct list_head peers;
@@ -754,7 +755,6 @@ struct ath10k {
 			const char *board;
 			size_t board_size;
 			size_t board_ext_size;
-			bool extd_peer_stats;
 		} fw;
 	} hw_params;
 
drivers/net/wireless/ath/ath10k/debug.c +1 -0
index 001c0a144614..355e1ae665f9 100644
@@ -327,6 +327,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 {
 	spin_lock_bh(&ar->data_lock);
 	ar->debug.fw_stats_done = false;
+	ar->debug.fw_stats.extended = false;
 	ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs);
 	ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs);
 	ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers);
drivers/net/wireless/ath/ath10k/debugfs_sta.c +10 -10
index af3d49af9eab..0da8a57e0ba7 100644
@@ -19,14 +19,14 @@
 #include "debug.h"
 
 static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar,
-						     struct list_head *head)
+						     struct ath10k_fw_stats *stats)
 {
-	struct ieee80211_sta *sta;
 	struct ath10k_fw_extd_stats_peer *peer;
+	struct ieee80211_sta *sta;
 	struct ath10k_sta *arsta;
 
 	rcu_read_lock();
-	list_for_each_entry(peer, head, list) {
+	list_for_each_entry(peer, &stats->peers_extd, list) {
 		sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr,
 						   NULL);
 		if (!sta)
@@ -38,13 +38,14 @@ static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar,
 }
 
 static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar,
-						struct list_head *head)
-{	struct ieee80211_sta *sta;
+						struct ath10k_fw_stats *stats)
+{
 	struct ath10k_fw_stats_peer *peer;
+	struct ieee80211_sta *sta;
 	struct ath10k_sta *arsta;
 
 	rcu_read_lock();
-	list_for_each_entry(peer, head, list) {
+	list_for_each_entry(peer, &stats->peers, list) {
 		sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr,
 						   NULL);
 		if (!sta)
@@ -58,11 +59,10 @@ static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar,
 void ath10k_sta_update_rx_duration(struct ath10k *ar,
 				   struct ath10k_fw_stats *stats)
 {
-	if (ar->hw_params.fw.extd_peer_stats)
-		ath10k_sta_update_stats_rx_duration(ar, &stats->peers);
+	if (stats->extended)
+		ath10k_sta_update_extd_stats_rx_duration(ar, stats);
 	else
-		ath10k_sta_update_extd_stats_rx_duration(ar,
-							 &stats->peers_extd);
+		ath10k_sta_update_stats_rx_duration(ar, stats);
 }
 
 static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file,
drivers/net/wireless/ath/ath10k/wmi.c +2 -0
index 5f2d423b1c33..16bd79716a6c 100644
@@ -3008,6 +3008,8 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,
 	if ((stats_id & WMI_10_4_STAT_PEER_EXTD) == 0)
 		return 0;
 
+	stats->extended = true;
+
 	for (i = 0; i < num_peer_stats; i++) {
 		const struct wmi_10_4_peer_extd_stats *src;
 		struct ath10k_fw_extd_stats_peer *dst;
Signature · 5 lines
Kalle Valo
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#3 lore raw

Hi Kalle,

Quoted 15 lines · Kalle
Quoted 13 lines · Kalle Valo

drivers/net/wireless/ath/ath10k/core.c static const struct ath10k_hw_params ath10k_hw_params_list[] = { · line 269

Quoted 8 lines
drivers/net/wireless/ath/ath10k/core.c +1 -0
@@ -261,6 +263,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA4019_BOARD_DATA_SZ,
 			.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 };

This is not a hardware feature so hw_params is not really the right place to handle this. In the pending branch I tried to solve this a bit differently:

Quoted 5 lines
Quoted 5 lines

https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=ecf4daadc7677518ec7185dbddab959ac6e2db96

I added a bool "extended" to struct ath10k_fw_stats which is used to detect if extended stats are used. Would that work? Please note that I have only compile tested the patch.

[shafi] thanks for taking time to do this, the change looks fine to me ! since 'ath10k_sta_update_rx_duration' is called right after 'ath10k_wmi_pull_fw_stats' this should properly update the rx_duration based on the current data

Quoted 135 lines

Here's a diff of what I did:

drivers/net/wireless/ath/ath10k/core.c +0 -3
index 58932c09efc5..b734345ab598 100644
@@ -180,7 +180,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
 			.board_size = QCA99X0_BOARD_DATA_SZ,
 			.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
-			.extd_peer_stats = true,
 		},
 	},
 	{
@@ -203,7 +202,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA9984_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA99X0_BOARD_DATA_SZ,
 			.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
-			.extd_peer_stats = true,
 		},
 	},
 	{
@@ -261,7 +259,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA4019_BOARD_DATA_SZ,
 			.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
-			.extd_peer_stats = true,
 		},
 	},
 };
drivers/net/wireless/ath/ath10k/core.h +1 -1
index 73a0b1ae1559..3707d8a707a2 100644
@@ -263,6 +263,7 @@ struct ath10k_fw_stats_pdev {
 };
 
 struct ath10k_fw_stats {
+	bool extended;
 	struct list_head pdevs;
 	struct list_head vdevs;
 	struct list_head peers;
@@ -754,7 +755,6 @@ struct ath10k {
 			const char *board;
 			size_t board_size;
 			size_t board_ext_size;
-			bool extd_peer_stats;
 		} fw;
 	} hw_params;
 
drivers/net/wireless/ath/ath10k/debug.c +1 -0
index 001c0a144614..355e1ae665f9 100644
@@ -327,6 +327,7 @@ static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 {
 	spin_lock_bh(&ar->data_lock);
 	ar->debug.fw_stats_done = false;
+	ar->debug.fw_stats.extended = false;
 	ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs);
 	ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs);
 	ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers);
drivers/net/wireless/ath/ath10k/debugfs_sta.c +10 -10
index af3d49af9eab..0da8a57e0ba7 100644
@@ -19,14 +19,14 @@
 #include "debug.h"
 
 static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar,
-						     struct list_head *head)
+						     struct ath10k_fw_stats *stats)
 {
-	struct ieee80211_sta *sta;
 	struct ath10k_fw_extd_stats_peer *peer;
+	struct ieee80211_sta *sta;
 	struct ath10k_sta *arsta;
 
 	rcu_read_lock();
-	list_for_each_entry(peer, head, list) {
+	list_for_each_entry(peer, &stats->peers_extd, list) {
 		sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr,
 						   NULL);
 		if (!sta)
@@ -38,13 +38,14 @@ static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar,
 }
 
 static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar,
-						struct list_head *head)
-{	struct ieee80211_sta *sta;
+						struct ath10k_fw_stats *stats)
+{
 	struct ath10k_fw_stats_peer *peer;
+	struct ieee80211_sta *sta;
 	struct ath10k_sta *arsta;
 
 	rcu_read_lock();
-	list_for_each_entry(peer, head, list) {
+	list_for_each_entry(peer, &stats->peers, list) {
 		sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr,
 						   NULL);
 		if (!sta)
@@ -58,11 +59,10 @@ static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar,
 void ath10k_sta_update_rx_duration(struct ath10k *ar,
 				   struct ath10k_fw_stats *stats)
 {
-	if (ar->hw_params.fw.extd_peer_stats)
-		ath10k_sta_update_stats_rx_duration(ar, &stats->peers);
+	if (stats->extended)
+		ath10k_sta_update_extd_stats_rx_duration(ar, stats);
 	else
-		ath10k_sta_update_extd_stats_rx_duration(ar,
-							 &stats->peers_extd);
+		ath10k_sta_update_stats_rx_duration(ar, stats);
 }
 
 static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file,
drivers/net/wireless/ath/ath10k/wmi.c +2 -0
index 5f2d423b1c33..16bd79716a6c 100644
@@ -3008,6 +3008,8 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar,
 	if ((stats_id & WMI_10_4_STAT_PEER_EXTD) == 0)
 		return 0;
 
+	stats->extended = true;
+
 	for (i = 0; i < num_peer_stats; i++) {
 		const struct wmi_10_4_peer_extd_stats *src;
 		struct ath10k_fw_extd_stats_peer *dst;
Signature · 2 lines
-- 
Kalle Valo

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

#4 lore raw
Quoted 20 lines · Mohammed Shafi Shajakhan

Hi Kalle,

Quoted 17 lines · Kalle
Quoted 15 lines · Kalle Valo

drivers/net/wireless/ath/ath10k/core.c static const struct ath10k_hw_params ath10k_hw_params_list[] = { · line 269

Quoted 8 lines
drivers/net/wireless/ath/ath10k/core.c +1 -0
@@ -261,6 +263,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA4019_BOARD_DATA_SZ,
 			.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 };

This is not a hardware feature so hw_params is not really the right place to handle this. In the pending branch I tried to solve this a bit differently:

https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=ecf4daadc7677518ec7185dbddab959ac6e2db96

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I added a bool "extended" to struct ath10k_fw_stats which is used to detect if extended stats are used. Would that work? Please note that I have only compile tested the patch.

[shafi] thanks for taking time to do this, the change looks fine to me ! since 'ath10k_sta_update_rx_duration' is called right after 'ath10k_wmi_pull_fw_stats' this should properly update the rx_duration based on the current data

Could you also run some tests to make sure? I don't trust my own code :)

Signature · 1 line
Kalle Valo
#5 lore raw
Quoted 26 lines · Kalle
Quoted 24 lines · Mohammed Shafi Shajakhan

Hi Kalle,

Quoted 20 lines · Kalle
Quoted 18 lines · Kalle Valo

drivers/net/wireless/ath/ath10k/core.c static const struct ath10k_hw_params ath10k_hw_params_list[] = { · line 269

Quoted 8 lines
drivers/net/wireless/ath/ath10k/core.c +1 -0
@@ -261,6 +263,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 			.board = QCA4019_HW_1_0_BOARD_DATA_FILE,
 			.board_size = QCA4019_BOARD_DATA_SZ,
 			.board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
+			.extd_peer_stats = true,
 		},
 	},
 };

This is not a hardware feature so hw_params is not really the right place to handle this. In the pending branch I tried to solve this a bit differently:

https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=ecf4daadc7677518ec7185dbddab959ac6e2db96

I added a bool "extended" to struct ath10k_fw_stats which is used to detect if extended stats are used. Would that work? Please note that I have only compile tested the patch.

Quoted 6 lines
Quoted 3 lines

[shafi] thanks for taking time to do this, the change looks fine to me ! since 'ath10k_sta_update_rx_duration' is called right after 'ath10k_wmi_pull_fw_stats' this should properly update the rx_duration based on the current data

Could you also run some tests to make sure? I don't trust my own code :)

[shafi] sure no problem, will do that, thanks for fixing this properly

regards,
shafi

#6 lore raw
In reply to Mohammed Shafi Shajakhan
Quoted 10 lines · Mohammed Shafi Shajakhan

From: Mohammed Shafi Shajakhan <[email protected]>

10.4 'extended peer stats' will be not be appended with normal peer stats data and they shall be coming in separate chunks. Fix this by maintaining a separate linked list 'extender peer stats' for 10.4 and update rx_duration for per station statistics. Also parse through beacon filter (if enabled), to make sure we parse the extended peer stats properly. This issue was exposed when more than one client is connected and extended peer stats for 10.4 is enabled

Quoted 7 lines

The order for the stats is as below
S - standard peer stats, E- extended peer stats, B - beacon filter stats

{S1, S2, S3..} -> {B1, B2, B3..}(if available) -> {E1, E2, E3..}

Fixes f9575793d44c ("ath10k: enable parsing per station rx duration for 10.4")

Thanks, 1 patch applied to ath-next branch of ath.git:

4a49ae94a448 ath10k: fix 10.4 extended peer stats update

Signature · 2 lines
Sent by pwcli
https://patchwork.kernel.org/patch/9149357/