dwc_rxfinish_one() unloads the map of a received buffer and hands the
packet to the stack, then dma4_rxfinish_locked() maps the replacement
mbuf and panics if that fails, as a hole cannot be left in the ring.
The mapping could not fail while the DMA tags allowed any address. Now
that they are limited to the address width of the hardware, the buffers
above it need bounce pages, and the mapping, which never waits, fails
with ENOMEM when the bounce zone shared with the other devices has none
left.
Map the new mbuf in a spare map before the old buffer is released and
swap the maps on success. When the mapping fails, count an input drop
and keep the old buffer on the ring.
Fixes: 200b2faf4819 ("dwc: Limit the DMA of the QoS core to the address width of the hardware")
Reported by: llm-postcr
Tested on: Quartz64 Model A (RK3568) with 8GB of RAM, with a scratch
kernel that fails the mapping of 20 new buffers during a TCP transfer: no panic, 20 input drops counted, and the transfer went on at 22.9 MB/s at 816MHz (23 MB/s with the kernel before the change)