• Jochen Henneberg's avatar
    net: stmmac: Fix for mismatched host/device DMA address width · 070246e4
    Jochen Henneberg authored
    Currently DMA address width is either read from a RO device register
    or force set from the platform data. This breaks DMA when the host DMA
    address width is <=32it but the device is >32bit.
    
    Right now the driver may decide to use a 2nd DMA descriptor for
    another buffer (happens in case of TSO xmit) assuming that 32bit
    addressing is used due to platform configuration but the device will
    still use both descriptor addresses as one address.
    
    This can be observed with the Intel EHL platform driver that sets
    32bit for addr64 but the MAC reports 40bit. The TX queue gets stuck in
    case of TCP with iptables NAT configuration on TSO packets.
    
    The logic should be like this: Whatever we do on the host side (memory
    allocation GFP flags) should happen with the host DMA width, whenever
    we decide how to set addresses on the device registers we must use the
    device DMA address width.
    
    This patch renames the platform address width field from addr64 (term
    used in device datasheet) to host_addr and uses this value exclusively
    for host side operations while all chip operations consider the device
    DMA width as read from the device register.
    
    Fixes: 7cfc4486 ("stmmac: intel: Configure EHL PSE0 GbE and PSE1 GbE to 32 bits DMA addressing")
    Signed-off-by: default avatarJochen Henneberg <jh@henneberg-systemdesign.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    070246e4
stmmac_main.c 206 KB