OSDN Git Service

mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports
authorDanielle Ratson <danieller@nvidia.com>
Wed, 26 Jan 2022 10:30:35 +0000 (12:30 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Jan 2022 11:15:42 +0000 (11:15 +0000)
commit615ebb8cc4e226da5ce49c799636fc9421eebcfe
tree4ab24307eefbafc84392a93342f6ffd22b600d01
parente62f5b0e3faa0269428d1fc139fe3c3e94a2b70a
mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports

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: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_env.c