linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: reserve tx credit only when txctl is ready to send
@ 2020-08-13  7:00 Wright Feng
  2020-08-13 10:57 ` Kalle Valo
  2020-08-18 14:33 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Wright Feng @ 2020-08-13  7:00 UTC (permalink / raw)
  To: linux-wireless
  Cc: wright.feng, brcm80211-dev-list, brcm80211-dev-list,
	Arend van Spriel, Franky Lin, Hante Meuleman, Kalle Valo,
	chi-hsien.lin, Dmitry Osipenko

The 4329 throughput drops from 40.2 Mbits/sec to 190 Kbits/sec in 2G
11n mode because the commit b41c232d33666 ("brcmfmac: reserve 2 credits
for host tx control path"). To fix the issue, host driver only reserves
tx control credit when there is a txctl frame is pending to send. And
we also check available credit by using "not equal to 0" instead of
"greater than 0" because tx_max and tx_seq are circled positive numbers.

Reported-by: Dmitry Osipenko <digetx@gmail.com>
Fixes: b41c232d33666 ("brcmfmac: reserve 2 credits for host tx control
path")
Signed-off-by: Wright Feng <wright.feng@cypress.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c  | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index e8712ad3ac45..3c07d1bbe1c6 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -664,9 +664,15 @@ 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 */
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] brcmfmac: reserve tx credit only when txctl is ready to send
  2020-08-13  7:00 [PATCH] brcmfmac: reserve tx credit only when txctl is ready to send Wright Feng
@ 2020-08-13 10:57 ` Kalle Valo
  2020-08-18 14:33 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-08-13 10:57 UTC (permalink / raw)
  To: Wright Feng
  Cc: linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	Arend van Spriel, Franky Lin, Hante Meuleman, chi-hsien.lin,
	Dmitry Osipenko

Wright Feng <wright.feng@cypress.com> writes:

> The 4329 throughput drops from 40.2 Mbits/sec to 190 Kbits/sec in 2G
> 11n mode because the commit b41c232d33666 ("brcmfmac: reserve 2 credits
> for host tx control path"). To fix the issue, host driver only reserves
> tx control credit when there is a txctl frame is pending to send. And
> we also check available credit by using "not equal to 0" instead of
> "greater than 0" because tx_max and tx_seq are circled positive numbers.
>
> Reported-by: Dmitry Osipenko <digetx@gmail.com>
> Fixes: b41c232d33666 ("brcmfmac: reserve 2 credits for host tx control
> path")

Fixes tag should be in one line, but I can fix it.

> Signed-off-by: Wright Feng <wright.feng@cypress.com>
> Tested-by: Dmitry Osipenko <digetx@gmail.com>

And I'll queue this to v5.9.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] brcmfmac: reserve tx credit only when txctl is ready to send
  2020-08-13  7:00 [PATCH] brcmfmac: reserve tx credit only when txctl is ready to send Wright Feng
  2020-08-13 10:57 ` Kalle Valo
@ 2020-08-18 14:33 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-08-18 14:33 UTC (permalink / raw)
  To: Wright Feng
  Cc: linux-wireless, wright.feng, brcm80211-dev-list,
	brcm80211-dev-list, Arend van Spriel, Franky Lin, Hante Meuleman,
	chi-hsien.lin, Dmitry Osipenko

Wright Feng <wright.feng@cypress.com> wrote:

> The 4329 throughput drops from 40.2 Mbits/sec to 190 Kbits/sec in 2G
> 11n mode because the commit b41c232d33666 ("brcmfmac: reserve 2 credits
> for host tx control path"). To fix the issue, host driver only reserves
> tx control credit when there is a txctl frame is pending to send. And
> we also check available credit by using "not equal to 0" instead of
> "greater than 0" because tx_max and tx_seq are circled positive numbers.
> 
> Reported-by: Dmitry Osipenko <digetx@gmail.com>
> Fixes: b41c232d33666 ("brcmfmac: reserve 2 credits for host tx control path")
> Signed-off-by: Wright Feng <wright.feng@cypress.com>
> Tested-by: Dmitry Osipenko <digetx@gmail.com>

Patch applied to wireless-drivers.git, thanks.

9a2a0862d973 brcmfmac: reserve tx credit only when txctl is ready to send

-- 
https://patchwork.kernel.org/patch/11711809/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-18 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13  7:00 [PATCH] brcmfmac: reserve tx credit only when txctl is ready to send Wright Feng
2020-08-13 10:57 ` Kalle Valo
2020-08-18 14:33 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).