[PATCH] iwinfo: add 802.11ax HE rate information
David Bauer
mail at david-bauer.net
Tue Apr 27 11:34:56 BST 2021
This adds 802.11ax HE specific rate information to iwinfo.
Add fields for HE status of a STA as well as DCM and guard interval
fields specific to HE operation.
Signed-off-by: David Bauer <mail at david-bauer.net>
---
api/nl80211.h | 12 ++++++++++++
include/iwinfo.h | 3 +++
iwinfo_cli.c | 14 ++++++++++++++
iwinfo_lua.c | 19 ++++++++++++++++---
iwinfo_nl80211.c | 14 +++++++++++++-
5 files changed, 58 insertions(+), 4 deletions(-)
diff --git a/api/nl80211.h b/api/nl80211.h
index 3d252e4..22a709e 100644
--- a/api/nl80211.h
+++ b/api/nl80211.h
@@ -2353,6 +2353,13 @@ struct nl80211_sta_flag_update {
* @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is
* a legacy rate and will be reported as the actual bitrate, i.e.
* a quarter of the base (20 MHz) rate
+ * @NL80211_RATE_INFO_HE_MCS: HE MCS index (u8, 0-11)
+ * @NL80211_RATE_INFO_HE_NSS: HE NSS value (u8, 1-8)
+ * @NL80211_RATE_INFO_HE_GI: HE guard interval identifier
+ * (u8, see &enum nl80211_he_gi)
+ * @NL80211_RATE_INFO_HE_DCM: HE DCM value (u8, 0/1)
+ * @NL80211_RATE_INFO_RU_ALLOC: HE RU allocation, if not present then
+ * non-OFDMA was used (u8, see &enum nl80211_he_ru_alloc)
* @__NL80211_RATE_INFO_AFTER_LAST: internal use
*/
enum nl80211_rate_info {
@@ -2369,6 +2376,11 @@ enum nl80211_rate_info {
NL80211_RATE_INFO_160_MHZ_WIDTH,
NL80211_RATE_INFO_10_MHZ_WIDTH,
NL80211_RATE_INFO_5_MHZ_WIDTH,
+ NL80211_RATE_INFO_HE_MCS,
+ NL80211_RATE_INFO_HE_NSS,
+ NL80211_RATE_INFO_HE_GI,
+ NL80211_RATE_INFO_HE_DCM,
+ NL80211_RATE_INFO_HE_RU_ALLOC,
/* keep last */
__NL80211_RATE_INFO_AFTER_LAST,
diff --git a/include/iwinfo.h b/include/iwinfo.h
index 1956abe..3fc414b 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -110,6 +110,9 @@ struct iwinfo_rate_entry {
uint8_t is_short_gi:1;
uint8_t is_ht:1;
uint8_t is_vht:1;
+ uint8_t is_he:1;
+ uint8_t he_gi;
+ uint8_t he_dcm;
uint8_t mhz;
uint8_t nss;
};
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 82b409c..8691f31 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -322,6 +322,20 @@ static char * format_assocrate(struct iwinfo_rate_entry *r)
l = sizeof(buf) - (p - buf);
}
}
+ else if (r->is_he)
+ {
+ p += snprintf(p, l, ", HE-MCS %d, %dMHz", r->mcs, r->mhz);
+ l = sizeof(buf) - (p - buf);
+
+ p += snprintf(p, l, ", HE-NSS %d", r->nss);
+ l = sizeof(buf) - (p - buf);
+
+ p += snprintf(p, l, ", HE-GI %d", r->he_gi);
+ l = sizeof(buf) - (p - buf);
+
+ p += snprintf(p, l, ", HE-DCM %d", r->he_dcm);
+ l = sizeof(buf) - (p - buf);
+ }
}
return buf;
diff --git a/iwinfo_lua.c b/iwinfo_lua.c
index 9935a8d..e49e454 100644
--- a/iwinfo_lua.c
+++ b/iwinfo_lua.c
@@ -268,6 +268,9 @@ static void set_rateinfo(lua_State *L, struct iwinfo_rate_entry *r, bool rx)
lua_pushboolean(L, r->is_vht);
lua_setfield(L, -2, rx ? "rx_vht" : "tx_vht");
+ lua_pushboolean(L, r->is_he);
+ lua_setfield(L, -2, rx ? "rx_he" : "tx_he");
+
lua_pushnumber(L, r->mhz);
lua_setfield(L, -2, rx ? "rx_mhz" : "tx_mhz");
@@ -282,7 +285,7 @@ static void set_rateinfo(lua_State *L, struct iwinfo_rate_entry *r, bool rx)
lua_pushboolean(L, r->is_short_gi);
lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
}
- else if (r->is_vht)
+ else if (r->is_vht || r->is_he)
{
lua_pushnumber(L, r->mcs);
lua_setfield(L, -2, rx ? "rx_mcs" : "tx_mcs");
@@ -290,8 +293,18 @@ static void set_rateinfo(lua_State *L, struct iwinfo_rate_entry *r, bool rx)
lua_pushnumber(L, r->nss);
lua_setfield(L, -2, rx ? "rx_nss" : "tx_nss");
- lua_pushboolean(L, r->is_short_gi);
- lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
+ if (r->is_he) {
+ lua_pushnumber(L, r->he_gi);
+ lua_setfield(L, -2, rx ? "rx_he_gi" : "tx_he_gi");
+
+ lua_pushnumber(L, r->he_dcm);
+ lua_setfield(L, -2, rx ? "rx_he_dcm" : "tx_he_dcm");
+ }
+
+ if (r->is_vht) {
+ lua_pushboolean(L, r->is_short_gi);
+ lua_setfield(L, -2, rx ? "rx_short_gi" : "tx_short_gi");
+ }
}
}
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index aeff778..eea521e 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1869,7 +1869,19 @@ static void nl80211_parse_rateinfo(struct nlattr **ri,
else if (ri[NL80211_RATE_INFO_BITRATE])
re->rate = nla_get_u16(ri[NL80211_RATE_INFO_BITRATE]) * 100;
- if (ri[NL80211_RATE_INFO_VHT_MCS])
+ if (ri[NL80211_RATE_INFO_HE_MCS])
+ {
+ re->is_he = 1;
+ re->mcs = nla_get_u8(ri[NL80211_RATE_INFO_HE_MCS]);
+
+ if (ri[NL80211_RATE_INFO_HE_NSS])
+ re->nss = nla_get_u8(ri[NL80211_RATE_INFO_HE_NSS]);
+ if (ri[NL80211_RATE_INFO_HE_GI])
+ re->he_gi = nla_get_u8(ri[NL80211_RATE_INFO_HE_GI]);
+ if (ri[NL80211_RATE_INFO_HE_DCM])
+ re->he_dcm = nla_get_u8(ri[NL80211_RATE_INFO_HE_DCM]);
+ }
+ else if (ri[NL80211_RATE_INFO_VHT_MCS])
{
re->is_vht = 1;
re->mcs = nla_get_u8(ri[NL80211_RATE_INFO_VHT_MCS]);
--
2.31.1
More information about the openwrt-devel
mailing list