1: f6a334a32935 ! 1: 83fe4ce588cf wifi: brcmfmac: disable TX beamforming on BCM4364 @@ Metadata Author: Andre Eikmeyer   ## Commit message ## - wifi: brcmfmac: disable TX beamforming on BCM4364 + wifi: brcmfmac: turn off TX beamforming on Apple BCM4364  - With "txbf" enabled, the BCM4364 firmware (9.30.514.0.32.5.94, as shipped - by Apple for the MacBookPro15,1) transmits a single beamformed spatial - stream (nrate VHT MCS9 NSS1 TXBF) towards a two stream AP. With "txbf" - cleared it picks two streams (VHT MCS9 NSS2) on its own. The firmware - enables "txbf" by default, so the driver has to clear it. + brcmfmac sets "txbf" to 1 at init. The Apple firmware for the BCM4364 + (9.30.514.0.32.5.94 on the MacBookPro15,1) has it on by default as + well, and then rate control settles on a single beamformed spatial + stream (nrate VHT MCS9 NSS1 TXBF) towards a two stream AP.  - Measured with iperf3 against a wired server on the same AP: + Beamforming more than one stream does not work on this firmware. With + "txbf" on and the rate fixed to two or three streams, the firmware takes + the rate but the uplink stalls. With "txbf" off, rate control picks two + streams (VHT MCS9 NSS2) on its own.  - 0.5 m from the AP, -36 dBm: 351 -> 623 Mbit/s uplink - -70 dBm: 96-130 -> 149-175 Mbit/s uplink + Uplink measured with iperf3 against a wired server was:  - Downlink and latency are unchanged. I did not notice any refression. + 0.5 m from the AP, -36 dBm: 351 -> 623 Mbit/s + -70 dBm: 96-130 -> 149-175 Mbit/s + + Downlink and latency remain unchanged. + + Set "txbf" to 0 on the BCM4364 when the board type is an Apple one.  Tested-by: Yossef Osman  Tested-by: Aditya Garg  @@ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c #include "core.h" #include "bus.h" #include "debug.h" +@@ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c: int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) + struct brcmf_rev_info *ri; + char *clmver; + char *ptr; ++ s32 txbf; + s32 err; +  + if (is_valid_ether_addr(ifp->mac_addr)) {  @@ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c: int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) goto done; } @@ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c: int brcmf_c_preinit_d  - /* Enable tx beamforming, errors can be ignored (not supported) */  - (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1);  + /* Enable tx beamforming, errors can be ignored (not supported). -+ * BCM4364 firmware enables it by default and then transmits a single -+ * beamformed stream instead of two, halving its uplink throughput. ++ * The Apple firmware for the BCM4364 has it on by default and then ++ * beamforms a single spatial stream, as beamforming more than one ++ * stream does not work. Turn it off there, so two streams are used.  + */ -+ (void)brcmf_fil_iovar_int_set(ifp, "txbf", -+ drvr->bus_if->chip != BRCM_CC_4364_CHIP_ID); ++ txbf = 1; ++ if (drvr->bus_if->chip == BRCM_CC_4364_CHIP_ID && ++ drvr->settings->board_type && ++ strstarts(drvr->settings->board_type, "apple,")) ++ txbf = 0; ++ (void)brcmf_fil_iovar_int_set(ifp, "txbf", txbf); done: return err; }