* [PATCH iw,v2 0/3] iw: fix HE and EHT information on Big Endian platformas
@ 2025-04-05 18:48 Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 1/3] iw: fix HE capabilities on Big Endian platforms Aleksander Jan Bajkowski
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Aleksander Jan Bajkowski @ 2025-04-05 18:48 UTC (permalink / raw)
To: johannes, ilan.peer, christopher.a.wills, slakkavalli, john,
linux-wireless, linux-kernel
Cc: Aleksander Jan Bajkowski
IE fields are encoded in Little Endian and are not correctly
printed on Big Endian platforms.
v2:
- added EHT capabilities patch
- minor code formatting changes
Aleksander Jan Bajkowski (3):
iw: fix HE capabilities on Big Endian platforms
iw: fix HE operation on Big Endian platforms
iw: fix EHT capabilities on Big Endian platforms
util.c | 50 +++++++++++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 23 deletions(-)
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH iw,v2 1/3] iw: fix HE capabilities on Big Endian platforms
2025-04-05 18:48 [PATCH iw,v2 0/3] iw: fix HE and EHT information on Big Endian platformas Aleksander Jan Bajkowski
@ 2025-04-05 18:48 ` Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 2/3] iw: fix HE operation " Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 3/3] iw: fix EHT capabilities " Aleksander Jan Bajkowski
2 siblings, 0 replies; 5+ messages in thread
From: Aleksander Jan Bajkowski @ 2025-04-05 18:48 UTC (permalink / raw)
To: johannes, ilan.peer, christopher.a.wills, slakkavalli, john,
linux-wireless, linux-kernel
Cc: Aleksander Jan Bajkowski
IE fields are encoded in Little Endian and are not correctly
printed on Big Endian platforms.
Fixes: c741be9f6ca3 ("iw: print HE capabilities")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
---
util.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/util.c b/util.c
index dc84886..6502788 100644
--- a/util.c
+++ b/util.c
@@ -1262,14 +1262,15 @@ static void __print_he_capa(const __u16 *mac_cap,
#define PRINT_HE_CAP(_var, _idx, _bit, _str) \
do { \
- if (_var[_idx] & BIT(_bit)) \
+ if (le16toh(_var[_idx]) & BIT(_bit)) \
printf("%s\t\t\t" _str "\n", pre); \
} while (0)
#define PRINT_HE_CAP_MASK(_var, _idx, _shift, _mask, _str) \
do { \
- if ((_var[_idx] >> _shift) & _mask) \
- printf("%s\t\t\t" _str ": %d\n", pre, (_var[_idx] >> _shift) & _mask); \
+ if ((le16toh(_var[_idx]) >> _shift) & _mask) \
+ printf("%s\t\t\t" _str ": %d\n", pre, \
+ (le16toh(_var[_idx]) >> _shift) & _mask); \
} while (0)
#define PRINT_HE_MAC_CAP(...) PRINT_HE_CAP(mac_cap, __VA_ARGS__)
@@ -1280,7 +1281,7 @@ static void __print_he_capa(const __u16 *mac_cap,
printf("%s\t\tHE MAC Capabilities (0x", pre);
for (i = 0; i < 3; i++)
- printf("%04x", mac_cap[i]);
+ printf("%04x", le16toh(mac_cap[i]));
printf("):\n");
PRINT_HE_MAC_CAP(0, 0, "+HTC HE Supported");
@@ -1394,18 +1395,18 @@ static void __print_he_capa(const __u16 *mac_cap,
char *bw[] = { "<= 80", "160", "80+80" };
int j;
- if ((phy_cap[0] & (phy_cap_support[i] << 8)) == 0)
+ if ((le16toh(phy_cap[0]) & (phy_cap_support[i] << 8)) == 0)
continue;
/* Supports more, but overflow? Abort. */
- if ((i * 2 + 2) * sizeof(mcs_set[0]) >= mcs_len)
+ if ((i * 2 + 2) * sizeof(le16toh(mcs_set[0])) >= mcs_len)
return;
for (j = 0; j < 2; j++) {
int k;
printf("%s\t\tHE %s MCS and NSS set %s MHz\n", pre, j ? "TX" : "RX", bw[i]);
for (k = 0; k < 8; k++) {
- __u16 mcs = mcs_set[(i * 2) + j];
+ __u16 mcs = le16toh(mcs_set[(i * 2) + j]);
mcs >>= k * 2;
mcs &= 0x3;
printf("%s\t\t\t%d streams: ", pre, k + 1);
@@ -1428,7 +1429,7 @@ static void __print_he_capa(const __u16 *mac_cap,
ppet_len = 0;
}
- if (ppet_len && (phy_cap[3] & BIT(15))) {
+ if (ppet_len && (le16toh(phy_cap[3]) & BIT(15))) {
printf("%s\t\tPPE Threshold ", pre);
for (i = 0; i < ppet_len; i++)
if (ppet[i])
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH iw,v2 2/3] iw: fix HE operation on Big Endian platforms
2025-04-05 18:48 [PATCH iw,v2 0/3] iw: fix HE and EHT information on Big Endian platformas Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 1/3] iw: fix HE capabilities on Big Endian platforms Aleksander Jan Bajkowski
@ 2025-04-05 18:48 ` Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 3/3] iw: fix EHT capabilities " Aleksander Jan Bajkowski
2 siblings, 0 replies; 5+ messages in thread
From: Aleksander Jan Bajkowski @ 2025-04-05 18:48 UTC (permalink / raw)
To: johannes, ilan.peer, christopher.a.wills, slakkavalli, john,
linux-wireless, linux-kernel
Cc: Aleksander Jan Bajkowski
IE fields are encoded in Little Endian and are not correctly
printed on Big Endian platforms.
Fixes: 422419e06d55 ("scan: Add printing of HE Operation Element")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
---
util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util.c b/util.c
index 6502788..1870393 100644
--- a/util.c
+++ b/util.c
@@ -1755,7 +1755,7 @@ void print_he_operation(const uint8_t *ie, int len)
{
uint8_t oper_parameters[3] = {ie[0], ie[1], ie[2] };
uint8_t bss_color = ie[3];
- uint16_t nss_mcs_set = *(uint16_t*)(&ie[4]);
+ uint16_t nss_mcs_set = le16toh(*(uint16_t *)(&ie[4]));
uint8_t vht_oper_present = oper_parameters[1] & 0x40;
uint8_t co_hosted_bss_present = oper_parameters[1] & 0x80;
uint8_t uhb_operation_info_present = oper_parameters[2] & 0x02;
@@ -1768,7 +1768,7 @@ void print_he_operation(const uint8_t *ie, int len)
printf("\t\t\tTWT Required\n");
printf("\t\t\tTXOP Duration RTS Threshold: %hu\n",
- (*(uint16_t*)(oper_parameters)) >> 4 & 0x03ff);
+ le16toh((*(uint16_t *)(oper_parameters))) >> 4 & 0x03ff);
if (oper_parameters[1] & 0x40)
printf("\t\t\tVHT Operation Information Present\n");
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH iw,v2 3/3] iw: fix EHT capabilities on Big Endian platforms
2025-04-05 18:48 [PATCH iw,v2 0/3] iw: fix HE and EHT information on Big Endian platformas Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 1/3] iw: fix HE capabilities on Big Endian platforms Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 2/3] iw: fix HE operation " Aleksander Jan Bajkowski
@ 2025-04-05 18:48 ` Aleksander Jan Bajkowski
2025-04-23 14:42 ` Johannes Berg
2 siblings, 1 reply; 5+ messages in thread
From: Aleksander Jan Bajkowski @ 2025-04-05 18:48 UTC (permalink / raw)
To: johannes, ilan.peer, christopher.a.wills, slakkavalli, john,
linux-wireless, linux-kernel
Cc: Aleksander Jan Bajkowski
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@wp.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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iw,v2 3/3] iw: fix EHT capabilities on Big Endian platforms
2025-04-05 18:48 ` [PATCH iw,v2 3/3] iw: fix EHT capabilities " Aleksander Jan Bajkowski
@ 2025-04-23 14:42 ` Johannes Berg
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2025-04-23 14:42 UTC (permalink / raw)
To: Aleksander Jan Bajkowski, ilan.peer, christopher.a.wills,
slakkavalli, john, linux-wireless, linux-kernel
On Sat, 2025-04-05 at 20:48 +0200, Aleksander Jan Bajkowski wrote:
> IE fields are encoded in Little Endian and are not correctly
> printed on Big Endian platforms.
>
I applied some other patches, and this didn't apply any more. Please
rebase and resend.
I did apply the other two.
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-23 14:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-05 18:48 [PATCH iw,v2 0/3] iw: fix HE and EHT information on Big Endian platformas Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 1/3] iw: fix HE capabilities on Big Endian platforms Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 2/3] iw: fix HE operation " Aleksander Jan Bajkowski
2025-04-05 18:48 ` [PATCH iw,v2 3/3] iw: fix EHT capabilities " Aleksander Jan Bajkowski
2025-04-23 14:42 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®