• Danielle Ratson's avatar
    mlxsw: core_env: Forbid power mode set and get on RJ45 ports · c8f994cc
    Danielle Ratson authored
    PMMP (Port Module Memory Map Properties) and MCION (Management Cable IO
    and Notifications) registers are not supported on RJ45 ports, so setting
    and getting power mode should be rejected.
    
    Therefore, before trying to access those registers, validate the port
    module type that was queried during initialization and return an error
    to user space in case the port module type is RJ45 (twisted pair).
    
    Set output example:
    
     # ethtool --set-module swp1 power-mode-policy auto
     netlink error: mlxsw_core: Power mode is not supported on port module type
     netlink error: Invalid argument
    
    Get output example:
    
     $ ethtool --show-module swp11
     netlink error: mlxsw_core: Power mode is not supported on port module type
     netlink error: Invalid argument
    Signed-off-by: default avatarDanielle Ratson <danieller@nvidia.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c8f994cc
core_env.c 31 KB