[riot-notifications] [RIOT-OS/RIOT] drivers/stm32_eth: add RX timestamps (#15610)

Marian Buschsieweke notifications at github.com
Mon Jan 25 22:22:16 CET 2021


@maribu commented on this pull request.



> -        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 */
+    while (1) {
+        /* there can be more DMA descriptors than needed for holding the Ethernet
+         * payload, as the 4 byte FCS will also be stored by DMA */
+        if (remain) {
+            size_t chunk = MIN(remain, ETH_RX_BUFFER_SIZE);
+            memcpy(buf, rx_curr->buffer_addr, chunk);
+            buf += chunk;
+            remain -= chunk;
+        }
+        if (rx_curr->status & RX_DESC_STAT_LS) {

It is set by the DMA on the last chunk of one Ethernet Frame. Previously, the driver relied on the size for terminating the loop (plus some special case handling for when the 4 byte FCS overflowed the last chunk, resulting in one DMA buffer more being used). This should actually be more bullet proof, at least when trusting the DMA to correctly mark the last chunk.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15610#discussion_r564051627
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210125/77c66c43/attachment.htm>


More information about the notifications mailing list