Skip to content

Reinitializing xemacpsif DMA on error case #352

@juanriverafranceschi

Description

@juanriverafranceschi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions