12.08.2020 07:03, Wright Feng пишет: ... > Hi Dmitry, > > The last time the drivers I used is v5.4 and I was not able to see low > throughput issue as you saw. > At this time, I changed the base to tag wt-2020-0727 and I am able to > reproduce the issue as you did. > TX throughput with wt-2020-07-27 FMAC is 190 Kbits/sec > > > The root cause should be that tx_max and tx_seq are circle positive > numbers, it should not use ">" to check if it still exists available TX > credit. > With the solution below, I am able to get the normal throughput. > TX throughput with wt-2020-07-27+patch FMAC is 40.0 Mbits/sec > > Regarding another case about 40Mbit/s, I am using 4329b0(4329/2) chip to > verify the throughput because we are not able to find 4329b1(4329/3) > which is very old product around 10 years ago. > The firmware I am using is the same version but the build is for 4329b0. > (private internal build - 4.220.48). My host platform is x86_64 with 4 > cores on Linux kernel 4.12. I will try your NVRAM when I have time to > see if I can find anything. > > --- > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c > b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c > index e8712ad..50c8107 100644 > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c > @@ -664,9 +664,14 @@ static void pkt_align(struct sk_buff *p, int len, > int align) > /* To check if there's window offered */ > static bool data_ok(struct brcmf_sdio *bus) > { > - /* Reserve TXCTL_CREDITS credits for txctl */ > - return (bus->tx_max - bus->tx_seq) > TXCTL_CREDITS && > - ((bus->tx_max - bus->tx_seq) & 0x80) == 0; > + u8 tx_rsv = 0; > + > + /* Reserve TXCTL_CREDITS credits for txctl when it is ready to send */ > + if (bus->ctrl_frame_stat) > + tx_rsv = TXCTL_CREDITS; > + > + return (bus->tx_max - bus->tx_seq - tx_rsv) != 0 && > + ((bus->tx_max - bus->tx_seq - tx_rsv) & 0x80) == 0; > } > > /* To check if there's window offered */ > --- Wright, thank you very much for the patch! It fixes the problem! Tested-by: Dmitry Osipenko <digetx@xxxxxxxxx> The 4329/3 is indeed an older chip, but it's also an "old" device (Acer A500 tablet from 2011/12) that I'm using. Upstream v5.9 kernel just got support for the A500. There are quite a lot of other older devices with 4329/3 in a wild that are still very usable if user can wipe off ancient Android and put a modern Linux distro on them. Today that A500 tablet is still rocking hard running a modern upstream kernel, opensource drivers and KDE Plasma 5. The 15Mbit is a good enough speed for a lot of things, but of course 40Mbit will be better. Would be great if you could try to help with improving the speed :) Please feel free to contact me at any time if you'll have patches to try!