Skip to content
  • Arun Parameswaran's avatar
    net: core: 'ethtool' issue with querying phy settings · f96dee13
    Arun Parameswaran authored
    
    
    When trying to configure the settings for PHY1, using commands
    like 'ethtool -s eth0 phyad 1 speed 100', the 'ethtool' seems to
    modify other settings apart from the speed of the PHY1, in the
    above case.
    
    The ethtool seems to query the settings for PHY0, and use this
    as the base to apply the new settings to the PHY1. This is
    causing the other settings of the PHY 1 to be wrongly
    configured.
    
    The issue is caused by the '_ethtool_get_settings()' API, which
    gets called because of the 'ETHTOOL_GSET' command, is clearing
    the 'cmd' pointer (of type 'struct ethtool_cmd') by calling
    memset. This clears all the parameters (if any) passed for the
    'ETHTOOL_GSET' cmd. So the driver's callback is always invoked
    with 'cmd->phy_address' as '0'.
    
    The '_ethtool_get_settings()' is called from other files in the
    'net/core'. So the fix is applied to the 'ethtool_get_settings()'
    which is only called in the context of the 'ethtool'.
    
    Signed-off-by: default avatarArun Parameswaran <aparames@broadcom.com>
    Reviewed-by: default avatarRay Jui <rjui@broadcom.com>
    Reviewed-by: default avatarScott Branden <sbranden@broadcom.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    f96dee13