• Danielle Ratson's avatar
    mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports · 615ebb8c
    Danielle Ratson authored
    MCIA (Management Cable Info Access) register is not supported on RJ45
    ports, so getting module EEPROM should be rejected.
    
    Therefore, before trying to access this register, 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).
    
    Examples for output when trying to get EEPROM module:
    
    Using netlink:
    
     # ethtool -m swp1
     netlink error: mlxsw_core: EEPROM is not equipped on port module type
     netlink error: Invalid argument
    
    Using IOCTL:
    
     # ethtool -m swp1
     Cannot get module EEPROM information: Invalid argument
     $ dmesg
     mlxsw_spectrum 0000:03:00.0 swp1: EEPROM is not equipped on port module type
    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>
    615ebb8c
core_env.c 30.7 KB