Reinitializing xemacpsif DMA on error case
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.2k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
We were having some issues with an older version of xemacpsif and found some potential issues during code review. Most of them were already fixed in newer versions of the Xilinx release but there is one that is not.
The driver will call init_dma when an error callback occurs:
https://github.com/Xilinx/embeddedsw/blob/master/ThirdParty/sw_services/lwip220/src/lwip-2.2.0/contrib/ports/xilinx/netif/xemacpsif.c#L471
init_dma increments the bd_space_index without resetting it to 0.
https://github.com/Xilinx/embeddedsw/blob/master/ThirdParty/sw_services/lwip220/src/lwip-2.2.0/contrib/ports/xilinx/netif/xemacpsif_dma.c#L660
If too many errors (~16) occur in the same power cycle it will eventually go past the end of the bd_space leading to overwriting whatever memory lives after. We have not seen that many errors occur in a single power cycle during our normal operation but noticed during code review that the risk is there. The fix would likely to set bd_space_index = 0 early in init_dma.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ThirdParty/sw_services/lwip220/src/lwip-2.2.0/contrib/ports/xilinx/netif/xemacpsif.c at the error callback and follow the call to init_dma in xemacpsif_dma.c. Inspect how bd_space_index is handled around line 660. Done means repeated DMA error reinitialization no longer advances beyond bd_space; verify the change against the described repeated-error scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100