mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-26 15:03:53 +01:00
cpu/stm32: Fix reception bug in periph_eth
The reception code hands RX DMA descriptors back to the DMA right after its contents were copied into the network stack internal buffer. This increases the odds that the DMA never runs out of DMA descriptors to fill, even under high load. However, the loop fetching the Ethernet frame stops to iterate at the end of the frame. If the DMA used one more descriptor to store the FCS, this was not returned back to the DMA. This commit fixes it.
This commit is contained in:
parent
7ced6a8ac8
commit
45dc86acce
@ -652,6 +652,13 @@ static int stm32_eth_recv(netdev_t *netdev, void *buf, size_t max_len,
|
||||
rx_curr = rx_curr->desc_next;
|
||||
}
|
||||
|
||||
if ((size + ETHERNET_FCS_LEN - 1) % ETH_RX_BUFFER_SIZE < ETHERNET_FCS_LEN) {
|
||||
/* one additional rx descriptor was needed only for the FCS, hand that
|
||||
* back to the DMA as well */
|
||||
rx_curr->status = RX_DESC_STAT_OWN;
|
||||
rx_curr = rx_curr->desc_next;
|
||||
}
|
||||
|
||||
_debug_rx_descriptor_info(__LINE__);
|
||||
handle_lost_rx_irqs();
|
||||
return size;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user