Repository navigation
wifi: brcmfmac: msgbuf: leave one rx packet ID of slack for the refill - #235
Conversation
The rx packet IDs are shared by the data, ioctl response and event buffers. max_rxbufpost is capped so that the data buffers get IDs nr_ctrl + 1 .. NR_RX_PKTIDS - 1, exactly as many IDs as buffers that may be posted. That is one too few when the ring is refilled. brcmf_msgbuf_process_rx_complete() calls brcmf_msgbuf_update_rxbufpost_count() before it frees the completed buffer's ID with brcmf_msgbuf_get_pktid(). When the posted count drops to max_rxbufpost - BRCMF_MSGBUF_RXBUFPOST_THRESHOLD, the refill tries to post 32 buffers while the buffer being completed still holds its ID, so only 31 IDs are free and the 32nd allocation fails with "No PKTID available". The refill posts 31 and logs, and the retry for the last buffer logs again. The posted count then sits one under the cap, so the next refill, 31 completions later, is short the same way: two lines for every 31 received buffers. On a BCM4398 (Pixel 8 Pro) a 300 MB download produced one "No PKTID available !!" line per 15.7 received packets (13,250 lines for 208,529 packets); the refill reading predicts one per 15.5. I saw no throughput problem, which fits: each short refill leaves at most one buffer unposted. Cap max_rxbufpost one lower so a full refill always finds an ID. Signed-off-by: Lef <me@lefteros.com>
|
Thank you, @Somnius, for splitting this out so cleanly, and for the Your note that you hadn't booted this exact rebase: the On my 7 Pro: I built One optional thing, only if you're touching it anyway: a I'll merge it as it is. Thanks again! |
This is the one-line packet-ID slack from the thread on #156, as its own PR now that #187 landed with the msgbuf commits. @derekross, @greenbrettmichael and @W4HO-ham, it goes right after "msgbuf: give control buffers the lowest packet IDs".
Without it the BCM4398 on the 8 Pro logs "No PKTID available !!" about once per 15.7 received packets (13,250 lines for 208,529 packets in a 300 MB download), because a refill needs N free IDs while the completed buffer still holds one. The change caps max_rxbufpost one lower (NR_RX_PKTIDS - 2), with a comment saying why. On my 8 Pro four runs of the same download gave 0 new lines (details in #156 (comment)), with the same packet counts and about the same time. On the 7 Pro it changes nothing, its firmware asks for 1535 buffers, so the min_t still picks 1535 (as @derekross worked out, #156 (comment)).
What I checked on this rebased commit: it's cherry-picked unchanged onto current omamobile (1a882ca), checkpatch --strict is clean, and msgbuf.o builds with W=1 and no warnings (clang r547379, my test kernel's config). What I haven't done is boot a kernel built from this exact rebase: the four runs above were on my earlier e1 tree with the same one-line change.