Re: [PATCH v2 4/5] wifi: brcmfmac: msgbuf: send the flowring delete without waiting for tx status
From: Arend van Spriel
Date: Thu Nov 26 2026 - 09:30:04 EST
On Wed, 11 Nov 2026 13:07:47 +0100, Andre Eikmeyer <dev@deq.rocks> wrote:
> The BCM4377 firmware returns the tx status of queued packets only when
> it gets the flowring delete request. brcmf_msgbuf_delete_flowring()
> waits up to 100 ms for them before it sends the request, so every
> disconnect logs a timeout, and the cleared counter goes below zero when
> the status arrives.
>
> The race the wait was added for in commit 0fa24196e425 ("wifi: brcmfmac:
> fix continuous 802.1x tx pending timeout error") is covered by
> RING_CLOSING since commit 09be7546a602 ("wifi: brcmfmac: fix scheduling
> while atomic issue when deleting flowring"), and late tx status still
> releases the packet. Send the delete right away and reset the counter
> when the ring is created.
>
> Signed-off-by: Andre Eikmeyer <dev@deq.rocks>
The race handled by 09be7546a602 is the posting side. What 0fa24196e425 also states
is that the flowring must be deleted only after all tx status is back, otherwise
pend_8021x_cnt never drains and every connection is delayed by 950 ms. Dropping the
wait is only safe if the firmware returns the tx status of the queued packets on
flowring delete, before the delete response. That was only observed on the BCM4377.
Would be good if this can be confirmed for other chips as well otherwise (probably)
better to keep the wait for those.
[...]
> ---
> .../broadcom/brcm80211/brcmfmac/msgbuf.c | 23 ++++++++-----------
> 1 file changed, 10 insertions(+), 13 deletions(-)
[...]
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
> @@ -73,7 +73,6 @@
> #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
> #define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48
>
> -#define BRCMF_MAX_TXSTATUS_WAIT_RETRIES 10
>
> struct msgbuf_common_hdr {
> u8 msgtype;
This leaves two consecutive blank lines before struct msgbuf_common_hdr.
[...]
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
> @@ -1471,23 +1475,16 @@ void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
> void *ret_ptr;
> u8 ifidx;
> int err;
> - int retry = BRCMF_MAX_TXSTATUS_WAIT_RETRIES;
>
> - /* make sure it is not in txflow */
> + /*
> + * Make sure txflow posts nothing more to the ring. The firmware returns
> + * the tx status of the posted packets when it deletes the ring, before
> + * it sends the delete response.
> + */
> brcmf_commonring_lock(commonring_del);
> flow->rings[flowid]->status = RING_CLOSING;
> brcmf_commonring_unlock(commonring_del);
>
> - /* wait for commonring txflow finished */
> - while (retry && atomic_read(&commonring_del->outstanding_tx)) {
> - usleep_range(5000, 10000);
> - retry--;
> - }
> - if (!retry) {
> - brcmf_err("timed out waiting for txstatus\n");
> - atomic_set(&commonring_del->outstanding_tx, 0);
> - }
> -
> /* no need to submit if firmware can not be reached */
> if (drvr->bus_if->state != BRCMF_BUS_UP) {
> brcmf_dbg(MSGBUF, "bus down, flowring will be removed\n");
As said above, I do not think the wait can go for all chips on the evidence of the
BCM4377 only. I will see if I can replicate this on my 43664 device.
Regards,
Arend