• Chun-Hao Lin's avatar
    r8169: fix nic may not work after changing mac address. · f51d4a10
    Chun-Hao Lin authored
    When there is no AC power, NIC may not work after changing mac address.
    Please refer to following link.
    http://www.spinics.net/lists/netdev/msg356572.html
    
    This issue is caused by runtime power management. When there is no AC
    power, if we put NIC down (ifconfig down), the driver will be in runtime
    suspend state and hardware will be put into D3 state. During this time,
    driver cannot access hardware regisers. So if you set new mac address
    during this time, it will not be set to hardware. After resume, NIC will
    keep using the old mac address and the network will not work normally.
    
    In this patch I add detecting runtime pm status when setting mac address.
    If driver is in runtime suspend state, it will skip setting mac address, keep
    the new mac address, and set the new mac address during runtime resume.
    Signed-off-by: default avatarChunhao Lin <hau@realtek.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    f51d4a10
r8169.c 209 KB