From patchwork Tue Apr 27 10:34:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Bauer X-Patchwork-Id: 1470638 X-Patchwork-Delegate: mail@david-bauer.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=Y3QqlGEF; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FTyrx41Hgz9sSs for ; Tue, 27 Apr 2021 20:37:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NVQf+ByTi5XtPso5ZVzkCFqV1kvO6n07Fh141qRgdeo=; b=Y3QqlGEFrZ1f9X b4uFy23fK1JYseBkxc0QYzGfcczqUQMhkpV2tBSuznLo3YnIRilCn2+O5SKVVf0j2ISwXmJ+kIbAn w9xftSgp5szvI9BPpZ+SG8WXdJQlfkEnB/+sS3qkIdnkbolnZIrCYHt1DFckaHoI6vIpkUsnsQvZa p9k8z7Kj+Ph9dL7ekCzkdA7BI6yhrQ6ClBy4B8DUPUVxdYOoWrgh5hGcHapVtyo+94WyANXyjFSwi wSR1BcNGUhD/zbf18121kWMwCmjSEdFYJshT3Cpg9H791hMXVPcbmP2wb5GUxd+D5PD0ddLF05ItL RNxuZ/HmHFo+OzVbuVDA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbL3r-001PXX-Fu; Tue, 27 Apr 2021 10:35:24 +0000 Received: from perseus.uberspace.de ([95.143.172.134]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbL3h-001PQL-4A for openwrt-devel@lists.openwrt.org; Tue, 27 Apr 2021 10:35:18 +0000 Received: (qmail 21798 invoked from network); 27 Apr 2021 10:34:58 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by perseus.uberspace.de with SMTP; 27 Apr 2021 10:34:58 -0000 From: David Bauer To: openwrt-devel@lists.openwrt.org Subject: [PATCH] iwinfo: add 802.11ax HE rate information Date: Tue, 27 Apr 2021 12:34:56 +0200 Message-Id: <20210427103456.297089-1-mail@david-bauer.net> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_113514_492524_1CACA05E X-CRM114-Status: GOOD ( 10.14 ) X-Spam-Score: -0.7 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 --- api/nl80211.h | 12 ++++++++++++ include/iwinfo.h | 3 +++ iwinfo_cli.c | 14 ++++++++++++++ iwinfo_lua.c | 19 ++++++++++++++++--- iwinfo_nl80211.c | [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [95.143.172.134 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 --- 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]);