wifi: brcmfmac: enable 2.4 GHz VHT on BCM4366 before AP bring-up
PATCH 1/1 wifi: brcmfmac: enable 2.4 GHz VHT on BCM4366 before AP bring-up
On BCM4366 firmware 10.28.2 (r769115) the 2.4 GHz radio defaults to vht_features 6: proprietary rates and 1024-QAM on, 2.4 GHz VHT off. brcmfmac never sets this iovar. As an AP the d11 PSM watchdog then fires repeatedly once a client passes traffic, the client disassociates and never completes DHCP. This renders the radio unusable as an AP.
On an ASUS RT-AC86U (BCM43666 2.4 GHz radio), with every other bring-up setting held fixed, values 0 and 6 fail and values 1 and 7 are stable, so bit 0 alone decides it. The ASUS firmware for this router sets 7.
Set bit 0, keeping the other bits, on the primary 2.4 GHz BSS of the 4366 family while the radio is still down. 5 GHz is left alone: it keeps 6 and is stable. This stabilizes 2.4GHz AP and clients now associate, DHCP and pass traffic at normal levels.
---
Tested on an ASUS RT-AC86U, firmware 10.28.2 (r769115), AP mode, 2.4 GHz channel 1 at 20 MHz, one client. The router runs OpenWrt on 6.12, so this is wireless-next brcmfmac at 991a73f49 built as a module with a small local shim for the older cfg80211 API (not part of this patch), not a wireless-next kernel. The two builds differ only by this patch:
with patch: vht_features 7, three speed test runs on one association,
no watchdog, DHCP completes, 560/155917 tx failed
without patch: vht_features 6, 16 PSM watchdogs in the first 102 s after
boot, client retries DHCP and gives up
5 GHz stays at 6 in both builds. One speed test run there was clean, with no tx failures and no watchdog.
The chip check covers the 4366
family, but only the 43666 2.4 GHz radio on this board has been tested.
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +32 -0
@@ -5253,6 +5253,36 @@ brcmf_parse_configure_security(struct brcmf_if *ifp,return err; } +#define BRCMF_VHT_FEATURES_2G_ENAB BIT(0) + +static void brcmf_cfg80211_4366_2g_vht (struct brcmf_if *ifp, +const struct cfg80211_chan_def *chandef) +{ +u32 chip = ifp->drvr->bus_if->chip; +u32 val, want; +s32 err; + +if (chandef->chan->band !=NL80211_BAND_2GHZ ) +return ; +if (chip !=BRCM_CC_4366_CHIP_ID && chip !=BRCM_CC_43664_CHIP_ID && + chip !=BRCM_CC_43666_CHIP_ID ) +return ; + err =brcmf_fil_iovar_int_get (ifp,"vht_features" , &val); +if (err <0 ) { +brcmf_dbg (INFO ,"vht_features get failed (%d)\n" , err); +return ; + } +if (val &BRCMF_VHT_FEATURES_2G_ENAB ) +return ; + want = val |BRCMF_VHT_FEATURES_2G_ENAB ; + err =brcmf_fil_iovar_int_set (ifp,"vht_features" , want); +if (err <0 ) +bphy_err (ifp->drvr,"vht_features 2.4 GHz enable failed (%d)\n" , + err); +else +brcmf_dbg (INFO ,"vht_features 0x%x -> 0x%x\n" , val, want); +} +static s32 brcmf_cfg80211_start_ap (struct wiphy *wiphy,struct net_device *ndev,struct cfg80211_ap_settings *settings)
@@ -5397,6 +5427,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, goto exit; } } +if (!mbss) +brcmf_cfg80211_4366_2g_vht (ifp, &settings->chandef); err =brcmf_fil_cmd_int_set (ifp,BRCMF_C_UP ,1 );if (err <0 ) {bphy_err (drvr,"BRCMF_C_UP error (%d)\n" , err);
base-commit: 991a73f4909f1348ffb4b38765cdb522a775e4c2
Signature · 1 line
2.47.3
Arend van Spriel
maintainerQuoted 5 lines · Jeff Campbell
On BCM4366 firmware 10.28.2 (r769115) the 2.4 GHz radio defaults to
vht_features6: proprietary rates and 1024-QAM on, 2.4 GHz VHT off. brcmfmac never sets this iovar. As an AP the d11 PSM watchdog then fires repeatedly once a client passes traffic, the client disassociates and never completes DHCP. This renders the radio unusable as an AP.
[...]
Quoted 4 lines
Set bit 0, keeping the other bits, on the primary 2.4 GHz BSS of the 4366 family while the radio is still down. 5 GHz is left alone: it keeps 6 and is stable. This stabilizes 2.4GHz AP and clients now associate, DHCP and pass traffic at normal levels.
[...]
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c brcmf_parse_configure_security(struct brcmf_if *ifp, · line 5269
Quoted 7 lines
--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+)drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +3
-0+if (chip !=BRCM_CC_4366_CHIP_ID && chip !=BRCM_CC_43664_CHIP_ID && + chip !=BRCM_CC_43666_CHIP_ID ) +return ;
Firmware 10.28.2 (r769115) is the version of both brcmfmac4366b-pcie.bin and brcmfmac4366c-pcie.bin in linux-firmware, so the firmware is covered. The radios are not: you tested the 43666 only (4366c image), while the change also applies to the 4366 and the 43664. Please mention in the commit message that the 4366 was not tested.
I ran this on a 43664 with the 4366c image. vht_features is 6 by default there as well and the patch sets it to 7 when the AP starts. A phone associates, gets DHCP, and the AP uses VHT rates (173 Mbit/s) on 2.4 GHz. What I could not reproduce is the failure without the patch: the AP started a minute after boot, on channel 6 at 20 MHz, ran 60 seconds of iperf3 in each direction with the stock driver and showed no PSM watchdog in the firmware console and no firmware halt. Which client and traffic pattern trigger the watchdog for you? Please add that to the commit message.
Also, bit 0 is the 2.4 GHz VHT enable. The firmware builds its own beacon from its settings and brcmfmac only parses a few IEs of the beacon that hostapd provides, so with this change the AP advertises VHT on 2.4 GHz even if hostapd is configured without VHT. Please say so in the commit message. If that is not acceptable, start_ap() already parses the beacon IEs, so bit 0 could be set only when hostapd provided a VHT Capabilities IE. That leaves a non-VHT AP at the values you found unstable, which would then need a different workaround.
[...]
Nit: "2.4GHz" should be "2.4 GHz" in the commit message.
Regards,
Arend