| From e2224c729840cc33c6ea89ba5e91b69f79c88e85 Mon Sep 17 00:00:00 2001 |
| From: Bassem Dawood <bassem@morsemicro.com> |
| Date: Thu, 19 Oct 2023 18:40:19 +1100 |
| Subject: [PATCH 22/28] iw: S1G: add 802.11ah support for link command display |
| |
| Amending the link command which depends on kernal changes for |
| 802.11ah bandwidths/MCS/NSS NL80211_RATE_INFO_ attributes. |
| |
| S1G frequency offset being used as well for the MHz units print. |
| |
| Signed-off-by: Bassem Dawood <bassem@morsemicro.com> |
| Link: https://lore.kernel.org/r/20231019074019.2246629-1-bassem@morsemicro.com |
| Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| --- |
| link.c | 9 +++++++-- |
| station.c | 10 ++++++++++ |
| 2 files changed, 17 insertions(+), 2 deletions(-) |
| |
| diff --git a/link.c b/link.c |
| index a090100..a7ee963 100644 |
| --- a/link.c |
| +++ b/link.c |
| @@ -29,6 +29,7 @@ static int link_bss_handler(struct nl_msg *msg, void *arg) |
| static struct nla_policy bss_policy[NL80211_BSS_MAX + 1] = { |
| [NL80211_BSS_TSF] = { .type = NLA_U64 }, |
| [NL80211_BSS_FREQUENCY] = { .type = NLA_U32 }, |
| + [NL80211_BSS_FREQUENCY_OFFSET] = { .type = NLA_U32 }, |
| [NL80211_BSS_BSSID] = { }, |
| [NL80211_BSS_BEACON_INTERVAL] = { .type = NLA_U16 }, |
| [NL80211_BSS_CAPABILITY] = { .type = NLA_U16 }, |
| @@ -41,6 +42,7 @@ static int link_bss_handler(struct nl_msg *msg, void *arg) |
| char mac_addr[20], dev[20], link_addr[20]; |
| int link_id = -1; |
| const char *indent = "\t"; |
| + int freq_offset = 0; |
| |
| nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), |
| genlmsg_attrlen(gnlh, 0), NULL); |
| @@ -121,9 +123,12 @@ static int link_bss_handler(struct nl_msg *msg, void *arg) |
| nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]), |
| false, result->mld ? PRINT_LINK_MLO_LINK : PRINT_LINK); |
| |
| + if (bss[NL80211_BSS_FREQUENCY_OFFSET]) |
| + freq_offset = nla_get_u32(bss[NL80211_BSS_FREQUENCY_OFFSET]); |
| + |
| if (bss[NL80211_BSS_FREQUENCY]) |
| - printf("%sfreq: %d\n", indent, |
| - nla_get_u32(bss[NL80211_BSS_FREQUENCY])); |
| + printf("%sfreq: %d.%d\n", indent, |
| + nla_get_u32(bss[NL80211_BSS_FREQUENCY]), freq_offset); |
| |
| if (nla_get_u32(bss[NL80211_BSS_STATUS]) != NL80211_BSS_STATUS_ASSOCIATED) |
| return NL_SKIP; |
| diff --git a/station.c b/station.c |
| index da1feae..bf7c0f5 100644 |
| --- a/station.c |
| +++ b/station.c |
| @@ -241,6 +241,16 @@ void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen) |
| pos += snprintf(pos, buflen - (pos - buf), " 160MHz"); |
| if (rinfo[NL80211_RATE_INFO_320_MHZ_WIDTH]) |
| pos += snprintf(pos, buflen - (pos - buf), " 320MHz"); |
| + if (rinfo[NL80211_RATE_INFO_1_MHZ_WIDTH]) |
| + pos += snprintf(pos, buflen - (pos - buf), " 1MHz"); |
| + if (rinfo[NL80211_RATE_INFO_2_MHZ_WIDTH]) |
| + pos += snprintf(pos, buflen - (pos - buf), " 2MHz"); |
| + if (rinfo[NL80211_RATE_INFO_4_MHZ_WIDTH]) |
| + pos += snprintf(pos, buflen - (pos - buf), " 4MHz"); |
| + if (rinfo[NL80211_RATE_INFO_8_MHZ_WIDTH]) |
| + pos += snprintf(pos, buflen - (pos - buf), " 8MHz"); |
| + if (rinfo[NL80211_RATE_INFO_16_MHZ_WIDTH]) |
| + pos += snprintf(pos, buflen - (pos - buf), " 16MHz"); |
| if (rinfo[NL80211_RATE_INFO_SHORT_GI]) |
| pos += snprintf(pos, buflen - (pos - buf), " short GI"); |
| if (rinfo[NL80211_RATE_INFO_VHT_NSS]) |
| -- |
| 2.39.2 |
| |