• Maciej S. Szmigiero's avatar
    r8169: set TxConfig register after TX / RX is enabled, just like RxConfig · f74dd480
    Maciej S. Szmigiero authored
    Commit 3559d81e ("r8169: simplify rtl_hw_start_8169") changed order of
    two register writes:
    1) Caused RxConfig to be written before TX / RX is enabled,
    2) Caused TxConfig to be written before TX / RX is enabled.
    
    At least on XIDs 10000000 ("RTL8169sb/8110sb") and
    18000000 ("RTL8169sc/8110sc") such writes are ignored by the chip, leaving
    values in these registers intact.
    
    Change 1) was reverted by
    commit 05212ba8 ("r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices"),
    however change 2) wasn't.
    
    In practice, this caused TxConfig's "InterFrameGap time" and "Max DMA Burst
    Size per Tx DMA Burst" bits to be zero dramatically reducing TX performance
    (in my tests it dropped from around 500Mbps to around 50Mbps).
    
    This patch fixes the issue by moving TxConfig register write a bit later in
    the code so it happens after TX / RX is already enabled.
    
    Fixes: 05212ba8 ("r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices")
    Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    f74dd480
r8169.c 184 KB