blob: 7bb242c276934824c12d9d000ef29833e7d06151 [file] [log] [blame]
developer66e89bc2024-04-23 14:50:01 +08001From e2224c729840cc33c6ea89ba5e91b69f79c88e85 Mon Sep 17 00:00:00 2001
2From: Bassem Dawood <bassem@morsemicro.com>
3Date: Thu, 19 Oct 2023 18:40:19 +1100
4Subject: [PATCH 22/28] iw: S1G: add 802.11ah support for link command display
5
6Amending the link command which depends on kernal changes for
7802.11ah bandwidths/MCS/NSS NL80211_RATE_INFO_ attributes.
8
9S1G frequency offset being used as well for the MHz units print.
10
11Signed-off-by: Bassem Dawood <bassem@morsemicro.com>
12Link: https://lore.kernel.org/r/20231019074019.2246629-1-bassem@morsemicro.com
13Signed-off-by: Johannes Berg <johannes.berg@intel.com>
14---
15 link.c | 9 +++++++--
16 station.c | 10 ++++++++++
17 2 files changed, 17 insertions(+), 2 deletions(-)
18
19diff --git a/link.c b/link.c
20index a090100..a7ee963 100644
21--- a/link.c
22+++ b/link.c
23@@ -29,6 +29,7 @@ static int link_bss_handler(struct nl_msg *msg, void *arg)
24 static struct nla_policy bss_policy[NL80211_BSS_MAX + 1] = {
25 [NL80211_BSS_TSF] = { .type = NLA_U64 },
26 [NL80211_BSS_FREQUENCY] = { .type = NLA_U32 },
27+ [NL80211_BSS_FREQUENCY_OFFSET] = { .type = NLA_U32 },
28 [NL80211_BSS_BSSID] = { },
29 [NL80211_BSS_BEACON_INTERVAL] = { .type = NLA_U16 },
30 [NL80211_BSS_CAPABILITY] = { .type = NLA_U16 },
31@@ -41,6 +42,7 @@ static int link_bss_handler(struct nl_msg *msg, void *arg)
32 char mac_addr[20], dev[20], link_addr[20];
33 int link_id = -1;
34 const char *indent = "\t";
35+ int freq_offset = 0;
36
37 nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
38 genlmsg_attrlen(gnlh, 0), NULL);
39@@ -121,9 +123,12 @@ static int link_bss_handler(struct nl_msg *msg, void *arg)
40 nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
41 false, result->mld ? PRINT_LINK_MLO_LINK : PRINT_LINK);
42
43+ if (bss[NL80211_BSS_FREQUENCY_OFFSET])
44+ freq_offset = nla_get_u32(bss[NL80211_BSS_FREQUENCY_OFFSET]);
45+
46 if (bss[NL80211_BSS_FREQUENCY])
47- printf("%sfreq: %d\n", indent,
48- nla_get_u32(bss[NL80211_BSS_FREQUENCY]));
49+ printf("%sfreq: %d.%d\n", indent,
50+ nla_get_u32(bss[NL80211_BSS_FREQUENCY]), freq_offset);
51
52 if (nla_get_u32(bss[NL80211_BSS_STATUS]) != NL80211_BSS_STATUS_ASSOCIATED)
53 return NL_SKIP;
54diff --git a/station.c b/station.c
55index da1feae..bf7c0f5 100644
56--- a/station.c
57+++ b/station.c
58@@ -241,6 +241,16 @@ void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
59 pos += snprintf(pos, buflen - (pos - buf), " 160MHz");
60 if (rinfo[NL80211_RATE_INFO_320_MHZ_WIDTH])
61 pos += snprintf(pos, buflen - (pos - buf), " 320MHz");
62+ if (rinfo[NL80211_RATE_INFO_1_MHZ_WIDTH])
63+ pos += snprintf(pos, buflen - (pos - buf), " 1MHz");
64+ if (rinfo[NL80211_RATE_INFO_2_MHZ_WIDTH])
65+ pos += snprintf(pos, buflen - (pos - buf), " 2MHz");
66+ if (rinfo[NL80211_RATE_INFO_4_MHZ_WIDTH])
67+ pos += snprintf(pos, buflen - (pos - buf), " 4MHz");
68+ if (rinfo[NL80211_RATE_INFO_8_MHZ_WIDTH])
69+ pos += snprintf(pos, buflen - (pos - buf), " 8MHz");
70+ if (rinfo[NL80211_RATE_INFO_16_MHZ_WIDTH])
71+ pos += snprintf(pos, buflen - (pos - buf), " 16MHz");
72 if (rinfo[NL80211_RATE_INFO_SHORT_GI])
73 pos += snprintf(pos, buflen - (pos - buf), " short GI");
74 if (rinfo[NL80211_RATE_INFO_VHT_NSS])
75--
762.39.2
77