Skip to content
  • Niklas Cassel's avatar
    net: stmmac: ensure that the MSS desc is the last desc to set the own bit · 15d2ee42
    Niklas Cassel authored
    
    
    A dma_wmb() is used to guarantee the ordering, with respect to
    other writes, to cache coherent DMA memory.
    
    There is a dma_wmb() in prepare_tx_desc()/prepare_tso_tx_desc() which
    ensures that TDES0/1/2 is written before TDES3 (which contains the own
    bit), for First Desc.
    
    However, in the rare case that MSS changes, there will be a MSS
    context descriptor in front of the regular DMA descriptors:
    
    <MSS desc> <- DMA Next Descriptor
    <First Desc>
    <desc n>
    <Last Desc>
    
    Thus, for this special case, we need a dma_wmb()
    after prepare_tso_tx_desc()/before writing the own bit to the MSS desc,
    so that we flush the write to TDES3 for First Desc,
    in order to ensure that the MSS descriptor is the last descriptor to
    set the own bit.
    
    Signed-off-by: default avatarNiklas Cassel <niklas.cassel@axis.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    15d2ee42