blob: f6c01f0a321df164bda35651f6a66ac1d40f7845 [file] [log] [blame]
From be69477058da6305cceb451a8449f41f8f9fe24d Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Tue, 11 Jun 2024 11:18:41 +0800
Subject: [PATCH 09/10] mtk: wifi: iw: dump links information in station dump
Parse and show the following link information
1. link address
2. Rssi
3. Tx rate
4. Rx rate
5. dtim period
4. beacon interval
CR-Id: WCNCR00240772
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Change-Id: Ia6122b7938a38ca0b2eb5060c21193f705d48181
---
station.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/station.c b/station.c
index bf7c0f5..e91cb73 100644
--- a/station.c
+++ b/station.c
@@ -636,6 +636,66 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
}
printf("\n\tcurrent time:\t%llu ms\n", now_ms);
+
+ printf("\t*** MLD Information ***");
+ if (tb[NL80211_ATTR_MLO_LINK_ID])
+ printf("\n\tSetup link = %d", nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]));
+
+ if (tb[NL80211_ATTR_MLD_ADDR]) {
+ mac_addr_n2a(mac_addr, nla_data(tb[NL80211_ATTR_MLD_ADDR]));
+ printf("\n\tMLD Address: %s", mac_addr);
+ }
+
+ if (tb[NL80211_ATTR_MLO_LINKS]) {
+ struct nlattr *link;
+ char buf[100];
+ int rem;
+
+ nla_for_each_nested(link, tb[NL80211_ATTR_MLO_LINKS], rem) {
+ struct nlattr *tb_link[NL80211_ATTR_MAX + 1];
+
+ nla_parse_nested(tb_link, NL80211_ATTR_MAX, link, NULL);
+
+ if (tb_link[NL80211_ATTR_MLO_LINK_ID])
+ printf("\n\t***** Link ID: %2d *****",
+ nla_get_u32(tb_link[NL80211_ATTR_MLO_LINK_ID]));
+ if (tb_link[NL80211_ATTR_MAC]) {
+ mac_addr_n2a(buf, nla_data(tb_link[NL80211_ATTR_MAC]));
+ printf("\n\tLink addr: %s", buf);
+ }
+ if (nla_parse_nested(sinfo, NL80211_STA_INFO_MAX,
+ tb_link[NL80211_ATTR_STA_INFO],
+ stats_policy)) {
+ fprintf(stderr, "failed to parse nested attributes!\n");
+ return NL_SKIP;
+ }
+ if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
+ parse_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE],
+ buf, sizeof(buf));
+ printf("\n\ttx bitrate:\t%s", buf);
+ }
+ if (sinfo[NL80211_STA_INFO_RX_BITRATE]) {
+ parse_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE],
+ buf, sizeof(buf));
+ printf("\n\trx bitrate:\t%s", buf);
+ }
+ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL]);
+ if (sinfo[NL80211_STA_INFO_SIGNAL])
+ printf("\n\tsignal: \t%d %sdBm",
+ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]),
+ chain);
+
+ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL_AVG]);
+ if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
+ printf("\n\tsignal avg:\t%d %sdBm",
+ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]),
+ chain);
+
+ if (sinfo[NL80211_STA_INFO_BSS_PARAM])
+ parse_bss_param(sinfo[NL80211_STA_INFO_BSS_PARAM]);
+ }
+ }
+ printf("\n");
return NL_SKIP;
}
--
2.18.0