• Heiner Kallweit's avatar
    net: phy: improve generic EEE ethtool functions · d1420bb9
    Heiner Kallweit authored
    So far the two functions consider neither member eee_enabled nor
    eee_active. Therefore network drivers have to do this in some kind
    of glue code. I think this can be avoided.
    
    Getting EEE parameters:
    When not advertising any EEE mode, we can't consider EEE to be enabled.
    Therefore interpret "EEE enabled" as "we advertise at least one EEE
    mode". It's similar with "EEE active": interpret it as "EEE modes
    advertised by both link partner have at least one mode in common".
    
    Setting EEE parameters:
    If eee_enabled isn't set, don't advertise any EEE mode and restart
    aneg if needed to switch off EEE. If eee_enabled is set and
    data->advertised is empty (e.g. because EEE was disabled), advertise
    everything we support as default. This way EEE can easily switched
    on/off by doing ethtool --set-eee <if> eee on/off, w/o any additional
    parameters.
    
    The changes to both functions shouldn't break any existing user.
    Once the changes have been applied, at least some users can be
    simplified.
    Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d1420bb9
phy.c 32.5 KB