summaryrefslogtreecommitdiff
path: root/iwinfo_nl80211.c
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2020-12-17 20:39:56 +0100
committerDavid Bauer <mail@david-bauer.net>2021-04-12 23:45:42 +0200
commit50b64a63e3945693646d1b2eb4e59e14e35cedc3 (patch)
tree03e7e9f4c50c13560e182bceff329a1a4110df37 /iwinfo_nl80211.c
parent4a32b33e9606f1bc1125f4bc24b0581349e55f2e (diff)
downloadiwinfo-50b64a63e3945693646d1b2eb4e59e14e35cedc3.tar.gz
iwinfo: add basic IEEE 802.11ax support
This adds basic support for IEEE 802.11ax when requesting HW or HT Modelist for a PHY from iwinfo. This way, applications using iwinfo can detect HE phys. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'iwinfo_nl80211.c')
-rw-r--r--iwinfo_nl80211.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 08b5dec..6e79ec8 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -2974,6 +2974,40 @@ static int nl80211_get_modelist_cb(struct nl_msg *msg, void *arg)
m->ht |= IWINFO_HTMODE_HT40;
}
+ if (bands[NL80211_BAND_ATTR_IFTYPE_DATA]) {
+ struct nlattr *tb[NL80211_BAND_IFTYPE_ATTR_MAX + 1];
+ uint16_t phy_cap[6] = { 0 };
+ struct nlattr *nl_iftype;
+ int rem_band;
+ int len;
+
+ m->hw |= IWINFO_80211_AX;
+ m->ht |= IWINFO_HTMODE_HE20;
+
+ nla_for_each_nested(nl_iftype, bands[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band) {
+ nla_parse(tb, NL80211_BAND_IFTYPE_ATTR_MAX,
+ nla_data(nl_iftype), nla_len(nl_iftype), NULL);
+ if (tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]) {
+ len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]);
+
+ if (len > sizeof(phy_cap) - 1)
+ len = sizeof(phy_cap) - 1;
+ memcpy(&((__u8 *)phy_cap)[1],
+ nla_data(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]),
+ len);
+ }
+
+ if (phy_cap[0] & BIT(9))
+ m->ht |= IWINFO_HTMODE_HE40;
+ if (phy_cap[0] & BIT(10))
+ m->ht |= IWINFO_HTMODE_HE40 | IWINFO_HTMODE_HE80;
+ if (phy_cap[0] & BIT(11))
+ m->ht |= IWINFO_HTMODE_HE160;
+ if (phy_cap[0] & BIT(12))
+ m->ht |= IWINFO_HTMODE_HE160 | IWINFO_HTMODE_HE80_80;
+ }
+ }
+
nla_for_each_nested(freq, bands[NL80211_BAND_ATTR_FREQS],
freqs_remain)
{