blob: f6c01f0a321df164bda35651f6a66ac1d40f7845 [file] [log] [blame]
developer42c7a432024-07-12 14:39:29 +08001From be69477058da6305cceb451a8449f41f8f9fe24d Mon Sep 17 00:00:00 2001
2From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Tue, 11 Jun 2024 11:18:41 +0800
4Subject: [PATCH 09/10] mtk: wifi: iw: dump links information in station dump
5
6Parse and show the following link information
71. link address
82. Rssi
93. Tx rate
104. Rx rate
115. dtim period
124. beacon interval
13
14CR-Id: WCNCR00240772
15Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
16Change-Id: Ia6122b7938a38ca0b2eb5060c21193f705d48181
17---
18 station.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
19 1 file changed, 60 insertions(+)
20
21diff --git a/station.c b/station.c
22index bf7c0f5..e91cb73 100644
23--- a/station.c
24+++ b/station.c
25@@ -636,6 +636,66 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
26 }
27
28 printf("\n\tcurrent time:\t%llu ms\n", now_ms);
29+
30+ printf("\t*** MLD Information ***");
31+ if (tb[NL80211_ATTR_MLO_LINK_ID])
32+ printf("\n\tSetup link = %d", nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]));
33+
34+ if (tb[NL80211_ATTR_MLD_ADDR]) {
35+ mac_addr_n2a(mac_addr, nla_data(tb[NL80211_ATTR_MLD_ADDR]));
36+ printf("\n\tMLD Address: %s", mac_addr);
37+ }
38+
39+ if (tb[NL80211_ATTR_MLO_LINKS]) {
40+ struct nlattr *link;
41+ char buf[100];
42+ int rem;
43+
44+ nla_for_each_nested(link, tb[NL80211_ATTR_MLO_LINKS], rem) {
45+ struct nlattr *tb_link[NL80211_ATTR_MAX + 1];
46+
47+ nla_parse_nested(tb_link, NL80211_ATTR_MAX, link, NULL);
48+
49+ if (tb_link[NL80211_ATTR_MLO_LINK_ID])
50+ printf("\n\t***** Link ID: %2d *****",
51+ nla_get_u32(tb_link[NL80211_ATTR_MLO_LINK_ID]));
52+ if (tb_link[NL80211_ATTR_MAC]) {
53+ mac_addr_n2a(buf, nla_data(tb_link[NL80211_ATTR_MAC]));
54+ printf("\n\tLink addr: %s", buf);
55+ }
56+ if (nla_parse_nested(sinfo, NL80211_STA_INFO_MAX,
57+ tb_link[NL80211_ATTR_STA_INFO],
58+ stats_policy)) {
59+ fprintf(stderr, "failed to parse nested attributes!\n");
60+ return NL_SKIP;
61+ }
62+ if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
63+ parse_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE],
64+ buf, sizeof(buf));
65+ printf("\n\ttx bitrate:\t%s", buf);
66+ }
67+ if (sinfo[NL80211_STA_INFO_RX_BITRATE]) {
68+ parse_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE],
69+ buf, sizeof(buf));
70+ printf("\n\trx bitrate:\t%s", buf);
71+ }
72+ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL]);
73+ if (sinfo[NL80211_STA_INFO_SIGNAL])
74+ printf("\n\tsignal: \t%d %sdBm",
75+ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]),
76+ chain);
77+
78+ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL_AVG]);
79+ if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
80+ printf("\n\tsignal avg:\t%d %sdBm",
81+ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]),
82+ chain);
83+
84+ if (sinfo[NL80211_STA_INFO_BSS_PARAM])
85+ parse_bss_param(sinfo[NL80211_STA_INFO_BSS_PARAM]);
86+ }
87+ }
88+ printf("\n");
89 return NL_SKIP;
90 }
91
92--
932.18.0
94