diff mbox series

iw: S1G: add 802.11ah support for link command display

Message ID 20231019074019.2246629-1-bassem@morsemicro.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series iw: S1G: add 802.11ah support for link command display | expand

Commit Message

Bassem Dawood Oct. 19, 2023, 7:40 a.m. UTC
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.c    |  9 +++++++--
 station.c | 10 ++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
diff mbox series

Patch

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])