Skip to content

Commit

Permalink
iwinfo: add basic 11ax support
Browse files Browse the repository at this point in the history
  • Loading branch information
mantas-p committed Nov 9, 2020
1 parent fecc14d commit adae444
Showing 1 changed file with 205 additions and 0 deletions.
205 changes: 205 additions & 0 deletions package/network/utils/iwinfo/patches/004-add-he-rates.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
--- a/api/nl80211.h
+++ b/api/nl80211.h
@@ -2262,6 +2262,7 @@ enum nl80211_iftype {
NL80211_IFTYPE_P2P_GO,
NL80211_IFTYPE_P2P_DEVICE,
NL80211_IFTYPE_OCB,
+ NL80211_IFTYPE_NAN,

/* keep last */
NUM_NL80211_IFTYPES,
@@ -2583,6 +2584,38 @@ enum nl80211_mpath_info {
};

/**
+ * enum nl80211_band_iftype_attr - Interface type data attributes
+ *
+ * @__NL80211_BAND_IFTYPE_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_BAND_IFTYPE_ATTR_IFTYPES: nested attribute containing a flag attribute
+ * for each interface type that supports the band data
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC: HE MAC capabilities as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY: HE PHY capabilities as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET: HE supported NSS/MCS as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE: HE PPE thresholds information as
+ * defined in HE capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band HE capability attribute currently
+ * defined
+ * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_band_iftype_attr {
+ __NL80211_BAND_IFTYPE_ATTR_INVALID,
+
+ NL80211_BAND_IFTYPE_ATTR_IFTYPES,
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC,
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY,
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
+
+ /* keep last */
+ __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
+ NL80211_BAND_IFTYPE_ATTR_MAX = __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST - 1
+};
+
+/**
* enum nl80211_band_attr - band attributes
* @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved
* @NL80211_BAND_ATTR_FREQS: supported frequencies in this band,
@@ -2597,6 +2630,14 @@ enum nl80211_mpath_info {
* @NL80211_BAND_ATTR_VHT_MCS_SET: 32-byte attribute containing the MCS set as
* defined in 802.11ac
* @NL80211_BAND_ATTR_VHT_CAPA: VHT capabilities, as in the HT information IE
+ * @NL80211_BAND_ATTR_IFTYPE_DATA: nested array attribute, with each entry using
+ * attributes from &enum nl80211_band_iftype_attr
+ * @NL80211_BAND_ATTR_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz
+ * channel(s) that are allowed to be used for EDMG transmissions.
+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251.
+ * @NL80211_BAND_ATTR_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes
+ * the allowed channel bandwidth configurations.
+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
* @NL80211_BAND_ATTR_MAX: highest band attribute currently defined
* @__NL80211_BAND_ATTR_AFTER_LAST: internal use
*/
@@ -2612,6 +2653,10 @@ enum nl80211_band_attr {

NL80211_BAND_ATTR_VHT_MCS_SET,
NL80211_BAND_ATTR_VHT_CAPA,
+ NL80211_BAND_ATTR_IFTYPE_DATA,
+
+ NL80211_BAND_ATTR_EDMG_CHANNELS,
+ NL80211_BAND_ATTR_EDMG_BW_CONFIG,

/* keep last */
__NL80211_BAND_ATTR_AFTER_LAST,
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -29,6 +29,7 @@
#define IWINFO_80211_N (1 << 3)
#define IWINFO_80211_AC (1 << 4)
#define IWINFO_80211_AD (1 << 5)
+#define IWINFO_80211_AX (1 << 6)

#define IWINFO_CIPHER_NONE (1 << 0)
#define IWINFO_CIPHER_WEP40 (1 << 1)
@@ -85,8 +86,13 @@ enum iwinfo_htmode {
IWINFO_HTMODE_VHT80 = (1 << 4),
IWINFO_HTMODE_VHT80_80 = (1 << 5),
IWINFO_HTMODE_VHT160 = (1 << 6),
+ IWINFO_HTMODE_HE20 = (1 << 7),
+ IWINFO_HTMODE_HE40 = (1 << 8),
+ IWINFO_HTMODE_HE80 = (1 << 9),
+ IWINFO_HTMODE_HE80_80 = (1 << 10),
+ IWINFO_HTMODE_HE160 = (1 << 11),

- IWINFO_HTMODE_COUNT = 7
+ IWINFO_HTMODE_COUNT = 12
};

extern const char *IWINFO_HTMODE_NAMES[IWINFO_HTMODE_COUNT];
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -263,18 +263,19 @@ static char * format_encryption(struct i

static char * format_hwmodes(int modes)
{
- static char buf[12];
+ static char buf[20];

if (modes <= 0)
snprintf(buf, sizeof(buf), "unknown");
else
- snprintf(buf, sizeof(buf), "802.11%s%s%s%s%s",
+ snprintf(buf, sizeof(buf), "802.11%s%s%s%s%s%s%s",
(modes & IWINFO_80211_A) ? "a" : "",
(modes & IWINFO_80211_B) ? "b" : "",
(modes & IWINFO_80211_G) ? "g" : "",
(modes & IWINFO_80211_N) ? "n" : "",
(modes & IWINFO_80211_AC) ? "ac" : "",
- (modes & IWINFO_80211_AD) ? "/ad" : "");
+ (modes & IWINFO_80211_AD) ? "/ad" : "",
+ (modes & IWINFO_80211_AX) ? "/ax" : "");

return buf;
}
--- a/iwinfo_lib.c
+++ b/iwinfo_lib.c
@@ -65,6 +65,11 @@ const char *IWINFO_HTMODE_NAMES[] = {
"VHT80",
"VHT80+80",
"VHT160",
+ "HE20",
+ "HE40",
+ "HE80",
+ "HE80+80",
+ "HE160",
};


--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -2816,8 +2816,50 @@ static int nl80211_get_modelist_cb(struc
m->hw |= IWINFO_80211_A;
}
}
- }

