[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250405184807.701728-4-olek2@wp.pl>
Date: Sat, 5 Apr 2025 20:48:07 +0200
From: Aleksander Jan Bajkowski <olek2@...pl>
To: johannes@...solutions.net,
ilan.peer@...el.com,
christopher.a.wills@...el.com,
slakkavalli@...to.com,
john@...ozen.org,
linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Aleksander Jan Bajkowski <olek2@...pl>
Subject: [PATCH iw,v2 3/3] iw: fix EHT capabilities on Big Endian platforms
IE fields are encoded in Little Endian and are not correctly
printed on Big Endian platforms.
Fixes: 5a71b722270c ("iw: Print local EHT capabilities")
Signed-off-by: Aleksander Jan Bajkowski <olek2@...pl>
---
util.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/util.c b/util.c
index 1870393..f105e07 100644
--- a/util.c
+++ b/util.c
@@ -1538,21 +1538,24 @@ static void __print_eht_capa(int band,
const char *pre = indent ? "\t" : "";
const char *mcs[] = { "0-7", "8-9", "10-11", "12-13"};
- #define PRINT_EHT_CAP(_var, _idx, _bit, _str) \
+ #define PRINT_EHT_MAC_CAP(_idx, _bit, _str) \
do { \
- if (_var[_idx] & BIT(_bit)) \
+ if (le32toh(mac_cap[_idx]) & BIT(_bit)) \
printf("%s\t\t\t" _str "\n", pre); \
} while (0)
- #define PRINT_EHT_CAP_MASK(_var, _idx, _shift, _mask, _str) \
+ #define PRINT_EHT_PHY_CAP(_idx, _bit, _str) \
do { \
- if ((_var[_idx] >> _shift) & _mask) \
- printf("%s\t\t\t" _str ": %d\n", pre, (_var[_idx] >> _shift) & _mask); \
+ if (phy_cap[_idx] & BIT(_bit)) \
+ printf("%s\t\t\t" _str "\n", pre); \
} while (0)
- #define PRINT_EHT_MAC_CAP(...) PRINT_EHT_CAP(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__)
+ #define PRINT_EHT_PHY_CAP_MASK(_idx, _shift, _mask, _str) \
+ do { \
+ if ((le32toh(phy_cap[_idx]) >> _shift) & _mask) \
+ printf("%s\t\t\t" _str ": %d\n", pre, \
+ (le32toh(phy_cap[_idx]) >> _shift) & _mask); \
+ } while (0)
printf("%s\t\tEHT MAC Capabilities (0x", pre);
for (i = 0; i < 2; i++)
@@ -1617,13 +1620,13 @@ static void __print_eht_capa(int band,
printf("%02x", ((__u8 *)mcs_set)[i]);
printf("):\n");
- if (!(he_phy_cap[0] & ((BIT(2) | BIT(3) | BIT(4)) << 8))){
+ if (!(le16toh(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);
} else {
- if (he_phy_cap[0] & (BIT(2) << 8)) {
+ if (le16toh(he_phy_cap[0]) & (BIT(2) << 8)) {
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],
@@ -1631,7 +1634,7 @@ static void __print_eht_capa(int band,
}
mcs_set += 3;
- if (he_phy_cap[0] & (BIT(3) << 8)) {
+ if (le16toh(he_phy_cap[0]) & (BIT(3) << 8)) {
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],
@@ -1639,7 +1642,7 @@ static void __print_eht_capa(int band,
}
mcs_set += 3;
- if (band == NL80211_BAND_6GHZ && (phy_cap[0] & BIT(1))) {
+ if (band == NL80211_BAND_6GHZ && (le32toh(phy_cap[0]) & BIT(1))) {
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],
@@ -1647,7 +1650,7 @@ static void __print_eht_capa(int band,
}
}
- if (ppet && ppet_len && (phy_cap[1] & BIT(11))) {
+ if (ppet && ppet_len && (le32toh(phy_cap[1]) & BIT(11))) {
printf("%s\t\tEHT PPE Thresholds ", pre);
for (i = 0; i < ppet_len; i++)
if (ppet[i])
--
2.39.5
Powered by blists - more mailing lists