• Ido Schimmel's avatar
    mlxsw: Add support for transceiver modules reset · 49fd3b64
    Ido Schimmel authored
    Implement support for ethtool_ops::reset in order to reset transceiver
    modules. The module backing the netdev is reset when the 'ETH_RESET_PHY'
    flag is set. After a successful reset, the flag is cleared by the driver
    and other flags are ignored. This is in accordance with the interface
    documentation:
    
    "The reset() operation must clear the flags for the components which
    were actually reset. On successful return, the flags indicate the
    components which were not reset, either because they do not exist in the
    hardware or because they cannot be reset independently. The driver must
    never reset any components that were not requested."
    
    Reset is useful in order to allow a module to transition out of a fault
    state. From section 6.3.2.12 in CMIS 5.0: "Except for a power cycle, the
    only exit path from the ModuleFault state is to perform a module reset
    by taking an action that causes the ResetS transition signal to become
    TRUE (see Table 6-11)".
    
    An error is returned when the netdev is administratively up:
    
     # ip link set dev swp11 up
    
     # ethtool --reset swp11 phy
     ETHTOOL_RESET 0x40
     Cannot issue ETHTOOL_RESET: Invalid argument
    
     # ip link set dev swp11 down
    
     # ethtool --reset swp11 phy
     ETHTOOL_RESET 0x40
     Components reset:     0x40
    
    An error is returned when the module is shared by multiple ports (split
    ports) and the "phy-shared" flag is not set:
    
     # devlink port split swp11 count 4
    
     # ethtool --reset swp11s0 phy
     ETHTOOL_RESET 0x40
     Cannot issue ETHTOOL_RESET: Invalid argument
    
     # ethtool --reset swp11s0 phy-shared
     ETHTOOL_RESET 0x400000
     Components reset:     0x400000
    
     # devlink port unsplit swp11s0
    
     # ethtool --reset swp11 phy
     ETHTOOL_RESET 0x40
     Components reset:     0x40
    
    An error is also returned when one of the ports using the module is
    administratively up:
    
     # devlink port split swp11 count 4
    
     # ip link set dev swp11s1 up
    
     # ethtool --reset swp11s0 phy-shared
     ETHTOOL_RESET 0x400000
     Cannot issue ETHTOOL_RESET: Invalid argument
    
     # ip link set dev swp11s1 down
    
     # ethtool --reset swp11s0 phy-shared
     ETHTOOL_RESET 0x400000
     Components reset:     0x400000
    
    Reset is performed by writing to the "rst" bit of the PMAOS register,
    which instructs the firmware to assert the reset signal connected to the
    module for a fixed amount of time.
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    49fd3b64
minimal.c 12.4 KB