• Russell King's avatar
    net: marvell: mvpp2: only reprogram what is necessary on mac_config · d14e078f
    Russell King authored
    mac_config() can be called at any point, and the expected behaviour
    from MAC drivers is to only reprogram when necessary - and certainly
    avoid taking the link down on every call.
    
    Unfortunately, mvpp2 does exactly that - it takes the link down, and
    reprograms everything, and then releases the forced-link down.
    
    This is bad, it can cause the link to bounce:
    
    - SFP detects signal, disables LOS indication.
    - SFP code calls into phylink, calling phylink_sfp_link_up() which
      triggers a resolve.
    - phylink_resolve() calls phylink_get_mac_state() and finds the MAC
      reporting link up.
    - phylink wants to configure the pause mode on the MAC, so calls
      phylink_mac_config()
    - mvpp2 takes the link down temporarily, generating a MAC link down
      event followed by another MAC link event.
    - phylink calls mac_link_up() and then processes the MAC link down
      event.
    - phylink_resolve() gets called again, registers the link down, and
      calls mach_link_down() before re-running itself.
    - phylink_resolve() starts again at step 3 above.  This sequence
      repeats.
    
    GMAC versions prior to mvpp2 do not require the link to be taken down
    except when certain link properties (eg, switching between SGMII and
    1000base-X mode, or enabling/disabling in-band negotiation) are
    changed.  Implement this for mvpp2.
    Tested-by: default avatarSven Auhagen <sven.auhagen@voleatech.de>
    Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d14e078f
mvpp2_main.c 149 KB