+ if (bands[NL80211_BAND_ATTR_IFTYPE_DATA]) {
+ struct nlattr *nl_iftype;
+ int rem_iftype;
+ struct nlattr *tb[NL80211_BAND_IFTYPE_ATTR_MAX + 1];
+ struct nlattr *tb_flags[NL80211_IFTYPE_MAX + 1];
+ char *iftypes[NUM_NL80211_IFTYPES] = {
+ "Unspec", "Adhoc", "Station", "AP", "AP/VLAN", "WDS", "Monitor",
+ "Mesh", "P2P/Client", "P2P/Go", "P2P/Device", "OCB", "NAN",
+ };
+
+ nla_for_each_nested(nl_iftype, bands[NL80211_BAND_ATTR_IFTYPE_DATA], rem_iftype) {
+ nla_parse(tb, NL80211_BAND_IFTYPE_ATTR_MAX,
+ nla_data(nl_iftype), nla_len(nl_iftype), NULL);
+ if (!tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES])
+ continue;
+ if (nla_parse_nested(tb_flags, NL80211_IFTYPE_MAX,
+ tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES], NULL))
+ continue;
+
+ if (tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]) {
+ size_t len;
+ uint8_t he_phy_cap;
+
+ len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]);
+ if (len < 1)
+ continue;
+
+ m->hw |= IWINFO_80211_AX;
+ m->ht |= IWINFO_HTMODE_HE20;
+
+ he_phy_cap = *(uint8_t*)(nla_data(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]));
+ if (he_phy_cap & (1 << 1))
+ m->ht |= IWINFO_HTMODE_HE40;
+ if (he_phy_cap & (1 << 2))
+ m->ht |= IWINFO_HTMODE_HE40 | IWINFO_HTMODE_HE80;
+ if (he_phy_cap & (1 << 3))
+ m->ht |= IWINFO_HTMODE_HE160;
+ if (he_phy_cap & (1 << 4))
+ m->ht |= IWINFO_HTMODE_HE160 | IWINFO_HTMODE_HE80_80;
+ }
+ }
+ }
+ }
m->ok = 1;
}

--- a/iwinfo_lua.c
+++ b/iwinfo_lua.c
@@ -521,6 +521,9 @@ static int iwinfo_L_hwmodelist(lua_State
lua_pushboolean(L, hwmodes & IWINFO_80211_AD);
lua_setfield(L, -2, "ad");

+ lua_pushboolean(L, hwmodes & IWINFO_80211_AX);
+ lua_setfield(L, -2, "ax");
+
return 1;
}

0 comments on commit adae444

Please sign in to comment.