Conversation
RDES3.PL contains the total frame length only on the last RX descriptor. Using it for intermediate descriptors produces invalid linked-buffer lengths for frames spanning more than one DMA buffer. Use the configured RX buffer length for intermediate descriptors, and calculate the remaining frame length from PL only for the last descriptor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix the segment length passed by
HAL_ETH_ReadData()to the RX link callback when an STM32H7 Ethernet frame spans multiple DMA descriptors.The current implementation reads
RDES3.PLfor every descriptor. In the STM32H7 enhanced RX descriptor format,PLcontains the total frame length on the last descriptor; it is not the length of each intermediate segment. Consequently, a frame that occupies more than one RX DMA buffer can be linked with incorrect segment lengths and reconstructed incorrectly.This change:
heth->Init.RxBuffLenfor every non-last descriptor;PLonly on the last descriptor; andThe change is limited to the STM32H7 HAL Ethernet receive path.
Test Steps
Hardware-in-the-loop validation was performed on an STM32H745ZI using FreeRTOS+TCP with D-cache enabled. The RX DMA buffer size was reduced to 256 bytes so ordinary Ethernet frames crossed multiple RX descriptors. A Windows UDP echo validator compared every returned payload byte with the transmitted data.
The following tests passed without reported payload corruption or timeout:
Checklist:
Related Issue
N/A
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.