Re: ath12k: handling of HE and EHT capabilities
From: Alexander Wilhelm
Date: Fri Mar 13 2026 - 03:46:46 EST
On Thu, Mar 12, 2026 at 02:00:21PM +0100, Alexander Wilhelm wrote:
> On Thu, Mar 12, 2026 at 01:10:21PM +0100, Johannes Berg wrote:
> > Wait ...
> >
> > > > I don’t see this in the function. For example, the MAC capabilities are a
> > > > `u16 *` in CPU endianness, which is simply memcpy’d from the parsed
> > > > `NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC`. Later, they are treated as `u16 *`,
> > > > as shown in the following code:
> > > >
> > > > printf("%s\t\tHE MAC Capabilities (0x", pre);
> > > > for (i = 0; i < 3; i++)
> > > > printf("%04x", mac_cap[i]);
> > > > printf("):\n");
> >
> > That's incorrect for sure. But iw code now actually reads
> >
> > printf("%s\t\tHE MAC Capabilities (0x", pre);
> > for (i = 0; i < 3; i++)
> > printf("%04x", le16toh(mac_cap[i]));
> > printf("):\n");
> >
> >
> > which is correct. HE PHY capabilities are printed as
> >
> > printf("%s\t\tHE PHY Capabilities: (0x", pre);
> > for (i = 0; i < 11; i++)
> > printf("%02x", ((__u8 *)phy_cap)[i + 1]);
> >
> > in my version of the code, and it seems to me the +1 is incorrect either
> > way?
> >
> > > printf("%s\t\tEHT MAC Capabilities (0x", pre);
> > > for (i = 0; i < 2; i++)
> > > printf("%02x", mac_cap[i]);
> >
> > This was also correct, not incorrect as I stated, since mac_cap is u8 *,
> > and EHT PHY capabilities are cast to u8 * first.
> >
> > Maybe your iw is just really old?
>
> Sorry, my fault. I'm using `OpenWrt v24.10.5` with `iw` version 6.9. The
> latest master has the `le16toh` implemented. With my `ath12k` fix the PHY
> capabilities and the respecitve descriptions are fine now. But I still
> cannot get MAC capabilities correct. I'll analyze it further.
Hi Johannes,
I finally have `ath12k` running with the correct capabilities. The latest
`iw` version also performs the byte swaps correctly, except for the HE MAC
capabilities output. There, each 2‑byte pair is swapped between big‑endian
and little‑endian platforms. I’m sending a patch to make this consistent
across all architectures. Thank you for the support.
Best regards
Alexander Wilhelm