208 lines
7.3 KiB
Diff
208 lines
7.3 KiB
Diff
From 4c859917316b69e66ba241d85b4da6ee01292a11 Mon Sep 17 00:00:00 2001
|
|
From: Dylan Eskew <dylan.eskew@candelatech.com>
|
|
Date: Wed, 19 Mar 2025 11:39:17 -0700
|
|
Subject: [PATCH] iw: util: update and clean up eht capa printing
|
|
|
|
A number of fields were either missing or incorrect, so
|
|
update to more aligned with 802.11be spec. Also clean up
|
|
printout formatting.
|
|
|
|
Signed-off-by: Dylan Eskew <dylan.eskew@candelatech.com>
|
|
Link: https://patch.msgid.link/20250319183918.1215853-2-dylan.eskew@candelatech.com
|
|
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
|
---
|
|
iw.h | 2 +
|
|
util.c | 124 ++++++++++++++++++++++++++++++++++++++++++++-------------
|
|
2 files changed, 99 insertions(+), 27 deletions(-)
|
|
|
|
--- a/iw.h
|
|
+++ b/iw.h
|
|
@@ -224,6 +224,8 @@ void print_vht_info(__u32 capa, const __
|
|
void print_he_capability(const uint8_t *ie, int len);
|
|
void print_he_operation(const uint8_t *ie, int len);
|
|
void print_he_info(struct nlattr *nl_iftype);
|
|
+void print_eht_capability(const uint8_t *ie, int len, const uint8_t *he_cap,
|
|
+ bool from_ap);
|
|
void print_eht_info(struct nlattr *nl_iftype, int band);
|
|
void print_s1g_capability(const uint8_t *caps);
|
|
|
|
--- a/util.c
|
|
+++ b/util.c
|
|
@@ -1515,11 +1515,11 @@ static void __print_eht_capa(int band,
|
|
const __u8 *mcs_set, size_t mcs_len,
|
|
const __u8 *ppet, size_t ppet_len,
|
|
const __u16 *he_phy_cap,
|
|
+ bool from_ap,
|
|
bool indent)
|
|
{
|
|
unsigned int i;
|
|
const char *pre = indent ? "\t" : "";
|
|
- const char *mcs[] = { "0-7", "8-9", "10-11", "12-13"};
|
|
|
|
#define PRINT_EHT_CAP(_var, _idx, _bit, _str) \
|
|
do { \
|
|
@@ -1534,6 +1534,7 @@ static void __print_eht_capa(int band,
|
|
} while (0)
|
|
|
|
#define PRINT_EHT_MAC_CAP(...) PRINT_EHT_CAP(mac_cap, __VA_ARGS__)
|
|
+ #define PRINT_EHT_MAC_CAP_MASK(...) PRINT_EHT_CAP_MASK(mac_cap, __VA_ARGS__)
|
|
#define PRINT_EHT_PHY_CAP(...) PRINT_EHT_CAP(phy_cap, __VA_ARGS__)
|
|
#define PRINT_EHT_PHY_CAP_MASK(...) PRINT_EHT_CAP_MASK(phy_cap, __VA_ARGS__)
|
|
|
|
@@ -1542,13 +1543,22 @@ static void __print_eht_capa(int band,
|
|
printf("%02x", mac_cap[i]);
|
|
printf("):\n");
|
|
|
|
- PRINT_EHT_MAC_CAP(0, 0, "NSEP priority access Supported");
|
|
+ PRINT_EHT_MAC_CAP(0, 0, "EPCS Priority Access Supported");
|
|
PRINT_EHT_MAC_CAP(0, 1, "EHT OM Control Supported");
|
|
- PRINT_EHT_MAC_CAP(0, 2, "Triggered TXOP Sharing Supported");
|
|
- PRINT_EHT_MAC_CAP(0, 3, "ARR Supported");
|
|
+ PRINT_EHT_MAC_CAP(0, 2, "Triggered TXOP Sharing Mode 1 Supported");
|
|
+ PRINT_EHT_MAC_CAP(0, 3, "Triggered TXOP Sharing Mode 2 Supported");
|
|
+ PRINT_EHT_MAC_CAP(0, 4, "Restricted TWP Supported");
|
|
+ PRINT_EHT_MAC_CAP(0, 5, "SCS Traffic Description Supported");
|
|
+ PRINT_EHT_MAC_CAP_MASK(0, 6, 0x3, "Maximum MPDU Length");
|
|
+
|
|
+ PRINT_EHT_MAC_CAP(1, 1, "Maximum A_MPDU Length Exponent Extension");
|
|
+ PRINT_EHT_MAC_CAP(1, 2, "EHT TRS Supported");
|
|
+ PRINT_EHT_MAC_CAP(1, 3, "TXOP Return In TXOP Sharing Mode 2 Supported");
|
|
+ PRINT_EHT_MAC_CAP(1, 4, "Two BQRs Supported");
|
|
+ PRINT_EHT_MAC_CAP_MASK(1, 5, 0x3, "EHT Link Adaptation Supported");
|
|
|
|
- printf("%s\t\tEHT PHY Capabilities: (0x", pre);
|
|
- for (i = 0; i < 8; i++)
|
|
+ printf("%s\t\tEHT PHY Capabilities (0x", pre);
|
|
+ for (i = 0; i < 9; i++)
|
|
printf("%02x", ((__u8 *)phy_cap)[i]);
|
|
printf("):\n");
|
|
|
|
@@ -1594,39 +1604,77 @@ static void __print_eht_capa(int band,
|
|
PRINT_EHT_PHY_CAP(1, 28, "MU Beamformer (80MHz)");
|
|
PRINT_EHT_PHY_CAP(1, 29, "MU Beamformer (160MHz)");
|
|
PRINT_EHT_PHY_CAP(1, 30, "MU Beamformer (320MHz)");
|
|
+ PRINT_EHT_PHY_CAP(1, 31, "TB Sounding Feedback Rate Limit");
|
|
|
|
- printf("%s\t\tEHT MCS/NSS: (0x", pre);
|
|
- for (i = 0; i < mcs_len; i++)
|
|
- printf("%02x", ((__u8 *)mcs_set)[i]);
|
|
- printf("):\n");
|
|
+ PRINT_EHT_PHY_CAP(2, 0, "Rx 1024-QAM In Wider Bandwidth DL OFDMA Supported");
|
|
+ PRINT_EHT_PHY_CAP(2, 1, "Rx 4096-QAM In Wider Bandwidth DL OFDMA Supported");
|
|
|
|
- if (!(he_phy_cap[0] & ((BIT(2) | BIT(3) | BIT(4)) << 8))){
|
|
- for (i = 0; i < 4; i++)
|
|
- printf("%s\t\tEHT bw=20 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n",
|
|
- pre, mcs[i],
|
|
- mcs_set[i] & 0xf, mcs_set[i] >> 4);
|
|
+ if (!from_ap &&
|
|
+ !(he_phy_cap[0] & ((BIT(1) | BIT(2) | BIT(3) | BIT(4)) << 8))) {
|
|
+ static const char * const mcs[] = { "0-7", "8-9", "10-11", "12-13" };
|
|
+
|
|
+ printf("%s\t\tEHT-MCS Map (20 Mhz Non-AP STA) (0x", pre);
|
|
+ for (i = 0; i < mcs_len; i++)
|
|
+ printf("%02x", ((__u8 *)mcs_set)[i]);
|
|
+ printf("):\n");
|
|
+
|
|
+ for (i = 0; i < 4; i++) {
|
|
+ printf("%s\t\t\tRx Max NSS for MCS %s: %u\n",
|
|
+ pre, mcs[i], mcs_set[i] & 0xf);
|
|
+ printf("%s\t\t\tTx Max NSS for MCS %s: %u\n",
|
|
+ pre, mcs[i], mcs_set[i] >> 4);
|
|
+ }
|
|
} else {
|
|
- if (he_phy_cap[0] & (BIT(2) << 8)) {
|
|
+ static const char * const mcs[] = { "0-9", "10-11", "12-13"};
|
|
+
|
|
+ /* Bit 1 corresponds to 2.4Ghz 40Mhz support
|
|
+ * Bit 2 corresponds to 5/6Ghz 40 and 80Mhz support
|
|
+ * If no Channel Width bits are set, but we are an AP, we use
|
|
+ * this MCS logic also.
|
|
+ */
|
|
+ if (he_phy_cap[0] & ((BIT(1) | BIT(2)) << 8) ||
|
|
+ (from_ap && !(he_phy_cap[0] & ((BIT(1) | BIT(2) | BIT(3) | BIT(4)) << 8)))) {
|
|
+ printf("%s\t\tEHT-MCS Map (BW <= 80) (0x", pre);
|
|
for (i = 0; i < 3; i++)
|
|
- printf("%s\t\tEHT bw <= 80 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n",
|
|
- pre, mcs[i + 1],
|
|
- mcs_set[i] & 0xf, mcs_set[i] >> 4);
|
|
+ printf("%02x", ((__u8 *)mcs_set)[i]);
|
|
+ printf("):\n");
|
|
+
|
|
+ for (i = 0; i < 3; i++) {
|
|
+ printf("%s\t\t\tRx Max NSS for MCS %s: %u\n",
|
|
+ pre, mcs[i], mcs_set[i] & 0xf);
|
|
+ printf("%s\t\t\tTx Max NSS for MCS %s: %u\n",
|
|
+ pre, mcs[i], mcs_set[i] >> 4);
|
|
+ }
|
|
}
|
|
mcs_set += 3;
|
|
|
|
if (he_phy_cap[0] & (BIT(3) << 8)) {
|
|
+ printf("%s\t\tEHT-MCS Map (BW = 160) (0x", pre);
|
|
for (i = 0; i < 3; i++)
|
|
- printf("%s\t\tEHT bw=160 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n",
|
|
- pre, mcs[i + 1],
|
|
- mcs_set[i] & 0xf, mcs_set[i] >> 4);
|
|
+ printf("%02x", ((__u8 *)mcs_set)[i]);
|
|
+ printf("):\n");
|
|
+
|
|
+ for (i = 0; i < 3; i++) {
|
|
+ printf("%s\t\t\tRx Max NSS for MCS %s: %u\n",
|
|
+ pre, mcs[i], mcs_set[i] & 0xf);
|
|
+ printf("%s\t\t\tTx Max NSS for MCS %s: %u\n",
|
|
+ pre, mcs[i], mcs_set[i] >> 4);
|
|
+ }
|
|
}
|
|
|
|
mcs_set += 3;
|
|
if (band == NL80211_BAND_6GHZ && (phy_cap[0] & BIT(1))) {
|
|
+ printf("%s\t\tEHT-MCS Map (BW = 320) (0x", pre);
|
|
for (i = 0; i < 3; i++)
|
|
- printf("%s\t\tEHT bw=320 MHz, max NSS for MCS %s: Rx=%u, Tx=%u\n",
|
|
- pre, mcs[i + 1],
|
|
- mcs_set[i] & 0xf, mcs_set[i] >> 4);
|
|
+ printf("%02x", ((__u8 *)mcs_set)[i]);
|
|
+ printf("):\n");
|
|
+
|
|
+ for (i = 0; i < 3; i++) {
|
|
+ printf("%s\t\t\tRx Max NSS for MCS %s: %u\n",
|
|
+ pre, mcs[i], mcs_set[i] & 0xf);
|
|
+ printf("%s\t\t\tTx Max NSS for MCS %s: %u\n",
|
|
+ pre, mcs[i], mcs_set[i] >> 4);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -1713,7 +1761,29 @@ void print_eht_info(struct nlattr *nl_if
|
|
}
|
|
|
|
__print_eht_capa(band, mac_cap, phy_cap, mcs_set, mcs_len, ppet, ppet_len,
|
|
- he_phy_cap, true);
|
|
+ he_phy_cap, false, true);
|
|
+}
|
|
+
|
|
+void print_eht_capability(const uint8_t *ie, int len, const uint8_t *he_cap,
|
|
+ bool from_ap)
|
|
+{
|
|
+ const void *mac_cap, *phy_cap, *mcs_set, *he_phy_cap;
|
|
+ int mcs_len;
|
|
+ int i = 0;
|
|
+
|
|
+ mac_cap = &ie[i];
|
|
+ i += 2;
|
|
+
|
|
+ phy_cap = &ie[i];
|
|
+ i += 9;
|
|
+
|
|
+ mcs_set = &ie[i];
|
|
+ mcs_len = len - i;
|
|
+
|
|
+ he_phy_cap = &he_cap[6];
|
|
+
|
|
+ __print_eht_capa(NL80211_BAND_6GHZ, mac_cap, phy_cap, mcs_set, mcs_len,
|
|
+ NULL, 0, he_phy_cap - 1, from_ap, false);
|
|
}
|
|
|
|
void print_he_capability(const uint8_t *ie, int len)
|