wifi: brcmfmac: disable TX beamforming on BCM4364
PATCH 1/1 wifi: brcmfmac: disable TX beamforming on 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.
Measured with iperf3 against a wired server on the same AP:
0.5 m from the AP, -36 dBm: 351 -> 623 Mbit/s uplink
-70 dBm: 96-130 -> 149-175 Mbit/s uplink
Downlink and latency are unchanged. I did not notice any refression.
---
The KaiT2en community runs this patch with its kernels, no regression was reported.
.../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +7 -2
@@ -10,6 +10,7 @@#include <linux/firmware.h> #include <brcmu_wifi.h> #include <brcmu_utils.h> +#include <brcm_hw_ids.h> #include "core.h" #include "bus.h" #include "debug.h"
@@ -450,8 +451,12 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) goto done; } -/* 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. +*/ + (void )brcmf_fil_iovar_int_set (ifp,"txbf" , + drvr->bus_if->chip !=BRCM_CC_4364_CHIP_ID ); done:return err; }
base-commit: 991a73f4909f1348ffb4b38765cdb522a775e4c2
Arend van Spriel
maintainerQuoted 11 lines · Andre Eikmeyer
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.
[...]
Tested-by Yossef Osman <[email protected]>Tested-by Aditya Garg <[email protected]>Signed-off-by Andre Eikmeyer <[email protected]>
[...]
Quoted 5 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +0
-1@@ -450,8 +451,12 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) goto done; } -/* Enable tx beamforming, errors can be ignored (not supported) */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) · line 462
Quoted 10 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +6
-1- (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. +*/ + (void )brcmf_fil_iovar_int_set (ifp,"txbf" , + drvr->bus_if->chip !=BRCM_CC_4364_CHIP_ID ); done:return err; }
The chip ID check has the same problem as in the ARP/ND offload patch [1]:
the issue is described as specific to the firmware shipped by Apple (9.30.514.0.32.5.94), but the quirk applies to every BCM4364. Please restrict it as suggested there.
Also, the comment says "Enable tx beamforming" while the code now conditionally disables it. Please make the code self-explanatory, e.g. a local variable or an explicit if (chip == BRCM_CC_4364_CHIP_ID) with the txbf value spelled out, instead of passing a bool expression as the iovar value.
Minor: typo "refression" in the commit message, and the subject lacks the target tree (wireless-next) which wifibot flagged.
Since this is a throughput quirk (not a fix) I would also like to know whether TX beamforming is functional at all on the BCM4364 or just mis-selected by rate control, so the commit message can state the actual root cause.
[1] https://lore.kernel.org/all/[email protected]/
Regards,
Arend
Quoted 46 lines · Arend van Spriel
Quoted 11 lines · Andre Eikmeyer
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.
[...]
Tested-by Yossef Osman <[email protected]>Tested-by Aditya Garg <[email protected]>Signed-off-by Andre Eikmeyer <[email protected]>[...]
Quoted 13 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +6
-2@@ -450,8 +451,12 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) goto done; } -/* 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. +*/ + (void )brcmf_fil_iovar_int_set (ifp,"txbf" , + drvr->bus_if->chip !=BRCM_CC_4364_CHIP_ID );done:
Quoted 2 lines
return err; }The chip ID check has the same problem as in the ARP/ND offload patch [1]:
the issue is described as specific to the firmware shipped by Apple (9.30.514.0.32.5.94), but the quirk applies to every BCM4364. Please restrict it as suggested there.Also, the comment says "Enable tx beamforming" while the code now conditionally disables it. Please make the code self-explanatory, e.g. a local variable or an explicit if (chip ==
BRCM_CC_4364_CHIP_ID) with the txbf value spelled out, instead of passing a bool expression as the iovar value.
Quoted 7 lines
Minor: typo "refression" in the commit message, and the subject lacks the target tree (wireless-next) which wifibot flagged.
Since this is a throughput quirk (not a fix) I would also like to know whether TX beamforming is functional at all on the BCM4364 or just mis-selected by rate control, so the commit message can state the actual root cause.
Unrelated but Airdrop conversation seems to have been stalled :(.
Arend van Spriel
maintainerQuoted 49 lines · Aditya Garg
Quoted 49 lines · Arend van Spriel
Quoted 11 lines · Andre Eikmeyer
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.
[...]
Tested-by Yossef Osman <[email protected]>Tested-by Aditya Garg <[email protected]>Signed-off-by Andre Eikmeyer <[email protected]>[...]
Quoted 13 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +6
-2@@ -450,8 +451,12 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) goto done; } -/* 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. +*/ + (void )brcmf_fil_iovar_int_set (ifp,"txbf" , + drvr->bus_if->chip !=BRCM_CC_4364_CHIP_ID );done:
Quoted 2 lines
return err; }The chip ID check has the same problem as in the ARP/ND offload patch [1]:
the issue is described as specific to the firmware shipped by Apple (9.30.514.0.32.5.94), but the quirk applies to every BCM4364. Please restrict it as suggested there.Also, the comment says "Enable tx beamforming" while the code now conditionally disables it. Please make the code self-explanatory, e.g. a local variable or an explicit if (chip ==
BRCM_CC_4364_CHIP_ID) with the txbf value spelled out, instead of passing a bool expression as the iovar value.Minor: typo "refression" in the commit message, and the subject lacks the target tree (wireless-next) which wifibot flagged.
Quoted 6 lines
Quoted 4 lines
Since this is a throughput quirk (not a fix) I would also like to know whether TX beamforming is functional at all on the BCM4364 or just mis-selected by rate control, so the commit message can state the actual root cause.
Unrelated but Airdrop conversation seems to have been stalled :(.
Indeed unrelated so let me respond to your earlier email that was more on the subject.
Regards,
Arend
PATCH v2 1/1 wifi: brcmfmac: turn off TX beamforming on Apple BCM4364
In reply to Andre Eikmeyerbrcmfmac 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.
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.
Uplink measured with iperf3 against a wired server was:
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.
---
Changes in v2:
- Restrict the quirk to Apple boards with settings->board_type
- Spell out the txbf value with an explicit if and fix the comment
- State the cause. Beamforming more than one stream does not work
- Fix the typo
- Target wireless-next
- v1: https://lore.kernel.org/all/[email protected]/
The T2 Linux community runs this patch with its kernels for quite a while now, no regression was reported.
.../wireless/broadcom/brcm80211/brcmfmac/common.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +13 -2
@@ -10,6 +10,7 @@#include <linux/firmware.h> #include <brcmu_wifi.h> #include <brcmu_utils.h> +#include <brcm_hw_ids.h> #include "core.h" #include "bus.h" #include "debug.h"
@@ -275,6 +276,7 @@ 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)) {
@@ -432,8 +434,17 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) goto done; } -/* 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). +* 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. +*/ + 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; }
base-commit: 5dbf2415ca9821a611d09308e3b29d2c37e7cd77
Signature · 1 line
2.56.0