• Niklas Cassel's avatar
    net: stmmac: make dwmac4_release_tx_desc() clear all descriptor fields · 1e88f6e0
    Niklas Cassel authored
    Make dwmac4_release_tx_desc() clear all descriptor fields, not just
    TDES2 and TDES3.
    
    I'm suspecting that TDES0 and TDES1 wasn't cleared because the DMA
    engine uses them to store the tx hardware timestamp (if PTP is enabled).
    
    However, stmmac_tx_clean() calls stmmac_get_tx_hwtstamp(), which reads
    and saves the timestamp, before it calls release_tx_desc(), so this
    is not an issue.
    
    stmmac_xmit() and stmmac_tso_xmit() both always overwrite TDES0,
    however, stmmac_tso_xmit() sometimes sets TDES1, and since neither
    stmmac_xmit() nor stmmac_tso_xmit() explicitly clears TDES1, both
    functions might reuse a DMA descriptor with old TDES1 data.
    
    I haven't observed any misbehavior even though TDES1 sometimes
    point to an old skb, however, explicitly clearing both TDES0 and TDES1
    in dwmac4_release_tx_desc() minimizes the chances of undefined behavior.
    Signed-off-by: default avatarNiklas Cassel <niklas.cassel@axis.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1e88f6e0
dwmac4_descs.c 11.3 KB