From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <gary.chang@realtek.com>, <damon.chen@realtek.com>
Subject: [PATCH rtw-next 2/8] wifi: rtw89: debug: add beacon_info debugfs
Date: Mon, 11 Aug 2025 20:37:38 +0800 [thread overview]
Message-ID: <20250811123744.15361-3-pkshih@realtek.com> (raw)
In-Reply-To: <20250811123744.15361-1-pkshih@realtek.com>
From: Kuan-Chung Chen <damon.chen@realtek.com>
Add debugfs beacon_info to display the information of beacon tracking.
The screenshot as below:
[Beacon info]
count: 15
interval: 100
dtim: 1
raw rssi: 146
hw rate: 0
length: 407
[Distribution]
tbtt
00 - 04: 26
05 - 09: 5
10 - 14: 1
15 - 19: 0
20 - 24: 0
25 - 29: 0
drift
0: 9
1: 7
2: 3
3: 3
4: 4
5: 1
6: 1
7: 2
8: 1
11: 1
lower bound: 0
upper bound: 10
outlier count: 1
[Tracking]
tbtt offset: 20
bcn timeout: 19
Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/debug.c | 61 ++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index afdfb9647fc1..a37cdd73ddc3 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -86,6 +86,7 @@ struct rtw89_debugfs {
struct rtw89_debugfs_priv stations;
struct rtw89_debugfs_priv disable_dm;
struct rtw89_debugfs_priv mlo_mode;
+ struct rtw89_debugfs_priv beacon_info;
};
struct rtw89_debugfs_iter_data {
@@ -4298,6 +4299,64 @@ rtw89_debug_priv_mlo_mode_set(struct rtw89_dev *rtwdev,
return count;
}
+static ssize_t
+rtw89_debug_priv_beacon_info_get(struct rtw89_dev *rtwdev,
+ struct rtw89_debugfs_priv *debugfs_priv,
+ char *buf, size_t bufsz)
+{
+ struct rtw89_pkt_stat *pkt_stat = &rtwdev->phystat.last_pkt_stat;
+ struct rtw89_beacon_track_info *bcn_track = &rtwdev->bcn_track;
+ struct rtw89_beacon_stat *bcn_stat = &rtwdev->phystat.bcn_stat;
+ struct rtw89_beacon_dist *bcn_dist = &bcn_stat->bcn_dist;
+ u16 upper, lower = bcn_stat->tbtt_tu_min;
+ char *p = buf, *end = buf + bufsz;
+ u16 *drift = bcn_stat->drift;
+ u8 bcn_num = bcn_stat->num;
+ u8 count;
+ u8 i;
+
+ p += scnprintf(p, end - p, "[Beacon info]\n");
+ p += scnprintf(p, end - p, "count: %u\n", pkt_stat->beacon_nr);
+ p += scnprintf(p, end - p, "interval: %u\n", bcn_track->beacon_int);
+ p += scnprintf(p, end - p, "dtim: %u\n", bcn_track->dtim);
+ p += scnprintf(p, end - p, "raw rssi: %lu\n",
+ ewma_rssi_read(&rtwdev->phystat.bcn_rssi));
+ p += scnprintf(p, end - p, "hw rate: %u\n", pkt_stat->beacon_rate);
+ p += scnprintf(p, end - p, "length: %u\n", pkt_stat->beacon_len);
+
+ p += scnprintf(p, end - p, "\n[Distribution]\n");
+ p += scnprintf(p, end - p, "tbtt\n");
+ for (i = 0; i < RTW89_BCN_TRACK_MAX_BIN_NUM; i++) {
+ upper = lower + RTW89_BCN_TRACK_BIN_WIDTH - 1;
+ if (i == RTW89_BCN_TRACK_MAX_BIN_NUM - 1)
+ upper = max(upper, bcn_stat->tbtt_tu_max);
+
+ p += scnprintf(p, end - p, "%02u - %02u: %u\n",
+ lower, upper, bcn_dist->bins[i]);
+
+ lower = upper + 1;
+ }
+
+ p += scnprintf(p, end - p, "\ndrift\n");
+
+ for (i = 0; i < bcn_num; i += count) {
+ count = 1;
+ while (i + count < bcn_num && drift[i] == drift[i + count])
+ count++;
+
+ p += scnprintf(p, end - p, "%u: %u\n", drift[i], count);
+ }
+ p += scnprintf(p, end - p, "\nlower bound: %u\n", bcn_dist->lower_bound);
+ p += scnprintf(p, end - p, "upper bound: %u\n", bcn_dist->upper_bound);
+ p += scnprintf(p, end - p, "outlier count: %u\n", bcn_dist->outlier_count);
+
+ p += scnprintf(p, end - p, "\n[Tracking]\n");
+ p += scnprintf(p, end - p, "tbtt offset: %u\n", bcn_track->tbtt_offset);
+ p += scnprintf(p, end - p, "bcn timeout: %u\n", bcn_track->bcn_timeout);
+
+ return p - buf;
+}
+
#define rtw89_debug_priv_get(name, opts...) \
{ \
.cb_read = rtw89_debug_priv_ ##name## _get, \
@@ -4356,6 +4415,7 @@ static const struct rtw89_debugfs rtw89_debugfs_templ = {
.stations = rtw89_debug_priv_get(stations, RLOCK),
.disable_dm = rtw89_debug_priv_set_and_get(disable_dm, RWLOCK),
.mlo_mode = rtw89_debug_priv_set_and_get(mlo_mode, RWLOCK),
+ .beacon_info = rtw89_debug_priv_get(beacon_info),
};
#define rtw89_debugfs_add(name, mode, fopname, parent) \
@@ -4401,6 +4461,7 @@ void rtw89_debugfs_add_sec1(struct rtw89_dev *rtwdev, struct dentry *debugfs_top
rtw89_debugfs_add_r(stations);
rtw89_debugfs_add_rw(disable_dm);
rtw89_debugfs_add_rw(mlo_mode);
+ rtw89_debugfs_add_r(beacon_info);
}
void rtw89_debugfs_init(struct rtw89_dev *rtwdev)
--
2.25.1
next prev parent reply other threads:[~2025-08-11 12:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 12:37 [PATCH rtw-next 0/8] wifi: rtw89: improve connection loss and 8851B performance Ping-Ke Shih
2025-08-11 12:37 ` [PATCH rtw-next 1/8] wifi: rtw89: introduce beacon tracking to improve connection stability Ping-Ke Shih
2025-08-19 1:18 ` Ping-Ke Shih
2025-08-11 12:37 ` Ping-Ke Shih [this message]
2025-08-11 12:37 ` [PATCH rtw-next 3/8] wifi: rtw89: wow: remove notify during WoWLAN net-detect Ping-Ke Shih
2025-08-11 12:37 ` [PATCH rtw-next 4/8] wifi: rtw89: 8851b: rfk: update IQK TIA setting Ping-Ke Shih
2025-08-11 12:39 ` [PATCH rtw-next 5/8] wifi: rtw89: 8851b: rfk: update TX wideband IQK Ping-Ke Shih
2025-08-11 12:39 ` [PATCH rtw-next 6/8] wifi: rtw89: 8852c: check LPS H2C command complete by C2H reg instead of done ack Ping-Ke Shih
2025-08-11 12:39 ` [PATCH rtw-next 7/8] wifi: rtw89: fix BSSID comparison for non-transmitted BSSID Ping-Ke Shih
2025-08-11 12:40 ` [PATCH rtw-next 8/8] wifi: rtw89: fix group frames loss when connected to " Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250811123744.15361-3-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=damon.chen@realtek.com \
--cc=gary.chang@realtek.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.