STM32H legacy driver fix: request usable RX size in legacy zero-copy - #1328
Conversation
htibosch
left a comment
There was a problem hiding this comment.
Thank you @liteStefanoUgolini for this PR. I approve it.
| uxLength = ETH_RX_BUF_SIZE; | ||
| /* Request the usable Ethernet payload area, excluding the descriptor | ||
| * metadata stored in front of pucEthernetBuffer. */ | ||
| uxLength = ETH_RX_BUF_SIZE - ipBUFFER_PADDING; |
There was a problem hiding this comment.
That sounds like a good change, thank you.
The sizeof of the RX buffer is usually set at :
#define ETH_RX_BUF_SIZE 1536U
because it has a great alignment ( 0x600 ).
@AniruddhaKanhere @kstribrnAmzn Can you please check this PR?
|
We have two approvals, I like the PR, let's go for it. |
45a43dc to
9021eb8
Compare
|
@htibosch Merge is blocked by the build checks. Is there something I should do? |
|
@liteStefanoUgolini As you are using STM32H, have you tried the latest version of the network interface? i do and I am very satisfied with the driver on my STM32H755 See also this comment. |
|
The PR is OK, expect for this piece of code: if( ( ulRxDesc & ETH_IP_PAYLOAD_MASK ) == ETH_IP_PAYLOAD_UNKNOWN )
{
- iptraceETHERNET_RX_EVENT_LOST();
- break;
}otherwise receiving ARP will not work. |
…path The STM32H legacy zero-copy RX path still requested ETH_RX_BUF_SIZE for replacement RX buffers even though BufferAllocation_1 now limits allocations to the interface-reported usable size. For this driver the usable size is ETH_RX_BUF_SIZE - ipBUFFER_PADDING. Requesting the full hardware buffer size caused every replacement allocation to fail, left pxReceivedBuffer as NULL, and dropped all received frames before they reached the IP task. Request ETH_RX_BUF_SIZE - ipBUFFER_PADDING in the RX fast path so the receive path matches the enforced allocation limit.
@htibosch it is not clear to me why this should be added in my PR, since the change will affect NetworkInterface.c |
9021eb8 to
42f80dd
Compare
Yes I briefly tried it some months ago, but because we would need to update also the STM HAL library to use it, we haven't use it in our project yet. Eventually we would move to the unified STM driver. |
Description
The STM32H legacy zero-copy RX path still requested ETH_RX_BUF_SIZE for replacement RX buffers even though BufferAllocation_1 now limits allocations to the interface-reported usable size.
For this driver the usable size is ETH_RX_BUF_SIZE - ipBUFFER_PADDING. Requesting the full hardware buffer size caused every replacement allocation to fail, left pxReceivedBuffer as NULL, and dropped all received frames before they reached the IP task.
Request ETH_RX_BUF_SIZE - ipBUFFER_PADDING in the RX fast path so the receive path matches the enforced allocation limit.
Test Steps
Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.