1: e30652dcb4d9 ! 1: 6f991be0f3f8 wifi: brcmfmac: keep ARP and ND offload off on the BCM4364 @@ Metadata Author: Andre Eikmeyer   ## Commit message ## - wifi: brcmfmac: keep ARP and ND offload off on the BCM4364 + wifi: brcmfmac: keep ARP and ND offload off on Apple BCM4355 and BCM4364  brcmfmac enables the firmware's ARP and IPv6 ND offload (ndoe) whenever the interface is up and not promiscuous. On the Apple firmware for the - BCM4364, ndoe makes IPv6 downloads collapse. IPv6 downloads topped out - at 55 Mbit/s on a MacBookPro15,1 with the BCM4364/3 and on the - MacBookPro16,1 with the later revision. The BCM4377 is not affected. + BCM4355 and BCM4364, ndoe makes downloads collapse.  - macOS enables ND offload for associated sleep only. A trace under - macOS 26.6.1 on a MacBookPro16,2 shows nd_hostip_clear, ndoe=1 and the - IPv6 addresses before sleep and ndoe cleared again on wake, see the - first report below. Keep them off on the BCM4364. + On the BCM4364, IPv6 downloads topped out at 55 Mbit/s on a + MacBookPro15,1 with the BCM4364/3 and on the MacBookPro16,1 with the + later revision [1][2]. On the BCM4355 of the MacBookAir8,1, downloads + fell to about 50 Mbit/s with the offload on and stayed at 300 to 400 + Mbit/s with it off, and the firmware logged errors several times a + second [3]. The BCM4377 is not affected.  + macOS enables ARP and ND offload for associated sleep only and clears + both on wake. ARP offload brings no benefit while awake, and without + WoWL brcmfmac disconnects on suspend on these Macs, so the offloads are + never used in sleep either. With ARP offload on, the firmware answers + from its own host IP table, and the host does not notice when that + table is stale. brcmfmac already turns both offloads off in promiscuous + mode and while a soft AP runs. + + Keep both off on these chips when the board type is an Apple one, + which runs the firmware the way macOS does while awake. + + [1] https://github.com/t2linux/kernel/issues/34 + [2] https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel/issues/227 + [3] https://github.com/t2linux/linux-t2-patches/pull/85 + + Fixes: 52f22fb21764 ("brcmfmac: add neighbor discovery offload ip address table configuration") + Cc: stable@vger.kernel.org Closes: https://github.com/t2linux/kernel/issues/34 Closes: https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel/issues/227 + Link: https://github.com/t2linux/linux-t2-patches/pull/85 Tested-by: Yossef Osman  Tested-by: Aditya Garg  + Co-developed-by: Aditya Garg  + Signed-off-by: Aditya Garg  Signed-off-by: Andre Eikmeyer   ## drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ## @@ drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c #include  #include   +@@ drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c: struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx) + return ifp; + } +  ++static bool brcmf_is_apple_nd_offload_broken(struct brcmf_pub *drvr) ++{ ++ const char *board_type = drvr->settings->board_type; ++ ++ if (!board_type || !strstarts(board_type, "apple,")) ++ return false; ++ ++ switch (drvr->bus_if->chip) { ++ case BRCM_CC_4355_CHIP_ID: ++ case BRCM_CC_4364_CHIP_ID: ++ return true; ++ default: ++ return false; ++ } ++} ++ + void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) + { + s32 err;  @@ drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c: void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) return; }  -+ /* With ND offload on while awake, the Apple firmware for the BCM4364 -+ * makes IPv6 downloads drop to low rates. macOS runs ARP and ND -+ * offload only in sleep, keep both off on this chip. ++ /* With ND offload on while awake, the Apple firmware for the BCM4355 ++ * and BCM4364 makes IPv6 downloads drop to low rates. macOS runs ARP ++ * and ND offload only in sleep, keep both off on these chips.  + */ -+ if (enable && ifp->drvr->bus_if->chip == BRCM_CC_4364_CHIP_ID) { -+ brcmf_dbg(TRACE, "Skip ARP/ND offload enable on BCM4364\n"); ++ if (enable && brcmf_is_apple_nd_offload_broken(ifp->drvr)) { ++ brcmf_dbg(TRACE, "Skip ARP/ND offload enable on Apple BCM%x\n", ++ ifp->drvr->bus_if->chip);  + enable = false;  + }  +