• Ido Schimmel's avatar
    mlxsw: Add ability to control transceiver modules' power mode · 0455dc50
    Ido Schimmel authored
    Implement support for ethtool_ops::.get_module_power_mode and
    ethtool_ops::set_module_power_mode.
    
    The get operation is implemented using the Management Cable IO and
    Notifications (MCION) register that reports the operational power mode
    of the module and its presence. In case a module is not present, its
    operational power mode is not reported to ethtool and user space. If not
    set before, the power mode policy is reported as "high", which is the
    default on Mellanox systems.
    
    The set operation is implemented using the Port Module Memory Map
    Properties (PMMP) register. The register instructs the device's firmware
    to transition a plugged-in module to / out of low power mode by writing
    to its memory map.
    
    When the power mode policy is set to 'auto', a module will not
    transition to low power mode as long as any ports using it are
    administratively up. Example:
    
     # devlink port split swp11 count 4
    
     # ethtool --set-module swp11s0 power-mode-policy auto
    
     $ ethtool --show-module swp11s0
     Module parameters for swp11s0:
     power-mode-policy auto
     power-mode low
    
     # ip link set dev swp11s0 up
    
     # ip link set dev swp11s1 up
    
     $ ethtool --show-module swp11s0
     Module parameters for swp11s0:
     power-mode-policy auto
     power-mode high
    
     # ip link set dev swp11s1 down
    
     $ ethtool --show-module swp11s0
     Module parameters for swp11s0:
     power-mode-policy auto
     power-mode high
    
     # ip link set dev swp11s0 down
    
     $ ethtool --show-module swp11s0
     Module parameters for swp11s0:
     power-mode-policy auto
     power-mode low
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    0455dc50
minimal.c 13.2 KB