mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
The RX task's drain loop called emac_esp_dma_get_remain_frames() after every received frame, an O(backlog) walk of the descriptor ring with a cache invalidate per descriptor. Under sustained load the scan cost grows with the backlog, so the deeper the backlog gets, the more time goes into scanning instead of draining, until the task can no longer keep up and the DMA drops frames continuously (measured ~3000 missed frames/s at 16k pkt/s bidirectional on ESP32-P4 with 20 descriptors). The loop only needs to know whether at least one more complete frame is waiting, which emac_esp_dma_alloc_recv_buf() already answers by checking a single descriptor, so exit the loop on that instead. The full remain-frames count is kept only under CONFIG_ETH_SOFT_FLOW_CONTROL, which genuinely needs it for the pause-frame watermarks. Related to https://github.com/espressif/esp-idf/issues/18800